[media] em28xx: improve USB endpoint logic, also use bulk transfers
The current enpoint logic ignores all bulk endpoints and uses
a fixed mapping between endpint addresses and the supported
data stream types (analog/audio/DVB):
Ep 0x82, isoc => analog
Ep 0x83, isoc => audio
Ep 0x84, isoc => DVB
Now that the code can also do bulk transfers, the endpoint
logic has to be extended to also consider bulk endpoints.
The new logic preserves backwards compatibility and reflects
the endpoint configurations we have seen so far:
Ep 0x82, isoc => analog
Ep 0x82, bulk => analog
Ep 0x83, isoc* => audio
Ep 0x84, isoc => digital
Ep 0x84, bulk => analog or digital**
(*: audio should always be isoc)
(**: analog, if ep 0x82 is isoc, otherwise digital)
[mchehab@redhat.com: Fix a CodingStyle issue: don't break strings
into separate lines]
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h
index f5be522..aa413bd 100644
--- a/drivers/media/usb/em28xx/em28xx.h
+++ b/drivers/media/usb/em28xx/em28xx.h
@@ -165,6 +165,12 @@
#define EM28XX_NUM_ISOC_PACKETS 64
#define EM28XX_DVB_NUM_ISOC_PACKETS 64
+/* bulk transfers: transfer buffer size = packet size * packet multiplier
+ USB 2.0 spec says bulk packet size is always 512 bytes
+ */
+#define EM28XX_BULK_PACKET_MULTIPLIER 384
+#define EM28XX_DVB_BULK_PACKET_MULTIPLIER 384
+
#define EM28XX_INTERLACED_DEFAULT 1
/*
@@ -584,8 +590,14 @@
/* usb transfer */
struct usb_device *udev; /* the usb device */
+ u8 analog_ep_isoc; /* address of isoc endpoint for analog */
+ u8 analog_ep_bulk; /* address of bulk endpoint for analog */
+ u8 dvb_ep_isoc; /* address of isoc endpoint for DVB */
+ u8 dvb_ep_bulk; /* address of bulk endpoint for DVC */
int alt; /* alternate setting */
int max_pkt_size; /* max packet size of the selected ep at alt */
+ int packet_multiplier; /* multiplier for wMaxPacketSize, used for
+ URB buffer size definition */
int num_alt; /* number of alternative settings */
unsigned int *alt_max_pkt_size_isoc; /* array of isoc wMaxPacketSize */
unsigned int analog_xfer_bulk:1; /* use bulk instead of isoc