All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/23] em28xx: add support fur USB bulk transfers
@ 2012-10-21 16:52 Frank Schäfer
  2012-10-21 16:52 ` [PATCH 01/23] em28xx: fix wrong data offset for non-interlaced mode in em28xx_copy_video Frank Schäfer
                   ` (26 more replies)
  0 siblings, 27 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-10-21 16:52 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, Frank Schäfer

This patch series adds support for USB bulk transfers to the em28xx driver.

Patch 1 is a bugfix for the image data processing with non-interlaced devices (webcams)
that should be considered for stable (see commit message).

Patches 2-21 extend the driver to support USB bulk transfers.
USB endpoint mapping had to be extended and is a bit tricky.
It might still not be sufficient to handle ALL isoc/bulk endpoints of ALL existing devices,
but it should work with the devices we have seen so far and (most important !) 
preserves backwards compatibility to the current driver behavior.
Isoc endpoints/transfers are preffered by default, patch 21 adds a module parameter to change this behavior.

The last two patches are follow-up patches not really related to USB tranfers.
Patch 22 reduces the code size in em28xx-video by merging the two URB data processing functions 
and patch 23 enables VBI-support for em2840-devices.

Please note that I could test the changes with an analog non-interlaced non-VBI device only !
So further tests with DVB/interlaced/VBI devices are strongly recommended !




Frank Schäfer (23):
  em28xx: fix wrong data offset for non-interlaced mode in
    em28xx_copy_video
  em28xx: clarify meaning of field 'progressive' in struct em28xx
  em28xx: rename isoc packet number constants and parameters
  em28xx: rename struct em28xx_usb_isoc_bufs to em28xx_usb_bufs
  em28xx: rename struct em28xx_usb_isoc_ctl to em28xx_usb_ctl
  em28xx: remove obsolete #define EM28XX_URB_TIMEOUT
  em28xx: update description of em28xx_irq_callback
  em28xx: rename function em28xx_uninit_isoc to em28xx_uninit_usb_xfer
  em28xx: create a common function for isoc and bulk URB allocation and
    setup
  em28xx: create a common function for isoc and bulk USB transfer
    initialization
  em28xx: clear USB halt/stall condition in em28xx_init_usb_xfer when
    using bulk transfers
  em28xx: remove double checks for urb->status == -ENOENT in
    urb_data_copy functions
  em28xx: rename function em28xx_isoc_copy and extend for USB bulk
    transfers
  em28xx: rename function em28xx_isoc_copy_vbi and extend for USB bulk
    transfers
  em28xx: rename function em28xx_dvb_isoc_copy and extend for USB bulk
    transfers
  em28xx: rename usb debugging module parameter and macro
  em28xx: rename some USB parameter fields in struct em28xx to clarify
    their role
  em28xx: add fields for analog and DVB USB transfer type selection to
    struct em28xx
  em28xx: set USB alternate settings for analog video bulk transfers
    properly
  em28xx: improve USB endpoint logic, also use bulk transfers
  em28xx: add module parameter for selection of the preferred USB
    transfer type
  em28xx: use common urb data copying function for vbi and non-vbi
    devices
  em28xx: enable VBI-support for em2840 devices

 drivers/media/usb/em28xx/em28xx-cards.c |  114 +++++++++---
 drivers/media/usb/em28xx/em28xx-core.c  |  250 ++++++++++++++++-----------
 drivers/media/usb/em28xx/em28xx-dvb.c   |   85 ++++++---
 drivers/media/usb/em28xx/em28xx-reg.h   |    4 +-
 drivers/media/usb/em28xx/em28xx-vbi.c   |    4 +-
 drivers/media/usb/em28xx/em28xx-video.c |  288 +++++++++++--------------------
 drivers/media/usb/em28xx/em28xx.h       |   78 +++++----
 7 Dateien geändert, 452 Zeilen hinzugefügt(+), 371 Zeilen entfernt(-)

-- 
1.7.10.4


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 01/23] em28xx: fix wrong data offset for non-interlaced mode in em28xx_copy_video
  2012-10-21 16:52 [PATCH 00/23] em28xx: add support fur USB bulk transfers Frank Schäfer
@ 2012-10-21 16:52 ` Frank Schäfer
  2012-10-21 16:52 ` [PATCH 02/23] em28xx: clarify meaning of field 'progressive' in struct em28xx Frank Schäfer
                   ` (25 subsequent siblings)
  26 siblings, 0 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-10-21 16:52 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, Frank Schäfer

em28xx_copy_video uses a wrong offset for the target buffer
when copying the data from an USB isoc packet. This happens
only for the second and all following lines in the packet.

The reason why this bug doesn't cause image corruption with
my test device (SilverCrest Webcam 1.3 MPix) is, that this
device never sends any packets that cross the end of a line.
I don't know if all devices behave like this, so this patch
should be considered for stable.

With the upcoming patches to add support for USB bulk transfers,
em28xx_copy_video will be called once per URB, which will
always trigger this bug.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 drivers/media/usb/em28xx/em28xx-video.c |   16 +++++++---------
 1 Datei geändert, 7 Zeilen hinzugefügt(+), 9 Zeilen entfernt(-)

diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
index 1e553d3..7c88a40 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -207,15 +207,10 @@ static void em28xx_copy_video(struct em28xx *dev,
 	startread = p;
 	remain = len;
 
-	if (dev->progressive)
+	if (dev->progressive || buf->top_field)
 		fieldstart = outp;
-	else {
-		/* Interlaces two half frames */
-		if (buf->top_field)
-			fieldstart = outp;
-		else
-			fieldstart = outp + bytesperline;
-	}
+	else /* interlaced mode, even nr. of lines */
+		fieldstart = outp + bytesperline;
 
 	linesdone = dma_q->pos / bytesperline;
 	currlinedone = dma_q->pos % bytesperline;
@@ -243,7 +238,10 @@ static void em28xx_copy_video(struct em28xx *dev,
 	remain -= lencopy;
 
 	while (remain > 0) {
-		startwrite += lencopy + bytesperline;
+		if (dev->progressive)
+			startwrite += lencopy;
+		else
+			startwrite += lencopy + bytesperline;
 		startread += lencopy;
 		if (bytesperline > remain)
 			lencopy = remain;
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 02/23] em28xx: clarify meaning of field 'progressive' in struct em28xx
  2012-10-21 16:52 [PATCH 00/23] em28xx: add support fur USB bulk transfers Frank Schäfer
  2012-10-21 16:52 ` [PATCH 01/23] em28xx: fix wrong data offset for non-interlaced mode in em28xx_copy_video Frank Schäfer
@ 2012-10-21 16:52 ` Frank Schäfer
  2012-10-21 16:52 ` [PATCH 03/23] em28xx: rename isoc packet number constants and parameters Frank Schäfer
                   ` (24 subsequent siblings)
  26 siblings, 0 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-10-21 16:52 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, Frank Schäfer

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 drivers/media/usb/em28xx/em28xx.h |    2 +-
 1 Datei geändert, 1 Zeile hinzugefügt(+), 1 Zeile entfernt(-)

diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h
index 8757523..4d4d0e1 100644
--- a/drivers/media/usb/em28xx/em28xx.h
+++ b/drivers/media/usb/em28xx/em28xx.h
@@ -496,7 +496,7 @@ struct em28xx {
 	int sensor_xres, sensor_yres;
 	int sensor_xtal;
 
-	/* Allows progressive (e. g. non-interlaced) mode */
+	/* Progressive (non-interlaced) mode */
 	int progressive;
 
 	/* Vinmode/Vinctl used at the driver */
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 03/23] em28xx: rename isoc packet number constants and parameters
  2012-10-21 16:52 [PATCH 00/23] em28xx: add support fur USB bulk transfers Frank Schäfer
  2012-10-21 16:52 ` [PATCH 01/23] em28xx: fix wrong data offset for non-interlaced mode in em28xx_copy_video Frank Schäfer
  2012-10-21 16:52 ` [PATCH 02/23] em28xx: clarify meaning of field 'progressive' in struct em28xx Frank Schäfer
@ 2012-10-21 16:52 ` Frank Schäfer
  2012-10-21 16:52 ` [PATCH 04/23] em28xx: rename struct em28xx_usb_isoc_bufs to em28xx_usb_bufs Frank Schäfer
                   ` (23 subsequent siblings)
  26 siblings, 0 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-10-21 16:52 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, Frank Schäfer

Rename EM28XX_NUM_PACKETS to EM28XX_NUM_ISOC_PACKETS and
EM28XX_DVB_MAX_PACKETS to EM28XX_DVB_NUM_ISOC_PACKETS to
clarify that these values are used only for isoc usb transfers.
Also use the term num_packets instead of max_packets, as this
is how these values are used and called in struct urb.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 drivers/media/usb/em28xx/em28xx-cards.c |    2 +-
 drivers/media/usb/em28xx/em28xx-core.c  |    8 ++++----
 drivers/media/usb/em28xx/em28xx-dvb.c   |    5 +++--
 drivers/media/usb/em28xx/em28xx-video.c |    4 ++--
 drivers/media/usb/em28xx/em28xx.h       |   10 +++++-----
 5 Dateien geändert, 15 Zeilen hinzugefügt(+), 14 Zeilen entfernt(-)

diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
index 16a84f9..8b40111 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -3314,7 +3314,7 @@ static int em28xx_usb_probe(struct usb_interface *interface,
 	if (has_dvb) {
 		/* pre-allocate DVB isoc transfer buffers */
 		retval = em28xx_alloc_isoc(dev, EM28XX_DIGITAL_MODE,
-					   EM28XX_DVB_MAX_PACKETS,
+					   EM28XX_DVB_NUM_ISOC_PACKETS,
 					   EM28XX_DVB_NUM_BUFS,
 					   dev->dvb_max_pkt_size);
 		if (retval) {
diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c
index bed07a6..2520a16 100644
--- a/drivers/media/usb/em28xx/em28xx-core.c
+++ b/drivers/media/usb/em28xx/em28xx-core.c
@@ -1034,7 +1034,7 @@ EXPORT_SYMBOL_GPL(em28xx_stop_urbs);
  * Allocate URBs
  */
 int em28xx_alloc_isoc(struct em28xx *dev, enum em28xx_mode mode,
-		      int max_packets, int num_bufs, int max_pkt_size)
+		      int num_packets, int num_bufs, int max_pkt_size)
 {
 	struct em28xx_usb_isoc_bufs *isoc_bufs;
 	int i;
@@ -1069,7 +1069,7 @@ int em28xx_alloc_isoc(struct em28xx *dev, enum em28xx_mode mode,
 	}
 
 	isoc_bufs->max_pkt_size = max_pkt_size;
-	isoc_bufs->num_packets = max_packets;
+	isoc_bufs->num_packets = num_packets;
 	dev->isoc_ctl.vid_buf = NULL;
 	dev->isoc_ctl.vbi_buf = NULL;
 
@@ -1129,7 +1129,7 @@ EXPORT_SYMBOL_GPL(em28xx_alloc_isoc);
  * Allocate URBs and start IRQ
  */
 int em28xx_init_isoc(struct em28xx *dev, enum em28xx_mode mode,
-		     int max_packets, int num_bufs, int max_pkt_size,
+		     int num_packets, int num_bufs, int max_pkt_size,
 		     int (*isoc_copy) (struct em28xx *dev, struct urb *urb))
 {
 	struct em28xx_dmaqueue *dma_q = &dev->vidq;
@@ -1153,7 +1153,7 @@ int em28xx_init_isoc(struct em28xx *dev, enum em28xx_mode mode,
 	}
 
 	if (alloc) {
-		rc = em28xx_alloc_isoc(dev, mode, max_packets,
+		rc = em28xx_alloc_isoc(dev, mode, num_packets,
 				       num_bufs, max_pkt_size);
 		if (rc)
 			return rc;
diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c
index 13ae821..0fe99ef 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -173,11 +173,12 @@ static int em28xx_start_streaming(struct em28xx_dvb *dvb)
 		return max_dvb_packet_size;
 	dprintk(1, "Using %d buffers each with %d x %d bytes\n",
 		EM28XX_DVB_NUM_BUFS,
-		EM28XX_DVB_MAX_PACKETS,
+		EM28XX_DVB_NUM_ISOC_PACKETS,
 		max_dvb_packet_size);
 
 	return em28xx_init_isoc(dev, EM28XX_DIGITAL_MODE,
-				EM28XX_DVB_MAX_PACKETS, EM28XX_DVB_NUM_BUFS,
+				EM28XX_DVB_NUM_ISOC_PACKETS,
+				EM28XX_DVB_NUM_BUFS,
 				max_dvb_packet_size, em28xx_dvb_isoc_copy);
 }
 
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
index 7c88a40..e51284c 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -764,13 +764,13 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb,
 	if (urb_init) {
 		if (em28xx_vbi_supported(dev) == 1)
 			rc = em28xx_init_isoc(dev, EM28XX_ANALOG_MODE,
-					      EM28XX_NUM_PACKETS,
+					      EM28XX_NUM_ISOC_PACKETS,
 					      EM28XX_NUM_BUFS,
 					      dev->max_pkt_size,
 					      em28xx_isoc_copy_vbi);
 		else
 			rc = em28xx_init_isoc(dev, EM28XX_ANALOG_MODE,
-					      EM28XX_NUM_PACKETS,
+					      EM28XX_NUM_ISOC_PACKETS,
 					      EM28XX_NUM_BUFS,
 					      dev->max_pkt_size,
 					      em28xx_isoc_copy);
diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h
index 4d4d0e1..119dc20 100644
--- a/drivers/media/usb/em28xx/em28xx.h
+++ b/drivers/media/usb/em28xx/em28xx.h
@@ -156,12 +156,12 @@
 #define EM28XX_NUM_BUFS 5
 #define EM28XX_DVB_NUM_BUFS 5
 
-/* number of packets for each buffer
+/* isoc transfers: number of packets for each buffer
    windows requests only 64 packets .. so we better do the same
    this is what I found out for all alternate numbers there!
  */
-#define EM28XX_NUM_PACKETS 64
-#define EM28XX_DVB_MAX_PACKETS 64
+#define EM28XX_NUM_ISOC_PACKETS 64
+#define EM28XX_DVB_NUM_ISOC_PACKETS 64
 
 #define EM28XX_INTERLACED_DEFAULT 1
 
@@ -666,9 +666,9 @@ int em28xx_set_outfmt(struct em28xx *dev);
 int em28xx_resolution_set(struct em28xx *dev);
 int em28xx_set_alternate(struct em28xx *dev);
 int em28xx_alloc_isoc(struct em28xx *dev, enum em28xx_mode mode,
-		      int max_packets, int num_bufs, int max_pkt_size);
+		      int num_packets, int num_bufs, int max_pkt_size);
 int em28xx_init_isoc(struct em28xx *dev, enum em28xx_mode mode,
-		     int max_packets, int num_bufs, int max_pkt_size,
+		     int num_packets, int num_bufs, int max_pkt_size,
 		     int (*isoc_copy) (struct em28xx *dev, struct urb *urb));
 void em28xx_uninit_isoc(struct em28xx *dev, enum em28xx_mode mode);
 void em28xx_stop_urbs(struct em28xx *dev);
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 04/23] em28xx: rename struct em28xx_usb_isoc_bufs to em28xx_usb_bufs
  2012-10-21 16:52 [PATCH 00/23] em28xx: add support fur USB bulk transfers Frank Schäfer
                   ` (2 preceding siblings ...)
  2012-10-21 16:52 ` [PATCH 03/23] em28xx: rename isoc packet number constants and parameters Frank Schäfer
@ 2012-10-21 16:52 ` Frank Schäfer
  2012-10-21 16:52 ` [PATCH 05/23] em28xx: rename struct em28xx_usb_isoc_ctl to em28xx_usb_ctl Frank Schäfer
                   ` (22 subsequent siblings)
  26 siblings, 0 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-10-21 16:52 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, Frank Schäfer

It will be used for USB bulk transfers, too.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 drivers/media/usb/em28xx/em28xx-core.c |    8 ++++----
 drivers/media/usb/em28xx/em28xx.h      |   10 +++++-----
 2 Dateien geändert, 9 Zeilen hinzugefügt(+), 9 Zeilen entfernt(-)

diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c
index 2520a16..b250a63 100644
--- a/drivers/media/usb/em28xx/em28xx-core.c
+++ b/drivers/media/usb/em28xx/em28xx-core.c
@@ -964,7 +964,7 @@ static void em28xx_irq_callback(struct urb *urb)
 void em28xx_uninit_isoc(struct em28xx *dev, enum em28xx_mode mode)
 {
 	struct urb *urb;
-	struct em28xx_usb_isoc_bufs *isoc_bufs;
+	struct em28xx_usb_bufs *isoc_bufs;
 	int i;
 
 	em28xx_isocdbg("em28xx: called em28xx_uninit_isoc in mode %d\n", mode);
@@ -1012,7 +1012,7 @@ void em28xx_stop_urbs(struct em28xx *dev)
 {
 	int i;
 	struct urb *urb;
-	struct em28xx_usb_isoc_bufs *isoc_bufs = &dev->isoc_ctl.digital_bufs;
+	struct em28xx_usb_bufs *isoc_bufs = &dev->isoc_ctl.digital_bufs;
 
 	em28xx_isocdbg("em28xx: called em28xx_stop_urbs\n");
 
@@ -1036,7 +1036,7 @@ EXPORT_SYMBOL_GPL(em28xx_stop_urbs);
 int em28xx_alloc_isoc(struct em28xx *dev, enum em28xx_mode mode,
 		      int num_packets, int num_bufs, int max_pkt_size)
 {
-	struct em28xx_usb_isoc_bufs *isoc_bufs;
+	struct em28xx_usb_bufs *isoc_bufs;
 	int i;
 	int sb_size, pipe;
 	struct urb *urb;
@@ -1134,7 +1134,7 @@ int em28xx_init_isoc(struct em28xx *dev, enum em28xx_mode mode,
 {
 	struct em28xx_dmaqueue *dma_q = &dev->vidq;
 	struct em28xx_dmaqueue *vbi_dma_q = &dev->vbiq;
-	struct em28xx_usb_isoc_bufs *isoc_bufs;
+	struct em28xx_usb_bufs *isoc_bufs;
 	int i;
 	int rc;
 	int alloc;
diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h
index 119dc20..a4a79bd 100644
--- a/drivers/media/usb/em28xx/em28xx.h
+++ b/drivers/media/usb/em28xx/em28xx.h
@@ -202,7 +202,7 @@ enum em28xx_mode {
 
 struct em28xx;
 
-struct em28xx_usb_isoc_bufs {
+struct em28xx_usb_bufs {
 		/* max packet size of isoc transaction */
 	int				max_pkt_size;
 
@@ -212,19 +212,19 @@ struct em28xx_usb_isoc_bufs {
 		/* number of allocated urbs */
 	int				num_bufs;
 
-		/* urb for isoc transfers */
+		/* urb for isoc/bulk transfers */
 	struct urb			**urb;
 
-		/* transfer buffers for isoc transfer */
+		/* transfer buffers for isoc/bulk transfer */
 	char				**transfer_buffer;
 };
 
 struct em28xx_usb_isoc_ctl {
 		/* isoc transfer buffers for analog mode */
-	struct em28xx_usb_isoc_bufs	analog_bufs;
+	struct em28xx_usb_bufs		analog_bufs;
 
 		/* isoc transfer buffers for digital mode */
-	struct em28xx_usb_isoc_bufs	digital_bufs;
+	struct em28xx_usb_bufs		digital_bufs;
 
 		/* Stores already requested buffers */
 	struct em28xx_buffer    	*vid_buf;
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 05/23] em28xx: rename struct em28xx_usb_isoc_ctl to em28xx_usb_ctl
  2012-10-21 16:52 [PATCH 00/23] em28xx: add support fur USB bulk transfers Frank Schäfer
                   ` (3 preceding siblings ...)
  2012-10-21 16:52 ` [PATCH 04/23] em28xx: rename struct em28xx_usb_isoc_bufs to em28xx_usb_bufs Frank Schäfer
@ 2012-10-21 16:52 ` Frank Schäfer
  2012-10-21 16:52 ` [PATCH 06/23] em28xx: remove obsolete #define EM28XX_URB_TIMEOUT Frank Schäfer
                   ` (21 subsequent siblings)
  26 siblings, 0 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-10-21 16:52 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, Frank Schäfer

Also rename the corresponding field isoc_ctl in struct em28xx
to usb_ctl.
We will use this struct for USB bulk transfers, too.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 drivers/media/usb/em28xx/em28xx-core.c  |   24 ++++++++++++------------
 drivers/media/usb/em28xx/em28xx-vbi.c   |    4 ++--
 drivers/media/usb/em28xx/em28xx-video.c |   24 ++++++++++++------------
 drivers/media/usb/em28xx/em28xx.h       |   12 ++++++------
 4 Dateien geändert, 32 Zeilen hinzugefügt(+), 32 Zeilen entfernt(-)

diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c
index b250a63..0892d92 100644
--- a/drivers/media/usb/em28xx/em28xx-core.c
+++ b/drivers/media/usb/em28xx/em28xx-core.c
@@ -941,7 +941,7 @@ static void em28xx_irq_callback(struct urb *urb)
 
 	/* Copy data from URB */
 	spin_lock(&dev->slock);
-	dev->isoc_ctl.isoc_copy(dev, urb);
+	dev->usb_ctl.urb_data_copy(dev, urb);
 	spin_unlock(&dev->slock);
 
 	/* Reset urb buffers */
@@ -970,9 +970,9 @@ void em28xx_uninit_isoc(struct em28xx *dev, enum em28xx_mode mode)
 	em28xx_isocdbg("em28xx: called em28xx_uninit_isoc in mode %d\n", mode);
 
 	if (mode == EM28XX_DIGITAL_MODE)
-		isoc_bufs = &dev->isoc_ctl.digital_bufs;
+		isoc_bufs = &dev->usb_ctl.digital_bufs;
 	else
-		isoc_bufs = &dev->isoc_ctl.analog_bufs;
+		isoc_bufs = &dev->usb_ctl.analog_bufs;
 
 	for (i = 0; i < isoc_bufs->num_bufs; i++) {
 		urb = isoc_bufs->urb[i];
@@ -1012,7 +1012,7 @@ void em28xx_stop_urbs(struct em28xx *dev)
 {
 	int i;
 	struct urb *urb;
-	struct em28xx_usb_bufs *isoc_bufs = &dev->isoc_ctl.digital_bufs;
+	struct em28xx_usb_bufs *isoc_bufs = &dev->usb_ctl.digital_bufs;
 
 	em28xx_isocdbg("em28xx: called em28xx_stop_urbs\n");
 
@@ -1045,9 +1045,9 @@ int em28xx_alloc_isoc(struct em28xx *dev, enum em28xx_mode mode,
 	em28xx_isocdbg("em28xx: called em28xx_alloc_isoc in mode %d\n", mode);
 
 	if (mode == EM28XX_DIGITAL_MODE)
-		isoc_bufs = &dev->isoc_ctl.digital_bufs;
+		isoc_bufs = &dev->usb_ctl.digital_bufs;
 	else
-		isoc_bufs = &dev->isoc_ctl.analog_bufs;
+		isoc_bufs = &dev->usb_ctl.analog_bufs;
 
 	/* De-allocates all pending stuff */
 	em28xx_uninit_isoc(dev, mode);
@@ -1070,8 +1070,8 @@ int em28xx_alloc_isoc(struct em28xx *dev, enum em28xx_mode mode,
 
 	isoc_bufs->max_pkt_size = max_pkt_size;
 	isoc_bufs->num_packets = num_packets;
-	dev->isoc_ctl.vid_buf = NULL;
-	dev->isoc_ctl.vbi_buf = NULL;
+	dev->usb_ctl.vid_buf = NULL;
+	dev->usb_ctl.vbi_buf = NULL;
 
 	sb_size = isoc_bufs->num_packets * isoc_bufs->max_pkt_size;
 
@@ -1079,7 +1079,7 @@ int em28xx_alloc_isoc(struct em28xx *dev, enum em28xx_mode mode,
 	for (i = 0; i < isoc_bufs->num_bufs; i++) {
 		urb = usb_alloc_urb(isoc_bufs->num_packets, GFP_KERNEL);
 		if (!urb) {
-			em28xx_err("cannot alloc isoc_ctl.urb %i\n", i);
+			em28xx_err("cannot alloc usb_ctl.urb %i\n", i);
 			em28xx_uninit_isoc(dev, mode);
 			return -ENOMEM;
 		}
@@ -1141,14 +1141,14 @@ int em28xx_init_isoc(struct em28xx *dev, enum em28xx_mode mode,
 
 	em28xx_isocdbg("em28xx: called em28xx_init_isoc in mode %d\n", mode);
 
-	dev->isoc_ctl.isoc_copy = isoc_copy;
+	dev->usb_ctl.urb_data_copy = isoc_copy;
 
 	if (mode == EM28XX_DIGITAL_MODE) {
-		isoc_bufs = &dev->isoc_ctl.digital_bufs;
+		isoc_bufs = &dev->usb_ctl.digital_bufs;
 		/* no need to free/alloc isoc buffers in digital mode */
 		alloc = 0;
 	} else {
-		isoc_bufs = &dev->isoc_ctl.analog_bufs;
+		isoc_bufs = &dev->usb_ctl.analog_bufs;
 		alloc = 1;
 	}
 
diff --git a/drivers/media/usb/em28xx/em28xx-vbi.c b/drivers/media/usb/em28xx/em28xx-vbi.c
index 2b4c9cb..d74713b 100644
--- a/drivers/media/usb/em28xx/em28xx-vbi.c
+++ b/drivers/media/usb/em28xx/em28xx-vbi.c
@@ -60,8 +60,8 @@ free_buffer(struct videobuf_queue *vq, struct em28xx_buffer *buf)
 	   VIDEOBUF_ACTIVE, it won't be, though.
 	*/
 	spin_lock_irqsave(&dev->slock, flags);
-	if (dev->isoc_ctl.vbi_buf == buf)
-		dev->isoc_ctl.vbi_buf = NULL;
+	if (dev->usb_ctl.vbi_buf == buf)
+		dev->usb_ctl.vbi_buf = NULL;
 	spin_unlock_irqrestore(&dev->slock, flags);
 
 	videobuf_vmalloc_free(&buf->vb);
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
index e51284c..b334885 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -165,7 +165,7 @@ static inline void buffer_filled(struct em28xx *dev,
 	buf->vb.field_count++;
 	do_gettimeofday(&buf->vb.ts);
 
-	dev->isoc_ctl.vid_buf = NULL;
+	dev->usb_ctl.vid_buf = NULL;
 
 	list_del(&buf->vb.queue);
 	wake_up(&buf->vb.done);
@@ -182,7 +182,7 @@ static inline void vbi_buffer_filled(struct em28xx *dev,
 	buf->vb.field_count++;
 	do_gettimeofday(&buf->vb.ts);
 
-	dev->isoc_ctl.vbi_buf = NULL;
+	dev->usb_ctl.vbi_buf = NULL;
 
 	list_del(&buf->vb.queue);
 	wake_up(&buf->vb.done);
@@ -368,7 +368,7 @@ static inline void get_next_buf(struct em28xx_dmaqueue *dma_q,
 
 	if (list_empty(&dma_q->active)) {
 		em28xx_isocdbg("No active queue to serve\n");
-		dev->isoc_ctl.vid_buf = NULL;
+		dev->usb_ctl.vid_buf = NULL;
 		*buf = NULL;
 		return;
 	}
@@ -380,7 +380,7 @@ static inline void get_next_buf(struct em28xx_dmaqueue *dma_q,
 	outp = videobuf_to_vmalloc(&(*buf)->vb);
 	memset(outp, 0, (*buf)->vb.size);
 
-	dev->isoc_ctl.vid_buf = *buf;
+	dev->usb_ctl.vid_buf = *buf;
 
 	return;
 }
@@ -396,7 +396,7 @@ static inline void vbi_get_next_buf(struct em28xx_dmaqueue *dma_q,
 
 	if (list_empty(&dma_q->active)) {
 		em28xx_isocdbg("No active queue to serve\n");
-		dev->isoc_ctl.vbi_buf = NULL;
+		dev->usb_ctl.vbi_buf = NULL;
 		*buf = NULL;
 		return;
 	}
@@ -407,7 +407,7 @@ static inline void vbi_get_next_buf(struct em28xx_dmaqueue *dma_q,
 	outp = videobuf_to_vmalloc(&(*buf)->vb);
 	memset(outp, 0x00, (*buf)->vb.size);
 
-	dev->isoc_ctl.vbi_buf = *buf;
+	dev->usb_ctl.vbi_buf = *buf;
 
 	return;
 }
@@ -435,7 +435,7 @@ static inline int em28xx_isoc_copy(struct em28xx *dev, struct urb *urb)
 			return 0;
 	}
 
-	buf = dev->isoc_ctl.vid_buf;
+	buf = dev->usb_ctl.vid_buf;
 	if (buf != NULL)
 		outp = videobuf_to_vmalloc(&buf->vb);
 
@@ -531,11 +531,11 @@ static inline int em28xx_isoc_copy_vbi(struct em28xx *dev, struct urb *urb)
 			return 0;
 	}
 
-	buf = dev->isoc_ctl.vid_buf;
+	buf = dev->usb_ctl.vid_buf;
 	if (buf != NULL)
 		outp = videobuf_to_vmalloc(&buf->vb);
 
-	vbi_buf = dev->isoc_ctl.vbi_buf;
+	vbi_buf = dev->usb_ctl.vbi_buf;
 	if (vbi_buf != NULL)
 		vbioutp = videobuf_to_vmalloc(&vbi_buf->vb);
 
@@ -725,8 +725,8 @@ static void free_buffer(struct videobuf_queue *vq, struct em28xx_buffer *buf)
 	   VIDEOBUF_ACTIVE, it won't be, though.
 	*/
 	spin_lock_irqsave(&dev->slock, flags);
-	if (dev->isoc_ctl.vid_buf == buf)
-		dev->isoc_ctl.vid_buf = NULL;
+	if (dev->usb_ctl.vid_buf == buf)
+		dev->usb_ctl.vid_buf = NULL;
 	spin_unlock_irqrestore(&dev->slock, flags);
 
 	videobuf_vmalloc_free(&buf->vb);
@@ -758,7 +758,7 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb,
 			goto fail;
 	}
 
-	if (!dev->isoc_ctl.analog_bufs.num_bufs)
+	if (!dev->usb_ctl.analog_bufs.num_bufs)
 		urb_init = 1;
 
 	if (urb_init) {
diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h
index a4a79bd..5ef0a7a 100644
--- a/drivers/media/usb/em28xx/em28xx.h
+++ b/drivers/media/usb/em28xx/em28xx.h
@@ -219,19 +219,19 @@ struct em28xx_usb_bufs {
 	char				**transfer_buffer;
 };
 
-struct em28xx_usb_isoc_ctl {
-		/* isoc transfer buffers for analog mode */
+struct em28xx_usb_ctl {
+		/* isoc/bulk transfer buffers for analog mode */
 	struct em28xx_usb_bufs		analog_bufs;
 
-		/* isoc transfer buffers for digital mode */
+		/* isoc/bulk transfer buffers for digital mode */
 	struct em28xx_usb_bufs		digital_bufs;
 
 		/* Stores already requested buffers */
 	struct em28xx_buffer    	*vid_buf;
 	struct em28xx_buffer    	*vbi_buf;
 
-		/* isoc urb callback */
-	int (*isoc_copy) (struct em28xx *dev, struct urb *urb);
+		/* copy data from URB */
+	int (*urb_data_copy) (struct em28xx *dev, struct urb *urb);
 
 };
 
@@ -581,7 +581,7 @@ struct em28xx {
 	/* Isoc control struct */
 	struct em28xx_dmaqueue vidq;
 	struct em28xx_dmaqueue vbiq;
-	struct em28xx_usb_isoc_ctl isoc_ctl;
+	struct em28xx_usb_ctl usb_ctl;
 	spinlock_t slock;
 
 	/* usb transfer */
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 06/23] em28xx: remove obsolete #define EM28XX_URB_TIMEOUT
  2012-10-21 16:52 [PATCH 00/23] em28xx: add support fur USB bulk transfers Frank Schäfer
                   ` (4 preceding siblings ...)
  2012-10-21 16:52 ` [PATCH 05/23] em28xx: rename struct em28xx_usb_isoc_ctl to em28xx_usb_ctl Frank Schäfer
@ 2012-10-21 16:52 ` Frank Schäfer
  2012-10-21 16:52 ` [PATCH 07/23] em28xx: update description of em28xx_irq_callback Frank Schäfer
                   ` (20 subsequent siblings)
  26 siblings, 0 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-10-21 16:52 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, Frank Schäfer

It isn't used anymore and uses constants which no longer exist.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 drivers/media/usb/em28xx/em28xx.h |    4 ----
 1 Datei geändert, 4 Zeilen entfernt(-)

diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h
index 5ef0a7a..c28e47f 100644
--- a/drivers/media/usb/em28xx/em28xx.h
+++ b/drivers/media/usb/em28xx/em28xx.h
@@ -186,10 +186,6 @@
 			Interval: 125us
 */
 
-/* time to wait when stopping the isoc transfer */
-#define EM28XX_URB_TIMEOUT \
-			msecs_to_jiffies(EM28XX_NUM_BUFS * EM28XX_NUM_PACKETS)
-
 /* time in msecs to wait for i2c writes to finish */
 #define EM2800_I2C_WRITE_TIMEOUT 20
 
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 07/23] em28xx: update description of em28xx_irq_callback
  2012-10-21 16:52 [PATCH 00/23] em28xx: add support fur USB bulk transfers Frank Schäfer
                   ` (5 preceding siblings ...)
  2012-10-21 16:52 ` [PATCH 06/23] em28xx: remove obsolete #define EM28XX_URB_TIMEOUT Frank Schäfer
@ 2012-10-21 16:52 ` Frank Schäfer
  2012-10-21 16:52 ` [PATCH 08/23] em28xx: rename function em28xx_uninit_isoc to em28xx_uninit_usb_xfer Frank Schäfer
                   ` (19 subsequent siblings)
  26 siblings, 0 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-10-21 16:52 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, Frank Schäfer

em28xx_irq_callback can be used for isoc and bulk transfers.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 drivers/media/usb/em28xx/em28xx-core.c |    3 ++-
 1 Datei geändert, 2 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)

diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c
index 0892d92..8f50f5c 100644
--- a/drivers/media/usb/em28xx/em28xx-core.c
+++ b/drivers/media/usb/em28xx/em28xx-core.c
@@ -919,7 +919,7 @@ EXPORT_SYMBOL_GPL(em28xx_set_mode);
    ------------------------------------------------------------------*/
 
 /*
- * IRQ callback, called by URB callback
+ * URB completion handler for isoc/bulk transfers
  */
 static void em28xx_irq_callback(struct urb *urb)
 {
@@ -946,6 +946,7 @@ static void em28xx_irq_callback(struct urb *urb)
 
 	/* Reset urb buffers */
 	for (i = 0; i < urb->number_of_packets; i++) {
+		/* isoc only (bulk: number_of_packets = 0) */
 		urb->iso_frame_desc[i].status = 0;
 		urb->iso_frame_desc[i].actual_length = 0;
 	}
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 08/23] em28xx: rename function em28xx_uninit_isoc to em28xx_uninit_usb_xfer
  2012-10-21 16:52 [PATCH 00/23] em28xx: add support fur USB bulk transfers Frank Schäfer
                   ` (6 preceding siblings ...)
  2012-10-21 16:52 ` [PATCH 07/23] em28xx: update description of em28xx_irq_callback Frank Schäfer
@ 2012-10-21 16:52 ` Frank Schäfer
  2012-10-21 16:52 ` [PATCH 09/23] em28xx: create a common function for isoc and bulk URB allocation and setup Frank Schäfer
                   ` (18 subsequent siblings)
  26 siblings, 0 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-10-21 16:52 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, Frank Schäfer

This function will be used to uninitialize USB bulk transfers, too.
Also rename the local variable isoc_bufs to usb_bufs.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 drivers/media/usb/em28xx/em28xx-cards.c |    4 +--
 drivers/media/usb/em28xx/em28xx-core.c  |   43 ++++++++++++++++---------------
 drivers/media/usb/em28xx/em28xx-video.c |    2 +-
 drivers/media/usb/em28xx/em28xx.h       |    2 +-
 4 Dateien geändert, 26 Zeilen hinzugefügt(+), 25 Zeilen entfernt(-)

diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
index 8b40111..fee68d8 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -3385,7 +3385,7 @@ static void em28xx_usb_disconnect(struct usb_interface *interface)
 		     video_device_node_name(dev->vdev));
 
 		dev->state |= DEV_MISCONFIGURED;
-		em28xx_uninit_isoc(dev, dev->mode);
+		em28xx_uninit_usb_xfer(dev, dev->mode);
 		dev->state |= DEV_DISCONNECTED;
 	} else {
 		dev->state |= DEV_DISCONNECTED;
@@ -3393,7 +3393,7 @@ static void em28xx_usb_disconnect(struct usb_interface *interface)
 	}
 
 	/* free DVB isoc buffers */
-	em28xx_uninit_isoc(dev, EM28XX_DIGITAL_MODE);
+	em28xx_uninit_usb_xfer(dev, EM28XX_DIGITAL_MODE);
 
 	mutex_unlock(&dev->lock);
 
diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c
index 8f50f5c..a1ebd08 100644
--- a/drivers/media/usb/em28xx/em28xx-core.c
+++ b/drivers/media/usb/em28xx/em28xx-core.c
@@ -962,49 +962,50 @@ static void em28xx_irq_callback(struct urb *urb)
 /*
  * Stop and Deallocate URBs
  */
-void em28xx_uninit_isoc(struct em28xx *dev, enum em28xx_mode mode)
+void em28xx_uninit_usb_xfer(struct em28xx *dev, enum em28xx_mode mode)
 {
 	struct urb *urb;
-	struct em28xx_usb_bufs *isoc_bufs;
+	struct em28xx_usb_bufs *usb_bufs;
 	int i;
 
-	em28xx_isocdbg("em28xx: called em28xx_uninit_isoc in mode %d\n", mode);
+	em28xx_isocdbg("em28xx: called em28xx_uninit_usb_xfer in mode %d\n",
+		       mode);
 
 	if (mode == EM28XX_DIGITAL_MODE)
-		isoc_bufs = &dev->usb_ctl.digital_bufs;
+		usb_bufs = &dev->usb_ctl.digital_bufs;
 	else
-		isoc_bufs = &dev->usb_ctl.analog_bufs;
+		usb_bufs = &dev->usb_ctl.analog_bufs;
 
-	for (i = 0; i < isoc_bufs->num_bufs; i++) {
-		urb = isoc_bufs->urb[i];
+	for (i = 0; i < usb_bufs->num_bufs; i++) {
+		urb = usb_bufs->urb[i];
 		if (urb) {
 			if (!irqs_disabled())
 				usb_kill_urb(urb);
 			else
 				usb_unlink_urb(urb);
 
-			if (isoc_bufs->transfer_buffer[i]) {
+			if (usb_bufs->transfer_buffer[i]) {
 				usb_free_coherent(dev->udev,
 					urb->transfer_buffer_length,
-					isoc_bufs->transfer_buffer[i],
+					usb_bufs->transfer_buffer[i],
 					urb->transfer_dma);
 			}
 			usb_free_urb(urb);
-			isoc_bufs->urb[i] = NULL;
+			usb_bufs->urb[i] = NULL;
 		}
-		isoc_bufs->transfer_buffer[i] = NULL;
+		usb_bufs->transfer_buffer[i] = NULL;
 	}
 
-	kfree(isoc_bufs->urb);
-	kfree(isoc_bufs->transfer_buffer);
+	kfree(usb_bufs->urb);
+	kfree(usb_bufs->transfer_buffer);
 
-	isoc_bufs->urb = NULL;
-	isoc_bufs->transfer_buffer = NULL;
-	isoc_bufs->num_bufs = 0;
+	usb_bufs->urb = NULL;
+	usb_bufs->transfer_buffer = NULL;
+	usb_bufs->num_bufs = 0;
 
 	em28xx_capture_start(dev, 0);
 }
-EXPORT_SYMBOL_GPL(em28xx_uninit_isoc);
+EXPORT_SYMBOL_GPL(em28xx_uninit_usb_xfer);
 
 /*
  * Stop URBs
@@ -1051,7 +1052,7 @@ int em28xx_alloc_isoc(struct em28xx *dev, enum em28xx_mode mode,
 		isoc_bufs = &dev->usb_ctl.analog_bufs;
 
 	/* De-allocates all pending stuff */
-	em28xx_uninit_isoc(dev, mode);
+	em28xx_uninit_usb_xfer(dev, mode);
 
 	isoc_bufs->num_bufs = num_bufs;
 
@@ -1081,7 +1082,7 @@ int em28xx_alloc_isoc(struct em28xx *dev, enum em28xx_mode mode,
 		urb = usb_alloc_urb(isoc_bufs->num_packets, GFP_KERNEL);
 		if (!urb) {
 			em28xx_err("cannot alloc usb_ctl.urb %i\n", i);
-			em28xx_uninit_isoc(dev, mode);
+			em28xx_uninit_usb_xfer(dev, mode);
 			return -ENOMEM;
 		}
 		isoc_bufs->urb[i] = urb;
@@ -1093,7 +1094,7 @@ int em28xx_alloc_isoc(struct em28xx *dev, enum em28xx_mode mode,
 					" buffer %i%s\n",
 					sb_size, i,
 					in_interrupt() ? " while in int" : "");
-			em28xx_uninit_isoc(dev, mode);
+			em28xx_uninit_usb_xfer(dev, mode);
 			return -ENOMEM;
 		}
 		memset(isoc_bufs->transfer_buffer[i], 0, sb_size);
@@ -1171,7 +1172,7 @@ int em28xx_init_isoc(struct em28xx *dev, enum em28xx_mode mode,
 		if (rc) {
 			em28xx_err("submit of urb %i failed (error=%i)\n", i,
 				   rc);
-			em28xx_uninit_isoc(dev, mode);
+			em28xx_uninit_usb_xfer(dev, mode);
 			return rc;
 		}
 	}
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
index b334885..1207a73 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -2272,7 +2272,7 @@ static int em28xx_v4l2_close(struct file *filp)
 		v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_power, 0);
 
 		/* do this before setting alternate! */
-		em28xx_uninit_isoc(dev, EM28XX_ANALOG_MODE);
+		em28xx_uninit_usb_xfer(dev, EM28XX_ANALOG_MODE);
 		em28xx_set_mode(dev, EM28XX_SUSPEND);
 
 		/* set alternate 0 */
diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h
index c28e47f..3ffadf9 100644
--- a/drivers/media/usb/em28xx/em28xx.h
+++ b/drivers/media/usb/em28xx/em28xx.h
@@ -666,7 +666,7 @@ int em28xx_alloc_isoc(struct em28xx *dev, enum em28xx_mode mode,
 int em28xx_init_isoc(struct em28xx *dev, enum em28xx_mode mode,
 		     int num_packets, int num_bufs, int max_pkt_size,
 		     int (*isoc_copy) (struct em28xx *dev, struct urb *urb));
-void em28xx_uninit_isoc(struct em28xx *dev, enum em28xx_mode mode);
+void em28xx_uninit_usb_xfer(struct em28xx *dev, enum em28xx_mode mode);
 void em28xx_stop_urbs(struct em28xx *dev);
 int em28xx_isoc_dvb_max_packetsize(struct em28xx *dev);
 int em28xx_set_mode(struct em28xx *dev, enum em28xx_mode set_mode);
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 09/23] em28xx: create a common function for isoc and bulk URB allocation and setup
  2012-10-21 16:52 [PATCH 00/23] em28xx: add support fur USB bulk transfers Frank Schäfer
                   ` (7 preceding siblings ...)
  2012-10-21 16:52 ` [PATCH 08/23] em28xx: rename function em28xx_uninit_isoc to em28xx_uninit_usb_xfer Frank Schäfer
@ 2012-10-21 16:52 ` Frank Schäfer
  2012-10-21 16:52 ` [PATCH 10/23] em28xx: create a common function for isoc and bulk USB transfer initialization Frank Schäfer
                   ` (17 subsequent siblings)
  26 siblings, 0 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-10-21 16:52 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, Frank Schäfer

Rename the existing function for isoc transfers em28xx_init_isoc
to em28xx_init_usb_xfer and extend it.
URB allocation and setup is now done depending on the USB
transfer type, which is selected with a new function parameter.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 drivers/media/usb/em28xx/em28xx-cards.c |    6 +-
 drivers/media/usb/em28xx/em28xx-core.c  |  101 +++++++++++++++++--------------
 drivers/media/usb/em28xx/em28xx.h       |    4 +-
 3 Dateien geändert, 61 Zeilen hinzugefügt(+), 50 Zeilen entfernt(-)

diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
index fee68d8..e0d03a1 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -3313,10 +3313,10 @@ static int em28xx_usb_probe(struct usb_interface *interface,
 
 	if (has_dvb) {
 		/* pre-allocate DVB isoc transfer buffers */
-		retval = em28xx_alloc_isoc(dev, EM28XX_DIGITAL_MODE,
-					   EM28XX_DVB_NUM_ISOC_PACKETS,
+		retval = em28xx_alloc_urbs(dev, EM28XX_DIGITAL_MODE, 0,
 					   EM28XX_DVB_NUM_BUFS,
-					   dev->dvb_max_pkt_size);
+					   dev->dvb_max_pkt_size,
+					   EM28XX_DVB_NUM_ISOC_PACKETS);
 		if (retval) {
 			goto unlock_and_free;
 		}
diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c
index a1ebd08..42388de 100644
--- a/drivers/media/usb/em28xx/em28xx-core.c
+++ b/drivers/media/usb/em28xx/em28xx-core.c
@@ -5,6 +5,7 @@
 		      Markus Rechberger <mrechberger@gmail.com>
 		      Mauro Carvalho Chehab <mchehab@infradead.org>
 		      Sascha Sommer <saschasommer@freenet.de>
+   Copyright (C) 2012 Frank Schäfer <fschaefer.oss@googlemail.com>
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -1035,10 +1036,10 @@ EXPORT_SYMBOL_GPL(em28xx_stop_urbs);
 /*
  * Allocate URBs
  */
-int em28xx_alloc_isoc(struct em28xx *dev, enum em28xx_mode mode,
-		      int num_packets, int num_bufs, int max_pkt_size)
+int em28xx_alloc_urbs(struct em28xx *dev, enum em28xx_mode mode, int xfer_bulk,
+		      int num_bufs, int max_pkt_size, int packet_multiplier)
 {
-	struct em28xx_usb_bufs *isoc_bufs;
+	struct em28xx_usb_bufs *usb_bufs;
 	int i;
 	int sb_size, pipe;
 	struct urb *urb;
@@ -1047,49 +1048,52 @@ int em28xx_alloc_isoc(struct em28xx *dev, enum em28xx_mode mode,
 	em28xx_isocdbg("em28xx: called em28xx_alloc_isoc in mode %d\n", mode);
 
 	if (mode == EM28XX_DIGITAL_MODE)
-		isoc_bufs = &dev->usb_ctl.digital_bufs;
+		usb_bufs = &dev->usb_ctl.digital_bufs;
 	else
-		isoc_bufs = &dev->usb_ctl.analog_bufs;
+		usb_bufs = &dev->usb_ctl.analog_bufs;
 
 	/* De-allocates all pending stuff */
 	em28xx_uninit_usb_xfer(dev, mode);
 
-	isoc_bufs->num_bufs = num_bufs;
+	usb_bufs->num_bufs = num_bufs;
 
-	isoc_bufs->urb = kzalloc(sizeof(void *)*num_bufs,  GFP_KERNEL);
-	if (!isoc_bufs->urb) {
+	usb_bufs->urb = kzalloc(sizeof(void *)*num_bufs,  GFP_KERNEL);
+	if (!usb_bufs->urb) {
 		em28xx_errdev("cannot alloc memory for usb buffers\n");
 		return -ENOMEM;
 	}
 
-	isoc_bufs->transfer_buffer = kzalloc(sizeof(void *)*num_bufs,
+	usb_bufs->transfer_buffer = kzalloc(sizeof(void *)*num_bufs,
 					     GFP_KERNEL);
-	if (!isoc_bufs->transfer_buffer) {
+	if (!usb_bufs->transfer_buffer) {
 		em28xx_errdev("cannot allocate memory for usb transfer\n");
-		kfree(isoc_bufs->urb);
+		kfree(usb_bufs->urb);
 		return -ENOMEM;
 	}
 
-	isoc_bufs->max_pkt_size = max_pkt_size;
-	isoc_bufs->num_packets = num_packets;
+	usb_bufs->max_pkt_size = max_pkt_size;
+	if (xfer_bulk)
+		usb_bufs->num_packets = 0;
+	else
+		usb_bufs->num_packets = packet_multiplier;
 	dev->usb_ctl.vid_buf = NULL;
 	dev->usb_ctl.vbi_buf = NULL;
 
-	sb_size = isoc_bufs->num_packets * isoc_bufs->max_pkt_size;
+	sb_size = packet_multiplier * usb_bufs->max_pkt_size;
 
 	/* allocate urbs and transfer buffers */
-	for (i = 0; i < isoc_bufs->num_bufs; i++) {
-		urb = usb_alloc_urb(isoc_bufs->num_packets, GFP_KERNEL);
+	for (i = 0; i < usb_bufs->num_bufs; i++) {
+		urb = usb_alloc_urb(usb_bufs->num_packets, GFP_KERNEL);
 		if (!urb) {
 			em28xx_err("cannot alloc usb_ctl.urb %i\n", i);
 			em28xx_uninit_usb_xfer(dev, mode);
 			return -ENOMEM;
 		}
-		isoc_bufs->urb[i] = urb;
+		usb_bufs->urb[i] = urb;
 
-		isoc_bufs->transfer_buffer[i] = usb_alloc_coherent(dev->udev,
+		usb_bufs->transfer_buffer[i] = usb_alloc_coherent(dev->udev,
 			sb_size, GFP_KERNEL, &urb->transfer_dma);
-		if (!isoc_bufs->transfer_buffer[i]) {
+		if (!usb_bufs->transfer_buffer[i]) {
 			em28xx_err("unable to allocate %i bytes for transfer"
 					" buffer %i%s\n",
 					sb_size, i,
@@ -1097,35 +1101,42 @@ int em28xx_alloc_isoc(struct em28xx *dev, enum em28xx_mode mode,
 			em28xx_uninit_usb_xfer(dev, mode);
 			return -ENOMEM;
 		}
-		memset(isoc_bufs->transfer_buffer[i], 0, sb_size);
-
-		/* FIXME: this is a hack - should be
-			'desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK'
-			should also be using 'desc.bInterval'
-		 */
-		pipe = usb_rcvisocpipe(dev->udev,
-				       mode == EM28XX_ANALOG_MODE ?
-				       EM28XX_EP_ANALOG : EM28XX_EP_DIGITAL);
-
-		usb_fill_int_urb(urb, dev->udev, pipe,
-				 isoc_bufs->transfer_buffer[i], sb_size,
-				 em28xx_irq_callback, dev, 1);
-
-		urb->number_of_packets = isoc_bufs->num_packets;
-		urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP;
-
-		k = 0;
-		for (j = 0; j < isoc_bufs->num_packets; j++) {
-			urb->iso_frame_desc[j].offset = k;
-			urb->iso_frame_desc[j].length =
-						isoc_bufs->max_pkt_size;
-			k += isoc_bufs->max_pkt_size;
+		memset(usb_bufs->transfer_buffer[i], 0, sb_size);
+
+		if (xfer_bulk) { /* bulk */
+			pipe = usb_rcvbulkpipe(dev->udev,
+					       mode == EM28XX_ANALOG_MODE ?
+					       EM28XX_EP_ANALOG :
+					       EM28XX_EP_DIGITAL);
+			usb_fill_bulk_urb(urb, dev->udev, pipe,
+					  usb_bufs->transfer_buffer[i], sb_size,
+					  em28xx_irq_callback, dev);
+			urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
+		} else { /* isoc */
+			pipe = usb_rcvisocpipe(dev->udev,
+					       mode == EM28XX_ANALOG_MODE ?
+					       EM28XX_EP_ANALOG :
+					       EM28XX_EP_DIGITAL);
+			usb_fill_int_urb(urb, dev->udev, pipe,
+					 usb_bufs->transfer_buffer[i], sb_size,
+					 em28xx_irq_callback, dev, 1);
+			urb->transfer_flags = URB_ISO_ASAP |
+					      URB_NO_TRANSFER_DMA_MAP;
+			k = 0;
+			for (j = 0; j < usb_bufs->num_packets; j++) {
+				urb->iso_frame_desc[j].offset = k;
+				urb->iso_frame_desc[j].length =
+							usb_bufs->max_pkt_size;
+				k += usb_bufs->max_pkt_size;
+			}
 		}
+
+		urb->number_of_packets = usb_bufs->num_packets;
 	}
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(em28xx_alloc_isoc);
+EXPORT_SYMBOL_GPL(em28xx_alloc_urbs);
 
 /*
  * Allocate URBs and start IRQ
@@ -1155,8 +1166,8 @@ int em28xx_init_isoc(struct em28xx *dev, enum em28xx_mode mode,
 	}
 
 	if (alloc) {
-		rc = em28xx_alloc_isoc(dev, mode, num_packets,
-				       num_bufs, max_pkt_size);
+		rc = em28xx_alloc_urbs(dev, mode, 0, num_bufs,
+				       max_pkt_size, num_packets);
 		if (rc)
 			return rc;
 	}
diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h
index 3ffadf9..9a1ffde 100644
--- a/drivers/media/usb/em28xx/em28xx.h
+++ b/drivers/media/usb/em28xx/em28xx.h
@@ -661,8 +661,8 @@ int em28xx_vbi_supported(struct em28xx *dev);
 int em28xx_set_outfmt(struct em28xx *dev);
 int em28xx_resolution_set(struct em28xx *dev);
 int em28xx_set_alternate(struct em28xx *dev);
-int em28xx_alloc_isoc(struct em28xx *dev, enum em28xx_mode mode,
-		      int num_packets, int num_bufs, int max_pkt_size);
+int em28xx_alloc_urbs(struct em28xx *dev, enum em28xx_mode mode, int xfer_bulk,
+		      int num_bufs, int max_pkt_size, int packet_multiplier);
 int em28xx_init_isoc(struct em28xx *dev, enum em28xx_mode mode,
 		     int num_packets, int num_bufs, int max_pkt_size,
 		     int (*isoc_copy) (struct em28xx *dev, struct urb *urb));
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 10/23] em28xx: create a common function for isoc and bulk USB transfer initialization
  2012-10-21 16:52 [PATCH 00/23] em28xx: add support fur USB bulk transfers Frank Schäfer
                   ` (8 preceding siblings ...)
  2012-10-21 16:52 ` [PATCH 09/23] em28xx: create a common function for isoc and bulk URB allocation and setup Frank Schäfer
@ 2012-10-21 16:52 ` Frank Schäfer
  2012-10-21 16:52 ` Frank Schäfer
                   ` (16 subsequent siblings)
  26 siblings, 0 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-10-21 16:52 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, Frank Schäfer

- rename em28xx_init_isoc to em28xx_init_usb_xfer
- add parameter for isoc/bulk transfer selection which is passed to em28xx_alloc_urbs
- rename local variable isoc_buf to usb_bufs

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 drivers/media/usb/em28xx/em28xx-core.c  |   30 ++++++++++++++++--------------
 drivers/media/usb/em28xx/em28xx-dvb.c   |    9 +++++----
 drivers/media/usb/em28xx/em28xx-video.c |   20 ++++++++++----------
 drivers/media/usb/em28xx/em28xx.h       |    8 +++++---
 4 Dateien geändert, 36 Zeilen hinzugefügt(+), 31 Zeilen entfernt(-)

diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c
index 42388de..d8a8e8b 100644
--- a/drivers/media/usb/em28xx/em28xx-core.c
+++ b/drivers/media/usb/em28xx/em28xx-core.c
@@ -1141,33 +1141,35 @@ EXPORT_SYMBOL_GPL(em28xx_alloc_urbs);
 /*
  * Allocate URBs and start IRQ
  */
-int em28xx_init_isoc(struct em28xx *dev, enum em28xx_mode mode,
-		     int num_packets, int num_bufs, int max_pkt_size,
-		     int (*isoc_copy) (struct em28xx *dev, struct urb *urb))
+int em28xx_init_usb_xfer(struct em28xx *dev, enum em28xx_mode mode,
+		    int xfer_bulk, int num_bufs, int max_pkt_size,
+		    int packet_multiplier,
+		    int (*urb_data_copy) (struct em28xx *dev, struct urb *urb))
 {
 	struct em28xx_dmaqueue *dma_q = &dev->vidq;
 	struct em28xx_dmaqueue *vbi_dma_q = &dev->vbiq;
-	struct em28xx_usb_bufs *isoc_bufs;
+	struct em28xx_usb_bufs *usb_bufs;
 	int i;
 	int rc;
 	int alloc;
 
-	em28xx_isocdbg("em28xx: called em28xx_init_isoc in mode %d\n", mode);
+	em28xx_isocdbg("em28xx: called em28xx_init_usb_xfer in mode %d\n",
+		       mode);
 
-	dev->usb_ctl.urb_data_copy = isoc_copy;
+	dev->usb_ctl.urb_data_copy = urb_data_copy;
 
 	if (mode == EM28XX_DIGITAL_MODE) {
-		isoc_bufs = &dev->usb_ctl.digital_bufs;
-		/* no need to free/alloc isoc buffers in digital mode */
+		usb_bufs = &dev->usb_ctl.digital_bufs;
+		/* no need to free/alloc usb buffers in digital mode */
 		alloc = 0;
 	} else {
-		isoc_bufs = &dev->usb_ctl.analog_bufs;
+		usb_bufs = &dev->usb_ctl.analog_bufs;
 		alloc = 1;
 	}
 
 	if (alloc) {
-		rc = em28xx_alloc_urbs(dev, mode, 0, num_bufs,
-				       max_pkt_size, num_packets);
+		rc = em28xx_alloc_urbs(dev, mode, xfer_bulk, num_bufs,
+				       max_pkt_size, packet_multiplier);
 		if (rc)
 			return rc;
 	}
@@ -1178,8 +1180,8 @@ int em28xx_init_isoc(struct em28xx *dev, enum em28xx_mode mode,
 	em28xx_capture_start(dev, 1);
 
 	/* submit urbs and enables IRQ */
-	for (i = 0; i < isoc_bufs->num_bufs; i++) {
-		rc = usb_submit_urb(isoc_bufs->urb[i], GFP_ATOMIC);
+	for (i = 0; i < usb_bufs->num_bufs; i++) {
+		rc = usb_submit_urb(usb_bufs->urb[i], GFP_ATOMIC);
 		if (rc) {
 			em28xx_err("submit of urb %i failed (error=%i)\n", i,
 				   rc);
@@ -1190,7 +1192,7 @@ int em28xx_init_isoc(struct em28xx *dev, enum em28xx_mode mode,
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(em28xx_init_isoc);
+EXPORT_SYMBOL_GPL(em28xx_init_usb_xfer);
 
 /*
  * em28xx_wake_i2c()
diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c
index 0fe99ef..66535dc 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -176,10 +176,11 @@ static int em28xx_start_streaming(struct em28xx_dvb *dvb)
 		EM28XX_DVB_NUM_ISOC_PACKETS,
 		max_dvb_packet_size);
 
-	return em28xx_init_isoc(dev, EM28XX_DIGITAL_MODE,
-				EM28XX_DVB_NUM_ISOC_PACKETS,
-				EM28XX_DVB_NUM_BUFS,
-				max_dvb_packet_size, em28xx_dvb_isoc_copy);
+	return em28xx_init_usb_xfer(dev, EM28XX_DIGITAL_MODE, 0,
+				    EM28XX_DVB_NUM_BUFS,
+				    max_dvb_packet_size,
+				    EM28XX_DVB_NUM_ISOC_PACKETS,
+				    em28xx_dvb_isoc_copy);
 }
 
 static int em28xx_stop_streaming(struct em28xx_dvb *dvb)
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
index 1207a73..4024dfc 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -763,17 +763,17 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb,
 
 	if (urb_init) {
 		if (em28xx_vbi_supported(dev) == 1)
-			rc = em28xx_init_isoc(dev, EM28XX_ANALOG_MODE,
-					      EM28XX_NUM_ISOC_PACKETS,
-					      EM28XX_NUM_BUFS,
-					      dev->max_pkt_size,
-					      em28xx_isoc_copy_vbi);
+			rc = em28xx_init_usb_xfer(dev, EM28XX_ANALOG_MODE, 0,
+						  EM28XX_NUM_BUFS,
+						  dev->max_pkt_size,
+						  EM28XX_NUM_ISOC_PACKETS,
+						  em28xx_isoc_copy_vbi);
 		else
-			rc = em28xx_init_isoc(dev, EM28XX_ANALOG_MODE,
-					      EM28XX_NUM_ISOC_PACKETS,
-					      EM28XX_NUM_BUFS,
-					      dev->max_pkt_size,
-					      em28xx_isoc_copy);
+			rc = em28xx_init_usb_xfer(dev, EM28XX_ANALOG_MODE, 0,
+						  EM28XX_NUM_BUFS,
+						  dev->max_pkt_size,
+						  EM28XX_NUM_ISOC_PACKETS,
+						  em28xx_isoc_copy);
 		if (rc < 0)
 			goto fail;
 	}
diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h
index 9a1ffde..e311b09 100644
--- a/drivers/media/usb/em28xx/em28xx.h
+++ b/drivers/media/usb/em28xx/em28xx.h
@@ -663,9 +663,11 @@ int em28xx_resolution_set(struct em28xx *dev);
 int em28xx_set_alternate(struct em28xx *dev);
 int em28xx_alloc_urbs(struct em28xx *dev, enum em28xx_mode mode, int xfer_bulk,
 		      int num_bufs, int max_pkt_size, int packet_multiplier);
-int em28xx_init_isoc(struct em28xx *dev, enum em28xx_mode mode,
-		     int num_packets, int num_bufs, int max_pkt_size,
-		     int (*isoc_copy) (struct em28xx *dev, struct urb *urb));
+int em28xx_init_usb_xfer(struct em28xx *dev, enum em28xx_mode mode,
+			 int xfer_bulk,
+			 int num_bufs, int max_pkt_size, int packet_multiplier,
+			 int (*urb_data_copy)
+					(struct em28xx *dev, struct urb *urb));
 void em28xx_uninit_usb_xfer(struct em28xx *dev, enum em28xx_mode mode);
 void em28xx_stop_urbs(struct em28xx *dev);
 int em28xx_isoc_dvb_max_packetsize(struct em28xx *dev);
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 10/23] em28xx: create a common function for isoc and bulk USB transfer initialization
  2012-10-21 16:52 [PATCH 00/23] em28xx: add support fur USB bulk transfers Frank Schäfer
                   ` (9 preceding siblings ...)
  2012-10-21 16:52 ` [PATCH 10/23] em28xx: create a common function for isoc and bulk USB transfer initialization Frank Schäfer
@ 2012-10-21 16:52 ` Frank Schäfer
  2012-10-21 16:52 ` [PATCH 11/23] em28xx: clear USB halt/stall condition in em28xx_init_usb_xfer when using bulk transfers Frank Schäfer
                   ` (15 subsequent siblings)
  26 siblings, 0 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-10-21 16:52 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, Frank Schäfer

- rename em28xx_init_isoc to em28xx_init_usb_xfer
- add parameter for isoc/bulk transfer selection which is passed to em28xx_alloc_urbs
- rename local variable isoc_buf to usb_bufs

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 drivers/media/usb/em28xx/em28xx-core.c  |   30 ++++++++++++++++--------------
 drivers/media/usb/em28xx/em28xx-dvb.c   |    9 +++++----
 drivers/media/usb/em28xx/em28xx-video.c |   20 ++++++++++----------
 drivers/media/usb/em28xx/em28xx.h       |    8 +++++---
 4 Dateien geändert, 36 Zeilen hinzugefügt(+), 31 Zeilen entfernt(-)

diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c
index 42388de..d8a8e8b 100644
--- a/drivers/media/usb/em28xx/em28xx-core.c
+++ b/drivers/media/usb/em28xx/em28xx-core.c
@@ -1141,33 +1141,35 @@ EXPORT_SYMBOL_GPL(em28xx_alloc_urbs);
 /*
  * Allocate URBs and start IRQ
  */
-int em28xx_init_isoc(struct em28xx *dev, enum em28xx_mode mode,
-		     int num_packets, int num_bufs, int max_pkt_size,
-		     int (*isoc_copy) (struct em28xx *dev, struct urb *urb))
+int em28xx_init_usb_xfer(struct em28xx *dev, enum em28xx_mode mode,
+		    int xfer_bulk, int num_bufs, int max_pkt_size,
+		    int packet_multiplier,
+		    int (*urb_data_copy) (struct em28xx *dev, struct urb *urb))
 {
 	struct em28xx_dmaqueue *dma_q = &dev->vidq;
 	struct em28xx_dmaqueue *vbi_dma_q = &dev->vbiq;
-	struct em28xx_usb_bufs *isoc_bufs;
+	struct em28xx_usb_bufs *usb_bufs;
 	int i;
 	int rc;
 	int alloc;
 
-	em28xx_isocdbg("em28xx: called em28xx_init_isoc in mode %d\n", mode);
+	em28xx_isocdbg("em28xx: called em28xx_init_usb_xfer in mode %d\n",
+		       mode);
 
-	dev->usb_ctl.urb_data_copy = isoc_copy;
+	dev->usb_ctl.urb_data_copy = urb_data_copy;
 
 	if (mode == EM28XX_DIGITAL_MODE) {
-		isoc_bufs = &dev->usb_ctl.digital_bufs;
-		/* no need to free/alloc isoc buffers in digital mode */
+		usb_bufs = &dev->usb_ctl.digital_bufs;
+		/* no need to free/alloc usb buffers in digital mode */
 		alloc = 0;
 	} else {
-		isoc_bufs = &dev->usb_ctl.analog_bufs;
+		usb_bufs = &dev->usb_ctl.analog_bufs;
 		alloc = 1;
 	}
 
 	if (alloc) {
-		rc = em28xx_alloc_urbs(dev, mode, 0, num_bufs,
-				       max_pkt_size, num_packets);
+		rc = em28xx_alloc_urbs(dev, mode, xfer_bulk, num_bufs,
+				       max_pkt_size, packet_multiplier);
 		if (rc)
 			return rc;
 	}
@@ -1178,8 +1180,8 @@ int em28xx_init_isoc(struct em28xx *dev, enum em28xx_mode mode,
 	em28xx_capture_start(dev, 1);
 
 	/* submit urbs and enables IRQ */
-	for (i = 0; i < isoc_bufs->num_bufs; i++) {
-		rc = usb_submit_urb(isoc_bufs->urb[i], GFP_ATOMIC);
+	for (i = 0; i < usb_bufs->num_bufs; i++) {
+		rc = usb_submit_urb(usb_bufs->urb[i], GFP_ATOMIC);
 		if (rc) {
 			em28xx_err("submit of urb %i failed (error=%i)\n", i,
 				   rc);
@@ -1190,7 +1192,7 @@ int em28xx_init_isoc(struct em28xx *dev, enum em28xx_mode mode,
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(em28xx_init_isoc);
+EXPORT_SYMBOL_GPL(em28xx_init_usb_xfer);
 
 /*
  * em28xx_wake_i2c()
diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c
index 0fe99ef..66535dc 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -176,10 +176,11 @@ static int em28xx_start_streaming(struct em28xx_dvb *dvb)
 		EM28XX_DVB_NUM_ISOC_PACKETS,
 		max_dvb_packet_size);
 
-	return em28xx_init_isoc(dev, EM28XX_DIGITAL_MODE,
-				EM28XX_DVB_NUM_ISOC_PACKETS,
-				EM28XX_DVB_NUM_BUFS,
-				max_dvb_packet_size, em28xx_dvb_isoc_copy);
+	return em28xx_init_usb_xfer(dev, EM28XX_DIGITAL_MODE, 0,
+				    EM28XX_DVB_NUM_BUFS,
+				    max_dvb_packet_size,
+				    EM28XX_DVB_NUM_ISOC_PACKETS,
+				    em28xx_dvb_isoc_copy);
 }
 
 static int em28xx_stop_streaming(struct em28xx_dvb *dvb)
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
index 1207a73..4024dfc 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -763,17 +763,17 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb,
 
 	if (urb_init) {
 		if (em28xx_vbi_supported(dev) == 1)
-			rc = em28xx_init_isoc(dev, EM28XX_ANALOG_MODE,
-					      EM28XX_NUM_ISOC_PACKETS,
-					      EM28XX_NUM_BUFS,
-					      dev->max_pkt_size,
-					      em28xx_isoc_copy_vbi);
+			rc = em28xx_init_usb_xfer(dev, EM28XX_ANALOG_MODE, 0,
+						  EM28XX_NUM_BUFS,
+						  dev->max_pkt_size,
+						  EM28XX_NUM_ISOC_PACKETS,
+						  em28xx_isoc_copy_vbi);
 		else
-			rc = em28xx_init_isoc(dev, EM28XX_ANALOG_MODE,
-					      EM28XX_NUM_ISOC_PACKETS,
-					      EM28XX_NUM_BUFS,
-					      dev->max_pkt_size,
-					      em28xx_isoc_copy);
+			rc = em28xx_init_usb_xfer(dev, EM28XX_ANALOG_MODE, 0,
+						  EM28XX_NUM_BUFS,
+						  dev->max_pkt_size,
+						  EM28XX_NUM_ISOC_PACKETS,
+						  em28xx_isoc_copy);
 		if (rc < 0)
 			goto fail;
 	}
diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h
index 9a1ffde..e311b09 100644
--- a/drivers/media/usb/em28xx/em28xx.h
+++ b/drivers/media/usb/em28xx/em28xx.h
@@ -663,9 +663,11 @@ int em28xx_resolution_set(struct em28xx *dev);
 int em28xx_set_alternate(struct em28xx *dev);
 int em28xx_alloc_urbs(struct em28xx *dev, enum em28xx_mode mode, int xfer_bulk,
 		      int num_bufs, int max_pkt_size, int packet_multiplier);
-int em28xx_init_isoc(struct em28xx *dev, enum em28xx_mode mode,
-		     int num_packets, int num_bufs, int max_pkt_size,
-		     int (*isoc_copy) (struct em28xx *dev, struct urb *urb));
+int em28xx_init_usb_xfer(struct em28xx *dev, enum em28xx_mode mode,
+			 int xfer_bulk,
+			 int num_bufs, int max_pkt_size, int packet_multiplier,
+			 int (*urb_data_copy)
+					(struct em28xx *dev, struct urb *urb));
 void em28xx_uninit_usb_xfer(struct em28xx *dev, enum em28xx_mode mode);
 void em28xx_stop_urbs(struct em28xx *dev);
 int em28xx_isoc_dvb_max_packetsize(struct em28xx *dev);
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 11/23] em28xx: clear USB halt/stall condition in em28xx_init_usb_xfer when using bulk transfers
  2012-10-21 16:52 [PATCH 00/23] em28xx: add support fur USB bulk transfers Frank Schäfer
                   ` (10 preceding siblings ...)
  2012-10-21 16:52 ` Frank Schäfer
@ 2012-10-21 16:52 ` Frank Schäfer
  2012-10-21 16:52 ` [PATCH 12/23] em28xx: remove double checks for urb->status == -ENOENT in urb_data_copy functions Frank Schäfer
                   ` (14 subsequent siblings)
  26 siblings, 0 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-10-21 16:52 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, Frank Schäfer

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 drivers/media/usb/em28xx/em28xx-core.c |   11 +++++++++++
 1 Datei geändert, 11 Zeilen hinzugefügt(+)

diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c
index d8a8e8b..8b8f783 100644
--- a/drivers/media/usb/em28xx/em28xx-core.c
+++ b/drivers/media/usb/em28xx/em28xx-core.c
@@ -1174,6 +1174,17 @@ int em28xx_init_usb_xfer(struct em28xx *dev, enum em28xx_mode mode,
 			return rc;
 	}
 
+	if (xfer_bulk) {
+		rc = usb_clear_halt(dev->udev, usb_bufs->urb[0]->pipe);
+		if (rc < 0) {
+			em28xx_err("failed to clear USB bulk endpoint "
+				   "stall/halt condition (error=%i)\n",
+				   rc);
+			em28xx_uninit_usb_xfer(dev, mode);
+			return rc;
+		}
+	}
+
 	init_waitqueue_head(&dma_q->wq);
 	init_waitqueue_head(&vbi_dma_q->wq);
 
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 12/23] em28xx: remove double checks for urb->status == -ENOENT in urb_data_copy functions
  2012-10-21 16:52 [PATCH 00/23] em28xx: add support fur USB bulk transfers Frank Schäfer
                   ` (11 preceding siblings ...)
  2012-10-21 16:52 ` [PATCH 11/23] em28xx: clear USB halt/stall condition in em28xx_init_usb_xfer when using bulk transfers Frank Schäfer
@ 2012-10-21 16:52 ` Frank Schäfer
  2012-10-21 16:52 ` [PATCH 13/23] em28xx: rename function em28xx_isoc_copy and extend for USB bulk transfers Frank Schäfer
                   ` (13 subsequent siblings)
  26 siblings, 0 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-10-21 16:52 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, Frank Schäfer

This check is already done in the URB handler
em28xx_irq_callback before calling these functions.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 drivers/media/usb/em28xx/em28xx-dvb.c   |    5 +----
 drivers/media/usb/em28xx/em28xx-video.c |   10 ++--------
 2 Dateien geändert, 3 Zeilen hinzugefügt(+), 12 Zeilen entfernt(-)

diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c
index 66535dc..b47e164 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -134,11 +134,8 @@ static inline int em28xx_dvb_isoc_copy(struct em28xx *dev, struct urb *urb)
 	if ((dev->state & DEV_DISCONNECTED) || (dev->state & DEV_MISCONFIGURED))
 		return 0;
 
-	if (urb->status < 0) {
+	if (urb->status < 0)
 		print_err_status(dev, -1, urb->status);
-		if (urb->status == -ENOENT)
-			return 0;
-	}
 
 	for (i = 0; i < urb->number_of_packets; i++) {
 		int status = urb->iso_frame_desc[i].status;
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
index 4024dfc..3518753 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -429,11 +429,8 @@ static inline int em28xx_isoc_copy(struct em28xx *dev, struct urb *urb)
 	if ((dev->state & DEV_DISCONNECTED) || (dev->state & DEV_MISCONFIGURED))
 		return 0;
 
-	if (urb->status < 0) {
+	if (urb->status < 0)
 		print_err_status(dev, -1, urb->status);
-		if (urb->status == -ENOENT)
-			return 0;
-	}
 
 	buf = dev->usb_ctl.vid_buf;
 	if (buf != NULL)
@@ -525,11 +522,8 @@ static inline int em28xx_isoc_copy_vbi(struct em28xx *dev, struct urb *urb)
 	if ((dev->state & DEV_DISCONNECTED) || (dev->state & DEV_MISCONFIGURED))
 		return 0;
 
-	if (urb->status < 0) {
+	if (urb->status < 0)
 		print_err_status(dev, -1, urb->status);
-		if (urb->status == -ENOENT)
-			return 0;
-	}
 
 	buf = dev->usb_ctl.vid_buf;
 	if (buf != NULL)
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 13/23] em28xx: rename function em28xx_isoc_copy and extend for USB bulk transfers
  2012-10-21 16:52 [PATCH 00/23] em28xx: add support fur USB bulk transfers Frank Schäfer
                   ` (12 preceding siblings ...)
  2012-10-21 16:52 ` [PATCH 12/23] em28xx: remove double checks for urb->status == -ENOENT in urb_data_copy functions Frank Schäfer
@ 2012-10-21 16:52 ` Frank Schäfer
  2012-10-21 16:52 ` [PATCH 14/23] em28xx: rename function em28xx_isoc_copy_vbi " Frank Schäfer
                   ` (12 subsequent siblings)
  26 siblings, 0 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-10-21 16:52 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, Frank Schäfer

The URB data processing for bulk transfers is very similar to what
is done with isoc transfers, so create a common function that works
with both transfer types based on the existing isoc function.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 drivers/media/usb/em28xx/em28xx-video.c |   66 +++++++++++++++++++------------
 1 Datei geändert, 41 Zeilen hinzugefügt(+), 25 Zeilen entfernt(-)

diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
index 3518753..63b0cc3 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -6,6 +6,7 @@
 		      Markus Rechberger <mrechberger@gmail.com>
 		      Mauro Carvalho Chehab <mchehab@infradead.org>
 		      Sascha Sommer <saschasommer@freenet.de>
+   Copyright (C) 2012 Frank Schäfer <fschaefer.oss@googlemail.com>
 
 	Some parts based on SN9C10x PC Camera Controllers GPL driver made
 		by Luca Risolia <luca.risolia@studio.unibo.it>
@@ -412,16 +413,14 @@ static inline void vbi_get_next_buf(struct em28xx_dmaqueue *dma_q,
 	return;
 }
 
-/*
- * Controls the isoc copy of each urb packet
- */
-static inline int em28xx_isoc_copy(struct em28xx *dev, struct urb *urb)
+/* Processes and copies the URB data content to a frame buffer queue */
+static inline int em28xx_urb_data_copy(struct em28xx *dev, struct urb *urb)
 {
 	struct em28xx_buffer    *buf;
 	struct em28xx_dmaqueue  *dma_q = &dev->vidq;
-	unsigned char *outp = NULL;
-	int i, len = 0, rc = 1;
-	unsigned char *p;
+	int xfer_bulk, num_packets, i, rc = 1;
+	unsigned int actual_length, len = 0;
+	unsigned char *p, *outp = NULL;
 
 	if (!dev)
 		return 0;
@@ -432,33 +431,47 @@ static inline int em28xx_isoc_copy(struct em28xx *dev, struct urb *urb)
 	if (urb->status < 0)
 		print_err_status(dev, -1, urb->status);
 
+	xfer_bulk = usb_pipebulk(urb->pipe);
+
 	buf = dev->usb_ctl.vid_buf;
 	if (buf != NULL)
 		outp = videobuf_to_vmalloc(&buf->vb);
 
-	for (i = 0; i < urb->number_of_packets; i++) {
-		int status = urb->iso_frame_desc[i].status;
+	if (xfer_bulk) /* bulk */
+		num_packets = 1;
+	else /* isoc */
+		num_packets = urb->number_of_packets;
+
+	for (i = 0; i < num_packets; i++) {
+		if (xfer_bulk) { /* bulk */
+			actual_length = urb->actual_length;
+
+			p = urb->transfer_buffer;
+		} else { /* isoc */
+			if (urb->iso_frame_desc[i].status < 0) {
+				print_err_status(dev, i,
+						 urb->iso_frame_desc[i].status);
+				if (urb->iso_frame_desc[i].status != -EPROTO)
+					continue;
+			}
 
-		if (status < 0) {
-			print_err_status(dev, i, status);
-			if (urb->iso_frame_desc[i].status != -EPROTO)
+			actual_length = urb->iso_frame_desc[i].actual_length;
+			if (actual_length > dev->max_pkt_size) {
+				em28xx_isocdbg("packet bigger than "
+					       "packet size");
 				continue;
-		}
-
-		len = urb->iso_frame_desc[i].actual_length - 4;
+			}
 
-		if (urb->iso_frame_desc[i].actual_length <= 0) {
-			/* em28xx_isocdbg("packet %d is empty",i); - spammy */
-			continue;
+			p = urb->transfer_buffer +
+			    urb->iso_frame_desc[i].offset;
 		}
-		if (urb->iso_frame_desc[i].actual_length >
-						dev->max_pkt_size) {
-			em28xx_isocdbg("packet bigger than packet size");
+
+		if (actual_length <= 0) {
+			/* NOTE: happens very often with isoc transfers */
+			/* em28xx_usbdbg("packet %d is empty",i); - spammy */
 			continue;
 		}
 
-		p = urb->transfer_buffer + urb->iso_frame_desc[i].offset;
-
 		/* FIXME: incomplete buffer checks where removed to make
 		   logic simpler. Impacts of those changes should be evaluated
 		 */
@@ -492,9 +505,12 @@ static inline int em28xx_isoc_copy(struct em28xx *dev, struct urb *urb)
 		}
 		if (buf != NULL) {
 			if (p[0] != 0x88 && p[0] != 0x22) {
+				/* NOTE: no intermediate data packet header
+				 * 88 88 88 88 when using bulk transfers */
 				em28xx_isocdbg("frame is not complete\n");
-				len += 4;
+				len = actual_length;
 			} else {
+				len = actual_length - 4;
 				p += 4;
 			}
 			em28xx_copy_video(dev, dma_q, buf, p, outp, len);
@@ -767,7 +783,7 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb,
 						  EM28XX_NUM_BUFS,
 						  dev->max_pkt_size,
 						  EM28XX_NUM_ISOC_PACKETS,
-						  em28xx_isoc_copy);
+						  em28xx_urb_data_copy);
 		if (rc < 0)
 			goto fail;
 	}
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 14/23] em28xx: rename function em28xx_isoc_copy_vbi and extend for USB bulk transfers
  2012-10-21 16:52 [PATCH 00/23] em28xx: add support fur USB bulk transfers Frank Schäfer
                   ` (13 preceding siblings ...)
  2012-10-21 16:52 ` [PATCH 13/23] em28xx: rename function em28xx_isoc_copy and extend for USB bulk transfers Frank Schäfer
@ 2012-10-21 16:52 ` Frank Schäfer
  2012-10-21 16:52 ` [PATCH 15/23] em28xx: rename function em28xx_dvb_isoc_copy " Frank Schäfer
                   ` (11 subsequent siblings)
  26 siblings, 0 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-10-21 16:52 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, Frank Schäfer

The URB data processing for bulk transfers is very similar to what
is done with isoc transfers, so create a common function that works
with both transfer types based on the existing isoc function.

This patch has been compilation tested only, because I don't have
a device with vbi support !

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 drivers/media/usb/em28xx/em28xx-video.c |   71 +++++++++++++++++++------------
 1 Datei geändert, 44 Zeilen hinzugefügt(+), 27 Zeilen entfernt(-)

diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
index 63b0cc3..d6de1cc 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -519,18 +519,16 @@ static inline int em28xx_urb_data_copy(struct em28xx *dev, struct urb *urb)
 	return rc;
 }
 
-/* Version of isoc handler that takes into account a mixture of video and
-   VBI data */
-static inline int em28xx_isoc_copy_vbi(struct em28xx *dev, struct urb *urb)
+/* Version of the urb data handler that takes into account a mixture of
+   video and VBI data */
+static inline int em28xx_urb_data_copy_vbi(struct em28xx *dev, struct urb *urb)
 {
 	struct em28xx_buffer    *buf, *vbi_buf;
 	struct em28xx_dmaqueue  *dma_q = &dev->vidq;
 	struct em28xx_dmaqueue  *vbi_dma_q = &dev->vbiq;
-	unsigned char *outp = NULL;
-	unsigned char *vbioutp = NULL;
-	int i, len = 0, rc = 1;
-	unsigned char *p;
-	int vbi_size;
+	int xfer_bulk, vbi_size, num_packets, i, rc = 1;
+	unsigned int actual_length, len = 0;
+	unsigned char *p, *outp = NULL, *vbioutp = NULL;
 
 	if (!dev)
 		return 0;
@@ -541,6 +539,8 @@ static inline int em28xx_isoc_copy_vbi(struct em28xx *dev, struct urb *urb)
 	if (urb->status < 0)
 		print_err_status(dev, -1, urb->status);
 
+	xfer_bulk = usb_pipebulk(urb->pipe);
+
 	buf = dev->usb_ctl.vid_buf;
 	if (buf != NULL)
 		outp = videobuf_to_vmalloc(&buf->vb);
@@ -549,28 +549,41 @@ static inline int em28xx_isoc_copy_vbi(struct em28xx *dev, struct urb *urb)
 	if (vbi_buf != NULL)
 		vbioutp = videobuf_to_vmalloc(&vbi_buf->vb);
 
-	for (i = 0; i < urb->number_of_packets; i++) {
-		int status = urb->iso_frame_desc[i].status;
+	if (xfer_bulk) /* bulk */
+		num_packets = 1;
+	else /* isoc */
+		num_packets = urb->number_of_packets;
+
+	for (i = 0; i < num_packets; i++) {
+		if (xfer_bulk) { /* bulk */
+			actual_length = urb->actual_length;
+
+			p = urb->transfer_buffer;
+		} else { /* isoc */
+			if (urb->iso_frame_desc[i].status < 0) {
+				print_err_status(dev, i,
+						 urb->iso_frame_desc[i].status);
+				if (urb->iso_frame_desc[i].status != -EPROTO)
+					continue;
+			}
 
-		if (status < 0) {
-			print_err_status(dev, i, status);
-			if (urb->iso_frame_desc[i].status != -EPROTO)
+			actual_length = urb->iso_frame_desc[i].actual_length;
+			if (actual_length > dev->max_pkt_size) {
+				em28xx_isocdbg("packet bigger than "
+					       "packet size");
 				continue;
-		}
+			}
 
-		len = urb->iso_frame_desc[i].actual_length;
-		if (urb->iso_frame_desc[i].actual_length <= 0) {
-			/* em28xx_isocdbg("packet %d is empty",i); - spammy */
-			continue;
+			p = urb->transfer_buffer +
+			    urb->iso_frame_desc[i].offset;
 		}
-		if (urb->iso_frame_desc[i].actual_length >
-						dev->max_pkt_size) {
-			em28xx_isocdbg("packet bigger than packet size");
+
+		if (actual_length <= 0) {
+			/* NOTE: happens very often with isoc transfers */
+			/* em28xx_usbdbg("packet %d is empty",i); - spammy */
 			continue;
 		}
 
-		p = urb->transfer_buffer + urb->iso_frame_desc[i].offset;
-
 		/* capture type 0 = vbi start
 		   capture type 1 = video start
 		   capture type 2 = video in progress */
@@ -580,16 +593,20 @@ static inline int em28xx_isoc_copy_vbi(struct em28xx *dev, struct urb *urb)
 			em28xx_isocdbg("VBI START HEADER!!!\n");
 			dev->cur_field = p[2];
 			p += 4;
-			len -= 4;
+			len = actual_length - 4;
 		} else if (p[0] == 0x88 && p[1] == 0x88 &&
 			   p[2] == 0x88 && p[3] == 0x88) {
 			/* continuation */
 			p += 4;
-			len -= 4;
+			len = actual_length - 4;
 		} else if (p[0] == 0x22 && p[1] == 0x5a) {
 			/* start video */
 			p += 4;
-			len -= 4;
+			len = actual_length - 4;
+		} else {
+			/* NOTE: With bulk transfers, intermediate data packets
+			 * have no continuation header */
+			len = actual_length;
 		}
 
 		vbi_size = dev->vbi_width * dev->vbi_height;
@@ -777,7 +794,7 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb,
 						  EM28XX_NUM_BUFS,
 						  dev->max_pkt_size,
 						  EM28XX_NUM_ISOC_PACKETS,
-						  em28xx_isoc_copy_vbi);
+						  em28xx_urb_data_copy_vbi);
 		else
 			rc = em28xx_init_usb_xfer(dev, EM28XX_ANALOG_MODE, 0,
 						  EM28XX_NUM_BUFS,
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 15/23] em28xx: rename function em28xx_dvb_isoc_copy and extend for USB bulk transfers
  2012-10-21 16:52 [PATCH 00/23] em28xx: add support fur USB bulk transfers Frank Schäfer
                   ` (14 preceding siblings ...)
  2012-10-21 16:52 ` [PATCH 14/23] em28xx: rename function em28xx_isoc_copy_vbi " Frank Schäfer
@ 2012-10-21 16:52 ` Frank Schäfer
  2012-10-21 16:52 ` [PATCH 16/23] em28xx: rename usb debugging module parameter and macro Frank Schäfer
                   ` (10 subsequent siblings)
  26 siblings, 0 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-10-21 16:52 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, Frank Schäfer

The URB data processing for DVB bulk transfers is very similar to
what is done with isoc transfers, so create a common function that
works with both transfer types based on the existing isoc function.

This patch has been compilation tested only, because I don't have
a DVB device !

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 drivers/media/usb/em28xx/em28xx-dvb.c |   44 +++++++++++++++++++++++----------
 1 Datei geändert, 31 Zeilen hinzugefügt(+), 13 Zeilen entfernt(-)

diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c
index b47e164..cd36a67 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -10,6 +10,8 @@
 
  (c) 2008 Aidan Thornton <makosoft@googlemail.com>
 
+ (c) 2012 Frank Schäfer <fschaefer.oss@googlemail.com>
+
  Based on cx88-dvb, saa7134-dvb and videobuf-dvb originally written by:
 	(c) 2004, 2005 Chris Pascoe <c.pascoe@itee.uq.edu.au>
 	(c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
@@ -124,9 +126,9 @@ static inline void print_err_status(struct em28xx *dev,
 	}
 }
 
-static inline int em28xx_dvb_isoc_copy(struct em28xx *dev, struct urb *urb)
+static inline int em28xx_dvb_urb_data_copy(struct em28xx *dev, struct urb *urb)
 {
-	int i;
+	int xfer_bulk, num_packets, i;
 
 	if (!dev)
 		return 0;
@@ -137,18 +139,34 @@ static inline int em28xx_dvb_isoc_copy(struct em28xx *dev, struct urb *urb)
 	if (urb->status < 0)
 		print_err_status(dev, -1, urb->status);
 
-	for (i = 0; i < urb->number_of_packets; i++) {
-		int status = urb->iso_frame_desc[i].status;
+	xfer_bulk = usb_pipebulk(urb->pipe);
 
-		if (status < 0) {
-			print_err_status(dev, i, status);
-			if (urb->iso_frame_desc[i].status != -EPROTO)
-				continue;
-		}
+	if (xfer_bulk) /* bulk */
+		num_packets = 1;
+	else /* isoc */
+		num_packets = urb->number_of_packets;
 
-		dvb_dmx_swfilter(&dev->dvb->demux, urb->transfer_buffer +
-				 urb->iso_frame_desc[i].offset,
-				 urb->iso_frame_desc[i].actual_length);
+	for (i = 0; i < num_packets; i++) {
+		if (xfer_bulk) {
+			if (urb->status < 0) {
+				print_err_status(dev, i, urb->status);
+				if (urb->status != -EPROTO)
+					continue;
+			}
+			dvb_dmx_swfilter(&dev->dvb->demux, urb->transfer_buffer,
+					urb->actual_length);
+		} else {
+			if (urb->iso_frame_desc[i].status < 0) {
+				print_err_status(dev, i,
+						 urb->iso_frame_desc[i].status);
+				if (urb->iso_frame_desc[i].status != -EPROTO)
+					continue;
+			}
+			dvb_dmx_swfilter(&dev->dvb->demux,
+					 urb->transfer_buffer +
+					 urb->iso_frame_desc[i].offset,
+					 urb->iso_frame_desc[i].actual_length);
+		}
 	}
 
 	return 0;
@@ -177,7 +195,7 @@ static int em28xx_start_streaming(struct em28xx_dvb *dvb)
 				    EM28XX_DVB_NUM_BUFS,
 				    max_dvb_packet_size,
 				    EM28XX_DVB_NUM_ISOC_PACKETS,
-				    em28xx_dvb_isoc_copy);
+				    em28xx_dvb_urb_data_copy);
 }
 
 static int em28xx_stop_streaming(struct em28xx_dvb *dvb)
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 16/23] em28xx: rename usb debugging module parameter and macro
  2012-10-21 16:52 [PATCH 00/23] em28xx: add support fur USB bulk transfers Frank Schäfer
                   ` (15 preceding siblings ...)
  2012-10-21 16:52 ` [PATCH 15/23] em28xx: rename function em28xx_dvb_isoc_copy " Frank Schäfer
@ 2012-10-21 16:52 ` Frank Schäfer
  2012-10-21 16:52 ` [PATCH 17/23] em28xx: rename some USB parameter fields in struct em28xx to clarify their role Frank Schäfer
                   ` (9 subsequent siblings)
  26 siblings, 0 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-10-21 16:52 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, Frank Schäfer

Rename module parameter isoc_debug to usb_debug and macro
em28xx_isocdbg to em28xx_usb dbg to reflect that they are
used for isoc and bulk USB transfers.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 drivers/media/usb/em28xx/em28xx-video.c |   58 +++++++++++++++----------------
 1 Datei geändert, 28 Zeilen hinzugefügt(+), 30 Zeilen entfernt(-)

diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
index d6de1cc..f435206 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -58,13 +58,13 @@
 		printk(KERN_INFO "%s %s :"fmt, \
 			 dev->name, __func__ , ##arg); } while (0)
 
-static unsigned int isoc_debug;
-module_param(isoc_debug, int, 0644);
-MODULE_PARM_DESC(isoc_debug, "enable debug messages [isoc transfers]");
+static unsigned int usb_debug;
+module_param(usb_debug, int, 0644);
+MODULE_PARM_DESC(usb_debug, "enable debug messages [isoc transfers]");
 
-#define em28xx_isocdbg(fmt, arg...) \
+#define em28xx_usbdbg(fmt, arg...) \
 do {\
-	if (isoc_debug) { \
+	if (usb_debug) { \
 		printk(KERN_INFO "%s %s :"fmt, \
 			 dev->name, __func__ , ##arg); \
 	} \
@@ -161,7 +161,7 @@ static inline void buffer_filled(struct em28xx *dev,
 				  struct em28xx_buffer *buf)
 {
 	/* Advice that buffer was filled */
-	em28xx_isocdbg("[%p/%d] wakeup\n", buf, buf->vb.i);
+	em28xx_usbdbg("[%p/%d] wakeup\n", buf, buf->vb.i);
 	buf->vb.state = VIDEOBUF_DONE;
 	buf->vb.field_count++;
 	do_gettimeofday(&buf->vb.ts);
@@ -177,7 +177,7 @@ static inline void vbi_buffer_filled(struct em28xx *dev,
 				     struct em28xx_buffer *buf)
 {
 	/* Advice that buffer was filled */
-	em28xx_isocdbg("[%p/%d] wakeup\n", buf, buf->vb.i);
+	em28xx_usbdbg("[%p/%d] wakeup\n", buf, buf->vb.i);
 
 	buf->vb.state = VIDEOBUF_DONE;
 	buf->vb.field_count++;
@@ -226,9 +226,9 @@ static void em28xx_copy_video(struct em28xx *dev,
 	lencopy = lencopy > remain ? remain : lencopy;
 
 	if ((char *)startwrite + lencopy > (char *)outp + buf->vb.size) {
-		em28xx_isocdbg("Overflow of %zi bytes past buffer end (1)\n",
-			       ((char *)startwrite + lencopy) -
-			       ((char *)outp + buf->vb.size));
+		em28xx_usbdbg("Overflow of %zi bytes past buffer end (1)\n",
+			      ((char *)startwrite + lencopy) -
+			      ((char *)outp + buf->vb.size));
 		remain = (char *)outp + buf->vb.size - (char *)startwrite;
 		lencopy = remain;
 	}
@@ -251,7 +251,7 @@ static void em28xx_copy_video(struct em28xx *dev,
 
 		if ((char *)startwrite + lencopy > (char *)outp +
 		    buf->vb.size) {
-			em28xx_isocdbg("Overflow of %zi bytes past buffer end"
+			em28xx_usbdbg("Overflow of %zi bytes past buffer end"
 				       "(2)\n",
 				       ((char *)startwrite + lencopy) -
 				       ((char *)outp + buf->vb.size));
@@ -280,24 +280,24 @@ static void em28xx_copy_vbi(struct em28xx *dev,
 	int bytesperline;
 
 	if (dev == NULL) {
-		em28xx_isocdbg("dev is null\n");
+		em28xx_usbdbg("dev is null\n");
 		return;
 	}
 	bytesperline = dev->vbi_width;
 
 	if (dma_q == NULL) {
-		em28xx_isocdbg("dma_q is null\n");
+		em28xx_usbdbg("dma_q is null\n");
 		return;
 	}
 	if (buf == NULL) {
 		return;
 	}
 	if (p == NULL) {
-		em28xx_isocdbg("p is null\n");
+		em28xx_usbdbg("p is null\n");
 		return;
 	}
 	if (outp == NULL) {
-		em28xx_isocdbg("outp is null\n");
+		em28xx_usbdbg("outp is null\n");
 		return;
 	}
 
@@ -351,9 +351,9 @@ static inline void print_err_status(struct em28xx *dev,
 		break;
 	}
 	if (packet < 0) {
-		em28xx_isocdbg("URB status %d [%s].\n",	status, errmsg);
+		em28xx_usbdbg("URB status %d [%s].\n",	status, errmsg);
 	} else {
-		em28xx_isocdbg("URB packet %d, status %d [%s].\n",
+		em28xx_usbdbg("URB packet %d, status %d [%s].\n",
 			       packet, status, errmsg);
 	}
 }
@@ -368,7 +368,7 @@ static inline void get_next_buf(struct em28xx_dmaqueue *dma_q,
 	char *outp;
 
 	if (list_empty(&dma_q->active)) {
-		em28xx_isocdbg("No active queue to serve\n");
+		em28xx_usbdbg("No active queue to serve\n");
 		dev->usb_ctl.vid_buf = NULL;
 		*buf = NULL;
 		return;
@@ -396,7 +396,7 @@ static inline void vbi_get_next_buf(struct em28xx_dmaqueue *dma_q,
 	char *outp;
 
 	if (list_empty(&dma_q->active)) {
-		em28xx_isocdbg("No active queue to serve\n");
+		em28xx_usbdbg("No active queue to serve\n");
 		dev->usb_ctl.vbi_buf = NULL;
 		*buf = NULL;
 		return;
@@ -457,8 +457,7 @@ static inline int em28xx_urb_data_copy(struct em28xx *dev, struct urb *urb)
 
 			actual_length = urb->iso_frame_desc[i].actual_length;
 			if (actual_length > dev->max_pkt_size) {
-				em28xx_isocdbg("packet bigger than "
-					       "packet size");
+				em28xx_usbdbg("packet bigger than packet size");
 				continue;
 			}
 
@@ -476,12 +475,12 @@ static inline int em28xx_urb_data_copy(struct em28xx *dev, struct urb *urb)
 		   logic simpler. Impacts of those changes should be evaluated
 		 */
 		if (p[0] == 0x33 && p[1] == 0x95 && p[2] == 0x00) {
-			em28xx_isocdbg("VBI HEADER!!!\n");
+			em28xx_usbdbg("VBI HEADER!!!\n");
 			/* FIXME: Should add vbi copy */
 			continue;
 		}
 		if (p[0] == 0x22 && p[1] == 0x5a) {
-			em28xx_isocdbg("Video frame %d, length=%i, %s\n", p[2],
+			em28xx_usbdbg("Video frame %d, length=%i, %s\n", p[2],
 				       len, (p[2] & 1) ? "odd" : "even");
 
 			if (dev->progressive || !(p[2] & 1)) {
@@ -507,7 +506,7 @@ static inline int em28xx_urb_data_copy(struct em28xx *dev, struct urb *urb)
 			if (p[0] != 0x88 && p[0] != 0x22) {
 				/* NOTE: no intermediate data packet header
 				 * 88 88 88 88 when using bulk transfers */
-				em28xx_isocdbg("frame is not complete\n");
+				em28xx_usbdbg("frame is not complete\n");
 				len = actual_length;
 			} else {
 				len = actual_length - 4;
@@ -569,8 +568,7 @@ static inline int em28xx_urb_data_copy_vbi(struct em28xx *dev, struct urb *urb)
 
 			actual_length = urb->iso_frame_desc[i].actual_length;
 			if (actual_length > dev->max_pkt_size) {
-				em28xx_isocdbg("packet bigger than "
-					       "packet size");
+				em28xx_usbdbg("packet bigger than packet size");
 				continue;
 			}
 
@@ -590,7 +588,7 @@ static inline int em28xx_urb_data_copy_vbi(struct em28xx *dev, struct urb *urb)
 		if (p[0] == 0x33 && p[1] == 0x95) {
 			dev->capture_type = 0;
 			dev->vbi_read = 0;
-			em28xx_isocdbg("VBI START HEADER!!!\n");
+			em28xx_usbdbg("VBI START HEADER!!!\n");
 			dev->cur_field = p[2];
 			p += 4;
 			len = actual_length - 4;
@@ -615,7 +613,7 @@ static inline int em28xx_urb_data_copy_vbi(struct em28xx *dev, struct urb *urb)
 			if (dev->vbi_read >= vbi_size) {
 				/* We've already read all the VBI data, so
 				   treat the rest as video */
-				em28xx_isocdbg("dev->vbi_read > vbi_size\n");
+				em28xx_usbdbg("dev->vbi_read > vbi_size\n");
 			} else if ((dev->vbi_read + len) < vbi_size) {
 				/* This entire frame is VBI data */
 				if (dev->vbi_read == 0 &&
@@ -687,7 +685,7 @@ static inline int em28xx_urb_data_copy_vbi(struct em28xx *dev, struct urb *urb)
 				len -= 4;
 			}
 			if (len >= 4 && p[0] == 0x22 && p[1] == 0x5a) {
-				em28xx_isocdbg("Video frame %d, len=%i, %s\n",
+				em28xx_usbdbg("Video frame %d, len=%i, %s\n",
 					       p[2], len, (p[2] & 1) ?
 					       "odd" : "even");
 				p += 4;
@@ -837,7 +835,7 @@ static void buffer_release(struct videobuf_queue *vq,
 	struct em28xx_fh       *fh   = vq->priv_data;
 	struct em28xx          *dev  = (struct em28xx *)fh->dev;
 
-	em28xx_isocdbg("em28xx: called buffer_release\n");
+	em28xx_usbdbg("em28xx: called buffer_release\n");
 
 	free_buffer(vq, buf);
 }
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 17/23] em28xx: rename some USB parameter fields in struct em28xx to clarify their role
  2012-10-21 16:52 [PATCH 00/23] em28xx: add support fur USB bulk transfers Frank Schäfer
                   ` (16 preceding siblings ...)
  2012-10-21 16:52 ` [PATCH 16/23] em28xx: rename usb debugging module parameter and macro Frank Schäfer
@ 2012-10-21 16:52 ` Frank Schäfer
  2012-10-21 16:52 ` [PATCH 18/23] em28xx: add fields for analog and DVB USB transfer type selection to struct em28xx Frank Schäfer
                   ` (8 subsequent siblings)
  26 siblings, 0 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-10-21 16:52 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, Frank Schäfer

Also improve the comments.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 drivers/media/usb/em28xx/em28xx-cards.c |   20 +++++++++++---------
 drivers/media/usb/em28xx/em28xx-core.c  |    8 ++++----
 drivers/media/usb/em28xx/em28xx-dvb.c   |    4 ++--
 drivers/media/usb/em28xx/em28xx-video.c |    2 +-
 drivers/media/usb/em28xx/em28xx.h       |   14 ++++++++------
 5 Dateien geändert, 26 Zeilen hinzugefügt(+), 22 Zeilen entfernt(-)

diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
index e0d03a1..d73b2b1 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -3174,9 +3174,10 @@ static int em28xx_usb_probe(struct usb_interface *interface,
 	}
 
 	/* compute alternate max packet sizes */
-	dev->alt_max_pkt_size = kmalloc(sizeof(dev->alt_max_pkt_size[0]) *
+	dev->alt_max_pkt_size_isoc =
+				kmalloc(sizeof(dev->alt_max_pkt_size_isoc[0]) *
 					interface->num_altsetting, GFP_KERNEL);
-	if (dev->alt_max_pkt_size == NULL) {
+	if (dev->alt_max_pkt_size_isoc == NULL) {
 		em28xx_errdev("out of memory!\n");
 		kfree(dev);
 		retval = -ENOMEM;
@@ -3207,13 +3208,14 @@ static int em28xx_usb_probe(struct usb_interface *interface,
 					break;
 				case EM28XX_EP_ANALOG:
 					has_video = true;
-					dev->alt_max_pkt_size[i] = size;
+					dev->alt_max_pkt_size_isoc[i] = size;
 					break;
 				case EM28XX_EP_DIGITAL:
 					has_dvb = true;
-					if (size > dev->dvb_max_pkt_size) {
-						dev->dvb_max_pkt_size = size;
-						dev->dvb_alt = i;
+					if (size > dev->dvb_max_pkt_size_isoc) {
+						dev->dvb_max_pkt_size_isoc =
+									  size;
+						dev->dvb_alt_isoc = i;
 					}
 					break;
 				}
@@ -3315,7 +3317,7 @@ static int em28xx_usb_probe(struct usb_interface *interface,
 		/* pre-allocate DVB isoc transfer buffers */
 		retval = em28xx_alloc_urbs(dev, EM28XX_DIGITAL_MODE, 0,
 					   EM28XX_DVB_NUM_BUFS,
-					   dev->dvb_max_pkt_size,
+					   dev->dvb_max_pkt_size_isoc,
 					   EM28XX_DVB_NUM_ISOC_PACKETS);
 		if (retval) {
 			goto unlock_and_free;
@@ -3335,7 +3337,7 @@ unlock_and_free:
 	mutex_unlock(&dev->lock);
 
 err_free:
-	kfree(dev->alt_max_pkt_size);
+	kfree(dev->alt_max_pkt_size_isoc);
 	kfree(dev);
 
 err:
@@ -3400,7 +3402,7 @@ static void em28xx_usb_disconnect(struct usb_interface *interface)
 	em28xx_close_extension(dev);
 
 	if (!dev->users) {
-		kfree(dev->alt_max_pkt_size);
+		kfree(dev->alt_max_pkt_size_isoc);
 		kfree(dev);
 	}
 }
diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c
index 8b8f783..6b588e2 100644
--- a/drivers/media/usb/em28xx/em28xx-core.c
+++ b/drivers/media/usb/em28xx/em28xx-core.c
@@ -830,14 +830,14 @@ int em28xx_set_alternate(struct em28xx *dev)
 
 	for (i = 0; i < dev->num_alt; i++) {
 		/* stop when the selected alt setting offers enough bandwidth */
-		if (dev->alt_max_pkt_size[i] >= min_pkt_size) {
+		if (dev->alt_max_pkt_size_isoc[i] >= min_pkt_size) {
 			dev->alt = i;
 			break;
 		/* otherwise make sure that we end up with the maximum bandwidth
 		   because the min_pkt_size equation might be wrong...
 		*/
-		} else if (dev->alt_max_pkt_size[i] >
-			   dev->alt_max_pkt_size[dev->alt])
+		} else if (dev->alt_max_pkt_size_isoc[i] >
+			   dev->alt_max_pkt_size_isoc[dev->alt])
 			dev->alt = i;
 	}
 
@@ -845,7 +845,7 @@ set_alt:
 	if (dev->alt != prev_alt) {
 		em28xx_coredbg("minimum isoc packet size: %u (alt=%d)\n",
 				min_pkt_size, dev->alt);
-		dev->max_pkt_size = dev->alt_max_pkt_size[dev->alt];
+		dev->max_pkt_size = dev->alt_max_pkt_size_isoc[dev->alt];
 		em28xx_coredbg("setting alternate %d with wMaxPacketSize=%u\n",
 			       dev->alt, dev->max_pkt_size);
 		errCode = usb_set_interface(dev->udev, 0, dev->alt);
diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c
index cd36a67..2d56c93 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -178,12 +178,12 @@ static int em28xx_start_streaming(struct em28xx_dvb *dvb)
 	struct em28xx *dev = dvb->adapter.priv;
 	int max_dvb_packet_size;
 
-	usb_set_interface(dev->udev, 0, dev->dvb_alt);
+	usb_set_interface(dev->udev, 0, dev->dvb_alt_isoc);
 	rc = em28xx_set_mode(dev, EM28XX_DIGITAL_MODE);
 	if (rc < 0)
 		return rc;
 
-	max_dvb_packet_size = dev->dvb_max_pkt_size;
+	max_dvb_packet_size = dev->dvb_max_pkt_size_isoc;
 	if (max_dvb_packet_size < 0)
 		return max_dvb_packet_size;
 	dprintk(1, "Using %d buffers each with %d x %d bytes\n",
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
index f435206..8767c06 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -2286,7 +2286,7 @@ static int em28xx_v4l2_close(struct file *filp)
 		   free the remaining resources */
 		if (dev->state & DEV_DISCONNECTED) {
 			em28xx_release_resources(dev);
-			kfree(dev->alt_max_pkt_size);
+			kfree(dev->alt_max_pkt_size_isoc);
 			mutex_unlock(&dev->lock);
 			kfree(dev);
 			kfree(fh);
diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h
index e311b09..8b96413 100644
--- a/drivers/media/usb/em28xx/em28xx.h
+++ b/drivers/media/usb/em28xx/em28xx.h
@@ -4,6 +4,7 @@
    Copyright (C) 2005 Markus Rechberger <mrechberger@gmail.com>
 		      Ludovico Cavedon <cavedon@sssup.it>
 		      Mauro Carvalho Chehab <mchehab@infradead.org>
+   Copyright (C) 2012 Frank Schäfer <fschaefer.oss@googlemail.com>
 
    Based on the em2800 driver from Sascha Sommer <saschasommer@freenet.de>
 
@@ -582,12 +583,13 @@ struct em28xx {
 
 	/* usb transfer */
 	struct usb_device *udev;	/* the usb device */
-	int alt;		/* alternate */
-	int max_pkt_size;	/* max packet size of isoc transaction */
-	int num_alt;		/* Number of alternative settings */
-	unsigned int *alt_max_pkt_size;	/* array of wMaxPacketSize */
-	int dvb_alt;				/* alternate for DVB */
-	unsigned int dvb_max_pkt_size;		/* wMaxPacketSize for DVB */
+	int alt;		/* alternate setting */
+	int max_pkt_size;	/* max packet size of the selected ep at alt */
+	int num_alt;		/* number of alternative settings */
+	unsigned int *alt_max_pkt_size_isoc; /* array of isoc wMaxPacketSize */
+	int dvb_alt_isoc;	/* alternate setting for DVB isoc transfers */
+	unsigned int dvb_max_pkt_size_isoc;	/* isoc max packet size of the
+						   selected DVB ep at dvb_alt */
 	char urb_buf[URB_MAX_CTRL_SIZE];	/* urb control msg buffer */
 
 	/* helper funcs that call usb_control_msg */
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 18/23] em28xx: add fields for analog and DVB USB transfer type selection to struct em28xx
  2012-10-21 16:52 [PATCH 00/23] em28xx: add support fur USB bulk transfers Frank Schäfer
                   ` (17 preceding siblings ...)
  2012-10-21 16:52 ` [PATCH 17/23] em28xx: rename some USB parameter fields in struct em28xx to clarify their role Frank Schäfer
@ 2012-10-21 16:52 ` Frank Schäfer
  2012-10-21 16:52 ` [PATCH 19/23] em28xx: set USB alternate settings for analog video bulk transfers properly Frank Schäfer
                   ` (7 subsequent siblings)
  26 siblings, 0 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-10-21 16:52 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, Frank Schäfer

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 drivers/media/usb/em28xx/em28xx.h |    4 ++++
 1 Datei geändert, 4 Zeilen hinzugefügt(+)

diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h
index 8b96413..f013650 100644
--- a/drivers/media/usb/em28xx/em28xx.h
+++ b/drivers/media/usb/em28xx/em28xx.h
@@ -587,9 +587,13 @@ struct em28xx {
 	int max_pkt_size;	/* max packet size of the selected ep at alt */
 	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
+						   transfers for analog      */
 	int dvb_alt_isoc;	/* alternate setting for DVB isoc transfers */
 	unsigned int dvb_max_pkt_size_isoc;	/* isoc max packet size of the
 						   selected DVB ep at dvb_alt */
+	unsigned int dvb_xfer_bulk:1;		/* use bulk instead of isoc
+						   transfers for DVB          */
 	char urb_buf[URB_MAX_CTRL_SIZE];	/* urb control msg buffer */
 
 	/* helper funcs that call usb_control_msg */
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 19/23] em28xx: set USB alternate settings for analog video bulk transfers properly
  2012-10-21 16:52 [PATCH 00/23] em28xx: add support fur USB bulk transfers Frank Schäfer
                   ` (18 preceding siblings ...)
  2012-10-21 16:52 ` [PATCH 18/23] em28xx: add fields for analog and DVB USB transfer type selection to struct em28xx Frank Schäfer
@ 2012-10-21 16:52 ` Frank Schäfer
  2012-10-21 16:52 ` [PATCH 20/23] em28xx: improve USB endpoint logic, also use bulk transfers Frank Schäfer
                   ` (6 subsequent siblings)
  26 siblings, 0 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-10-21 16:52 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, Frank Schäfer

Extend function em28xx_set_alternate:
- use alternate setting 0 for bulk transfers as default
- respect module parameter 'alt'=0 for bulk transfers
- set max_packet_size to 512 bytes for bulk transfers

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 drivers/media/usb/em28xx/em28xx-core.c |   23 +++++++++++++++--------
 1 Datei geändert, 15 Zeilen hinzugefügt(+), 8 Zeilen entfernt(-)

diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c
index 6b588e2..06d5734 100644
--- a/drivers/media/usb/em28xx/em28xx-core.c
+++ b/drivers/media/usb/em28xx/em28xx-core.c
@@ -805,21 +805,23 @@ int em28xx_resolution_set(struct em28xx *dev)
 	return em28xx_scaler_set(dev, dev->hscale, dev->vscale);
 }
 
+/* Set USB alternate setting for analog video */
 int em28xx_set_alternate(struct em28xx *dev)
 {
 	int errCode, prev_alt = dev->alt;
 	int i;
 	unsigned int min_pkt_size = dev->width * 2 + 4;
 
-	/*
-	 * alt = 0 is used only for control messages, so, only values
-	 * greater than 0 can be used for streaming.
-	 */
-	if (alt && alt < dev->num_alt) {
+	/* NOTE: for isoc transfers, only alt settings > 0 are allowed
+		 for bulk transfers, use alt=0 as default value */
+	dev->alt = 0;
+	if ((alt > 0) && (alt < dev->num_alt)) {
 		em28xx_coredbg("alternate forced to %d\n", dev->alt);
 		dev->alt = alt;
 		goto set_alt;
 	}
+	if (dev->analog_xfer_bulk)
+		goto set_alt;
 
 	/* When image size is bigger than a certain value,
 	   the frame size should be increased, otherwise, only
@@ -843,9 +845,14 @@ int em28xx_set_alternate(struct em28xx *dev)
 
 set_alt:
 	if (dev->alt != prev_alt) {
-		em28xx_coredbg("minimum isoc packet size: %u (alt=%d)\n",
-				min_pkt_size, dev->alt);
-		dev->max_pkt_size = dev->alt_max_pkt_size_isoc[dev->alt];
+		if (dev->analog_xfer_bulk) {
+			dev->max_pkt_size = 512; /* USB 2.0 spec */
+		} else { /* isoc */
+			em28xx_coredbg("minimum isoc packet size: "
+				       "%u (alt=%d)\n", min_pkt_size, dev->alt);
+			dev->max_pkt_size =
+					  dev->alt_max_pkt_size_isoc[dev->alt];
+		}
 		em28xx_coredbg("setting alternate %d with wMaxPacketSize=%u\n",
 			       dev->alt, dev->max_pkt_size);
 		errCode = usb_set_interface(dev->udev, 0, dev->alt);
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 20/23] em28xx: improve USB endpoint logic, also use bulk transfers
  2012-10-21 16:52 [PATCH 00/23] em28xx: add support fur USB bulk transfers Frank Schäfer
                   ` (19 preceding siblings ...)
  2012-10-21 16:52 ` [PATCH 19/23] em28xx: set USB alternate settings for analog video bulk transfers properly Frank Schäfer
@ 2012-10-21 16:52 ` Frank Schäfer
  2012-10-21 16:52 ` [PATCH 21/23] em28xx: add module parameter for selection of the preferred USB transfer type Frank Schäfer
                   ` (5 subsequent siblings)
  26 siblings, 0 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-10-21 16:52 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, Frank Schäfer

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)

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 drivers/media/usb/em28xx/em28xx-cards.c |   97 +++++++++++++++++++++++++------
 drivers/media/usb/em28xx/em28xx-core.c  |   32 ++++++++--
 drivers/media/usb/em28xx/em28xx-dvb.c   |   34 +++++++----
 drivers/media/usb/em28xx/em28xx-reg.h   |    4 +-
 drivers/media/usb/em28xx/em28xx-video.c |   10 ++--
 drivers/media/usb/em28xx/em28xx.h       |   12 ++++
 6 Dateien geändert, 149 Zeilen hinzugefügt(+), 40 Zeilen entfernt(-)

diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
index d73b2b1..751e408 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -6,6 +6,7 @@
 		      Markus Rechberger <mrechberger@gmail.com>
 		      Mauro Carvalho Chehab <mchehab@infradead.org>
 		      Sascha Sommer <saschasommer@freenet.de>
+   Copyright (C) 2012 Frank Schäfer <fschaefer.oss@googlemail.com>
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -3200,26 +3201,69 @@ static int em28xx_usb_probe(struct usb_interface *interface,
 			if (udev->speed == USB_SPEED_HIGH)
 				size = size * hb_mult(sizedescr);
 
-			if (usb_endpoint_xfer_isoc(e) &&
-			    usb_endpoint_dir_in(e)) {
+			if (usb_endpoint_dir_in(e)) {
 				switch (e->bEndpointAddress) {
-				case EM28XX_EP_AUDIO:
-					has_audio = true;
-					break;
-				case EM28XX_EP_ANALOG:
+				case 0x82:
 					has_video = true;
-					dev->alt_max_pkt_size_isoc[i] = size;
+					if (usb_endpoint_xfer_isoc(e)) {
+						dev->analog_ep_isoc =
+							    e->bEndpointAddress;
+						dev->alt_max_pkt_size_isoc[i] = size;
+					} else if (usb_endpoint_xfer_bulk(e)) {
+						dev->analog_ep_bulk =
+							    e->bEndpointAddress;
+					}
+					break;
+				case 0x83:
+					if (usb_endpoint_xfer_isoc(e)) {
+						has_audio = true;
+					} else {
+						printk(KERN_INFO DRIVER_NAME
+						": error: skipping audio end"
+						"point 0x83, because it uses"
+						" bulk transfers !\n");
+					}
 					break;
-				case EM28XX_EP_DIGITAL:
-					has_dvb = true;
-					if (size > dev->dvb_max_pkt_size_isoc) {
-						dev->dvb_max_pkt_size_isoc =
-									  size;
-						dev->dvb_alt_isoc = i;
+				case 0x84:
+					if (has_video &&
+					    (usb_endpoint_xfer_bulk(e))) {
+						dev->analog_ep_bulk =
+							    e->bEndpointAddress;
+					} else {
+						has_dvb = true;
+						if (usb_endpoint_xfer_isoc(e)) {
+							dev->dvb_ep_isoc = e->bEndpointAddress;
+							if (size > dev->dvb_max_pkt_size_isoc) {
+								dev->dvb_max_pkt_size_isoc = size;
+								dev->dvb_alt_isoc = i;
+							}
+						} else {
+							dev->dvb_ep_bulk = e->bEndpointAddress;
+						}
 					}
 					break;
 				}
 			}
+			/* NOTE:
+			 * Old logic with support for isoc transfers only was:
+			 *  0x82	isoc		=> analog
+			 *  0x83	isoc		=> audio
+			 *  0x84	isoc		=> digital
+			 *
+			 * New logic with support for bulk transfers
+			 *  0x82	isoc		=> analog
+			 *  0x82	bulk		=> analog
+			 *  0x83	isoc*		=> audio
+			 *  0x84	isoc		=> digital
+			 *  0x84	bulk		=> analog or digital**
+			 * (*: audio should always be isoc)
+			 * (**: analog, if ep 0x82 is isoc, otherwise digital)
+			 *
+			 * The new logic preserves backwards compatibility and
+			 * reflects the endpoint configurations we have seen
+			 * so far. But there might be devices for which this
+			 * logic is not sufficient...
+			 */
 		}
 	}
 
@@ -3280,6 +3324,12 @@ static int em28xx_usb_probe(struct usb_interface *interface,
 		goto err_free;
 	}
 
+	/* Select USB transfer types to use */
+	if (has_video && !dev->analog_ep_isoc)
+		dev->analog_xfer_bulk = 1;
+	if (has_dvb && !dev->dvb_ep_isoc)
+		dev->dvb_xfer_bulk = 1;
+
 	snprintf(dev->name, sizeof(dev->name), "em28xx #%d", nr);
 	dev->devno = nr;
 	dev->model = id->driver_info;
@@ -3314,12 +3364,23 @@ static int em28xx_usb_probe(struct usb_interface *interface,
 	}
 
 	if (has_dvb) {
-		/* pre-allocate DVB isoc transfer buffers */
-		retval = em28xx_alloc_urbs(dev, EM28XX_DIGITAL_MODE, 0,
-					   EM28XX_DVB_NUM_BUFS,
-					   dev->dvb_max_pkt_size_isoc,
-					   EM28XX_DVB_NUM_ISOC_PACKETS);
+		/* pre-allocate DVB usb transfer buffers */
+		if (dev->dvb_xfer_bulk) {
+			retval = em28xx_alloc_urbs(dev, EM28XX_DIGITAL_MODE,
+					    dev->dvb_xfer_bulk,
+					    EM28XX_DVB_NUM_BUFS,
+					    512,
+					    EM28XX_DVB_BULK_PACKET_MULTIPLIER);
+		} else {
+			retval = em28xx_alloc_urbs(dev, EM28XX_DIGITAL_MODE,
+					    dev->dvb_xfer_bulk,
+					    EM28XX_DVB_NUM_BUFS,
+					    dev->dvb_max_pkt_size_isoc,
+					    EM28XX_DVB_NUM_ISOC_PACKETS);
+		}
 		if (retval) {
+			printk(DRIVER_NAME ": Failed to pre-allocate USB"
+			       " transfer buffers for DVB.\n");
 			goto unlock_and_free;
 		}
 	}
diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c
index 06d5734..c78d38b 100644
--- a/drivers/media/usb/em28xx/em28xx-core.c
+++ b/drivers/media/usb/em28xx/em28xx-core.c
@@ -847,11 +847,13 @@ set_alt:
 	if (dev->alt != prev_alt) {
 		if (dev->analog_xfer_bulk) {
 			dev->max_pkt_size = 512; /* USB 2.0 spec */
+			dev->packet_multiplier = EM28XX_BULK_PACKET_MULTIPLIER;
 		} else { /* isoc */
 			em28xx_coredbg("minimum isoc packet size: "
 				       "%u (alt=%d)\n", min_pkt_size, dev->alt);
 			dev->max_pkt_size =
 					  dev->alt_max_pkt_size_isoc[dev->alt];
+			dev->packet_multiplier = EM28XX_NUM_ISOC_PACKETS;
 		}
 		em28xx_coredbg("setting alternate %d with wMaxPacketSize=%u\n",
 			       dev->alt, dev->max_pkt_size);
@@ -1054,10 +1056,28 @@ int em28xx_alloc_urbs(struct em28xx *dev, enum em28xx_mode mode, int xfer_bulk,
 
 	em28xx_isocdbg("em28xx: called em28xx_alloc_isoc in mode %d\n", mode);
 
-	if (mode == EM28XX_DIGITAL_MODE)
+	/* Check mode and if we have an endpoint for the selected
+	   transfer type, select buffer				 */
+	if (mode == EM28XX_DIGITAL_MODE) {
+		if ((xfer_bulk && !dev->dvb_ep_bulk) ||
+		    (!xfer_bulk && !dev->dvb_ep_isoc)) {
+			em28xx_errdev("no endpoint for DVB mode and "
+				      "transfer type %d\n", xfer_bulk > 0);
+			return -EINVAL;
+		}
 		usb_bufs = &dev->usb_ctl.digital_bufs;
-	else
+	} else if (mode == EM28XX_ANALOG_MODE) {
+		if ((xfer_bulk && !dev->analog_ep_bulk) ||
+		    (!xfer_bulk && !dev->analog_ep_isoc)) {
+			em28xx_errdev("no endpoint for analog mode and "
+				      "transfer type %d\n", xfer_bulk > 0);
+			return -EINVAL;
+		}
 		usb_bufs = &dev->usb_ctl.analog_bufs;
+	} else {
+		em28xx_errdev("invalid mode selected\n");
+		return -EINVAL;
+	}
 
 	/* De-allocates all pending stuff */
 	em28xx_uninit_usb_xfer(dev, mode);
@@ -1113,8 +1133,8 @@ int em28xx_alloc_urbs(struct em28xx *dev, enum em28xx_mode mode, int xfer_bulk,
 		if (xfer_bulk) { /* bulk */
 			pipe = usb_rcvbulkpipe(dev->udev,
 					       mode == EM28XX_ANALOG_MODE ?
-					       EM28XX_EP_ANALOG :
-					       EM28XX_EP_DIGITAL);
+					       dev->analog_ep_bulk :
+					       dev->dvb_ep_bulk);
 			usb_fill_bulk_urb(urb, dev->udev, pipe,
 					  usb_bufs->transfer_buffer[i], sb_size,
 					  em28xx_irq_callback, dev);
@@ -1122,8 +1142,8 @@ int em28xx_alloc_urbs(struct em28xx *dev, enum em28xx_mode mode, int xfer_bulk,
 		} else { /* isoc */
 			pipe = usb_rcvisocpipe(dev->udev,
 					       mode == EM28XX_ANALOG_MODE ?
-					       EM28XX_EP_ANALOG :
-					       EM28XX_EP_DIGITAL);
+					       dev->analog_ep_isoc :
+					       dev->dvb_ep_isoc);
 			usb_fill_int_urb(urb, dev->udev, pipe,
 					 usb_bufs->transfer_buffer[i], sb_size,
 					 em28xx_irq_callback, dev, 1);
diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c
index 2d56c93..76265a4 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -176,25 +176,39 @@ static int em28xx_start_streaming(struct em28xx_dvb *dvb)
 {
 	int rc;
 	struct em28xx *dev = dvb->adapter.priv;
-	int max_dvb_packet_size;
+	int dvb_max_packet_size, packet_multiplier, dvb_alt;
+
+	if (dev->dvb_xfer_bulk) {
+		if (!dev->dvb_ep_bulk)
+			return -ENODEV;
+		dvb_max_packet_size = 512; /* USB 2.0 spec */
+		packet_multiplier = EM28XX_DVB_BULK_PACKET_MULTIPLIER;
+		dvb_alt = 0;
+	} else { /* isoc */
+		if (!dev->dvb_ep_isoc)
+			return -ENODEV;
+		dvb_max_packet_size = dev->dvb_max_pkt_size_isoc;
+		if (dvb_max_packet_size < 0)
+			return dvb_max_packet_size;
+		packet_multiplier = EM28XX_DVB_NUM_ISOC_PACKETS;
+		dvb_alt = dev->dvb_alt_isoc;
+	}
 
-	usb_set_interface(dev->udev, 0, dev->dvb_alt_isoc);
+	usb_set_interface(dev->udev, 0, dvb_alt);
 	rc = em28xx_set_mode(dev, EM28XX_DIGITAL_MODE);
 	if (rc < 0)
 		return rc;
 
-	max_dvb_packet_size = dev->dvb_max_pkt_size_isoc;
-	if (max_dvb_packet_size < 0)
-		return max_dvb_packet_size;
 	dprintk(1, "Using %d buffers each with %d x %d bytes\n",
 		EM28XX_DVB_NUM_BUFS,
-		EM28XX_DVB_NUM_ISOC_PACKETS,
-		max_dvb_packet_size);
+		packet_multiplier,
+		dvb_max_packet_size);
 
-	return em28xx_init_usb_xfer(dev, EM28XX_DIGITAL_MODE, 0,
+	return em28xx_init_usb_xfer(dev, EM28XX_DIGITAL_MODE,
+				    dev->dvb_xfer_bulk,
 				    EM28XX_DVB_NUM_BUFS,
-				    max_dvb_packet_size,
-				    EM28XX_DVB_NUM_ISOC_PACKETS,
+				    dvb_max_packet_size,
+				    packet_multiplier,
 				    em28xx_dvb_urb_data_copy);
 }
 
diff --git a/drivers/media/usb/em28xx/em28xx-reg.h b/drivers/media/usb/em28xx/em28xx-reg.h
index 6ff3682..8cd3acf 100644
--- a/drivers/media/usb/em28xx/em28xx-reg.h
+++ b/drivers/media/usb/em28xx/em28xx-reg.h
@@ -13,9 +13,9 @@
 #define EM_GPO_3   (1 << 3)
 
 /* em28xx endpoints */
-#define EM28XX_EP_ANALOG	0x82
+/* 0x82:   (always ?) analog */
 #define EM28XX_EP_AUDIO		0x83
-#define EM28XX_EP_DIGITAL	0x84
+/* 0x84:   digital or analog */
 
 /* em2800 registers */
 #define EM2800_R08_AUDIOSRC 0x08
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
index 8767c06..4ec54fd 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -788,16 +788,18 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb,
 
 	if (urb_init) {
 		if (em28xx_vbi_supported(dev) == 1)
-			rc = em28xx_init_usb_xfer(dev, EM28XX_ANALOG_MODE, 0,
+			rc = em28xx_init_usb_xfer(dev, EM28XX_ANALOG_MODE,
+						  dev->analog_xfer_bulk,
 						  EM28XX_NUM_BUFS,
 						  dev->max_pkt_size,
-						  EM28XX_NUM_ISOC_PACKETS,
+						  dev->packet_multiplier,
 						  em28xx_urb_data_copy_vbi);
 		else
-			rc = em28xx_init_usb_xfer(dev, EM28XX_ANALOG_MODE, 0,
+			rc = em28xx_init_usb_xfer(dev, EM28XX_ANALOG_MODE,
+						  dev->analog_xfer_bulk,
 						  EM28XX_NUM_BUFS,
 						  dev->max_pkt_size,
-						  EM28XX_NUM_ISOC_PACKETS,
+						  dev->packet_multiplier,
 						  em28xx_urb_data_copy);
 		if (rc < 0)
 			goto fail;
diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h
index f013650..c60f248 100644
--- a/drivers/media/usb/em28xx/em28xx.h
+++ b/drivers/media/usb/em28xx/em28xx.h
@@ -164,6 +164,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
 
 /*
@@ -583,8 +589,14 @@ struct em28xx {
 
 	/* 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
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 21/23] em28xx: add module parameter for selection of the preferred USB transfer type
  2012-10-21 16:52 [PATCH 00/23] em28xx: add support fur USB bulk transfers Frank Schäfer
                   ` (20 preceding siblings ...)
  2012-10-21 16:52 ` [PATCH 20/23] em28xx: improve USB endpoint logic, also use bulk transfers Frank Schäfer
@ 2012-10-21 16:52 ` Frank Schäfer
  2012-10-21 16:52 ` [PATCH 22/23] em28xx: use common urb data copying function for vbi and non-vbi devices Frank Schäfer
                   ` (4 subsequent siblings)
  26 siblings, 0 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-10-21 16:52 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, Frank Schäfer

By default, isoc transfers are used if possible.
With the new module parameter, bulk can be selected as the
preferred USB transfer type.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 drivers/media/usb/em28xx/em28xx-cards.c |    9 +++++++--
 1 Datei geändert, 7 Zeilen hinzugefügt(+), 2 Zeilen entfernt(-)

diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
index 751e408..410ed8d 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -61,6 +61,11 @@ static unsigned int card[]     = {[0 ... (EM28XX_MAXBOARDS - 1)] = UNSET };
 module_param_array(card,  int, NULL, 0444);
 MODULE_PARM_DESC(card,     "card type");
 
+static unsigned int prefer_bulk;
+module_param(prefer_bulk, int, 0644);
+MODULE_PARM_DESC(prefer_bulk, "prefer USB bulk transfers");
+
+
 /* Bitmask marking allocated devices from 0 to EM28XX_MAXBOARDS - 1 */
 static unsigned long em28xx_devused;
 
@@ -3325,9 +3330,9 @@ static int em28xx_usb_probe(struct usb_interface *interface,
 	}
 
 	/* Select USB transfer types to use */
-	if (has_video && !dev->analog_ep_isoc)
+	if (has_video && (!dev->analog_ep_isoc || prefer_bulk))
 		dev->analog_xfer_bulk = 1;
-	if (has_dvb && !dev->dvb_ep_isoc)
+	if (has_dvb && (!dev->dvb_ep_isoc || prefer_bulk))
 		dev->dvb_xfer_bulk = 1;
 
 	snprintf(dev->name, sizeof(dev->name), "em28xx #%d", nr);
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 22/23] em28xx: use common urb data copying function for vbi and non-vbi devices
  2012-10-21 16:52 [PATCH 00/23] em28xx: add support fur USB bulk transfers Frank Schäfer
                   ` (21 preceding siblings ...)
  2012-10-21 16:52 ` [PATCH 21/23] em28xx: add module parameter for selection of the preferred USB transfer type Frank Schäfer
@ 2012-10-21 16:52 ` Frank Schäfer
  2012-10-21 16:52 ` [PATCH 23/23] em28xx: enable VBI-support for em2840 devices Frank Schäfer
                   ` (3 subsequent siblings)
  26 siblings, 0 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-10-21 16:52 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, Frank Schäfer

em28xx_urb_data_copy_vbi is actually an extended version of
em28xx_urb_data_copy. With some minor fixes applied, it can be
used for non-vbi-devices, too, without any performance impacts.

Tested with a non-VBI device only.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 drivers/media/usb/em28xx/em28xx-video.c |  145 ++++---------------------------
 1 Datei geändert, 16 Zeilen hinzugefügt(+), 129 Zeilen entfernt(-)

diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
index 4ec54fd..5f8b508 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -178,7 +178,6 @@ static inline void vbi_buffer_filled(struct em28xx *dev,
 {
 	/* Advice that buffer was filled */
 	em28xx_usbdbg("[%p/%d] wakeup\n", buf, buf->vb.i);
-
 	buf->vb.state = VIDEOBUF_DONE;
 	buf->vb.field_count++;
 	do_gettimeofday(&buf->vb.ts);
@@ -376,7 +375,6 @@ static inline void get_next_buf(struct em28xx_dmaqueue *dma_q,
 
 	/* Get the next buffer */
 	*buf = list_entry(dma_q->active.next, struct em28xx_buffer, vb.queue);
-
 	/* Cleans up buffer - Useful for testing for frame/URB loss */
 	outp = videobuf_to_vmalloc(&(*buf)->vb);
 	memset(outp, 0, (*buf)->vb.size);
@@ -413,119 +411,13 @@ static inline void vbi_get_next_buf(struct em28xx_dmaqueue *dma_q,
 	return;
 }
 
-/* Processes and copies the URB data content to a frame buffer queue */
+/* Processes and copies the URB data content (video and VBI data) */
 static inline int em28xx_urb_data_copy(struct em28xx *dev, struct urb *urb)
 {
-	struct em28xx_buffer    *buf;
-	struct em28xx_dmaqueue  *dma_q = &dev->vidq;
-	int xfer_bulk, num_packets, i, rc = 1;
-	unsigned int actual_length, len = 0;
-	unsigned char *p, *outp = NULL;
-
-	if (!dev)
-		return 0;
-
-	if ((dev->state & DEV_DISCONNECTED) || (dev->state & DEV_MISCONFIGURED))
-		return 0;
-
-	if (urb->status < 0)
-		print_err_status(dev, -1, urb->status);
-
-	xfer_bulk = usb_pipebulk(urb->pipe);
-
-	buf = dev->usb_ctl.vid_buf;
-	if (buf != NULL)
-		outp = videobuf_to_vmalloc(&buf->vb);
-
-	if (xfer_bulk) /* bulk */
-		num_packets = 1;
-	else /* isoc */
-		num_packets = urb->number_of_packets;
-
-	for (i = 0; i < num_packets; i++) {
-		if (xfer_bulk) { /* bulk */
-			actual_length = urb->actual_length;
-
-			p = urb->transfer_buffer;
-		} else { /* isoc */
-			if (urb->iso_frame_desc[i].status < 0) {
-				print_err_status(dev, i,
-						 urb->iso_frame_desc[i].status);
-				if (urb->iso_frame_desc[i].status != -EPROTO)
-					continue;
-			}
-
-			actual_length = urb->iso_frame_desc[i].actual_length;
-			if (actual_length > dev->max_pkt_size) {
-				em28xx_usbdbg("packet bigger than packet size");
-				continue;
-			}
-
-			p = urb->transfer_buffer +
-			    urb->iso_frame_desc[i].offset;
-		}
-
-		if (actual_length <= 0) {
-			/* NOTE: happens very often with isoc transfers */
-			/* em28xx_usbdbg("packet %d is empty",i); - spammy */
-			continue;
-		}
-
-		/* FIXME: incomplete buffer checks where removed to make
-		   logic simpler. Impacts of those changes should be evaluated
-		 */
-		if (p[0] == 0x33 && p[1] == 0x95 && p[2] == 0x00) {
-			em28xx_usbdbg("VBI HEADER!!!\n");
-			/* FIXME: Should add vbi copy */
-			continue;
-		}
-		if (p[0] == 0x22 && p[1] == 0x5a) {
-			em28xx_usbdbg("Video frame %d, length=%i, %s\n", p[2],
-				       len, (p[2] & 1) ? "odd" : "even");
-
-			if (dev->progressive || !(p[2] & 1)) {
-				if (buf != NULL)
-					buffer_filled(dev, dma_q, buf);
-				get_next_buf(dma_q, &buf);
-				if (buf == NULL)
-					outp = NULL;
-				else
-					outp = videobuf_to_vmalloc(&buf->vb);
-			}
-
-			if (buf != NULL) {
-				if (p[2] & 1)
-					buf->top_field = 0;
-				else
-					buf->top_field = 1;
-			}
-
-			dma_q->pos = 0;
-		}
-		if (buf != NULL) {
-			if (p[0] != 0x88 && p[0] != 0x22) {
-				/* NOTE: no intermediate data packet header
-				 * 88 88 88 88 when using bulk transfers */
-				em28xx_usbdbg("frame is not complete\n");
-				len = actual_length;
-			} else {
-				len = actual_length - 4;
-				p += 4;
-			}
-			em28xx_copy_video(dev, dma_q, buf, p, outp, len);
-		}
-	}
-	return rc;
-}
-
-/* Version of the urb data handler that takes into account a mixture of
-   video and VBI data */
-static inline int em28xx_urb_data_copy_vbi(struct em28xx *dev, struct urb *urb)
-{
 	struct em28xx_buffer    *buf, *vbi_buf;
 	struct em28xx_dmaqueue  *dma_q = &dev->vidq;
 	struct em28xx_dmaqueue  *vbi_dma_q = &dev->vbiq;
-	int xfer_bulk, vbi_size, num_packets, i, rc = 1;
+	int xfer_bulk, num_packets, i, rc = 1;
 	unsigned int actual_length, len = 0;
 	unsigned char *p, *outp = NULL, *vbioutp = NULL;
 
@@ -599,6 +491,7 @@ static inline int em28xx_urb_data_copy_vbi(struct em28xx *dev, struct urb *urb)
 			len = actual_length - 4;
 		} else if (p[0] == 0x22 && p[1] == 0x5a) {
 			/* start video */
+			dev->capture_type = 1;
 			p += 4;
 			len = actual_length - 4;
 		} else {
@@ -607,9 +500,8 @@ static inline int em28xx_urb_data_copy_vbi(struct em28xx *dev, struct urb *urb)
 			len = actual_length;
 		}
 
-		vbi_size = dev->vbi_width * dev->vbi_height;
-
 		if (dev->capture_type == 0) {
+			int vbi_size = dev->vbi_width * dev->vbi_height;
 			if (dev->vbi_read >= vbi_size) {
 				/* We've already read all the VBI data, so
 				   treat the rest as video */
@@ -641,9 +533,11 @@ static inline int em28xx_urb_data_copy_vbi(struct em28xx *dev, struct urb *urb)
 					}
 				}
 
-				dev->vbi_read += len;
-				em28xx_copy_vbi(dev, vbi_dma_q, vbi_buf, p,
-						vbioutp, len);
+				if (vbi_buf != NULL) {
+					dev->vbi_read += len;
+					em28xx_copy_vbi(dev, vbi_dma_q, vbi_buf,
+							p, vbioutp, len);
+				}
 			} else {
 				/* Some of this frame is VBI data and some is
 				   video data */
@@ -787,20 +681,13 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb,
 		urb_init = 1;
 
 	if (urb_init) {
-		if (em28xx_vbi_supported(dev) == 1)
-			rc = em28xx_init_usb_xfer(dev, EM28XX_ANALOG_MODE,
-						  dev->analog_xfer_bulk,
-						  EM28XX_NUM_BUFS,
-						  dev->max_pkt_size,
-						  dev->packet_multiplier,
-						  em28xx_urb_data_copy_vbi);
-		else
-			rc = em28xx_init_usb_xfer(dev, EM28XX_ANALOG_MODE,
-						  dev->analog_xfer_bulk,
-						  EM28XX_NUM_BUFS,
-						  dev->max_pkt_size,
-						  dev->packet_multiplier,
-						  em28xx_urb_data_copy);
+		dev->capture_type = -1;
+		rc = em28xx_init_usb_xfer(dev, EM28XX_ANALOG_MODE,
+					  dev->analog_xfer_bulk,
+					  EM28XX_NUM_BUFS,
+					  dev->max_pkt_size,
+					  dev->packet_multiplier,
+					  em28xx_urb_data_copy);
 		if (rc < 0)
 			goto fail;
 	}
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 23/23] em28xx: enable VBI-support for em2840 devices
  2012-10-21 16:52 [PATCH 00/23] em28xx: add support fur USB bulk transfers Frank Schäfer
                   ` (22 preceding siblings ...)
  2012-10-21 16:52 ` [PATCH 22/23] em28xx: use common urb data copying function for vbi and non-vbi devices Frank Schäfer
@ 2012-10-21 16:52 ` Frank Schäfer
  2012-10-21 18:13 ` [PATCH 00/23] em28xx: add support fur USB bulk transfers Devin Heitmueller
                   ` (2 subsequent siblings)
  26 siblings, 0 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-10-21 16:52 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, Frank Schäfer

I just noticed that the eMPIA hardware specification from
02/01/2004 says that the em2840 supports VBI, too.

I don't have this device, so this patch is compilation tested only !

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 drivers/media/usb/em28xx/em28xx-core.c |    3 ++-
 1 Datei geändert, 2 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)

diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c
index c78d38b..2a9b94f 100644
--- a/drivers/media/usb/em28xx/em28xx-core.c
+++ b/drivers/media/usb/em28xx/em28xx-core.c
@@ -678,7 +678,8 @@ int em28xx_vbi_supported(struct em28xx *dev)
 	if (disable_vbi == 1)
 		return 0;
 
-	if (dev->chip_id == CHIP_ID_EM2860 ||
+	if (dev->chip_id == CHIP_ID_EM2840 ||
+	    dev->chip_id == CHIP_ID_EM2860 ||
 	    dev->chip_id == CHIP_ID_EM2883)
 		return 1;
 
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/23] em28xx: add support fur USB bulk transfers
  2012-10-21 16:52 [PATCH 00/23] em28xx: add support fur USB bulk transfers Frank Schäfer
                   ` (23 preceding siblings ...)
  2012-10-21 16:52 ` [PATCH 23/23] em28xx: enable VBI-support for em2840 devices Frank Schäfer
@ 2012-10-21 18:13 ` Devin Heitmueller
  2012-10-23 19:02   ` Frank Schäfer
       [not found] ` <20121028175752.447c39d5@redhat.com>
  2012-10-31  1:39 ` Benny Amorsen
  26 siblings, 1 reply; 48+ messages in thread
From: Devin Heitmueller @ 2012-10-21 18:13 UTC (permalink / raw)
  To: Frank Schäfer; +Cc: mchehab, linux-media

Hi Frank,

On Sun, Oct 21, 2012 at 12:52 PM, Frank Schäfer
<fschaefer.oss@googlemail.com> wrote:
> This patch series adds support for USB bulk transfers to the em28xx driver.

This is a welcome change that some users have been asking about for a while.

> Patch 1 is a bugfix for the image data processing with non-interlaced devices (webcams)
> that should be considered for stable (see commit message).
>
> Patches 2-21 extend the driver to support USB bulk transfers.
> USB endpoint mapping had to be extended and is a bit tricky.
> It might still not be sufficient to handle ALL isoc/bulk endpoints of ALL existing devices,
> but it should work with the devices we have seen so far and (most important !)
> preserves backwards compatibility to the current driver behavior.
> Isoc endpoints/transfers are preffered by default, patch 21 adds a module parameter to change this behavior.
>
> The last two patches are follow-up patches not really related to USB tranfers.
> Patch 22 reduces the code size in em28xx-video by merging the two URB data processing functions

This is generally good stuff.  When I originally added the VBI
support, I kept the URB handlers separate initially to reduce the risk
of breaking existing devices, and always assumed that at some point
the two routines would be merged.  You did regression test without VBI
support enabled though, right?

> and patch 23 enables VBI-support for em2840-devices.

Patch 23 shouldn't be applied unless somebody has an em2840 device to
test with first.  Nobody has complained about this so far, and it's
better to not support VBI than to possibly break existing support.

> Please note that I could test the changes with an analog non-interlaced non-VBI device only !
> So further tests with DVB/interlaced/VBI devices are strongly recommended !

So here's the problem:  I don't have the cycles to test this, and all
the refactoring presents a very real risk that breakage of existing
support could occur.  You've basically got three options if you want
to see this merged upstream:

1.  Wait for me to eventually do the testing.
2.  Plead for users to do testing, in particular of the VBI support
for interlaced devices (which is 99% of devices out there)
3.  See if Mauro has time to do the testing.
4.  Spend $30 and buy one of the dozens of em28xx based analog capture
devices out there and do the validation yourself (a huge percentage of
the "Video tape capture devices" are em28xx based.  For example, when
I did the original VBI work, I used the following:

KWorld DVD Maker USB 2.0 VS- USB2800 USB 2.0 Interface
http://www.newegg.com/Product/Product.aspx?Item=N82E16815100112

If you're in the United States, I can mail you a device for testing.
But given how dirt-cheap they are, buying one yourself might be easier
(and if the money is really the issue, send me your paypal details
offline and I'll give you the $30.00).

Thanks for you hard work on this, and it will be great to get this
stuff into the mainline.

Devin

-- 
Devin J. Heitmueller - Kernel Labs
http://www.kernellabs.com

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/23] em28xx: add support fur USB bulk transfers
  2012-10-21 18:13 ` [PATCH 00/23] em28xx: add support fur USB bulk transfers Devin Heitmueller
@ 2012-10-23 19:02   ` Frank Schäfer
  0 siblings, 0 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-10-23 19:02 UTC (permalink / raw)
  To: dheitmueller; +Cc: linux-media

Hi,

Am 21.10.2012 21:13, schrieb Devin Heitmueller:
> Hi Frank,
>
> On Sun, Oct 21, 2012 at 12:52 PM, Frank Schäfer
> <fschaefer.oss@googlemail.com> wrote:
>> This patch series adds support for USB bulk transfers to the em28xx driver.
> This is a welcome change that some users have been asking about for a while.

Yes, I know...

>
>> Patch 1 is a bugfix for the image data processing with non-interlaced devices (webcams)
>> that should be considered for stable (see commit message).
>>
>> Patches 2-21 extend the driver to support USB bulk transfers.
>> USB endpoint mapping had to be extended and is a bit tricky.
>> It might still not be sufficient to handle ALL isoc/bulk endpoints of ALL existing devices,
>> but it should work with the devices we have seen so far and (most important !)
>> preserves backwards compatibility to the current driver behavior.
>> Isoc endpoints/transfers are preffered by default, patch 21 adds a module parameter to change this behavior.
>>
>> The last two patches are follow-up patches not really related to USB tranfers.
>> Patch 22 reduces the code size in em28xx-video by merging the two URB data processing functions
> This is generally good stuff.  When I originally added the VBI
> support, I kept the URB handlers separate initially to reduce the risk
> of breaking existing devices, and always assumed that at some point
> the two routines would be merged.  You did regression test without VBI
> support enabled though, right?

Yes, but when you take a look at the code, you will see that this patch
nothing really changes for VBI devices.
The problem / regression potential is the non-VBI-devices as they are
now using the VBI-version, too, but they have been tested.
Btw, why didn't you test this function with VBI disabled when you added
it ? ;)

>
>> and patch 23 enables VBI-support for em2840-devices.
> Patch 23 shouldn't be applied unless somebody has an em2840 device to
> test with first.  Nobody has complained about this so far, and it's
> better to not support VBI than to possibly break existing support.

Btw, what about em2874 / em2884 / em28174 ?
We should really sort these kind of things out when adding new devices...

>
>> Please note that I could test the changes with an analog non-interlaced non-VBI device only !
>> So further tests with DVB/interlaced/VBI devices are strongly recommended !
> So here's the problem:  I don't have the cycles to test this, and all
> the refactoring presents a very real risk that breakage of existing
> support could occur.  You've basically got three options if you want
> to see this merged upstream:
>
> 1.  Wait for me to eventually do the testing.
> 2.  Plead for users to do testing, in particular of the VBI support
> for interlaced devices (which is 99% of devices out there)
> 3.  See if Mauro has time to do the testing.

I would say 1 + 2 + 3 ;)
And maybe it's a good chance for the people who were asking for this
feature in the past.

I know there are lots of other people on this list having such a device.

> 4.  Spend $30 and buy one of the dozens of em28xx based analog capture
> devices out there and do the validation yourself (a huge percentage of
> the "Video tape capture devices" are em28xx based.  For example, when
> I did the original VBI work, I used the following:
>
> KWorld DVD Maker USB 2.0 VS- USB2800 USB 2.0 Interface
> http://www.newegg.com/Product/Product.aspx?Item=N82E16815100112
>
> If you're in the United States, I can mail you a device for testing.
> But given how dirt-cheap they are, buying one yourself might be easier
> (and if the money is really the issue, send me your paypal details
> offline and I'll give you the $30.00).

No, thank you. I already have too many devices which I actually don't need.
I'm doing this as a hobby and at the moment, I'm focussed on getting the
devices I already have working properly (which isn't a small task).

I personally don't need this feature uptsream at the moment.
The device I used for testing supports ISOC as well and the em25xx
webcam I'm currently working on will likely use gspca at the end.

> Thanks for you hard work on this, and it will be great to get this
> stuff into the mainline.

I did what I could do. Now its up to others ;)

Regards,
Frank

> Devin
>


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/23] em28xx: add support fur USB bulk transfers
       [not found] ` <20121028175752.447c39d5@redhat.com>
@ 2012-10-29 15:33   ` Frank Schäfer
  2012-10-29 20:03     ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 48+ messages in thread
From: Frank Schäfer @ 2012-10-29 15:33 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media

Am 28.10.2012 21:57, schrieb Mauro Carvalho Chehab:
> Em Sun, 21 Oct 2012 19:52:05 +0300
> Frank Schäfer <fschaefer.oss@googlemail.com> escreveu:
>
>> This patch series adds support for USB bulk transfers to the em28xx driver.
>>
>> Patch 1 is a bugfix for the image data processing with non-interlaced devices (webcams)
>> that should be considered for stable (see commit message).
>>
>> Patches 2-21 extend the driver to support USB bulk transfers.
>> USB endpoint mapping had to be extended and is a bit tricky.
>> It might still not be sufficient to handle ALL isoc/bulk endpoints of ALL existing devices,
>> but it should work with the devices we have seen so far and (most important !) 
>> preserves backwards compatibility to the current driver behavior.
>> Isoc endpoints/transfers are preffered by default, patch 21 adds a module parameter to change this behavior.
>>
>> The last two patches are follow-up patches not really related to USB tranfers.
>> Patch 22 reduces the code size in em28xx-video by merging the two URB data processing functions 
>> and patch 23 enables VBI-support for em2840-devices.
>>
>> Please note that I could test the changes with an analog non-interlaced non-VBI device only !
>> So further tests with DVB/interlaced/VBI devices are strongly recommended !
> Did a quick test here with all applied, with analog TV with xawtv and tvtime. 
> Didn't work.

Ok, thanks for testing.

> I'll need to postpone it, until I have more time to double check it and bisect.

I would also need further informations about the test you've made (did
you enable bulk ?) and the device you used (supports VBI ?).

Regards,
Frank

>
> Regards,
> Mauro


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/23] em28xx: add support fur USB bulk transfers
  2012-10-29 15:33   ` Frank Schäfer
@ 2012-10-29 20:03     ` Mauro Carvalho Chehab
  2012-10-29 21:14       ` Frank Schäfer
  0 siblings, 1 reply; 48+ messages in thread
From: Mauro Carvalho Chehab @ 2012-10-29 20:03 UTC (permalink / raw)
  To: Frank Schäfer; +Cc: linux-media

Em Mon, 29 Oct 2012 17:33:12 +0200
Frank Schäfer <fschaefer.oss@googlemail.com> escreveu:

> Am 28.10.2012 21:57, schrieb Mauro Carvalho Chehab:
> > Em Sun, 21 Oct 2012 19:52:05 +0300
> > Frank Schäfer <fschaefer.oss@googlemail.com> escreveu:
> >
> >> This patch series adds support for USB bulk transfers to the em28xx driver.
> >>
> >> Patch 1 is a bugfix for the image data processing with non-interlaced devices (webcams)
> >> that should be considered for stable (see commit message).
> >>
> >> Patches 2-21 extend the driver to support USB bulk transfers.
> >> USB endpoint mapping had to be extended and is a bit tricky.
> >> It might still not be sufficient to handle ALL isoc/bulk endpoints of ALL existing devices,
> >> but it should work with the devices we have seen so far and (most important !) 
> >> preserves backwards compatibility to the current driver behavior.
> >> Isoc endpoints/transfers are preffered by default, patch 21 adds a module parameter to change this behavior.
> >>
> >> The last two patches are follow-up patches not really related to USB tranfers.
> >> Patch 22 reduces the code size in em28xx-video by merging the two URB data processing functions 
> >> and patch 23 enables VBI-support for em2840-devices.
> >>
> >> Please note that I could test the changes with an analog non-interlaced non-VBI device only !
> >> So further tests with DVB/interlaced/VBI devices are strongly recommended !
> > Did a quick test here with all applied, with analog TV with xawtv and tvtime. 
> > Didn't work.
> 
> Ok, thanks for testing.
> 
> > I'll need to postpone it, until I have more time to double check it and bisect.
> 
> I would also need further informations about the test you've made (did
> you enable bulk ?) and the device you used (supports VBI ?).

I used a WinTV HVR-950/980. Logs enclosed.

Regards,
Mauro


[ 8410.539167] media: Linux media interface: v0.10
[ 8410.554658] Linux video capture interface: v2.00
[ 8410.559272] WARNING: You are using an experimental version of the media stack.
	As the driver is backported to an older kernel, it doesn't offer
	enough quality for its usage in production.
	Use it with care.
Latest git patches (needed if you report a bug to linux-media@vger.kernel.org):
	8e216e50ddca0550ffd477ce27e843a506b3ae2e [media] it913x [BUG] Enable endpoint 3 on devices with HID interface
	684259353666b05a148cc70dfeed8e699daedbcd [media] Add Fujitsu Siemens Amilo Pi 2530 to gspca upside down table
	a66cd0b691c730ed751dbf66ffbd0edf18241790 [media] winbond-cir: do not rename input name
[ 8410.669117] em28xx: New device  WinTV HVR-980 @ 480 Mbps (2040:6513, interface 0, class 0)
[ 8410.677360] em28xx: Audio Vendor Class interface 0 found
[ 8410.682652] em28xx: Video interface 0 found
[ 8410.686817] em28xx: DVB interface 0 found
[ 8410.690955] em28xx #0: chip ID is em2882/em2883
[ 8410.837123] em28xx #0: i2c eeprom 00: 1a eb 67 95 40 20 13 65 d0 12 5c 03 82 1e 6a 18
[ 8410.845092] em28xx #0: i2c eeprom 10: 00 00 24 57 66 07 01 00 00 00 00 00 00 00 00 00
[ 8410.853063] em28xx #0: i2c eeprom 20: 46 00 01 00 f0 10 02 00 b8 00 00 00 5b 1c 00 00
[ 8410.861019] em28xx #0: i2c eeprom 30: 00 00 20 40 20 80 02 20 01 01 01 01 00 00 00 00
[ 8410.868974] em28xx #0: i2c eeprom 40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 8410.876926] em28xx #0: i2c eeprom 50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 8410.884901] em28xx #0: i2c eeprom 60: 00 00 00 00 00 00 00 00 00 00 18 03 34 00 30 00
[ 8410.892874] em28xx #0: i2c eeprom 70: 32 00 38 00 34 00 34 00 39 00 30 00 31 00 38 00
[ 8410.900838] em28xx #0: i2c eeprom 80: 00 00 1e 03 57 00 69 00 6e 00 54 00 56 00 20 00
[ 8410.908791] em28xx #0: i2c eeprom 90: 48 00 56 00 52 00 2d 00 39 00 38 00 30 00 00 00
[ 8410.916743] em28xx #0: i2c eeprom a0: 84 12 00 00 05 50 1a 7f d4 78 23 b1 fe d0 18 85
[ 8410.924695] em28xx #0: i2c eeprom b0: ff 00 00 00 04 84 0a 00 01 01 20 77 00 40 fa 40
[ 8410.932646] em28xx #0: i2c eeprom c0: 1d f0 74 02 01 00 01 79 4f 00 00 00 00 00 00 00
[ 8410.940596] em28xx #0: i2c eeprom d0: 84 12 00 00 05 50 1a 7f d4 78 23 b1 fe d0 18 85
[ 8410.948549] em28xx #0: i2c eeprom e0: ff 00 00 00 04 84 0a 00 01 01 20 77 00 40 fa 40
[ 8410.956502] em28xx #0: i2c eeprom f0: 1d f0 74 02 01 00 01 79 4f 00 00 00 00 00 00 00
[ 8410.964459] em28xx #0: EEPROM ID= 0x9567eb1a, EEPROM hash = 0x994b2bdd
[ 8410.970959] em28xx #0: EEPROM info:
[ 8410.974431] em28xx #0:	AC97 audio (5 sample rates)
[ 8410.979201] em28xx #0:	500mA max power
[ 8410.982948] em28xx #0:	Table at 0x24, strings=0x1e82, 0x186a, 0x0000
[ 8410.989277] em28xx #0: Identified as Hauppauge WinTV HVR 950 (card=16)
[ 8410.997388] tveeprom 3-0050: Hauppauge model 65201, rev A1C0, serial# 1917178
[ 8411.004502] tveeprom 3-0050: tuner model is Xceive XC3028 (idx 120, type 71)
[ 8411.011522] tveeprom 3-0050: TV standards PAL(B/G) PAL(I) PAL(D/D1/K) ATSC/DVB Digital (eeprom 0xd4)
[ 8411.020646] tveeprom 3-0050: audio processor is None (idx 0)
[ 8411.026281] tveeprom 3-0050: has radio
[ 8411.092490] tvp5150 3-005c: chip found @ 0xb8 (em28xx #0)
[ 8411.097904] tvp5150 3-005c: tvp5150am1 detected.
[ 8411.132278] tuner 3-0061: Tuner -1 found with type(s) Radio TV.
[ 8411.151694] xc2028: Xcv2028/3028 init called!
[ 8411.151698] xc2028 3-0061: creating new instance
[ 8411.156310] xc2028 3-0061: type set to XCeive xc2028/xc3028 tuner
[ 8411.162389] xc2028 3-0061: xc2028_set_config called
[ 8411.162403] xc2028 3-0061: xc2028_set_analog_freq called
[ 8411.162405] xc2028 3-0061: generic_set_freq called
[ 8411.162458] xc2028 3-0061: should set frequency 567250 kHz
[ 8411.162460] xc2028 3-0061: check_firmware called
[ 8411.162835] em28xx #0: Config register raw data: 0xd0
[ 8411.168575] em28xx #0: AC97 vendor ID = 0xffffffff
[ 8411.173820] em28xx #0: AC97 features = 0x6a90
[ 8411.178202] em28xx #0: Empia 202 AC97 audio processor detected
[ 8411.213621] xc2028 3-0061: request_firmware_nowait(): OK
[ 8411.213624] xc2028 3-0061: load_all_firmwares called
[ 8411.213626] xc2028 3-0061: Loading 80 firmware images from xc3028-v27.fw, type: xc2028 firmware, ver 2.7
[ 8411.223191] xc2028 3-0061: Reading firmware type BASE F8MHZ (3), id 0, size=8718.
[ 8411.223198] xc2028 3-0061: Reading firmware type BASE F8MHZ MTS (7), id 0, size=8712.
[ 8411.223204] xc2028 3-0061: Reading firmware type BASE FM (401), id 0, size=8562.
[ 8411.223209] xc2028 3-0061: Reading firmware type BASE FM INPUT1 (c01), id 0, size=8576.
[ 8411.223214] xc2028 3-0061: Reading firmware type BASE (1), id 0, size=8706.
[ 8411.223219] xc2028 3-0061: Reading firmware type BASE MTS (5), id 0, size=8682.
[ 8411.223222] xc2028 3-0061: Reading firmware type (0), id 100000007, size=161.
[ 8411.223224] xc2028 3-0061: Reading firmware type MTS (4), id 100000007, size=169.
[ 8411.223226] xc2028 3-0061: Reading firmware type (0), id 200000007, size=161.
[ 8411.223227] xc2028 3-0061: Reading firmware type MTS (4), id 200000007, size=169.
[ 8411.223229] xc2028 3-0061: Reading firmware type (0), id 400000007, size=161.
[ 8411.223231] xc2028 3-0061: Reading firmware type MTS (4), id 400000007, size=169.
[ 8411.223233] xc2028 3-0061: Reading firmware type (0), id 800000007, size=161.
[ 8411.223235] xc2028 3-0061: Reading firmware type MTS (4), id 800000007, size=169.
[ 8411.223237] xc2028 3-0061: Reading firmware type (0), id 3000000e0, size=161.
[ 8411.223239] xc2028 3-0061: Reading firmware type MTS (4), id 3000000e0, size=169.
[ 8411.223241] xc2028 3-0061: Reading firmware type (0), id c000000e0, size=161.
[ 8411.223242] xc2028 3-0061: Reading firmware type MTS (4), id c000000e0, size=169.
[ 8411.223244] xc2028 3-0061: Reading firmware type (0), id 200000, size=161.
[ 8411.223246] xc2028 3-0061: Reading firmware type MTS (4), id 200000, size=169.
[ 8411.223248] xc2028 3-0061: Reading firmware type (0), id 4000000, size=161.
[ 8411.223249] xc2028 3-0061: Reading firmware type MTS (4), id 4000000, size=169.
[ 8411.223251] xc2028 3-0061: Reading firmware type D2633 DTV6 ATSC (10030), id 0, size=149.
[ 8411.223254] xc2028 3-0061: Reading firmware type D2620 DTV6 QAM (68), id 0, size=149.
[ 8411.223257] xc2028 3-0061: Reading firmware type D2633 DTV6 QAM (70), id 0, size=149.
[ 8411.223259] xc2028 3-0061: Reading firmware type D2620 DTV7 (88), id 0, size=149.
[ 8411.223262] xc2028 3-0061: Reading firmware type D2633 DTV7 (90), id 0, size=149.
[ 8411.223264] xc2028 3-0061: Reading firmware type D2620 DTV78 (108), id 0, size=149.
[ 8411.223266] xc2028 3-0061: Reading firmware type D2633 DTV78 (110), id 0, size=149.
[ 8411.223269] xc2028 3-0061: Reading firmware type D2620 DTV8 (208), id 0, size=149.
[ 8411.223271] xc2028 3-0061: Reading firmware type D2633 DTV8 (210), id 0, size=149.
[ 8411.223273] xc2028 3-0061: Reading firmware type FM (400), id 0, size=135.
[ 8411.223275] xc2028 3-0061: Reading firmware type (0), id 10, size=161.
[ 8411.223277] xc2028 3-0061: Reading firmware type MTS (4), id 10, size=169.
[ 8411.223279] xc2028 3-0061: Reading firmware type (0), id 1000400000, size=169.
[ 8411.223281] xc2028 3-0061: Reading firmware type (0), id c00400000, size=161.
[ 8411.223282] xc2028 3-0061: Reading firmware type (0), id 800000, size=161.
[ 8411.223284] xc2028 3-0061: Reading firmware type (0), id 8000, size=161.
[ 8411.223286] xc2028 3-0061: Reading firmware type LCD (1000), id 8000, size=161.
[ 8411.223288] xc2028 3-0061: Reading firmware type LCD NOGD (3000), id 8000, size=161.
[ 8411.223290] xc2028 3-0061: Reading firmware type MTS (4), id 8000, size=169.
[ 8411.223292] xc2028 3-0061: Reading firmware type (0), id b700, size=161.
[ 8411.223294] xc2028 3-0061: Reading firmware type LCD (1000), id b700, size=161.
[ 8411.223295] xc2028 3-0061: Reading firmware type LCD NOGD (3000), id b700, size=161.
[ 8411.223298] xc2028 3-0061: Reading firmware type (0), id 2000, size=161.
[ 8411.223300] xc2028 3-0061: Reading firmware type MTS (4), id b700, size=169.
[ 8411.223302] xc2028 3-0061: Reading firmware type MTS LCD (1004), id b700, size=169.
[ 8411.223304] xc2028 3-0061: Reading firmware type MTS LCD NOGD (3004), id b700, size=169.
[ 8411.223306] xc2028 3-0061: Reading firmware type SCODE HAS_IF_3280 (60000000), id 0, size=192.
[ 8411.223309] xc2028 3-0061: Reading firmware type SCODE HAS_IF_3300 (60000000), id 0, size=192.
[ 8411.223311] xc2028 3-0061: Reading firmware type SCODE HAS_IF_3440 (60000000), id 0, size=192.
[ 8411.223313] xc2028 3-0061: Reading firmware type SCODE HAS_IF_3460 (60000000), id 0, size=192.
[ 8411.223316] xc2028 3-0061: Reading firmware type DTV6 ATSC OREN36 SCODE HAS_IF_3800 (60210020), id 0, size=192.
[ 8411.223319] xc2028 3-0061: Reading firmware type SCODE HAS_IF_4000 (60000000), id 0, size=192.
[ 8411.223321] xc2028 3-0061: Reading firmware type DTV6 ATSC TOYOTA388 SCODE HAS_IF_4080 (60410020), id 0, size=192.
[ 8411.223325] xc2028 3-0061: Reading firmware type SCODE HAS_IF_4200 (60000000), id 0, size=192.
[ 8411.223327] xc2028 3-0061: Reading firmware type MONO SCODE HAS_IF_4320 (60008000), id 8000, size=192.
[ 8411.223330] xc2028 3-0061: Reading firmware type SCODE HAS_IF_4450 (60000000), id 0, size=192.
[ 8411.223332] xc2028 3-0061: Reading firmware type MTS LCD NOGD MONO IF SCODE HAS_IF_4500 (6002b004), id b700, size=192.
[ 8411.223336] xc2028 3-0061: Reading firmware type LCD NOGD IF SCODE HAS_IF_4600 (60023000), id 8000, size=192.
[ 8411.223339] xc2028 3-0061: Reading firmware type DTV6 QAM DTV7 DTV78 DTV8 ZARLINK456 SCODE HAS_IF_4760 (620003e0), id 0, size=192.
[ 8411.223343] xc2028 3-0061: Reading firmware type SCODE HAS_IF_4940 (60000000), id 0, size=192.
[ 8411.223346] xc2028 3-0061: Reading firmware type SCODE HAS_IF_5260 (60000000), id 0, size=192.
[ 8411.223348] xc2028 3-0061: Reading firmware type MONO SCODE HAS_IF_5320 (60008000), id f00000007, size=192.
[ 8411.223351] xc2028 3-0061: Reading firmware type DTV7 DTV78 DTV8 DIBCOM52 CHINA SCODE HAS_IF_5400 (65000380), id 0, size=192.
[ 8411.223354] xc2028 3-0061: Reading firmware type DTV6 ATSC OREN538 SCODE HAS_IF_5580 (60110020), id 0, size=192.
[ 8411.223358] xc2028 3-0061: Reading firmware type SCODE HAS_IF_5640 (60000000), id 300000007, size=192.
[ 8411.223360] xc2028 3-0061: Reading firmware type SCODE HAS_IF_5740 (60000000), id c00000007, size=192.
[ 8411.223363] xc2028 3-0061: Reading firmware type SCODE HAS_IF_5900 (60000000), id 0, size=192.
[ 8411.223365] xc2028 3-0061: Reading firmware type MONO SCODE HAS_IF_6000 (60008000), id c04c000f0, size=192.
[ 8411.223367] xc2028 3-0061: Reading firmware type DTV6 QAM ATSC LG60 F6MHZ SCODE HAS_IF_6200 (68050060), id 0, size=192.
[ 8411.223371] xc2028 3-0061: Reading firmware type SCODE HAS_IF_6240 (60000000), id 10, size=192.
[ 8411.223374] xc2028 3-0061: Reading firmware type MONO SCODE HAS_IF_6320 (60008000), id 200000, size=192.
[ 8411.223377] xc2028 3-0061: Reading firmware type SCODE HAS_IF_6340 (60000000), id 200000, size=192.
[ 8411.223379] xc2028 3-0061: Reading firmware type MONO SCODE HAS_IF_6500 (60008000), id c044000e0, size=192.
[ 8411.223382] xc2028 3-0061: Reading firmware type DTV6 ATSC ATI638 SCODE HAS_IF_6580 (60090020), id 0, size=192.
[ 8411.223385] xc2028 3-0061: Reading firmware type SCODE HAS_IF_6600 (60000000), id 3000000e0, size=192.
[ 8411.223388] xc2028 3-0061: Reading firmware type MONO SCODE HAS_IF_6680 (60008000), id 3000000e0, size=192.
[ 8411.223390] xc2028 3-0061: Reading firmware type DTV6 ATSC TOYOTA794 SCODE HAS_IF_8140 (60810020), id 0, size=192.
[ 8411.223393] xc2028 3-0061: Reading firmware type SCODE HAS_IF_8200 (60000000), id 0, size=192.
[ 8411.223396] xc2028 3-0061: Firmware files loaded.
[ 8411.346732] em28xx #0: v4l2 driver version 0.1.3
[ 8411.351857] xc2028 3-0061: xc2028_set_analog_freq called
[ 8411.351860] xc2028 3-0061: generic_set_freq called
[ 8411.351874] xc2028 3-0061: should set frequency 567250 kHz
[ 8411.351878] xc2028 3-0061: check_firmware called
[ 8411.351879] xc2028 3-0061: checking firmware, user requested type=F8MHZ MTS (6), id 00000000000000ff, scode_tbl (0), scode_nr 0
[ 8411.384856] xc2028 3-0061: load_firmware called
[ 8411.384860] xc2028 3-0061: seek_firmware called, want type=BASE F8MHZ MTS (7), id 0000000000000000.
[ 8411.384865] xc2028 3-0061: Found firmware for type=BASE F8MHZ MTS (7), id 0000000000000000.
[ 8411.384869] xc2028 3-0061: Loading firmware for type=BASE F8MHZ MTS (7), id 0000000000000000.
[ 8412.464685] xc2028 3-0061: Load init1 firmware, if exists
[ 8412.464689] xc2028 3-0061: load_firmware called
[ 8412.464691] xc2028 3-0061: seek_firmware called, want type=BASE INIT1 F8MHZ MTS (4007), id 0000000000000000.
[ 8412.464698] xc2028 3-0061: Can't find firmware for type=BASE INIT1 F8MHZ MTS (4007), id 0000000000000000.
[ 8412.464703] xc2028 3-0061: load_firmware called
[ 8412.464705] xc2028 3-0061: seek_firmware called, want type=BASE INIT1 MTS (4005), id 0000000000000000.
[ 8412.464709] xc2028 3-0061: Can't find firmware for type=BASE INIT1 MTS (4005), id 0000000000000000.
[ 8412.464714] xc2028 3-0061: load_firmware called
[ 8412.464715] xc2028 3-0061: seek_firmware called, want type=F8MHZ MTS (6), id 00000000000000ff.
[ 8412.464720] xc2028 3-0061: Selecting best matching firmware (3 bits) for type=MTS (4), id 00000000000000ff:
[ 8412.464723] xc2028 3-0061: Found firmware for type=MTS (4), id 0000000100000007.
[ 8412.464726] xc2028 3-0061: Loading firmware for type=MTS (4), id 0000000100000007.
[ 8412.490792] xc2028 3-0061: Trying to load scode 0
[ 8412.490796] xc2028 3-0061: load_scode called
[ 8412.490798] xc2028 3-0061: seek_firmware called, want type=F8MHZ MTS SCODE (20000006), id 0000000100000007.
[ 8412.490804] xc2028 3-0061: Can't find firmware for type=MTS SCODE (20000004), id 0000000100000007.
[ 8412.490808] xc2028 3-0061: xc2028_get_reg 0004 called
[ 8412.491762] xc2028 3-0061: xc2028_get_reg 0008 called
[ 8412.492886] xc2028 3-0061: Device is Xceive 3028 version 1.0, firmware version 2.7
[ 8412.605248] xc2028 3-0061: divisor= 00 00 8d d0 (freq=567.250)
[ 8412.671096] em28xx #0: V4L2 video device registered as video0
[ 8412.676837] em28xx #0: V4L2 VBI device registered as vbi0
[ 8412.682216] xc2028 3-0061: Putting xc2028/3028 into poweroff mode.
[ 8412.684011] usbcore: registered new interface driver em28xx
[ 8412.699349] em28xx-audio.c: probing for em28xx Audio Vendor Class
[ 8412.705435] em28xx-audio.c: Copyright (C) 2006 Markus Rechberger
[ 8412.711431] em28xx-audio.c: Copyright (C) 2007-2011 Mauro Carvalho Chehab
[ 8412.718705] Em28xx: Initialized (Em28xx Audio Extension) extension
[ 8412.738793] WARNING: You are using an experimental version of the media stack.
	As the driver is backported to an older kernel, it doesn't offer
	enough quality for its usage in production.
	Use it with care.
Latest git patches (needed if you report a bug to linux-media@vger.kernel.org):
	8e216e50ddca0550ffd477ce27e843a506b3ae2e [media] it913x [BUG] Enable endpoint 3 on devices with HID interface
	684259353666b05a148cc70dfeed8e699daedbcd [media] Add Fujitsu Siemens Amilo Pi 2530 to gspca upside down table
	a66cd0b691c730ed751dbf66ffbd0edf18241790 [media] winbond-cir: do not rename input name
[ 8412.907194] xc2028 3-0061: Putting xc2028/3028 into poweroff mode.
[ 8412.996749] xc2028: Xcv2028/3028 init called!
[ 8412.996753] xc2028 3-0061: attaching existing instance
[ 8413.001881] xc2028 3-0061: type set to XCeive xc2028/xc3028 tuner
[ 8413.007953] em28xx #0: em28xx #0/2: xc3028 attached
[ 8413.013015] DVB: registering new adapter (em28xx #0)
[ 8413.018017] usb 1-6: DVB: registering adapter 0 frontend 0 (LG Electronics LGDT3303 VSB/QAM Frontend)...
[ 8413.029903] em28xx #0: Successfully loaded em28xx-dvb
[ 8413.034970] Em28xx: Initialized (Em28xx dvb Extension) extension
[ 8413.056144] WARNING: You are using an experimental version of the media stack.
	As the driver is backported to an older kernel, it doesn't offer
	enough quality for its usage in production.
	Use it with care.
Latest git patches (needed if you report a bug to linux-media@vger.kernel.org):
	8e216e50ddca0550ffd477ce27e843a506b3ae2e [media] it913x [BUG] Enable endpoint 3 on devices with HID interface
	684259353666b05a148cc70dfeed8e699daedbcd [media] Add Fujitsu Siemens Amilo Pi 2530 to gspca upside down table
	a66cd0b691c730ed751dbf66ffbd0edf18241790 [media] winbond-cir: do not rename input name
[ 8413.160007] Registered IR keymap rc-hauppauge
[ 8413.164522] input: em28xx IR (em28xx #0) as /devices/pci0000:00/0000:00:1a.7/usb1/1-6/rc/rc0/input11
[ 8413.174318] rc0: em28xx IR (em28xx #0) as /devices/pci0000:00/0000:00:1a.7/usb1/1-6/rc/rc0
[ 8413.183921] Em28xx: Initialized (Em28xx Input Extension) extension
[ 8440.697028] [drm] nouveau 0000:0f:00.0: Setting dpms mode 0 on vga encoder (output 0)
[ 8454.966006] xc2028 3-0061: xc2028_get_reg 0002 called
[ 8454.990113] xc2028 3-0061: i2c input error: rc = -19 (should be 2)
[ 8454.996282] xc2028 3-0061: xc2028_signal called
[ 8454.997656] xc2028 3-0061: xc2028_get_reg 0002 called
[ 8455.021846] xc2028 3-0061: i2c input error: rc = -19 (should be 2)
[ 8455.028012] xc2028 3-0061: signal strength is 0
[ 8455.102094] [drm] nouveau 0000:0f:00.0: Setting dpms mode 3 on vga encoder (output 0)
[ 8455.130131] [drm] nouveau 0000:0f:00.0: Setting dpms mode 0 on vga encoder (output 0)
[ 8455.137940] [drm] nouveau 0000:0f:00.0: Output VGA-1 is running on CRTC 0 using output A
[ 8455.249617] xc2028 3-0061: xc2028_set_analog_freq called
[ 8455.249621] xc2028 3-0061: generic_set_freq called
[ 8455.249623] xc2028 3-0061: should set frequency 567250 kHz
[ 8455.249624] xc2028 3-0061: check_firmware called
[ 8455.249625] xc2028 3-0061: checking firmware, user requested type=F8MHZ MTS (6), id 00000000000000ff, scode_tbl (0), scode_nr 0
[ 8455.289395] xc2028 3-0061: load_firmware called
[ 8455.289399] xc2028 3-0061: seek_firmware called, want type=BASE F8MHZ MTS (7), id 0000000000000000.
[ 8455.289402] xc2028 3-0061: Found firmware for type=BASE F8MHZ MTS (7), id 0000000000000000.
[ 8455.289405] xc2028 3-0061: Loading firmware for type=BASE F8MHZ MTS (7), id 0000000000000000.
[ 8456.364027] xc2028 3-0061: Load init1 firmware, if exists
[ 8456.364031] xc2028 3-0061: load_firmware called
[ 8456.364034] xc2028 3-0061: seek_firmware called, want type=BASE INIT1 F8MHZ MTS (4007), id 0000000000000000.
[ 8456.364040] xc2028 3-0061: Can't find firmware for type=BASE INIT1 F8MHZ MTS (4007), id 0000000000000000.
[ 8456.364045] xc2028 3-0061: load_firmware called
[ 8456.364047] xc2028 3-0061: seek_firmware called, want type=BASE INIT1 MTS (4005), id 0000000000000000.
[ 8456.364051] xc2028 3-0061: Can't find firmware for type=BASE INIT1 MTS (4005), id 0000000000000000.
[ 8456.364056] xc2028 3-0061: load_firmware called
[ 8456.364057] xc2028 3-0061: seek_firmware called, want type=F8MHZ MTS (6), id 00000000000000ff.
[ 8456.364062] xc2028 3-0061: Selecting best matching firmware (3 bits) for type=MTS (4), id 00000000000000ff:
[ 8456.364065] xc2028 3-0061: Found firmware for type=MTS (4), id 0000000100000007.
[ 8456.364067] xc2028 3-0061: Loading firmware for type=MTS (4), id 0000000100000007.
[ 8456.390174] xc2028 3-0061: Trying to load scode 0
[ 8456.390177] xc2028 3-0061: load_scode called
[ 8456.390180] xc2028 3-0061: seek_firmware called, want type=F8MHZ MTS SCODE (20000006), id 0000000100000007.
[ 8456.390186] xc2028 3-0061: Can't find firmware for type=MTS SCODE (20000004), id 0000000100000007.
[ 8456.390190] xc2028 3-0061: xc2028_get_reg 0004 called
[ 8456.391165] xc2028 3-0061: xc2028_get_reg 0008 called
[ 8456.392133] xc2028 3-0061: Device is Xceive 3028 version 1.0, firmware version 2.7
[ 8456.504746] xc2028 3-0061: divisor= 00 00 8d d0 (freq=567.250)
[ 8456.631140] xc2028 3-0061: xc2028_set_analog_freq called
[ 8456.631145] xc2028 3-0061: generic_set_freq called
[ 8456.631147] xc2028 3-0061: should set frequency 567250 kHz
[ 8456.631149] xc2028 3-0061: check_firmware called
[ 8456.631151] xc2028 3-0061: checking firmware, user requested type=MTS (4), id 0000000000000100, scode_tbl (0), scode_nr 0
[ 8456.670654] xc2028 3-0061: load_firmware called
[ 8456.670658] xc2028 3-0061: seek_firmware called, want type=BASE MTS (5), id 0000000000000000.
[ 8456.670663] xc2028 3-0061: Found firmware for type=BASE MTS (5), id 0000000000000000.
[ 8456.670666] xc2028 3-0061: Loading firmware for type=BASE MTS (5), id 0000000000000000.
[ 8457.775318] xc2028 3-0061: Load init1 firmware, if exists
[ 8457.775321] xc2028 3-0061: load_firmware called
[ 8457.775323] xc2028 3-0061: seek_firmware called, want type=BASE INIT1 MTS (4005), id 0000000000000000.
[ 8457.775327] xc2028 3-0061: Can't find firmware for type=BASE INIT1 MTS (4005), id 0000000000000000.
[ 8457.775330] xc2028 3-0061: load_firmware called
[ 8457.775331] xc2028 3-0061: seek_firmware called, want type=BASE INIT1 MTS (4005), id 0000000000000000.
[ 8457.775334] xc2028 3-0061: Can't find firmware for type=BASE INIT1 MTS (4005), id 0000000000000000.
[ 8457.775336] xc2028 3-0061: load_firmware called
[ 8457.775337] xc2028 3-0061: seek_firmware called, want type=MTS (4), id 0000000000000100.
[ 8457.775340] xc2028 3-0061: Found firmware for type=MTS (4), id 000000000000b700.
[ 8457.775342] xc2028 3-0061: Loading firmware for type=MTS (4), id 000000000000b700.
[ 8457.801526] xc2028 3-0061: Trying to load scode 0
[ 8457.801529] xc2028 3-0061: load_scode called
[ 8457.801530] xc2028 3-0061: seek_firmware called, want type=MTS SCODE (20000004), id 000000000000b700.
[ 8457.801534] xc2028 3-0061: Found firmware for type=MTS SCODE (20000004), id 000000000000b700.
[ 8457.801536] xc2028 3-0061: Loading SCODE for type=MTS LCD NOGD MONO IF SCODE HAS_IF_4500 (6002b004), id 000000000000b700.
[ 8457.815266] xc2028 3-0061: xc2028_get_reg 0004 called
[ 8457.816264] xc2028 3-0061: xc2028_get_reg 0008 called
[ 8457.817263] xc2028 3-0061: Device is Xceive 3028 version 1.0, firmware version 2.7
[ 8457.929985] xc2028 3-0061: divisor= 00 00 8d d0 (freq=567.250)
[ 8457.930049] xc2028 3-0061: xc2028_set_analog_freq called
[ 8457.930052] xc2028 3-0061: generic_set_freq called
[ 8457.930055] xc2028 3-0061: should set frequency 67250 kHz
[ 8457.930056] xc2028 3-0061: check_firmware called
[ 8457.930058] xc2028 3-0061: checking firmware, user requested type=MTS (4), id 0000000000000100, scode_tbl (0), scode_nr 0
[ 8457.930064] xc2028 3-0061: BASE firmware not changed.
[ 8457.930066] xc2028 3-0061: Std-specific firmware already loaded.
[ 8457.930067] xc2028 3-0061: SCODE firmware already loaded.
[ 8457.930070] xc2028 3-0061: xc2028_get_reg 0004 called
[ 8457.931458] xc2028 3-0061: xc2028_get_reg 0008 called
[ 8457.932474] xc2028 3-0061: Device is Xceive 3028 version 1.0, firmware version 2.7
[ 8458.044925] xc2028 3-0061: divisor= 00 00 10 d0 (freq=67.250)
[ 8458.047565] xc2028 3-0061: xc2028_set_analog_freq called
[ 8458.047569] xc2028 3-0061: generic_set_freq called
[ 8458.047571] xc2028 3-0061: should set frequency 67250 kHz
[ 8458.047573] xc2028 3-0061: check_firmware called
[ 8458.047575] xc2028 3-0061: checking firmware, user requested type=MTS (4), id 0000000000000100, scode_tbl (0), scode_nr 0
[ 8458.047581] xc2028 3-0061: BASE firmware not changed.
[ 8458.047583] xc2028 3-0061: Std-specific firmware already loaded.
[ 8458.047584] xc2028 3-0061: SCODE firmware already loaded.
[ 8458.047587] xc2028 3-0061: xc2028_get_reg 0004 called
[ 8458.048645] xc2028 3-0061: xc2028_get_reg 0008 called
[ 8458.049645] xc2028 3-0061: Device is Xceive 3028 version 1.0, firmware version 2.7
[ 8458.161860] xc2028 3-0061: divisor= 00 00 10 d0 (freq=67.250)
[ 8463.248599] xc2028 3-0061: xc2028_get_reg 0002 called
[ 8463.249590] xc2028 3-0061: xc2028_get_reg 0001 called
[ 8463.250577] xc2028 3-0061: AFC is 0 Hz
[ 8463.250581] xc2028 3-0061: xc2028_signal called
[ 8463.250583] xc2028 3-0061: xc2028_get_reg 0002 called
[ 8463.251561] xc2028 3-0061: xc2028_get_reg 0040 called
[ 8463.252561] xc2028 3-0061: signal strength is 20479

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/23] em28xx: add support fur USB bulk transfers
  2012-10-29 20:03     ` Mauro Carvalho Chehab
@ 2012-10-29 21:14       ` Frank Schäfer
  2012-10-30  3:00         ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 48+ messages in thread
From: Frank Schäfer @ 2012-10-29 21:14 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media

Am 29.10.2012 22:03, schrieb Mauro Carvalho Chehab:
> Em Mon, 29 Oct 2012 17:33:12 +0200
> Frank Schäfer <fschaefer.oss@googlemail.com> escreveu:
>
>> Am 28.10.2012 21:57, schrieb Mauro Carvalho Chehab:
>>> Em Sun, 21 Oct 2012 19:52:05 +0300
>>> Frank Schäfer <fschaefer.oss@googlemail.com> escreveu:
>>>
>>>> This patch series adds support for USB bulk transfers to the em28xx driver.
>>>>
>>>> Patch 1 is a bugfix for the image data processing with non-interlaced devices (webcams)
>>>> that should be considered for stable (see commit message).
>>>>
>>>> Patches 2-21 extend the driver to support USB bulk transfers.
>>>> USB endpoint mapping had to be extended and is a bit tricky.
>>>> It might still not be sufficient to handle ALL isoc/bulk endpoints of ALL existing devices,
>>>> but it should work with the devices we have seen so far and (most important !) 
>>>> preserves backwards compatibility to the current driver behavior.
>>>> Isoc endpoints/transfers are preffered by default, patch 21 adds a module parameter to change this behavior.
>>>>
>>>> The last two patches are follow-up patches not really related to USB tranfers.
>>>> Patch 22 reduces the code size in em28xx-video by merging the two URB data processing functions 
>>>> and patch 23 enables VBI-support for em2840-devices.
>>>>
>>>> Please note that I could test the changes with an analog non-interlaced non-VBI device only !
>>>> So further tests with DVB/interlaced/VBI devices are strongly recommended !
>>> Did a quick test here with all applied, with analog TV with xawtv and tvtime. 
>>> Didn't work.
>> Ok, thanks for testing.
>>
>>> I'll need to postpone it, until I have more time to double check it and bisect.
>> I would also need further informations about the test you've made (did
>> you enable bulk ?) and the device you used (supports VBI ?).
> I used a WinTV HVR-950/980. Logs enclosed.
>
> Regards,
> Mauro

Thanks.
Did you load the module with prefer_bulk=1 ?
You just started xawtv/tvtime but got no picture, right ?

There is nothing unusual in the log, except...

...
> [ 8412.464698] xc2028 3-0061: Can't find firmware for type=BASE INIT1 F8MHZ MTS (4007), id 0000000000000000.
...
> [ 8412.464709] xc2028 3-0061: Can't find firmware for type=BASE INIT1 MTS (4005), id 0000000000000000.
...
> [ 8412.490804] xc2028 3-0061: Can't find firmware for type=MTS SCODE (20000004), id 0000000100000007.

and

...
> [ 8454.966006] xc2028 3-0061: xc2028_get_reg 0002 called
> [ 8454.990113] xc2028 3-0061: i2c input error: rc = -19 (should be 2)
> [ 8454.996282] xc2028 3-0061: xc2028_signal called
> [ 8454.997656] xc2028 3-0061: xc2028_get_reg 0002 called
> [ 8455.021846] xc2028 3-0061: i2c input error: rc = -19 (should be 2)

Are these errors normal ?
Are you sure the device is working properly without my patches ?

You could try to load the em28xx module with usb_debug=1.

Regards,
Frank



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/23] em28xx: add support fur USB bulk transfers
  2012-10-29 21:14       ` Frank Schäfer
@ 2012-10-30  3:00         ` Mauro Carvalho Chehab
  2012-10-30  4:06           ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 48+ messages in thread
From: Mauro Carvalho Chehab @ 2012-10-30  3:00 UTC (permalink / raw)
  To: Frank Schäfer; +Cc: linux-media

Em Mon, 29 Oct 2012 23:14:55 +0200
Frank Schäfer <fschaefer.oss@googlemail.com> escreveu:

> Am 29.10.2012 22:03, schrieb Mauro Carvalho Chehab:
> > Em Mon, 29 Oct 2012 17:33:12 +0200
> > Frank Schäfer <fschaefer.oss@googlemail.com> escreveu:
> >
> >> Am 28.10.2012 21:57, schrieb Mauro Carvalho Chehab:
> >>> Em Sun, 21 Oct 2012 19:52:05 +0300
> >>> Frank Schäfer <fschaefer.oss@googlemail.com> escreveu:
> >>>
> >>>> This patch series adds support for USB bulk transfers to the em28xx driver.
> >>>>
> >>>> Patch 1 is a bugfix for the image data processing with non-interlaced devices (webcams)
> >>>> that should be considered for stable (see commit message).
> >>>>
> >>>> Patches 2-21 extend the driver to support USB bulk transfers.
> >>>> USB endpoint mapping had to be extended and is a bit tricky.
> >>>> It might still not be sufficient to handle ALL isoc/bulk endpoints of ALL existing devices,
> >>>> but it should work with the devices we have seen so far and (most important !) 
> >>>> preserves backwards compatibility to the current driver behavior.
> >>>> Isoc endpoints/transfers are preffered by default, patch 21 adds a module parameter to change this behavior.
> >>>>
> >>>> The last two patches are follow-up patches not really related to USB tranfers.
> >>>> Patch 22 reduces the code size in em28xx-video by merging the two URB data processing functions 
> >>>> and patch 23 enables VBI-support for em2840-devices.
> >>>>
> >>>> Please note that I could test the changes with an analog non-interlaced non-VBI device only !
> >>>> So further tests with DVB/interlaced/VBI devices are strongly recommended !
> >>> Did a quick test here with all applied, with analog TV with xawtv and tvtime. 
> >>> Didn't work.
> >> Ok, thanks for testing.
> >>
> >>> I'll need to postpone it, until I have more time to double check it and bisect.
> >> I would also need further informations about the test you've made (did
> >> you enable bulk ?) and the device you used (supports VBI ?).
> > I used a WinTV HVR-950/980. Logs enclosed.
> >
> > Regards,
> > Mauro
> 
> Thanks.
> Did you load the module with prefer_bulk=1 ?

No.

> You just started xawtv/tvtime but got no picture, right ?

Yes. I tested also v4l2grab. No frames got returned there.

> 
> There is nothing unusual in the log, except...
> 
> ...
> > [ 8412.464698] xc2028 3-0061: Can't find firmware for type=BASE INIT1 F8MHZ MTS (4007), id 0000000000000000.
> ...
> > [ 8412.464709] xc2028 3-0061: Can't find firmware for type=BASE INIT1 MTS (4005), id 0000000000000000.
> ...

Those are normal. AFAIKT, only firmwares < version 2.0 had init broken into
INIT0 and INIT1.

> > [ 8412.490804] xc2028 3-0061: Can't find firmware for type=MTS SCODE (20000004), id 0000000100000007.

This is ok, as another similar SCODE firmware got loaded.

> 
> and
> 
> ...
> > [ 8454.966006] xc2028 3-0061: xc2028_get_reg 0002 called
> > [ 8454.990113] xc2028 3-0061: i2c input error: rc = -19 (should be 2)
> > [ 8454.996282] xc2028 3-0061: xc2028_signal called
> > [ 8454.997656] xc2028 3-0061: xc2028_get_reg 0002 called
> > [ 8455.021846] xc2028 3-0061: i2c input error: rc = -19 (should be 2)

Those are weird. In any case, as far as I remember, even if xc3028 is bad tuned,
em28xx should be outputing some data. I suspect, however, that those errors
maybe because the em28xx chip has died already.

> 
> Are these errors normal ?
> Are you sure the device is working properly without my patches ?

Yes. See below.

> 
> You could try to load the em28xx module with usb_debug=1.

I'll post it on a separate email.

> 
> Regards,
> Frank
> 
> 

dmesg without your patches:

[  729.964324] Linux video capture interface: v2.00
[  729.968927] WARNING: You are using an experimental version of the media stack.
	As the driver is backported to an older kernel, it doesn't offer
	enough quality for its usage in production.
	Use it with care.
Latest git patches (needed if you report a bug to linux-media@vger.kernel.org):
	8e216e50ddca0550ffd477ce27e843a506b3ae2e [media] it913x [BUG] Enable endpoint 3 on devices with HID interface
	684259353666b05a148cc70dfeed8e699daedbcd [media] Add Fujitsu Siemens Amilo Pi 2530 to gspca upside down table
	a66cd0b691c730ed751dbf66ffbd0edf18241790 [media] winbond-cir: do not rename input name
[  730.034451] em28xx: New device  WinTV HVR-980 @ 480 Mbps (2040:6513, interface 0, class 0)
[  730.042715] em28xx: Audio Vendor Class interface 0 found
[  730.048033] em28xx: Video interface 0 found
[  730.052225] em28xx: DVB interface 0 found
[  730.056320] em28xx #0: chip ID is em2882/em2883
[  730.202750] em28xx #0: i2c eeprom 00: 1a eb 67 95 40 20 13 65 d0 12 5c 03 82 1e 6a 18
[  730.210868] em28xx #0: i2c eeprom 10: 00 00 24 57 66 07 01 00 00 00 00 00 00 00 00 00
[  730.218848] em28xx #0: i2c eeprom 20: 46 00 01 00 f0 10 02 00 b8 00 00 00 5b 1c 00 00
[  730.226821] em28xx #0: i2c eeprom 30: 00 00 20 40 20 80 02 20 01 01 01 01 00 00 00 00
[  730.234811] em28xx #0: i2c eeprom 40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[  730.242808] em28xx #0: i2c eeprom 50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[  730.250807] em28xx #0: i2c eeprom 60: 00 00 00 00 00 00 00 00 00 00 18 03 34 00 30 00
[  730.258803] em28xx #0: i2c eeprom 70: 32 00 38 00 34 00 34 00 39 00 30 00 31 00 38 00
[  730.266796] em28xx #0: i2c eeprom 80: 00 00 1e 03 57 00 69 00 6e 00 54 00 56 00 20 00
[  730.274765] em28xx #0: i2c eeprom 90: 48 00 56 00 52 00 2d 00 39 00 38 00 30 00 00 00
[  730.282760] em28xx #0: i2c eeprom a0: 84 12 00 00 05 50 1a 7f d4 78 23 b1 fe d0 18 85
[  730.290778] em28xx #0: i2c eeprom b0: ff 00 00 00 04 84 0a 00 01 01 20 77 00 40 fa 40
[  730.298778] em28xx #0: i2c eeprom c0: 1d f0 74 02 01 00 01 79 4f 00 00 00 00 00 00 00
[  730.306775] em28xx #0: i2c eeprom d0: 84 12 00 00 05 50 1a 7f d4 78 23 b1 fe d0 18 85
[  730.314746] em28xx #0: i2c eeprom e0: ff 00 00 00 04 84 0a 00 01 01 20 77 00 40 fa 40
[  730.322743] em28xx #0: i2c eeprom f0: 1d f0 74 02 01 00 01 79 4f 00 00 00 00 00 00 00
[  730.330763] em28xx #0: EEPROM ID= 0x9567eb1a, EEPROM hash = 0x994b2bdd
[  730.337267] em28xx #0: EEPROM info:
[  730.340743] em28xx #0:	AC97 audio (5 sample rates)
[  730.345516] em28xx #0:	500mA max power
[  730.349252] em28xx #0:	Table at 0x24, strings=0x1e82, 0x186a, 0x0000
[  730.355582] em28xx #0: Identified as Hauppauge WinTV HVR 950 (card=16)
[  730.363404] tveeprom 3-0050: Hauppauge model 65201, rev A1C0, serial# 1917178
[  730.370572] tveeprom 3-0050: tuner model is Xceive XC3028 (idx 120, type 71)
[  730.377626] tveeprom 3-0050: TV standards PAL(B/G) PAL(I) PAL(D/D1/K) ATSC/DVB Digital (eeprom 0xd4)
[  730.386774] tveeprom 3-0050: audio processor is None (idx 0)
[  730.392461] tveeprom 3-0050: has radio
[  730.443029] tvp5150 3-005c: chip found @ 0xb8 (em28xx #0)
[  730.448418] tvp5150 3-005c: tvp5150am1 detected.
[  730.471249] tuner 3-0061: Tuner -1 found with type(s) Radio TV.
[  730.479100] xc2028: Xcv2028/3028 init called!
[  730.479104] xc2028 3-0061: creating new instance
[  730.483747] xc2028 3-0061: type set to XCeive xc2028/xc3028 tuner
[  730.489852] xc2028 3-0061: xc2028_set_config called
[  730.489862] xc2028 3-0061: xc2028_set_analog_freq called
[  730.489865] xc2028 3-0061: generic_set_freq called
[  730.489867] xc2028 3-0061: should set frequency 567250 kHz
[  730.489868] xc2028 3-0061: check_firmware called
[  730.490080] em28xx #0: Config register raw data: 0xd0
[  730.495854] em28xx #0: AC97 vendor ID = 0xffffffff
[  730.501095] em28xx #0: AC97 features = 0x6a90
[  730.505468] em28xx #0: Empia 202 AC97 audio processor detected
[  730.506556] xc2028 3-0061: request_firmware_nowait(): OK
[  730.506557] xc2028 3-0061: load_all_firmwares called
[  730.506558] xc2028 3-0061: Loading 80 firmware images from xc3028-v27.fw, type: xc2028 firmware, ver 2.7
[  730.506563] xc2028 3-0061: Reading firmware type BASE F8MHZ (3), id 0, size=8718.
[  730.506568] xc2028 3-0061: Reading firmware type BASE F8MHZ MTS (7), id 0, size=8712.
[  730.506572] xc2028 3-0061: Reading firmware type BASE FM (401), id 0, size=8562.
[  730.506576] xc2028 3-0061: Reading firmware type BASE FM INPUT1 (c01), id 0, size=8576.
[  730.506580] xc2028 3-0061: Reading firmware type BASE (1), id 0, size=8706.
[  730.506584] xc2028 3-0061: Reading firmware type BASE MTS (5), id 0, size=8682.
[  730.506586] xc2028 3-0061: Reading firmware type (0), id 100000007, size=161.
[  730.506587] xc2028 3-0061: Reading firmware type MTS (4), id 100000007, size=169.
[  730.506588] xc2028 3-0061: Reading firmware type (0), id 200000007, size=161.
[  730.506590] xc2028 3-0061: Reading firmware type MTS (4), id 200000007, size=169.
[  730.506591] xc2028 3-0061: Reading firmware type (0), id 400000007, size=161.
[  730.506592] xc2028 3-0061: Reading firmware type MTS (4), id 400000007, size=169.
[  730.506593] xc2028 3-0061: Reading firmware type (0), id 800000007, size=161.
[  730.506595] xc2028 3-0061: Reading firmware type MTS (4), id 800000007, size=169.
[  730.506596] xc2028 3-0061: Reading firmware type (0), id 3000000e0, size=161.
[  730.506597] xc2028 3-0061: Reading firmware type MTS (4), id 3000000e0, size=169.
[  730.506598] xc2028 3-0061: Reading firmware type (0), id c000000e0, size=161.
[  730.506600] xc2028 3-0061: Reading firmware type MTS (4), id c000000e0, size=169.
[  730.506601] xc2028 3-0061: Reading firmware type (0), id 200000, size=161.
[  730.506602] xc2028 3-0061: Reading firmware type MTS (4), id 200000, size=169.
[  730.506603] xc2028 3-0061: Reading firmware type (0), id 4000000, size=161.
[  730.506605] xc2028 3-0061: Reading firmware type MTS (4), id 4000000, size=169.
[  730.506606] xc2028 3-0061: Reading firmware type D2633 DTV6 ATSC (10030), id 0, size=149.
[  730.506608] xc2028 3-0061: Reading firmware type D2620 DTV6 QAM (68), id 0, size=149.
[  730.506610] xc2028 3-0061: Reading firmware type D2633 DTV6 QAM (70), id 0, size=149.
[  730.506611] xc2028 3-0061: Reading firmware type D2620 DTV7 (88), id 0, size=149.
[  730.506613] xc2028 3-0061: Reading firmware type D2633 DTV7 (90), id 0, size=149.
[  730.506615] xc2028 3-0061: Reading firmware type D2620 DTV78 (108), id 0, size=149.
[  730.506616] xc2028 3-0061: Reading firmware type D2633 DTV78 (110), id 0, size=149.
[  730.506618] xc2028 3-0061: Reading firmware type D2620 DTV8 (208), id 0, size=149.
[  730.506619] xc2028 3-0061: Reading firmware type D2633 DTV8 (210), id 0, size=149.
[  730.506620] xc2028 3-0061: Reading firmware type FM (400), id 0, size=135.
[  730.506622] xc2028 3-0061: Reading firmware type (0), id 10, size=161.
[  730.506623] xc2028 3-0061: Reading firmware type MTS (4), id 10, size=169.
[  730.506624] xc2028 3-0061: Reading firmware type (0), id 1000400000, size=169.
[  730.506626] xc2028 3-0061: Reading firmware type (0), id c00400000, size=161.
[  730.506627] xc2028 3-0061: Reading firmware type (0), id 800000, size=161.
[  730.506628] xc2028 3-0061: Reading firmware type (0), id 8000, size=161.
[  730.506629] xc2028 3-0061: Reading firmware type LCD (1000), id 8000, size=161.
[  730.506631] xc2028 3-0061: Reading firmware type LCD NOGD (3000), id 8000, size=161.
[  730.506632] xc2028 3-0061: Reading firmware type MTS (4), id 8000, size=169.
[  730.506633] xc2028 3-0061: Reading firmware type (0), id b700, size=161.
[  730.506635] xc2028 3-0061: Reading firmware type LCD (1000), id b700, size=161.
[  730.506636] xc2028 3-0061: Reading firmware type LCD NOGD (3000), id b700, size=161.
[  730.506637] xc2028 3-0061: Reading firmware type (0), id 2000, size=161.
[  730.506639] xc2028 3-0061: Reading firmware type MTS (4), id b700, size=169.
[  730.506640] xc2028 3-0061: Reading firmware type MTS LCD (1004), id b700, size=169.
[  730.506642] xc2028 3-0061: Reading firmware type MTS LCD NOGD (3004), id b700, size=169.
[  730.506644] xc2028 3-0061: Reading firmware type SCODE HAS_IF_3280 (60000000), id 0, size=192.
[  730.506645] xc2028 3-0061: Reading firmware type SCODE HAS_IF_3300 (60000000), id 0, size=192.
[  730.506647] xc2028 3-0061: Reading firmware type SCODE HAS_IF_3440 (60000000), id 0, size=192.
[  730.506648] xc2028 3-0061: Reading firmware type SCODE HAS_IF_3460 (60000000), id 0, size=192.
[  730.506650] xc2028 3-0061: Reading firmware type DTV6 ATSC OREN36 SCODE HAS_IF_3800 (60210020), id 0, size=192.
[  730.506652] xc2028 3-0061: Reading firmware type SCODE HAS_IF_4000 (60000000), id 0, size=192.
[  730.506654] xc2028 3-0061: Reading firmware type DTV6 ATSC TOYOTA388 SCODE HAS_IF_4080 (60410020), id 0, size=192.
[  730.506655] xc2028 3-0061: Reading firmware type SCODE HAS_IF_4200 (60000000), id 0, size=192.
[  730.506657] xc2028 3-0061: Reading firmware type MONO SCODE HAS_IF_4320 (60008000), id 8000, size=192.
[  730.506659] xc2028 3-0061: Reading firmware type SCODE HAS_IF_4450 (60000000), id 0, size=192.
[  730.506661] xc2028 3-0061: Reading firmware type MTS LCD NOGD MONO IF SCODE HAS_IF_4500 (6002b004), id b700, size=192.
[  730.506663] xc2028 3-0061: Reading firmware type LCD NOGD IF SCODE HAS_IF_4600 (60023000), id 8000, size=192.
[  730.506666] xc2028 3-0061: Reading firmware type DTV6 QAM DTV7 DTV78 DTV8 ZARLINK456 SCODE HAS_IF_4760 (620003e0), id 0, size=192.
[  730.506667] xc2028 3-0061: Reading firmware type SCODE HAS_IF_4940 (60000000), id 0, size=192.
[  730.506669] xc2028 3-0061: Reading firmware type SCODE HAS_IF_5260 (60000000), id 0, size=192.
[  730.506670] xc2028 3-0061: Reading firmware type MONO SCODE HAS_IF_5320 (60008000), id f00000007, size=192.
[  730.506673] xc2028 3-0061: Reading firmware type DTV7 DTV78 DTV8 DIBCOM52 CHINA SCODE HAS_IF_5400 (65000380), id 0, size=192.
[  730.506676] xc2028 3-0061: Reading firmware type DTV6 ATSC OREN538 SCODE HAS_IF_5580 (60110020), id 0, size=192.
[  730.506677] xc2028 3-0061: Reading firmware type SCODE HAS_IF_5640 (60000000), id 300000007, size=192.
[  730.506679] xc2028 3-0061: Reading firmware type SCODE HAS_IF_5740 (60000000), id c00000007, size=192.
[  730.506680] xc2028 3-0061: Reading firmware type SCODE HAS_IF_5900 (60000000), id 0, size=192.
[  730.506682] xc2028 3-0061: Reading firmware type MONO SCODE HAS_IF_6000 (60008000), id c04c000f0, size=192.
[  730.506684] xc2028 3-0061: Reading firmware type DTV6 QAM ATSC LG60 F6MHZ SCODE HAS_IF_6200 (68050060), id 0, size=192.
[  730.506686] xc2028 3-0061: Reading firmware type SCODE HAS_IF_6240 (60000000), id 10, size=192.
[  730.506688] xc2028 3-0061: Reading firmware type MONO SCODE HAS_IF_6320 (60008000), id 200000, size=192.
[  730.506689] xc2028 3-0061: Reading firmware type SCODE HAS_IF_6340 (60000000), id 200000, size=192.
[  730.506691] xc2028 3-0061: Reading firmware type MONO SCODE HAS_IF_6500 (60008000), id c044000e0, size=192.
[  730.506693] xc2028 3-0061: Reading firmware type DTV6 ATSC ATI638 SCODE HAS_IF_6580 (60090020), id 0, size=192.
[  730.506695] xc2028 3-0061: Reading firmware type SCODE HAS_IF_6600 (60000000), id 3000000e0, size=192.
[  730.506697] xc2028 3-0061: Reading firmware type MONO SCODE HAS_IF_6680 (60008000), id 3000000e0, size=192.
[  730.506699] xc2028 3-0061: Reading firmware type DTV6 ATSC TOYOTA794 SCODE HAS_IF_8140 (60810020), id 0, size=192.
[  730.506700] xc2028 3-0061: Reading firmware type SCODE HAS_IF_8200 (60000000), id 0, size=192.
[  730.506701] xc2028 3-0061: Firmware files loaded.
[  730.678409] em28xx #0: v4l2 driver version 0.1.3
[  730.683501] xc2028 3-0061: xc2028_set_analog_freq called
[  730.683505] xc2028 3-0061: generic_set_freq called
[  730.683507] xc2028 3-0061: should set frequency 567250 kHz
[  730.683509] xc2028 3-0061: check_firmware called
[  730.683511] xc2028 3-0061: checking firmware, user requested type=F8MHZ MTS (6), id 00000000000000ff, scode_tbl (0), scode_nr 0
[  730.716365] xc2028 3-0061: load_firmware called
[  730.716369] xc2028 3-0061: seek_firmware called, want type=BASE F8MHZ MTS (7), id 0000000000000000.
[  730.716374] xc2028 3-0061: Found firmware for type=BASE F8MHZ MTS (7), id 0000000000000000.
[  730.716378] xc2028 3-0061: Loading firmware for type=BASE F8MHZ MTS (7), id 0000000000000000.
[  731.861264] xc2028 3-0061: Load init1 firmware, if exists
[  731.861268] xc2028 3-0061: load_firmware called
[  731.861270] xc2028 3-0061: seek_firmware called, want type=BASE INIT1 F8MHZ MTS (4007), id 0000000000000000.
[  731.861276] xc2028 3-0061: Can't find firmware for type=BASE INIT1 F8MHZ MTS (4007), id 0000000000000000.
[  731.861281] xc2028 3-0061: load_firmware called
[  731.861283] xc2028 3-0061: seek_firmware called, want type=BASE INIT1 MTS (4005), id 0000000000000000.
[  731.861288] xc2028 3-0061: Can't find firmware for type=BASE INIT1 MTS (4005), id 0000000000000000.
[  731.861292] xc2028 3-0061: load_firmware called
[  731.861293] xc2028 3-0061: seek_firmware called, want type=F8MHZ MTS (6), id 00000000000000ff.
[  731.861298] xc2028 3-0061: Selecting best matching firmware (3 bits) for type=MTS (4), id 00000000000000ff:
[  731.861301] xc2028 3-0061: Found firmware for type=MTS (4), id 0000000100000007.
[  731.861304] xc2028 3-0061: Loading firmware for type=MTS (4), id 0000000100000007.
[  731.887500] xc2028 3-0061: Trying to load scode 0
[  731.887503] xc2028 3-0061: load_scode called
[  731.887505] xc2028 3-0061: seek_firmware called, want type=F8MHZ MTS SCODE (20000006), id 0000000100000007.
[  731.887511] xc2028 3-0061: Can't find firmware for type=MTS SCODE (20000004), id 0000000100000007.
[  731.887515] xc2028 3-0061: xc2028_get_reg 0004 called
[  731.888497] xc2028 3-0061: xc2028_get_reg 0008 called
[  731.889496] xc2028 3-0061: Device is Xceive 3028 version 1.0, firmware version 2.7
[  732.003679] xc2028 3-0061: divisor= 00 00 8d d0 (freq=567.250)
[  732.068097] em28xx #0: V4L2 video device registered as video0
[  732.073835] em28xx #0: V4L2 VBI device registered as vbi0
[  732.079217] xc2028 3-0061: Putting xc2028/3028 into poweroff mode.
[  732.080529] usbcore: registered new interface driver em28xx
[  732.086501] xc2028 3-0061: Putting xc2028/3028 into poweroff mode.
[  732.090205] em28xx-audio.c: probing for em28xx Audio Vendor Class
[  732.096308] em28xx-audio.c: Copyright (C) 2006 Markus Rechberger
[  732.102295] em28xx-audio.c: Copyright (C) 2007-2011 Mauro Carvalho Chehab
[  732.109507] Em28xx: Initialized (Em28xx Audio Extension) extension
[  732.119372] WARNING: You are using an experimental version of the media stack.
	As the driver is backported to an older kernel, it doesn't offer
	enough quality for its usage in production.
	Use it with care.
Latest git patches (needed if you report a bug to linux-media@vger.kernel.org):
	8e216e50ddca0550ffd477ce27e843a506b3ae2e [media] it913x [BUG] Enable endpoint 3 on devices with HID interface
	684259353666b05a148cc70dfeed8e699daedbcd [media] Add Fujitsu Siemens Amilo Pi 2530 to gspca upside down table
	a66cd0b691c730ed751dbf66ffbd0edf18241790 [media] winbond-cir: do not rename input name
[  732.328571] xc2028 3-0061: Putting xc2028/3028 into poweroff mode.
[  732.413454] xc2028: Xcv2028/3028 init called!
[  732.413458] xc2028 3-0061: attaching existing instance
[  732.418586] xc2028 3-0061: type set to XCeive xc2028/xc3028 tuner
[  732.424659] em28xx #0: em28xx #0/2: xc3028 attached
[  732.429525] DVB: registering new adapter (em28xx #0)
[  732.434539] usb 1-6: DVB: registering adapter 0 frontend 0 (LG Electronics LGDT3303 VSB/QAM Frontend)...
[  732.447070] em28xx #0: Successfully loaded em28xx-dvb
[  732.452142] Em28xx: Initialized (Em28xx dvb Extension) extension
[  732.460597] WARNING: You are using an experimental version of the media stack.
	As the driver is backported to an older kernel, it doesn't offer
	enough quality for its usage in production.
	Use it with care.
Latest git patches (needed if you report a bug to linux-media@vger.kernel.org):
	8e216e50ddca0550ffd477ce27e843a506b3ae2e [media] it913x [BUG] Enable endpoint 3 on devices with HID interface
	684259353666b05a148cc70dfeed8e699daedbcd [media] Add Fujitsu Siemens Amilo Pi 2530 to gspca upside down table
	a66cd0b691c730ed751dbf66ffbd0edf18241790 [media] winbond-cir: do not rename input name
[  732.544391] Registered IR keymap rc-hauppauge
[  732.549270] input: em28xx IR (em28xx #0) as /devices/pci0000:00/0000:00:1a.7/usb1/1-6/rc/rc0/input10
[  732.558649] rc0: em28xx IR (em28xx #0) as /devices/pci0000:00/0000:00:1a.7/usb1/1-6/rc/rc0
[  732.568394] Em28xx: Initialized (Em28xx Input Extension) extension
[  769.673455] [drm] nouveau 0000:0f:00.0: Setting dpms mode 0 on vga encoder (output 0)
[  779.605647] fuse init (API version 7.20)
[  781.388965] [drm] nouveau 0000:0f:00.0: Setting dpms mode 3 on vga encoder (output 0)
[  781.417059] [drm] nouveau 0000:0f:00.0: Setting dpms mode 0 on vga encoder (output 0)
[  781.424867] [drm] nouveau 0000:0f:00.0: Output VGA-1 is running on CRTC 0 using output A
[  798.020393] xc2028 3-0061: xc2028_get_reg 0002 called
[  798.044399] xc2028 3-0061: i2c input error: rc = -19 (should be 2)
[  798.050585] xc2028 3-0061: xc2028_signal called
[  798.050657] xc2028 3-0061: xc2028_get_reg 0002 called
[  798.075410] xc2028 3-0061: i2c input error: rc = -19 (should be 2)
[  798.081607] xc2028 3-0061: signal strength is 0
[  798.139585] xc2028 3-0061: xc2028_set_analog_freq called
[  798.139589] xc2028 3-0061: generic_set_freq called
[  798.139592] xc2028 3-0061: should set frequency 567250 kHz
[  798.139594] xc2028 3-0061: check_firmware called
[  798.139595] xc2028 3-0061: checking firmware, user requested type=F8MHZ MTS (6), id 00000000000000ff, scode_tbl (0), scode_nr 0
[  798.178937] xc2028 3-0061: load_firmware called
[  798.178942] xc2028 3-0061: seek_firmware called, want type=BASE F8MHZ MTS (7), id 0000000000000000.
[  798.178948] xc2028 3-0061: Found firmware for type=BASE F8MHZ MTS (7), id 0000000000000000.
[  798.178952] xc2028 3-0061: Loading firmware for type=BASE F8MHZ MTS (7), id 0000000000000000.
[  799.277736] xc2028 3-0061: Load init1 firmware, if exists
[  799.277740] xc2028 3-0061: load_firmware called
[  799.277742] xc2028 3-0061: seek_firmware called, want type=BASE INIT1 F8MHZ MTS (4007), id 0000000000000000.
[  799.277749] xc2028 3-0061: Can't find firmware for type=BASE INIT1 F8MHZ MTS (4007), id 0000000000000000.
[  799.277754] xc2028 3-0061: load_firmware called
[  799.277756] xc2028 3-0061: seek_firmware called, want type=BASE INIT1 MTS (4005), id 0000000000000000.
[  799.277760] xc2028 3-0061: Can't find firmware for type=BASE INIT1 MTS (4005), id 0000000000000000.
[  799.277764] xc2028 3-0061: load_firmware called
[  799.277766] xc2028 3-0061: seek_firmware called, want type=F8MHZ MTS (6), id 00000000000000ff.
[  799.277770] xc2028 3-0061: Selecting best matching firmware (3 bits) for type=MTS (4), id 00000000000000ff:
[  799.277773] xc2028 3-0061: Found firmware for type=MTS (4), id 0000000100000007.
[  799.277776] xc2028 3-0061: Loading firmware for type=MTS (4), id 0000000100000007.
[  799.303867] xc2028 3-0061: Trying to load scode 0
[  799.303870] xc2028 3-0061: load_scode called
[  799.303872] xc2028 3-0061: seek_firmware called, want type=F8MHZ MTS SCODE (20000006), id 0000000100000007.
[  799.303878] xc2028 3-0061: Can't find firmware for type=MTS SCODE (20000004), id 0000000100000007.
[  799.303882] xc2028 3-0061: xc2028_get_reg 0004 called
[  799.304845] xc2028 3-0061: xc2028_get_reg 0008 called
[  799.305878] xc2028 3-0061: Device is Xceive 3028 version 1.0, firmware version 2.7
[  799.418259] xc2028 3-0061: divisor= 00 00 8d d0 (freq=567.250)
[  799.548720] xc2028 3-0061: xc2028_set_analog_freq called
[  799.548725] xc2028 3-0061: generic_set_freq called
[  799.548727] xc2028 3-0061: should set frequency 567250 kHz
[  799.548729] xc2028 3-0061: check_firmware called
[  799.548731] xc2028 3-0061: checking firmware, user requested type=MTS (4), id 0000000000000100, scode_tbl (0), scode_nr 0
[  799.588185] xc2028 3-0061: load_firmware called
[  799.588189] xc2028 3-0061: seek_firmware called, want type=BASE MTS (5), id 0000000000000000.
[  799.588194] xc2028 3-0061: Found firmware for type=BASE MTS (5), id 0000000000000000.
[  799.588198] xc2028 3-0061: Loading firmware for type=BASE MTS (5), id 0000000000000000.
[  800.719235] xc2028 3-0061: Load init1 firmware, if exists
[  800.719240] xc2028 3-0061: load_firmware called
[  800.719242] xc2028 3-0061: seek_firmware called, want type=BASE INIT1 MTS (4005), id 0000000000000000.
[  800.719248] xc2028 3-0061: Can't find firmware for type=BASE INIT1 MTS (4005), id 0000000000000000.
[  800.719253] xc2028 3-0061: load_firmware called
[  800.719255] xc2028 3-0061: seek_firmware called, want type=BASE INIT1 MTS (4005), id 0000000000000000.
[  800.719259] xc2028 3-0061: Can't find firmware for type=BASE INIT1 MTS (4005), id 0000000000000000.
[  800.719263] xc2028 3-0061: load_firmware called
[  800.719265] xc2028 3-0061: seek_firmware called, want type=MTS (4), id 0000000000000100.
[  800.719268] xc2028 3-0061: Found firmware for type=MTS (4), id 000000000000b700.
[  800.719271] xc2028 3-0061: Loading firmware for type=MTS (4), id 000000000000b700.
[  800.745365] xc2028 3-0061: Trying to load scode 0
[  800.745368] xc2028 3-0061: load_scode called
[  800.745370] xc2028 3-0061: seek_firmware called, want type=MTS SCODE (20000004), id 000000000000b700.
[  800.745375] xc2028 3-0061: Found firmware for type=MTS SCODE (20000004), id 000000000000b700.
[  800.745379] xc2028 3-0061: Loading SCODE for type=MTS LCD NOGD MONO IF SCODE HAS_IF_4500 (6002b004), id 000000000000b700.
[  800.759139] xc2028 3-0061: xc2028_get_reg 0004 called
[  800.760235] xc2028 3-0061: xc2028_get_reg 0008 called
[  800.761212] xc2028 3-0061: Device is Xceive 3028 version 1.0, firmware version 2.7
[  800.873497] xc2028 3-0061: divisor= 00 00 8d d0 (freq=567.250)
[  800.873562] xc2028 3-0061: xc2028_set_analog_freq called
[  800.873565] xc2028 3-0061: generic_set_freq called
[  800.873568] xc2028 3-0061: should set frequency 67250 kHz
[  800.873569] xc2028 3-0061: check_firmware called
[  800.873571] xc2028 3-0061: checking firmware, user requested type=MTS (4), id 0000000000000100, scode_tbl (0), scode_nr 0
[  800.873577] xc2028 3-0061: BASE firmware not changed.
[  800.873578] xc2028 3-0061: Std-specific firmware already loaded.
[  800.873580] xc2028 3-0061: SCODE firmware already loaded.
[  800.873582] xc2028 3-0061: xc2028_get_reg 0004 called
[  800.874965] xc2028 3-0061: xc2028_get_reg 0008 called
[  800.876048] xc2028 3-0061: Device is Xceive 3028 version 1.0, firmware version 2.7
[  800.988426] xc2028 3-0061: divisor= 00 00 10 d0 (freq=67.250)
[  800.991100] xc2028 3-0061: xc2028_set_analog_freq called
[  800.991103] xc2028 3-0061: generic_set_freq called
[  800.991105] xc2028 3-0061: should set frequency 67250 kHz
[  800.991107] xc2028 3-0061: check_firmware called
[  800.991108] xc2028 3-0061: checking firmware, user requested type=MTS (4), id 0000000000000100, scode_tbl (0), scode_nr 0
[  800.991114] xc2028 3-0061: BASE firmware not changed.
[  800.991116] xc2028 3-0061: Std-specific firmware already loaded.
[  800.991117] xc2028 3-0061: SCODE firmware already loaded.
[  800.991119] xc2028 3-0061: xc2028_get_reg 0004 called
[  800.992091] xc2028 3-0061: xc2028_get_reg 0008 called
[  800.993091] xc2028 3-0061: Device is Xceive 3028 version 1.0, firmware version 2.7
[  801.105365] xc2028 3-0061: divisor= 00 00 10 d0 (freq=67.250)
[  806.140059] xc2028 3-0061: xc2028_get_reg 0002 called
[  806.141054] xc2028 3-0061: xc2028_get_reg 0001 called
[  806.142034] xc2028 3-0061: AFC is 0 Hz
[  806.142037] xc2028 3-0061: xc2028_signal called
[  806.142039] xc2028 3-0061: xc2028_get_reg 0002 called
[  806.143056] xc2028 3-0061: xc2028_get_reg 0040 called
[  806.144056] xc2028 3-0061: signal strength is 24575
[  808.181238] xc2028 3-0061: xc2028_set_analog_freq called
[  808.181242] xc2028 3-0061: generic_set_freq called
[  808.181245] xc2028 3-0061: should set frequency 67250 kHz
[  808.181247] xc2028 3-0061: check_firmware called
[  808.181249] xc2028 3-0061: checking firmware, user requested type=MTS (4), id 0000000000000100, scode_tbl (0), scode_nr 0
[  808.181254] xc2028 3-0061: BASE firmware not changed.
[  808.181256] xc2028 3-0061: Std-specific firmware already loaded.
[  808.181258] xc2028 3-0061: SCODE firmware already loaded.
[  808.181260] xc2028 3-0061: xc2028_get_reg 0004 called
[  808.182219] xc2028 3-0061: xc2028_get_reg 0008 called
[  808.183218] xc2028 3-0061: Device is Xceive 3028 version 1.0, firmware version 2.7
[  808.295515] xc2028 3-0061: divisor= 00 00 10 d0 (freq=67.250)
[  808.362457] xc2028 3-0061: Putting xc2028/3028 into poweroff mode.

It working perfectly with xawtv.

-- 
Regards,
Mauro

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/23] em28xx: add support fur USB bulk transfers
  2012-10-30  3:00         ` Mauro Carvalho Chehab
@ 2012-10-30  4:06           ` Mauro Carvalho Chehab
  2012-10-30 13:08             ` Devin Heitmueller
  2012-10-30 17:18             ` Frank Schäfer
  0 siblings, 2 replies; 48+ messages in thread
From: Mauro Carvalho Chehab @ 2012-10-30  4:06 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: Frank Schäfer, linux-media

Em Tue, 30 Oct 2012 01:00:12 -0200
Mauro Carvalho Chehab <mchehab@redhat.com> escreveu:

> Em Mon, 29 Oct 2012 23:14:55 +0200
> Frank Schäfer <fschaefer.oss@googlemail.com> escreveu:
> 
> > Am 29.10.2012 22:03, schrieb Mauro Carvalho Chehab:
> > > Em Mon, 29 Oct 2012 17:33:12 +0200
> > > Frank Schäfer <fschaefer.oss@googlemail.com> escreveu:
> > >
> > >> Am 28.10.2012 21:57, schrieb Mauro Carvalho Chehab:
> > >>> Em Sun, 21 Oct 2012 19:52:05 +0300
> > >>> Frank Schäfer <fschaefer.oss@googlemail.com> escreveu:
> > >>>
> > >>>> This patch series adds support for USB bulk transfers to the em28xx driver.
> > >>>>
> > >>>> Patch 1 is a bugfix for the image data processing with non-interlaced devices (webcams)
> > >>>> that should be considered for stable (see commit message).
> > >>>>
> > >>>> Patches 2-21 extend the driver to support USB bulk transfers.
> > >>>> USB endpoint mapping had to be extended and is a bit tricky.
> > >>>> It might still not be sufficient to handle ALL isoc/bulk endpoints of ALL existing devices,
> > >>>> but it should work with the devices we have seen so far and (most important !) 
> > >>>> preserves backwards compatibility to the current driver behavior.
> > >>>> Isoc endpoints/transfers are preffered by default, patch 21 adds a module parameter to change this behavior.
> > >>>>
> > >>>> The last two patches are follow-up patches not really related to USB tranfers.
> > >>>> Patch 22 reduces the code size in em28xx-video by merging the two URB data processing functions 
> > >>>> and patch 23 enables VBI-support for em2840-devices.
> > >>>>
> > >>>> Please note that I could test the changes with an analog non-interlaced non-VBI device only !
> > >>>> So further tests with DVB/interlaced/VBI devices are strongly recommended !
> > >>> Did a quick test here with all applied, with analog TV with xawtv and tvtime. 
> > >>> Didn't work.
> > >> Ok, thanks for testing.
> > >>
> > >>> I'll need to postpone it, until I have more time to double check it and bisect.
> > >> I would also need further informations about the test you've made (did
> > >> you enable bulk ?) and the device you used (supports VBI ?).
> > > I used a WinTV HVR-950/980. Logs enclosed.
> > >
> > > Regards,
> > > Mauro
> > 
> > Thanks.
> > Did you load the module with prefer_bulk=1 ?
> 
> No.
> 
> > You just started xawtv/tvtime but got no picture, right ?
> 
> Yes. I tested also v4l2grab. No frames got returned there.
> 
> > 
> > There is nothing unusual in the log, except...
> > 
> > ...
> > > [ 8412.464698] xc2028 3-0061: Can't find firmware for type=BASE INIT1 F8MHZ MTS (4007), id 0000000000000000.
> > ...
> > > [ 8412.464709] xc2028 3-0061: Can't find firmware for type=BASE INIT1 MTS (4005), id 0000000000000000.
> > ...
> 
> Those are normal. AFAIKT, only firmwares < version 2.0 had init broken into
> INIT0 and INIT1.
> 
> > > [ 8412.490804] xc2028 3-0061: Can't find firmware for type=MTS SCODE (20000004), id 0000000100000007.
> 
> This is ok, as another similar SCODE firmware got loaded.
> 
> > 
> > and
> > 
> > ...
> > > [ 8454.966006] xc2028 3-0061: xc2028_get_reg 0002 called
> > > [ 8454.990113] xc2028 3-0061: i2c input error: rc = -19 (should be 2)
> > > [ 8454.996282] xc2028 3-0061: xc2028_signal called
> > > [ 8454.997656] xc2028 3-0061: xc2028_get_reg 0002 called
> > > [ 8455.021846] xc2028 3-0061: i2c input error: rc = -19 (should be 2)
> 
> Those are weird. In any case, as far as I remember, even if xc3028 is bad tuned,
> em28xx should be outputing some data. I suspect, however, that those errors
> maybe because the em28xx chip has died already.
> 
> > 
> > Are these errors normal ?
> > Are you sure the device is working properly without my patches ?
> 
> Yes. See below.
> 
> > 
> > You could try to load the em28xx module with usb_debug=1.
> 
> I'll post it on a separate email.
> 

Did a git bisect. The last patch where the bug doesn't occur is this 
changeset:
	em28xx: add module parameter for selection of the preferred USB transfer type

That means that this changeset broke it:

	em28xx: use common urb data copying function for vbi and non-vbi devices

I didn't test them with my Silvercrest webcam yet.

I hope that helps.

Regards,
Mauro

PS.: Logs of the latest working driver is enclosed.


[ 4658.112071] media: Linux media interface: v0.10
[ 4658.118615] Linux video capture interface: v2.00
[ 4658.123229] WARNING: You are using an experimental version of the media stack.
	As the driver is backported to an older kernel, it doesn't offer
	enough quality for its usage in production.
	Use it with care.
Latest git patches (needed if you report a bug to linux-media@vger.kernel.org):
	d259aec2578fe66c43ae89ef65735fa7b70fa948 [media] em28xx: add module parameter for selection of the preferred USB transfer type
	2c930ac7e1aa0c8181d5d283e4cb5de69b8121d5 [media] em28xx: improve USB endpoint logic, also use bulk transfers
	6b43cf6a235d564487fd10d73d8c377d4d6bafff [media] em28xx: set USB alternate settings for analog video bulk transfers properly
[ 4658.192384] em28xx: New device  WinTV HVR-980 @ 480 Mbps (2040:6513, interface 0, class 0)
[ 4658.200654] em28xx: Audio Vendor Class interface 0 found
[ 4658.205957] em28xx: Video interface 0 found
[ 4658.210133] em28xx: DVB interface 0 found
[ 4658.214178] em28xx #0: chip ID is em2882/em2883
[ 4658.361126] em28xx #0: i2c eeprom 00: 1a eb 67 95 40 20 13 65 d0 12 5c 03 82 1e 6a 18
[ 4658.369192] em28xx #0: i2c eeprom 10: 00 00 24 57 66 07 01 00 00 00 00 00 00 00 00 00
[ 4658.377234] em28xx #0: i2c eeprom 20: 46 00 01 00 f0 10 02 00 b8 00 00 00 5b 1c 00 00
[ 4658.385334] em28xx #0: i2c eeprom 30: 00 00 20 40 20 80 02 20 01 01 01 01 00 00 00 00
[ 4658.393444] em28xx #0: i2c eeprom 40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 4658.401638] em28xx #0: i2c eeprom 50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 4658.409788] em28xx #0: i2c eeprom 60: 00 00 00 00 00 00 00 00 00 00 18 03 34 00 30 00
[ 4658.417909] em28xx #0: i2c eeprom 70: 32 00 38 00 34 00 34 00 39 00 30 00 31 00 38 00
[ 4658.425992] em28xx #0: i2c eeprom 80: 00 00 1e 03 57 00 69 00 6e 00 54 00 56 00 20 00
[ 4658.434026] em28xx #0: i2c eeprom 90: 48 00 56 00 52 00 2d 00 39 00 38 00 30 00 00 00
[ 4658.442100] em28xx #0: i2c eeprom a0: 84 12 00 00 05 50 1a 7f d4 78 23 b1 fe d0 18 85
[ 4658.450227] em28xx #0: i2c eeprom b0: ff 00 00 00 04 84 0a 00 01 01 20 77 00 40 fa 40
[ 4658.458311] em28xx #0: i2c eeprom c0: 1d f0 74 02 01 00 01 79 4f 00 00 00 00 00 00 00
[ 4658.466409] em28xx #0: i2c eeprom d0: 84 12 00 00 05 50 1a 7f d4 78 23 b1 fe d0 18 85
[ 4658.474500] em28xx #0: i2c eeprom e0: ff 00 00 00 04 84 0a 00 01 01 20 77 00 40 fa 40
[ 4658.482585] em28xx #0: i2c eeprom f0: 1d f0 74 02 01 00 01 79 4f 00 00 00 00 00 00 00
[ 4658.490566] em28xx #0: EEPROM ID= 0x9567eb1a, EEPROM hash = 0x994b2bdd
[ 4658.497081] em28xx #0: EEPROM info:
[ 4658.500564] em28xx #0:	AC97 audio (5 sample rates)
[ 4658.505346] em28xx #0:	500mA max power
[ 4658.509087] em28xx #0:	Table at 0x24, strings=0x1e82, 0x186a, 0x0000
[ 4658.515433] em28xx #0: Identified as Hauppauge WinTV HVR 950 (card=16)
[ 4658.525141] tveeprom 3-0050: Hauppauge model 65201, rev A1C0, serial# 1917178
[ 4658.532283] tveeprom 3-0050: tuner model is Xceive XC3028 (idx 120, type 71)
[ 4658.539312] tveeprom 3-0050: TV standards PAL(B/G) PAL(I) PAL(D/D1/K) ATSC/DVB Digital (eeprom 0xd4)
[ 4658.548426] tveeprom 3-0050: audio processor is None (idx 0)
[ 4658.554069] tveeprom 3-0050: has radio
[ 4658.606748] tvp5150 3-005c: chip found @ 0xb8 (em28xx #0)
[ 4658.612155] tvp5150 3-005c: tvp5150am1 detected.
[ 4658.636054] tuner 3-0061: Tuner -1 found with type(s) Radio TV.
[ 4658.643381] xc2028: Xcv2028/3028 init called!
[ 4658.643384] xc2028 3-0061: creating new instance
[ 4658.647993] xc2028 3-0061: type set to XCeive xc2028/xc3028 tuner
[ 4658.654089] xc2028 3-0061: xc2028_set_config called
[ 4658.654102] xc2028 3-0061: xc2028_set_analog_freq called
[ 4658.654104] xc2028 3-0061: generic_set_freq called
[ 4658.654105] xc2028 3-0061: should set frequency 567250 kHz
[ 4658.654106] xc2028 3-0061: check_firmware called
[ 4658.655153] em28xx #0: Config register raw data: 0xd0
[ 4658.660914] xc2028 3-0061: request_firmware_nowait(): OK
[ 4658.660917] xc2028 3-0061: load_all_firmwares called
[ 4658.660919] xc2028 3-0061: Loading 80 firmware images from xc3028-v27.fw, type: xc2028 firmware, ver 2.7
[ 4658.670417] xc2028 3-0061: Reading firmware type BASE F8MHZ (3), id 0, size=8718.
[ 4658.670424] xc2028 3-0061: Reading firmware type BASE F8MHZ MTS (7), id 0, size=8712.
[ 4658.670430] xc2028 3-0061: Reading firmware type BASE FM (401), id 0, size=8562.
[ 4658.670436] xc2028 3-0061: Reading firmware type BASE FM INPUT1 (c01), id 0, size=8576.
[ 4658.670441] xc2028 3-0061: Reading firmware type BASE (1), id 0, size=8706.
[ 4658.670446] xc2028 3-0061: Reading firmware type BASE MTS (5), id 0, size=8682.
[ 4658.670451] xc2028 3-0061: Reading firmware type (0), id 100000007, size=161.
[ 4658.670453] xc2028 3-0061: Reading firmware type MTS (4), id 100000007, size=169.
[ 4658.670455] xc2028 3-0061: Reading firmware type (0), id 200000007, size=161.
[ 4658.670457] xc2028 3-0061: Reading firmware type MTS (4), id 200000007, size=169.
[ 4658.670459] xc2028 3-0061: Reading firmware type (0), id 400000007, size=161.
[ 4658.670460] xc2028 3-0061: Reading firmware type MTS (4), id 400000007, size=169.
[ 4658.670462] xc2028 3-0061: Reading firmware type (0), id 800000007, size=161.
[ 4658.670464] xc2028 3-0061: Reading firmware type MTS (4), id 800000007, size=169.
[ 4658.670467] xc2028 3-0061: Reading firmware type (0), id 3000000e0, size=161.
[ 4658.670469] xc2028 3-0061: Reading firmware type MTS (4), id 3000000e0, size=169.
[ 4658.670471] xc2028 3-0061: Reading firmware type (0), id c000000e0, size=161.
[ 4658.670472] xc2028 3-0061: Reading firmware type MTS (4), id c000000e0, size=169.
[ 4658.670474] xc2028 3-0061: Reading firmware type (0), id 200000, size=161.
[ 4658.670476] xc2028 3-0061: Reading firmware type MTS (4), id 200000, size=169.
[ 4658.670478] xc2028 3-0061: Reading firmware type (0), id 4000000, size=161.
[ 4658.670480] xc2028 3-0061: Reading firmware type MTS (4), id 4000000, size=169.
[ 4658.670481] xc2028 3-0061: Reading firmware type D2633 DTV6 ATSC (10030), id 0, size=149.
[ 4658.670485] xc2028 3-0061: Reading firmware type D2620 DTV6 QAM (68), id 0, size=149.
[ 4658.670488] xc2028 3-0061: Reading firmware type D2633 DTV6 QAM (70), id 0, size=149.
[ 4658.670491] xc2028 3-0061: Reading firmware type D2620 DTV7 (88), id 0, size=149.
[ 4658.670493] xc2028 3-0061: Reading firmware type D2633 DTV7 (90), id 0, size=149.
[ 4658.670495] xc2028 3-0061: Reading firmware type D2620 DTV78 (108), id 0, size=149.
[ 4658.670499] xc2028 3-0061: Reading firmware type D2633 DTV78 (110), id 0, size=149.
[ 4658.670501] xc2028 3-0061: Reading firmware type D2620 DTV8 (208), id 0, size=149.
[ 4658.670503] xc2028 3-0061: Reading firmware type D2633 DTV8 (210), id 0, size=149.
[ 4658.670506] xc2028 3-0061: Reading firmware type FM (400), id 0, size=135.
[ 4658.670508] xc2028 3-0061: Reading firmware type (0), id 10, size=161.
[ 4658.670510] xc2028 3-0061: Reading firmware type MTS (4), id 10, size=169.
[ 4658.670513] xc2028 3-0061: Reading firmware type (0), id 1000400000, size=169.
[ 4658.670514] xc2028 3-0061: Reading firmware type (0), id c00400000, size=161.
[ 4658.670516] xc2028 3-0061: Reading firmware type (0), id 800000, size=161.
[ 4658.670518] xc2028 3-0061: Reading firmware type (0), id 8000, size=161.
[ 4658.670519] xc2028 3-0061: Reading firmware type LCD (1000), id 8000, size=161.
[ 4658.670521] xc2028 3-0061: Reading firmware type LCD NOGD (3000), id 8000, size=161.
[ 4658.670525] xc2028 3-0061: Reading firmware type MTS (4), id 8000, size=169.
[ 4658.670527] xc2028 3-0061: Reading firmware type (0), id b700, size=161.
[ 4658.670529] xc2028 3-0061: Reading firmware type LCD (1000), id b700, size=161.
[ 4658.670531] xc2028 3-0061: Reading firmware type LCD NOGD (3000), id b700, size=161.
[ 4658.670533] xc2028 3-0061: Reading firmware type (0), id 2000, size=161.
[ 4658.670535] xc2028 3-0061: Reading firmware type MTS (4), id b700, size=169.
[ 4658.670538] xc2028 3-0061: Reading firmware type MTS LCD (1004), id b700, size=169.
[ 4658.670540] xc2028 3-0061: Reading firmware type MTS LCD NOGD (3004), id b700, size=169.
[ 4658.670543] xc2028 3-0061: Reading firmware type SCODE HAS_IF_3280 (60000000), id 0, size=192.
[ 4658.670546] xc2028 3-0061: Reading firmware type SCODE HAS_IF_3300 (60000000), id 0, size=192.
[ 4658.670549] xc2028 3-0061: Reading firmware type SCODE HAS_IF_3440 (60000000), id 0, size=192.
[ 4658.670551] xc2028 3-0061: Reading firmware type SCODE HAS_IF_3460 (60000000), id 0, size=192.
[ 4658.670554] xc2028 3-0061: Reading firmware type DTV6 ATSC OREN36 SCODE HAS_IF_3800 (60210020), id 0, size=192.
[ 4658.670557] xc2028 3-0061: Reading firmware type SCODE HAS_IF_4000 (60000000), id 0, size=192.
[ 4658.670560] xc2028 3-0061: Reading firmware type DTV6 ATSC TOYOTA388 SCODE HAS_IF_4080 (60410020), id 0, size=192.
[ 4658.670564] xc2028 3-0061: Reading firmware type SCODE HAS_IF_4200 (60000000), id 0, size=192.
[ 4658.670566] xc2028 3-0061: Reading firmware type MONO SCODE HAS_IF_4320 (60008000), id 8000, size=192.
[ 4658.670569] xc2028 3-0061: Reading firmware type SCODE HAS_IF_4450 (60000000), id 0, size=192.
[ 4658.670572] xc2028 3-0061: Reading firmware type MTS LCD NOGD MONO IF SCODE HAS_IF_4500 (6002b004), id b700, size=192.
[ 4658.670576] xc2028 3-0061: Reading firmware type LCD NOGD IF SCODE HAS_IF_4600 (60023000), id 8000, size=192.
[ 4658.670579] xc2028 3-0061: Reading firmware type DTV6 QAM DTV7 DTV78 DTV8 ZARLINK456 SCODE HAS_IF_4760 (620003e0), id 0, size=192.
[ 4658.670584] xc2028 3-0061: Reading firmware type SCODE HAS_IF_4940 (60000000), id 0, size=192.
[ 4658.670587] xc2028 3-0061: Reading firmware type SCODE HAS_IF_5260 (60000000), id 0, size=192.
[ 4658.670589] xc2028 3-0061: Reading firmware type MONO SCODE HAS_IF_5320 (60008000), id f00000007, size=192.
[ 4658.670592] xc2028 3-0061: Reading firmware type DTV7 DTV78 DTV8 DIBCOM52 CHINA SCODE HAS_IF_5400 (65000380), id 0, size=192.
[ 4658.670596] xc2028 3-0061: Reading firmware type DTV6 ATSC OREN538 SCODE HAS_IF_5580 (60110020), id 0, size=192.
[ 4658.670599] xc2028 3-0061: Reading firmware type SCODE HAS_IF_5640 (60000000), id 300000007, size=192.
[ 4658.670602] xc2028 3-0061: Reading firmware type SCODE HAS_IF_5740 (60000000), id c00000007, size=192.
[ 4658.670605] xc2028 3-0061: Reading firmware type SCODE HAS_IF_5900 (60000000), id 0, size=192.
[ 4658.670607] xc2028 3-0061: Reading firmware type MONO SCODE HAS_IF_6000 (60008000), id c04c000f0, size=192.
[ 4658.670609] xc2028 3-0061: Reading firmware type DTV6 QAM ATSC LG60 F6MHZ SCODE HAS_IF_6200 (68050060), id 0, size=192.
[ 4658.670613] xc2028 3-0061: Reading firmware type SCODE HAS_IF_6240 (60000000), id 10, size=192.
[ 4658.670616] xc2028 3-0061: Reading firmware type MONO SCODE HAS_IF_6320 (60008000), id 200000, size=192.
[ 4658.670618] xc2028 3-0061: Reading firmware type SCODE HAS_IF_6340 (60000000), id 200000, size=192.
[ 4658.670621] xc2028 3-0061: Reading firmware type MONO SCODE HAS_IF_6500 (60008000), id c044000e0, size=192.
[ 4658.670623] xc2028 3-0061: Reading firmware type DTV6 ATSC ATI638 SCODE HAS_IF_6580 (60090020), id 0, size=192.
[ 4658.670626] xc2028 3-0061: Reading firmware type SCODE HAS_IF_6600 (60000000), id 3000000e0, size=192.
[ 4658.670629] xc2028 3-0061: Reading firmware type MONO SCODE HAS_IF_6680 (60008000), id 3000000e0, size=192.
[ 4658.670632] xc2028 3-0061: Reading firmware type DTV6 ATSC TOYOTA794 SCODE HAS_IF_8140 (60810020), id 0, size=192.
[ 4658.670636] xc2028 3-0061: Reading firmware type SCODE HAS_IF_8200 (60000000), id 0, size=192.
[ 4658.670639] xc2028 3-0061: Firmware files loaded.
[ 4658.671468] em28xx #0: AC97 vendor ID = 0xffffffff
[ 4658.677461] em28xx #0: AC97 features = 0x6a90
[ 4658.681817] em28xx #0: Empia 202 AC97 audio processor detected
[ 4658.844996] em28xx #0: v4l2 driver version 0.1.3
[ 4658.850119] xc2028 3-0061: xc2028_set_analog_freq called
[ 4658.850123] xc2028 3-0061: generic_set_freq called
[ 4658.850125] xc2028 3-0061: should set frequency 567250 kHz
[ 4658.850127] xc2028 3-0061: check_firmware called
[ 4658.850129] xc2028 3-0061: checking firmware, user requested type=F8MHZ MTS (6), id 00000000000000ff, scode_tbl (0), scode_nr 0
[ 4658.883049] xc2028 3-0061: load_firmware called
[ 4658.883053] xc2028 3-0061: seek_firmware called, want type=BASE F8MHZ MTS (7), id 0000000000000000.
[ 4658.883058] xc2028 3-0061: Found firmware for type=BASE F8MHZ MTS (7), id 0000000000000000.
[ 4658.883063] xc2028 3-0061: Loading firmware for type=BASE F8MHZ MTS (7), id 0000000000000000.
[ 4660.005871] xc2028 3-0061: Load init1 firmware, if exists
[ 4660.005875] xc2028 3-0061: load_firmware called
[ 4660.005878] xc2028 3-0061: seek_firmware called, want type=BASE INIT1 F8MHZ MTS (4007), id 0000000000000000.
[ 4660.005884] xc2028 3-0061: Can't find firmware for type=BASE INIT1 F8MHZ MTS (4007), id 0000000000000000.
[ 4660.005890] xc2028 3-0061: load_firmware called
[ 4660.005891] xc2028 3-0061: seek_firmware called, want type=BASE INIT1 MTS (4005), id 0000000000000000.
[ 4660.005896] xc2028 3-0061: Can't find firmware for type=BASE INIT1 MTS (4005), id 0000000000000000.
[ 4660.005900] xc2028 3-0061: load_firmware called
[ 4660.005902] xc2028 3-0061: seek_firmware called, want type=F8MHZ MTS (6), id 00000000000000ff.
[ 4660.005906] xc2028 3-0061: Selecting best matching firmware (3 bits) for type=MTS (4), id 00000000000000ff:
[ 4660.005909] xc2028 3-0061: Found firmware for type=MTS (4), id 0000000100000007.
[ 4660.005912] xc2028 3-0061: Loading firmware for type=MTS (4), id 0000000100000007.
[ 4660.032132] xc2028 3-0061: Trying to load scode 0
[ 4660.032136] xc2028 3-0061: load_scode called
[ 4660.032138] xc2028 3-0061: seek_firmware called, want type=F8MHZ MTS SCODE (20000006), id 0000000100000007.
[ 4660.032144] xc2028 3-0061: Can't find firmware for type=MTS SCODE (20000004), id 0000000100000007.
[ 4660.032148] xc2028 3-0061: xc2028_get_reg 0004 called
[ 4660.033125] xc2028 3-0061: xc2028_get_reg 0008 called
[ 4660.034125] xc2028 3-0061: Device is Xceive 3028 version 1.0, firmware version 2.7
[ 4660.146418] xc2028 3-0061: divisor= 00 00 8d d0 (freq=567.250)
[ 4660.211039] em28xx #0: V4L2 video device registered as video0
[ 4660.216790] em28xx #0: V4L2 VBI device registered as vbi0
[ 4660.222176] xc2028 3-0061: Putting xc2028/3028 into poweroff mode.
[ 4660.223495] usbcore: registered new interface driver em28xx
[ 4660.232396] em28xx-audio.c: probing for em28xx Audio Vendor Class
[ 4660.238494] em28xx-audio.c: Copyright (C) 2006 Markus Rechberger
[ 4660.244484] em28xx-audio.c: Copyright (C) 2007-2011 Mauro Carvalho Chehab
[ 4660.251461] Em28xx: Initialized (Em28xx Audio Extension) extension
[ 4660.260023] WARNING: You are using an experimental version of the media stack.
	As the driver is backported to an older kernel, it doesn't offer
	enough quality for its usage in production.
	Use it with care.
Latest git patches (needed if you report a bug to linux-media@vger.kernel.org):
	d259aec2578fe66c43ae89ef65735fa7b70fa948 [media] em28xx: add module parameter for selection of the preferred USB transfer type
	2c930ac7e1aa0c8181d5d283e4cb5de69b8121d5 [media] em28xx: improve USB endpoint logic, also use bulk transfers
	6b43cf6a235d564487fd10d73d8c377d4d6bafff [media] em28xx: set USB alternate settings for analog video bulk transfers properly
[ 4660.454482] xc2028 3-0061: Putting xc2028/3028 into poweroff mode.
[ 4660.521856] xc2028: Xcv2028/3028 init called!
[ 4660.521862] xc2028 3-0061: attaching existing instance
[ 4660.527023] xc2028 3-0061: type set to XCeive xc2028/xc3028 tuner
[ 4660.533123] em28xx #0: em28xx #0/2: xc3028 attached
[ 4660.538023] DVB: registering new adapter (em28xx #0)
[ 4660.543012] usb 1-6: DVB: registering adapter 0 frontend 0 (LG Electronics LGDT3303 VSB/QAM Frontend)...
[ 4660.553173] em28xx #0: Successfully loaded em28xx-dvb
[ 4660.558234] Em28xx: Initialized (Em28xx dvb Extension) extension
[ 4660.577432] WARNING: You are using an experimental version of the media stack.
	As the driver is backported to an older kernel, it doesn't offer
	enough quality for its usage in production.
	Use it with care.
Latest git patches (needed if you report a bug to linux-media@vger.kernel.org):
	d259aec2578fe66c43ae89ef65735fa7b70fa948 [media] em28xx: add module parameter for selection of the preferred USB transfer type
	2c930ac7e1aa0c8181d5d283e4cb5de69b8121d5 [media] em28xx: improve USB endpoint logic, also use bulk transfers
	6b43cf6a235d564487fd10d73d8c377d4d6bafff [media] em28xx: set USB alternate settings for analog video bulk transfers properly
[ 4660.670144] Registered IR keymap rc-hauppauge
[ 4660.674637] input: em28xx IR (em28xx #0) as /devices/pci0000:00/0000:00:1a.7/usb1/1-6/rc/rc0/input19
[ 4660.684089] rc0: em28xx IR (em28xx #0) as /devices/pci0000:00/0000:00:1a.7/usb1/1-6/rc/rc0
[ 4660.697886] Em28xx: Initialized (Em28xx Input Extension) extension
[ 4672.157416] xc2028 3-0061: xc2028_get_reg 0002 called
[ 4672.181327] xc2028 3-0061: i2c input error: rc = -19 (should be 2)
[ 4672.187513] xc2028 3-0061: xc2028_signal called
[ 4672.187662] xc2028 3-0061: xc2028_get_reg 0002 called
[ 4672.212286] xc2028 3-0061: i2c input error: rc = -19 (should be 2)
[ 4672.218475] xc2028 3-0061: signal strength is 0
[ 4672.285133] xc2028 3-0061: xc2028_set_analog_freq called
[ 4672.285137] xc2028 3-0061: generic_set_freq called
[ 4672.285138] xc2028 3-0061: should set frequency 567250 kHz
[ 4672.285139] xc2028 3-0061: check_firmware called
[ 4672.285140] xc2028 3-0061: checking firmware, user requested type=F8MHZ MTS (6), id 00000000000000ff, scode_tbl (0), scode_nr 0
[ 4672.324934] xc2028 3-0061: load_firmware called
[ 4672.324938] xc2028 3-0061: seek_firmware called, want type=BASE F8MHZ MTS (7), id 0000000000000000.
[ 4672.324944] xc2028 3-0061: Found firmware for type=BASE F8MHZ MTS (7), id 0000000000000000.
[ 4672.324949] xc2028 3-0061: Loading firmware for type=BASE F8MHZ MTS (7), id 0000000000000000.
[ 4673.463009] xc2028 3-0061: Load init1 firmware, if exists
[ 4673.463013] xc2028 3-0061: load_firmware called
[ 4673.463016] xc2028 3-0061: seek_firmware called, want type=BASE INIT1 F8MHZ MTS (4007), id 0000000000000000.
[ 4673.463023] xc2028 3-0061: Can't find firmware for type=BASE INIT1 F8MHZ MTS (4007), id 0000000000000000.
[ 4673.463028] xc2028 3-0061: load_firmware called
[ 4673.463030] xc2028 3-0061: seek_firmware called, want type=BASE INIT1 MTS (4005), id 0000000000000000.
[ 4673.463034] xc2028 3-0061: Can't find firmware for type=BASE INIT1 MTS (4005), id 0000000000000000.
[ 4673.463038] xc2028 3-0061: load_firmware called
[ 4673.463040] xc2028 3-0061: seek_firmware called, want type=F8MHZ MTS (6), id 00000000000000ff.
[ 4673.463045] xc2028 3-0061: Selecting best matching firmware (3 bits) for type=MTS (4), id 00000000000000ff:
[ 4673.463048] xc2028 3-0061: Found firmware for type=MTS (4), id 0000000100000007.
[ 4673.463051] xc2028 3-0061: Loading firmware for type=MTS (4), id 0000000100000007.
[ 4673.489121] xc2028 3-0061: Trying to load scode 0
[ 4673.489125] xc2028 3-0061: load_scode called
[ 4673.489127] xc2028 3-0061: seek_firmware called, want type=F8MHZ MTS SCODE (20000006), id 0000000100000007.
[ 4673.489133] xc2028 3-0061: Can't find firmware for type=MTS SCODE (20000004), id 0000000100000007.
[ 4673.489138] xc2028 3-0061: xc2028_get_reg 0004 called
[ 4673.490114] xc2028 3-0061: xc2028_get_reg 0008 called
[ 4673.491118] xc2028 3-0061: Device is Xceive 3028 version 1.0, firmware version 2.7
[ 4673.603232] xc2028 3-0061: divisor= 00 00 8d d0 (freq=567.250)
[ 4673.735595] xc2028 3-0061: xc2028_set_analog_freq called
[ 4673.735599] xc2028 3-0061: generic_set_freq called
[ 4673.735602] xc2028 3-0061: should set frequency 567250 kHz
[ 4673.735604] xc2028 3-0061: check_firmware called
[ 4673.735605] xc2028 3-0061: checking firmware, user requested type=MTS (4), id 0000000000000100, scode_tbl (0), scode_nr 0
[ 4673.775203] xc2028 3-0061: load_firmware called
[ 4673.775208] xc2028 3-0061: seek_firmware called, want type=BASE MTS (5), id 0000000000000000.
[ 4673.775213] xc2028 3-0061: Found firmware for type=BASE MTS (5), id 0000000000000000.
[ 4673.775217] xc2028 3-0061: Loading firmware for type=BASE MTS (5), id 0000000000000000.
[ 4674.905886] xc2028 3-0061: Load init1 firmware, if exists
[ 4674.905890] xc2028 3-0061: load_firmware called
[ 4674.905891] xc2028 3-0061: seek_firmware called, want type=BASE INIT1 MTS (4005), id 0000000000000000.
[ 4674.905895] xc2028 3-0061: Can't find firmware for type=BASE INIT1 MTS (4005), id 0000000000000000.
[ 4674.905898] xc2028 3-0061: load_firmware called
[ 4674.905899] xc2028 3-0061: seek_firmware called, want type=BASE INIT1 MTS (4005), id 0000000000000000.
[ 4674.905902] xc2028 3-0061: Can't find firmware for type=BASE INIT1 MTS (4005), id 0000000000000000.
[ 4674.905905] xc2028 3-0061: load_firmware called
[ 4674.905906] xc2028 3-0061: seek_firmware called, want type=MTS (4), id 0000000000000100.
[ 4674.905908] xc2028 3-0061: Found firmware for type=MTS (4), id 000000000000b700.
[ 4674.905910] xc2028 3-0061: Loading firmware for type=MTS (4), id 000000000000b700.
[ 4674.932253] xc2028 3-0061: Trying to load scode 0
[ 4674.932256] xc2028 3-0061: load_scode called
[ 4674.932258] xc2028 3-0061: seek_firmware called, want type=MTS SCODE (20000004), id 000000000000b700.
[ 4674.932262] xc2028 3-0061: Found firmware for type=MTS SCODE (20000004), id 000000000000b700.
[ 4674.932265] xc2028 3-0061: Loading SCODE for type=MTS LCD NOGD MONO IF SCODE HAS_IF_4500 (6002b004), id 000000000000b700.
[ 4674.946107] xc2028 3-0061: xc2028_get_reg 0004 called
[ 4674.947106] xc2028 3-0061: xc2028_get_reg 0008 called
[ 4674.948084] xc2028 3-0061: Device is Xceive 3028 version 1.0, firmware version 2.7
[ 4675.060498] xc2028 3-0061: divisor= 00 00 8d d0 (freq=567.250)
[ 4675.060566] xc2028 3-0061: xc2028_set_analog_freq called
[ 4675.060568] xc2028 3-0061: generic_set_freq called
[ 4675.060569] xc2028 3-0061: should set frequency 67250 kHz
[ 4675.060570] xc2028 3-0061: check_firmware called
[ 4675.060572] xc2028 3-0061: checking firmware, user requested type=MTS (4), id 0000000000000100, scode_tbl (0), scode_nr 0
[ 4675.060575] xc2028 3-0061: BASE firmware not changed.
[ 4675.060577] xc2028 3-0061: Std-specific firmware already loaded.
[ 4675.060578] xc2028 3-0061: SCODE firmware already loaded.
[ 4675.060579] xc2028 3-0061: xc2028_get_reg 0004 called
[ 4675.062036] xc2028 3-0061: xc2028_get_reg 0008 called
[ 4675.063047] xc2028 3-0061: Device is Xceive 3028 version 1.0, firmware version 2.7
[ 4675.175446] xc2028 3-0061: divisor= 00 00 10 d0 (freq=67.250)
[ 4675.178098] xc2028 3-0061: xc2028_set_analog_freq called
[ 4675.178102] xc2028 3-0061: generic_set_freq called
[ 4675.178104] xc2028 3-0061: should set frequency 67250 kHz
[ 4675.178106] xc2028 3-0061: check_firmware called
[ 4675.178108] xc2028 3-0061: checking firmware, user requested type=MTS (4), id 0000000000000100, scode_tbl (0), scode_nr 0
[ 4675.178114] xc2028 3-0061: BASE firmware not changed.
[ 4675.178115] xc2028 3-0061: Std-specific firmware already loaded.
[ 4675.178117] xc2028 3-0061: SCODE firmware already loaded.
[ 4675.178119] xc2028 3-0061: xc2028_get_reg 0004 called
[ 4675.179213] xc2028 3-0061: xc2028_get_reg 0008 called
[ 4675.180221] xc2028 3-0061: Device is Xceive 3028 version 1.0, firmware version 2.7
[ 4675.292362] xc2028 3-0061: divisor= 00 00 10 d0 (freq=67.250)
[ 4677.622717] xc2028 3-0061: xc2028_set_analog_freq called
[ 4677.622722] xc2028 3-0061: generic_set_freq called
[ 4677.622725] xc2028 3-0061: should set frequency 67250 kHz
[ 4677.622726] xc2028 3-0061: check_firmware called
[ 4677.622728] xc2028 3-0061: checking firmware, user requested type=MTS (4), id 0000000000000100, scode_tbl (0), scode_nr 0
[ 4677.622734] xc2028 3-0061: BASE firmware not changed.
[ 4677.622736] xc2028 3-0061: Std-specific firmware already loaded.
[ 4677.622738] xc2028 3-0061: SCODE firmware already loaded.
[ 4677.622740] xc2028 3-0061: xc2028_get_reg 0004 called
[ 4677.623940] xc2028 3-0061: xc2028_get_reg 0008 called
[ 4677.624940] xc2028 3-0061: Device is Xceive 3028 version 1.0, firmware version 2.7
[ 4677.737991] xc2028 3-0061: divisor= 00 00 10 d0 (freq=67.250)
[ 4677.798357] xc2028 3-0061: Putting xc2028/3028 into poweroff mode.


-- 
Regards,
Mauro

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/23] em28xx: add support fur USB bulk transfers
  2012-10-30  4:06           ` Mauro Carvalho Chehab
@ 2012-10-30 13:08             ` Devin Heitmueller
  2012-10-30 14:03               ` Mauro Carvalho Chehab
  2012-10-30 17:29               ` Frank Schäfer
  2012-10-30 17:18             ` Frank Schäfer
  1 sibling, 2 replies; 48+ messages in thread
From: Devin Heitmueller @ 2012-10-30 13:08 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: Frank Schäfer, linux-media

On Tue, Oct 30, 2012 at 12:06 AM, Mauro Carvalho Chehab
<mchehab@redhat.com> wrote:
> Did a git bisect. The last patch where the bug doesn't occur is this
> changeset:
>         em28xx: add module parameter for selection of the preferred USB transfer type
>
> That means that this changeset broke it:
>
>         em28xx: use common urb data copying function for vbi and non-vbi devices

Oh good, when I saw the subject line for that patch, I got worried.
Looking at the patch, it seems like he just calls the VBI version for
both cases assuming the VBI version is a complete superset of the
non-VBI version, which it is clearly not.

That whole patch should just be reverted.  If he's going to spend the
time to refactor the code to allow the VBI version to be used for both
then fine, but blindly calling the VBI version without making real
code changes is *NOT* going to work.

Frank, good job in naming your patch - it made me scream "WAIT!" when
I saw it.  Bad job for blindly submitting a code change without any
idea whether it actually worked.  ;-)

I know developers have the tendency to look at code and say "oh,
that's ugly, I should change that."  However it's more important that
it actually work than it be pretty.

Devin

-- 
Devin J. Heitmueller - Kernel Labs
http://www.kernellabs.com

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/23] em28xx: add support fur USB bulk transfers
  2012-10-30 13:08             ` Devin Heitmueller
@ 2012-10-30 14:03               ` Mauro Carvalho Chehab
  2012-10-30 17:29               ` Frank Schäfer
  1 sibling, 0 replies; 48+ messages in thread
From: Mauro Carvalho Chehab @ 2012-10-30 14:03 UTC (permalink / raw)
  To: Devin Heitmueller; +Cc: Frank Schäfer, linux-media

Em Tue, 30 Oct 2012 09:08:15 -0400
Devin Heitmueller <dheitmueller@kernellabs.com> escreveu:

> On Tue, Oct 30, 2012 at 12:06 AM, Mauro Carvalho Chehab
> <mchehab@redhat.com> wrote:
> > Did a git bisect. The last patch where the bug doesn't occur is this
> > changeset:
> >         em28xx: add module parameter for selection of the preferred USB transfer type
> >
> > That means that this changeset broke it:
> >
> >         em28xx: use common urb data copying function for vbi and non-vbi devices
> 
> Oh good, when I saw the subject line for that patch, I got worried.
> Looking at the patch, it seems like he just calls the VBI version for
> both cases assuming the VBI version is a complete superset of the
> non-VBI version, which it is clearly not.
> 
> That whole patch should just be reverted. 

I didn't apply Frank's patch yet. So, no need to revert ;) Also, the test
is still incomplete, as I didn't check if the existing webcam support is
still working. I also didn't review each individual changes (although,
on a quick glance, except for those two final patches, nothing bad popped-up). 

I'll likely finish testing and will review it only after my return
back from ELCE.

> If he's going to spend the
> time to refactor the code to allow the VBI version to be used for both
> then fine, but blindly calling the VBI version without making real
> code changes is *NOT* going to work.

Yes.

> Frank, good job in naming your patch - it made me scream "WAIT!" when
> I saw it.  Bad job for blindly submitting a code change without any
> idea whether it actually worked.  ;-)
> 
> I know developers have the tendency to look at code and say "oh,
> that's ugly, I should change that."  However it's more important that
> it actually work than it be pretty.
> 
> Devin
> 


-- 
Regards,
Mauro

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/23] em28xx: add support fur USB bulk transfers
  2012-10-30  4:06           ` Mauro Carvalho Chehab
  2012-10-30 13:08             ` Devin Heitmueller
@ 2012-10-30 17:18             ` Frank Schäfer
  2012-11-08 18:03               ` Frank Schäfer
  1 sibling, 1 reply; 48+ messages in thread
From: Frank Schäfer @ 2012-10-30 17:18 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media

Am 30.10.2012 06:06, schrieb Mauro Carvalho Chehab:

<snip>
> Did a git bisect. The last patch where the bug doesn't occur is this 
> changeset:
> 	em28xx: add module parameter for selection of the preferred USB transfer type
>
> That means that this changeset broke it:
>
> 	em28xx: use common urb data copying function for vbi and non-vbi devices
Ok, thanks.
That means we are VERY close...

I think this is the only change that could cause the trouble:
> @@ -599,6 +491,7 @@ static inline int em28xx_urb_data_copy_vbi(struct em28xx *dev, struct urb *urb)
>  			len = actual_length - 4;
>  		} else if (p[0] == 0x22 && p[1] == 0x5a) {
>  			/* start video */
> +			dev->capture_type = 1;
>  			p += 4;
>  			len = actual_length - 4;
>  		} else {

Could you try again with this line commented out ? (em28xx-video.c, line
494 in the patched file).
usb_debug=1 would be usefull, too.

> I didn't test them with my Silvercrest webcam yet.

I re-tested 5 minutes ago with this device and it works fine.
Btw, which frame rates do you get  ? ;)

Regards,
Frank

> I hope that helps.
>
> Regards,
> Mauro
>
> PS.: Logs of the latest working driver is enclosed.
>
>
> [ 4658.112071] media: Linux media interface: v0.10
> [ 4658.118615] Linux video capture interface: v2.00
> [ 4658.123229] WARNING: You are using an experimental version of the media stack.
> 	As the driver is backported to an older kernel, it doesn't offer
> 	enough quality for its usage in production.
> 	Use it with care.
> Latest git patches (needed if you report a bug to linux-media@vger.kernel.org):
> 	d259aec2578fe66c43ae89ef65735fa7b70fa948 [media] em28xx: add module parameter for selection of the preferred USB transfer type
> 	2c930ac7e1aa0c8181d5d283e4cb5de69b8121d5 [media] em28xx: improve USB endpoint logic, also use bulk transfers
> 	6b43cf6a235d564487fd10d73d8c377d4d6bafff [media] em28xx: set USB alternate settings for analog video bulk transfers properly
> [ 4658.192384] em28xx: New device  WinTV HVR-980 @ 480 Mbps (2040:6513, interface 0, class 0)
> [ 4658.200654] em28xx: Audio Vendor Class interface 0 found
> [ 4658.205957] em28xx: Video interface 0 found
> [ 4658.210133] em28xx: DVB interface 0 found
> [ 4658.214178] em28xx #0: chip ID is em2882/em2883
> [ 4658.361126] em28xx #0: i2c eeprom 00: 1a eb 67 95 40 20 13 65 d0 12 5c 03 82 1e 6a 18
> [ 4658.369192] em28xx #0: i2c eeprom 10: 00 00 24 57 66 07 01 00 00 00 00 00 00 00 00 00
> [ 4658.377234] em28xx #0: i2c eeprom 20: 46 00 01 00 f0 10 02 00 b8 00 00 00 5b 1c 00 00
> [ 4658.385334] em28xx #0: i2c eeprom 30: 00 00 20 40 20 80 02 20 01 01 01 01 00 00 00 00
> [ 4658.393444] em28xx #0: i2c eeprom 40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> [ 4658.401638] em28xx #0: i2c eeprom 50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> [ 4658.409788] em28xx #0: i2c eeprom 60: 00 00 00 00 00 00 00 00 00 00 18 03 34 00 30 00
> [ 4658.417909] em28xx #0: i2c eeprom 70: 32 00 38 00 34 00 34 00 39 00 30 00 31 00 38 00
> [ 4658.425992] em28xx #0: i2c eeprom 80: 00 00 1e 03 57 00 69 00 6e 00 54 00 56 00 20 00
> [ 4658.434026] em28xx #0: i2c eeprom 90: 48 00 56 00 52 00 2d 00 39 00 38 00 30 00 00 00
> [ 4658.442100] em28xx #0: i2c eeprom a0: 84 12 00 00 05 50 1a 7f d4 78 23 b1 fe d0 18 85
> [ 4658.450227] em28xx #0: i2c eeprom b0: ff 00 00 00 04 84 0a 00 01 01 20 77 00 40 fa 40
> [ 4658.458311] em28xx #0: i2c eeprom c0: 1d f0 74 02 01 00 01 79 4f 00 00 00 00 00 00 00
> [ 4658.466409] em28xx #0: i2c eeprom d0: 84 12 00 00 05 50 1a 7f d4 78 23 b1 fe d0 18 85
> [ 4658.474500] em28xx #0: i2c eeprom e0: ff 00 00 00 04 84 0a 00 01 01 20 77 00 40 fa 40
> [ 4658.482585] em28xx #0: i2c eeprom f0: 1d f0 74 02 01 00 01 79 4f 00 00 00 00 00 00 00
> [ 4658.490566] em28xx #0: EEPROM ID= 0x9567eb1a, EEPROM hash = 0x994b2bdd
> [ 4658.497081] em28xx #0: EEPROM info:
> [ 4658.500564] em28xx #0:	AC97 audio (5 sample rates)
> [ 4658.505346] em28xx #0:	500mA max power
> [ 4658.509087] em28xx #0:	Table at 0x24, strings=0x1e82, 0x186a, 0x0000
> [ 4658.515433] em28xx #0: Identified as Hauppauge WinTV HVR 950 (card=16)
> [ 4658.525141] tveeprom 3-0050: Hauppauge model 65201, rev A1C0, serial# 1917178
> [ 4658.532283] tveeprom 3-0050: tuner model is Xceive XC3028 (idx 120, type 71)
> [ 4658.539312] tveeprom 3-0050: TV standards PAL(B/G) PAL(I) PAL(D/D1/K) ATSC/DVB Digital (eeprom 0xd4)
> [ 4658.548426] tveeprom 3-0050: audio processor is None (idx 0)
> [ 4658.554069] tveeprom 3-0050: has radio
> [ 4658.606748] tvp5150 3-005c: chip found @ 0xb8 (em28xx #0)
> [ 4658.612155] tvp5150 3-005c: tvp5150am1 detected.
> [ 4658.636054] tuner 3-0061: Tuner -1 found with type(s) Radio TV.
> [ 4658.643381] xc2028: Xcv2028/3028 init called!
> [ 4658.643384] xc2028 3-0061: creating new instance
> [ 4658.647993] xc2028 3-0061: type set to XCeive xc2028/xc3028 tuner
> [ 4658.654089] xc2028 3-0061: xc2028_set_config called
> [ 4658.654102] xc2028 3-0061: xc2028_set_analog_freq called
> [ 4658.654104] xc2028 3-0061: generic_set_freq called
> [ 4658.654105] xc2028 3-0061: should set frequency 567250 kHz
> [ 4658.654106] xc2028 3-0061: check_firmware called
> [ 4658.655153] em28xx #0: Config register raw data: 0xd0
> [ 4658.660914] xc2028 3-0061: request_firmware_nowait(): OK
> [ 4658.660917] xc2028 3-0061: load_all_firmwares called
> [ 4658.660919] xc2028 3-0061: Loading 80 firmware images from xc3028-v27.fw, type: xc2028 firmware, ver 2.7
> [ 4658.670417] xc2028 3-0061: Reading firmware type BASE F8MHZ (3), id 0, size=8718.
> [ 4658.670424] xc2028 3-0061: Reading firmware type BASE F8MHZ MTS (7), id 0, size=8712.
> [ 4658.670430] xc2028 3-0061: Reading firmware type BASE FM (401), id 0, size=8562.
> [ 4658.670436] xc2028 3-0061: Reading firmware type BASE FM INPUT1 (c01), id 0, size=8576.
> [ 4658.670441] xc2028 3-0061: Reading firmware type BASE (1), id 0, size=8706.
> [ 4658.670446] xc2028 3-0061: Reading firmware type BASE MTS (5), id 0, size=8682.
> [ 4658.670451] xc2028 3-0061: Reading firmware type (0), id 100000007, size=161.
> [ 4658.670453] xc2028 3-0061: Reading firmware type MTS (4), id 100000007, size=169.
> [ 4658.670455] xc2028 3-0061: Reading firmware type (0), id 200000007, size=161.
> [ 4658.670457] xc2028 3-0061: Reading firmware type MTS (4), id 200000007, size=169.
> [ 4658.670459] xc2028 3-0061: Reading firmware type (0), id 400000007, size=161.
> [ 4658.670460] xc2028 3-0061: Reading firmware type MTS (4), id 400000007, size=169.
> [ 4658.670462] xc2028 3-0061: Reading firmware type (0), id 800000007, size=161.
> [ 4658.670464] xc2028 3-0061: Reading firmware type MTS (4), id 800000007, size=169.
> [ 4658.670467] xc2028 3-0061: Reading firmware type (0), id 3000000e0, size=161.
> [ 4658.670469] xc2028 3-0061: Reading firmware type MTS (4), id 3000000e0, size=169.
> [ 4658.670471] xc2028 3-0061: Reading firmware type (0), id c000000e0, size=161.
> [ 4658.670472] xc2028 3-0061: Reading firmware type MTS (4), id c000000e0, size=169.
> [ 4658.670474] xc2028 3-0061: Reading firmware type (0), id 200000, size=161.
> [ 4658.670476] xc2028 3-0061: Reading firmware type MTS (4), id 200000, size=169.
> [ 4658.670478] xc2028 3-0061: Reading firmware type (0), id 4000000, size=161.
> [ 4658.670480] xc2028 3-0061: Reading firmware type MTS (4), id 4000000, size=169.
> [ 4658.670481] xc2028 3-0061: Reading firmware type D2633 DTV6 ATSC (10030), id 0, size=149.
> [ 4658.670485] xc2028 3-0061: Reading firmware type D2620 DTV6 QAM (68), id 0, size=149.
> [ 4658.670488] xc2028 3-0061: Reading firmware type D2633 DTV6 QAM (70), id 0, size=149.
> [ 4658.670491] xc2028 3-0061: Reading firmware type D2620 DTV7 (88), id 0, size=149.
> [ 4658.670493] xc2028 3-0061: Reading firmware type D2633 DTV7 (90), id 0, size=149.
> [ 4658.670495] xc2028 3-0061: Reading firmware type D2620 DTV78 (108), id 0, size=149.
> [ 4658.670499] xc2028 3-0061: Reading firmware type D2633 DTV78 (110), id 0, size=149.
> [ 4658.670501] xc2028 3-0061: Reading firmware type D2620 DTV8 (208), id 0, size=149.
> [ 4658.670503] xc2028 3-0061: Reading firmware type D2633 DTV8 (210), id 0, size=149.
> [ 4658.670506] xc2028 3-0061: Reading firmware type FM (400), id 0, size=135.
> [ 4658.670508] xc2028 3-0061: Reading firmware type (0), id 10, size=161.
> [ 4658.670510] xc2028 3-0061: Reading firmware type MTS (4), id 10, size=169.
> [ 4658.670513] xc2028 3-0061: Reading firmware type (0), id 1000400000, size=169.
> [ 4658.670514] xc2028 3-0061: Reading firmware type (0), id c00400000, size=161.
> [ 4658.670516] xc2028 3-0061: Reading firmware type (0), id 800000, size=161.
> [ 4658.670518] xc2028 3-0061: Reading firmware type (0), id 8000, size=161.
> [ 4658.670519] xc2028 3-0061: Reading firmware type LCD (1000), id 8000, size=161.
> [ 4658.670521] xc2028 3-0061: Reading firmware type LCD NOGD (3000), id 8000, size=161.
> [ 4658.670525] xc2028 3-0061: Reading firmware type MTS (4), id 8000, size=169.
> [ 4658.670527] xc2028 3-0061: Reading firmware type (0), id b700, size=161.
> [ 4658.670529] xc2028 3-0061: Reading firmware type LCD (1000), id b700, size=161.
> [ 4658.670531] xc2028 3-0061: Reading firmware type LCD NOGD (3000), id b700, size=161.
> [ 4658.670533] xc2028 3-0061: Reading firmware type (0), id 2000, size=161.
> [ 4658.670535] xc2028 3-0061: Reading firmware type MTS (4), id b700, size=169.
> [ 4658.670538] xc2028 3-0061: Reading firmware type MTS LCD (1004), id b700, size=169.
> [ 4658.670540] xc2028 3-0061: Reading firmware type MTS LCD NOGD (3004), id b700, size=169.
> [ 4658.670543] xc2028 3-0061: Reading firmware type SCODE HAS_IF_3280 (60000000), id 0, size=192.
> [ 4658.670546] xc2028 3-0061: Reading firmware type SCODE HAS_IF_3300 (60000000), id 0, size=192.
> [ 4658.670549] xc2028 3-0061: Reading firmware type SCODE HAS_IF_3440 (60000000), id 0, size=192.
> [ 4658.670551] xc2028 3-0061: Reading firmware type SCODE HAS_IF_3460 (60000000), id 0, size=192.
> [ 4658.670554] xc2028 3-0061: Reading firmware type DTV6 ATSC OREN36 SCODE HAS_IF_3800 (60210020), id 0, size=192.
> [ 4658.670557] xc2028 3-0061: Reading firmware type SCODE HAS_IF_4000 (60000000), id 0, size=192.
> [ 4658.670560] xc2028 3-0061: Reading firmware type DTV6 ATSC TOYOTA388 SCODE HAS_IF_4080 (60410020), id 0, size=192.
> [ 4658.670564] xc2028 3-0061: Reading firmware type SCODE HAS_IF_4200 (60000000), id 0, size=192.
> [ 4658.670566] xc2028 3-0061: Reading firmware type MONO SCODE HAS_IF_4320 (60008000), id 8000, size=192.
> [ 4658.670569] xc2028 3-0061: Reading firmware type SCODE HAS_IF_4450 (60000000), id 0, size=192.
> [ 4658.670572] xc2028 3-0061: Reading firmware type MTS LCD NOGD MONO IF SCODE HAS_IF_4500 (6002b004), id b700, size=192.
> [ 4658.670576] xc2028 3-0061: Reading firmware type LCD NOGD IF SCODE HAS_IF_4600 (60023000), id 8000, size=192.
> [ 4658.670579] xc2028 3-0061: Reading firmware type DTV6 QAM DTV7 DTV78 DTV8 ZARLINK456 SCODE HAS_IF_4760 (620003e0), id 0, size=192.
> [ 4658.670584] xc2028 3-0061: Reading firmware type SCODE HAS_IF_4940 (60000000), id 0, size=192.
> [ 4658.670587] xc2028 3-0061: Reading firmware type SCODE HAS_IF_5260 (60000000), id 0, size=192.
> [ 4658.670589] xc2028 3-0061: Reading firmware type MONO SCODE HAS_IF_5320 (60008000), id f00000007, size=192.
> [ 4658.670592] xc2028 3-0061: Reading firmware type DTV7 DTV78 DTV8 DIBCOM52 CHINA SCODE HAS_IF_5400 (65000380), id 0, size=192.
> [ 4658.670596] xc2028 3-0061: Reading firmware type DTV6 ATSC OREN538 SCODE HAS_IF_5580 (60110020), id 0, size=192.
> [ 4658.670599] xc2028 3-0061: Reading firmware type SCODE HAS_IF_5640 (60000000), id 300000007, size=192.
> [ 4658.670602] xc2028 3-0061: Reading firmware type SCODE HAS_IF_5740 (60000000), id c00000007, size=192.
> [ 4658.670605] xc2028 3-0061: Reading firmware type SCODE HAS_IF_5900 (60000000), id 0, size=192.
> [ 4658.670607] xc2028 3-0061: Reading firmware type MONO SCODE HAS_IF_6000 (60008000), id c04c000f0, size=192.
> [ 4658.670609] xc2028 3-0061: Reading firmware type DTV6 QAM ATSC LG60 F6MHZ SCODE HAS_IF_6200 (68050060), id 0, size=192.
> [ 4658.670613] xc2028 3-0061: Reading firmware type SCODE HAS_IF_6240 (60000000), id 10, size=192.
> [ 4658.670616] xc2028 3-0061: Reading firmware type MONO SCODE HAS_IF_6320 (60008000), id 200000, size=192.
> [ 4658.670618] xc2028 3-0061: Reading firmware type SCODE HAS_IF_6340 (60000000), id 200000, size=192.
> [ 4658.670621] xc2028 3-0061: Reading firmware type MONO SCODE HAS_IF_6500 (60008000), id c044000e0, size=192.
> [ 4658.670623] xc2028 3-0061: Reading firmware type DTV6 ATSC ATI638 SCODE HAS_IF_6580 (60090020), id 0, size=192.
> [ 4658.670626] xc2028 3-0061: Reading firmware type SCODE HAS_IF_6600 (60000000), id 3000000e0, size=192.
> [ 4658.670629] xc2028 3-0061: Reading firmware type MONO SCODE HAS_IF_6680 (60008000), id 3000000e0, size=192.
> [ 4658.670632] xc2028 3-0061: Reading firmware type DTV6 ATSC TOYOTA794 SCODE HAS_IF_8140 (60810020), id 0, size=192.
> [ 4658.670636] xc2028 3-0061: Reading firmware type SCODE HAS_IF_8200 (60000000), id 0, size=192.
> [ 4658.670639] xc2028 3-0061: Firmware files loaded.
> [ 4658.671468] em28xx #0: AC97 vendor ID = 0xffffffff
> [ 4658.677461] em28xx #0: AC97 features = 0x6a90
> [ 4658.681817] em28xx #0: Empia 202 AC97 audio processor detected
> [ 4658.844996] em28xx #0: v4l2 driver version 0.1.3
> [ 4658.850119] xc2028 3-0061: xc2028_set_analog_freq called
> [ 4658.850123] xc2028 3-0061: generic_set_freq called
> [ 4658.850125] xc2028 3-0061: should set frequency 567250 kHz
> [ 4658.850127] xc2028 3-0061: check_firmware called
> [ 4658.850129] xc2028 3-0061: checking firmware, user requested type=F8MHZ MTS (6), id 00000000000000ff, scode_tbl (0), scode_nr 0
> [ 4658.883049] xc2028 3-0061: load_firmware called
> [ 4658.883053] xc2028 3-0061: seek_firmware called, want type=BASE F8MHZ MTS (7), id 0000000000000000.
> [ 4658.883058] xc2028 3-0061: Found firmware for type=BASE F8MHZ MTS (7), id 0000000000000000.
> [ 4658.883063] xc2028 3-0061: Loading firmware for type=BASE F8MHZ MTS (7), id 0000000000000000.
> [ 4660.005871] xc2028 3-0061: Load init1 firmware, if exists
> [ 4660.005875] xc2028 3-0061: load_firmware called
> [ 4660.005878] xc2028 3-0061: seek_firmware called, want type=BASE INIT1 F8MHZ MTS (4007), id 0000000000000000.
> [ 4660.005884] xc2028 3-0061: Can't find firmware for type=BASE INIT1 F8MHZ MTS (4007), id 0000000000000000.
> [ 4660.005890] xc2028 3-0061: load_firmware called
> [ 4660.005891] xc2028 3-0061: seek_firmware called, want type=BASE INIT1 MTS (4005), id 0000000000000000.
> [ 4660.005896] xc2028 3-0061: Can't find firmware for type=BASE INIT1 MTS (4005), id 0000000000000000.
> [ 4660.005900] xc2028 3-0061: load_firmware called
> [ 4660.005902] xc2028 3-0061: seek_firmware called, want type=F8MHZ MTS (6), id 00000000000000ff.
> [ 4660.005906] xc2028 3-0061: Selecting best matching firmware (3 bits) for type=MTS (4), id 00000000000000ff:
> [ 4660.005909] xc2028 3-0061: Found firmware for type=MTS (4), id 0000000100000007.
> [ 4660.005912] xc2028 3-0061: Loading firmware for type=MTS (4), id 0000000100000007.
> [ 4660.032132] xc2028 3-0061: Trying to load scode 0
> [ 4660.032136] xc2028 3-0061: load_scode called
> [ 4660.032138] xc2028 3-0061: seek_firmware called, want type=F8MHZ MTS SCODE (20000006), id 0000000100000007.
> [ 4660.032144] xc2028 3-0061: Can't find firmware for type=MTS SCODE (20000004), id 0000000100000007.
> [ 4660.032148] xc2028 3-0061: xc2028_get_reg 0004 called
> [ 4660.033125] xc2028 3-0061: xc2028_get_reg 0008 called
> [ 4660.034125] xc2028 3-0061: Device is Xceive 3028 version 1.0, firmware version 2.7
> [ 4660.146418] xc2028 3-0061: divisor= 00 00 8d d0 (freq=567.250)
> [ 4660.211039] em28xx #0: V4L2 video device registered as video0
> [ 4660.216790] em28xx #0: V4L2 VBI device registered as vbi0
> [ 4660.222176] xc2028 3-0061: Putting xc2028/3028 into poweroff mode.
> [ 4660.223495] usbcore: registered new interface driver em28xx
> [ 4660.232396] em28xx-audio.c: probing for em28xx Audio Vendor Class
> [ 4660.238494] em28xx-audio.c: Copyright (C) 2006 Markus Rechberger
> [ 4660.244484] em28xx-audio.c: Copyright (C) 2007-2011 Mauro Carvalho Chehab
> [ 4660.251461] Em28xx: Initialized (Em28xx Audio Extension) extension
> [ 4660.260023] WARNING: You are using an experimental version of the media stack.
> 	As the driver is backported to an older kernel, it doesn't offer
> 	enough quality for its usage in production.
> 	Use it with care.
> Latest git patches (needed if you report a bug to linux-media@vger.kernel.org):
> 	d259aec2578fe66c43ae89ef65735fa7b70fa948 [media] em28xx: add module parameter for selection of the preferred USB transfer type
> 	2c930ac7e1aa0c8181d5d283e4cb5de69b8121d5 [media] em28xx: improve USB endpoint logic, also use bulk transfers
> 	6b43cf6a235d564487fd10d73d8c377d4d6bafff [media] em28xx: set USB alternate settings for analog video bulk transfers properly
> [ 4660.454482] xc2028 3-0061: Putting xc2028/3028 into poweroff mode.
> [ 4660.521856] xc2028: Xcv2028/3028 init called!
> [ 4660.521862] xc2028 3-0061: attaching existing instance
> [ 4660.527023] xc2028 3-0061: type set to XCeive xc2028/xc3028 tuner
> [ 4660.533123] em28xx #0: em28xx #0/2: xc3028 attached
> [ 4660.538023] DVB: registering new adapter (em28xx #0)
> [ 4660.543012] usb 1-6: DVB: registering adapter 0 frontend 0 (LG Electronics LGDT3303 VSB/QAM Frontend)...
> [ 4660.553173] em28xx #0: Successfully loaded em28xx-dvb
> [ 4660.558234] Em28xx: Initialized (Em28xx dvb Extension) extension
> [ 4660.577432] WARNING: You are using an experimental version of the media stack.
> 	As the driver is backported to an older kernel, it doesn't offer
> 	enough quality for its usage in production.
> 	Use it with care.
> Latest git patches (needed if you report a bug to linux-media@vger.kernel.org):
> 	d259aec2578fe66c43ae89ef65735fa7b70fa948 [media] em28xx: add module parameter for selection of the preferred USB transfer type
> 	2c930ac7e1aa0c8181d5d283e4cb5de69b8121d5 [media] em28xx: improve USB endpoint logic, also use bulk transfers
> 	6b43cf6a235d564487fd10d73d8c377d4d6bafff [media] em28xx: set USB alternate settings for analog video bulk transfers properly
> [ 4660.670144] Registered IR keymap rc-hauppauge
> [ 4660.674637] input: em28xx IR (em28xx #0) as /devices/pci0000:00/0000:00:1a.7/usb1/1-6/rc/rc0/input19
> [ 4660.684089] rc0: em28xx IR (em28xx #0) as /devices/pci0000:00/0000:00:1a.7/usb1/1-6/rc/rc0
> [ 4660.697886] Em28xx: Initialized (Em28xx Input Extension) extension
> [ 4672.157416] xc2028 3-0061: xc2028_get_reg 0002 called
> [ 4672.181327] xc2028 3-0061: i2c input error: rc = -19 (should be 2)
> [ 4672.187513] xc2028 3-0061: xc2028_signal called
> [ 4672.187662] xc2028 3-0061: xc2028_get_reg 0002 called
> [ 4672.212286] xc2028 3-0061: i2c input error: rc = -19 (should be 2)
> [ 4672.218475] xc2028 3-0061: signal strength is 0
> [ 4672.285133] xc2028 3-0061: xc2028_set_analog_freq called
> [ 4672.285137] xc2028 3-0061: generic_set_freq called
> [ 4672.285138] xc2028 3-0061: should set frequency 567250 kHz
> [ 4672.285139] xc2028 3-0061: check_firmware called
> [ 4672.285140] xc2028 3-0061: checking firmware, user requested type=F8MHZ MTS (6), id 00000000000000ff, scode_tbl (0), scode_nr 0
> [ 4672.324934] xc2028 3-0061: load_firmware called
> [ 4672.324938] xc2028 3-0061: seek_firmware called, want type=BASE F8MHZ MTS (7), id 0000000000000000.
> [ 4672.324944] xc2028 3-0061: Found firmware for type=BASE F8MHZ MTS (7), id 0000000000000000.
> [ 4672.324949] xc2028 3-0061: Loading firmware for type=BASE F8MHZ MTS (7), id 0000000000000000.
> [ 4673.463009] xc2028 3-0061: Load init1 firmware, if exists
> [ 4673.463013] xc2028 3-0061: load_firmware called
> [ 4673.463016] xc2028 3-0061: seek_firmware called, want type=BASE INIT1 F8MHZ MTS (4007), id 0000000000000000.
> [ 4673.463023] xc2028 3-0061: Can't find firmware for type=BASE INIT1 F8MHZ MTS (4007), id 0000000000000000.
> [ 4673.463028] xc2028 3-0061: load_firmware called
> [ 4673.463030] xc2028 3-0061: seek_firmware called, want type=BASE INIT1 MTS (4005), id 0000000000000000.
> [ 4673.463034] xc2028 3-0061: Can't find firmware for type=BASE INIT1 MTS (4005), id 0000000000000000.
> [ 4673.463038] xc2028 3-0061: load_firmware called
> [ 4673.463040] xc2028 3-0061: seek_firmware called, want type=F8MHZ MTS (6), id 00000000000000ff.
> [ 4673.463045] xc2028 3-0061: Selecting best matching firmware (3 bits) for type=MTS (4), id 00000000000000ff:
> [ 4673.463048] xc2028 3-0061: Found firmware for type=MTS (4), id 0000000100000007.
> [ 4673.463051] xc2028 3-0061: Loading firmware for type=MTS (4), id 0000000100000007.
> [ 4673.489121] xc2028 3-0061: Trying to load scode 0
> [ 4673.489125] xc2028 3-0061: load_scode called
> [ 4673.489127] xc2028 3-0061: seek_firmware called, want type=F8MHZ MTS SCODE (20000006), id 0000000100000007.
> [ 4673.489133] xc2028 3-0061: Can't find firmware for type=MTS SCODE (20000004), id 0000000100000007.
> [ 4673.489138] xc2028 3-0061: xc2028_get_reg 0004 called
> [ 4673.490114] xc2028 3-0061: xc2028_get_reg 0008 called
> [ 4673.491118] xc2028 3-0061: Device is Xceive 3028 version 1.0, firmware version 2.7
> [ 4673.603232] xc2028 3-0061: divisor= 00 00 8d d0 (freq=567.250)
> [ 4673.735595] xc2028 3-0061: xc2028_set_analog_freq called
> [ 4673.735599] xc2028 3-0061: generic_set_freq called
> [ 4673.735602] xc2028 3-0061: should set frequency 567250 kHz
> [ 4673.735604] xc2028 3-0061: check_firmware called
> [ 4673.735605] xc2028 3-0061: checking firmware, user requested type=MTS (4), id 0000000000000100, scode_tbl (0), scode_nr 0
> [ 4673.775203] xc2028 3-0061: load_firmware called
> [ 4673.775208] xc2028 3-0061: seek_firmware called, want type=BASE MTS (5), id 0000000000000000.
> [ 4673.775213] xc2028 3-0061: Found firmware for type=BASE MTS (5), id 0000000000000000.
> [ 4673.775217] xc2028 3-0061: Loading firmware for type=BASE MTS (5), id 0000000000000000.
> [ 4674.905886] xc2028 3-0061: Load init1 firmware, if exists
> [ 4674.905890] xc2028 3-0061: load_firmware called
> [ 4674.905891] xc2028 3-0061: seek_firmware called, want type=BASE INIT1 MTS (4005), id 0000000000000000.
> [ 4674.905895] xc2028 3-0061: Can't find firmware for type=BASE INIT1 MTS (4005), id 0000000000000000.
> [ 4674.905898] xc2028 3-0061: load_firmware called
> [ 4674.905899] xc2028 3-0061: seek_firmware called, want type=BASE INIT1 MTS (4005), id 0000000000000000.
> [ 4674.905902] xc2028 3-0061: Can't find firmware for type=BASE INIT1 MTS (4005), id 0000000000000000.
> [ 4674.905905] xc2028 3-0061: load_firmware called
> [ 4674.905906] xc2028 3-0061: seek_firmware called, want type=MTS (4), id 0000000000000100.
> [ 4674.905908] xc2028 3-0061: Found firmware for type=MTS (4), id 000000000000b700.
> [ 4674.905910] xc2028 3-0061: Loading firmware for type=MTS (4), id 000000000000b700.
> [ 4674.932253] xc2028 3-0061: Trying to load scode 0
> [ 4674.932256] xc2028 3-0061: load_scode called
> [ 4674.932258] xc2028 3-0061: seek_firmware called, want type=MTS SCODE (20000004), id 000000000000b700.
> [ 4674.932262] xc2028 3-0061: Found firmware for type=MTS SCODE (20000004), id 000000000000b700.
> [ 4674.932265] xc2028 3-0061: Loading SCODE for type=MTS LCD NOGD MONO IF SCODE HAS_IF_4500 (6002b004), id 000000000000b700.
> [ 4674.946107] xc2028 3-0061: xc2028_get_reg 0004 called
> [ 4674.947106] xc2028 3-0061: xc2028_get_reg 0008 called
> [ 4674.948084] xc2028 3-0061: Device is Xceive 3028 version 1.0, firmware version 2.7
> [ 4675.060498] xc2028 3-0061: divisor= 00 00 8d d0 (freq=567.250)
> [ 4675.060566] xc2028 3-0061: xc2028_set_analog_freq called
> [ 4675.060568] xc2028 3-0061: generic_set_freq called
> [ 4675.060569] xc2028 3-0061: should set frequency 67250 kHz
> [ 4675.060570] xc2028 3-0061: check_firmware called
> [ 4675.060572] xc2028 3-0061: checking firmware, user requested type=MTS (4), id 0000000000000100, scode_tbl (0), scode_nr 0
> [ 4675.060575] xc2028 3-0061: BASE firmware not changed.
> [ 4675.060577] xc2028 3-0061: Std-specific firmware already loaded.
> [ 4675.060578] xc2028 3-0061: SCODE firmware already loaded.
> [ 4675.060579] xc2028 3-0061: xc2028_get_reg 0004 called
> [ 4675.062036] xc2028 3-0061: xc2028_get_reg 0008 called
> [ 4675.063047] xc2028 3-0061: Device is Xceive 3028 version 1.0, firmware version 2.7
> [ 4675.175446] xc2028 3-0061: divisor= 00 00 10 d0 (freq=67.250)
> [ 4675.178098] xc2028 3-0061: xc2028_set_analog_freq called
> [ 4675.178102] xc2028 3-0061: generic_set_freq called
> [ 4675.178104] xc2028 3-0061: should set frequency 67250 kHz
> [ 4675.178106] xc2028 3-0061: check_firmware called
> [ 4675.178108] xc2028 3-0061: checking firmware, user requested type=MTS (4), id 0000000000000100, scode_tbl (0), scode_nr 0
> [ 4675.178114] xc2028 3-0061: BASE firmware not changed.
> [ 4675.178115] xc2028 3-0061: Std-specific firmware already loaded.
> [ 4675.178117] xc2028 3-0061: SCODE firmware already loaded.
> [ 4675.178119] xc2028 3-0061: xc2028_get_reg 0004 called
> [ 4675.179213] xc2028 3-0061: xc2028_get_reg 0008 called
> [ 4675.180221] xc2028 3-0061: Device is Xceive 3028 version 1.0, firmware version 2.7
> [ 4675.292362] xc2028 3-0061: divisor= 00 00 10 d0 (freq=67.250)
> [ 4677.622717] xc2028 3-0061: xc2028_set_analog_freq called
> [ 4677.622722] xc2028 3-0061: generic_set_freq called
> [ 4677.622725] xc2028 3-0061: should set frequency 67250 kHz
> [ 4677.622726] xc2028 3-0061: check_firmware called
> [ 4677.622728] xc2028 3-0061: checking firmware, user requested type=MTS (4), id 0000000000000100, scode_tbl (0), scode_nr 0
> [ 4677.622734] xc2028 3-0061: BASE firmware not changed.
> [ 4677.622736] xc2028 3-0061: Std-specific firmware already loaded.
> [ 4677.622738] xc2028 3-0061: SCODE firmware already loaded.
> [ 4677.622740] xc2028 3-0061: xc2028_get_reg 0004 called
> [ 4677.623940] xc2028 3-0061: xc2028_get_reg 0008 called
> [ 4677.624940] xc2028 3-0061: Device is Xceive 3028 version 1.0, firmware version 2.7
> [ 4677.737991] xc2028 3-0061: divisor= 00 00 10 d0 (freq=67.250)
> [ 4677.798357] xc2028 3-0061: Putting xc2028/3028 into poweroff mode.
>
>



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/23] em28xx: add support fur USB bulk transfers
  2012-10-30 13:08             ` Devin Heitmueller
  2012-10-30 14:03               ` Mauro Carvalho Chehab
@ 2012-10-30 17:29               ` Frank Schäfer
  1 sibling, 0 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-10-30 17:29 UTC (permalink / raw)
  To: dheitmueller; +Cc: Mauro Carvalho Chehab, linux-media

Am 30.10.2012 15:08, schrieb Devin Heitmueller:
> On Tue, Oct 30, 2012 at 12:06 AM, Mauro Carvalho Chehab
> <mchehab@redhat.com> wrote:
>> Did a git bisect. The last patch where the bug doesn't occur is this
>> changeset:
>>         em28xx: add module parameter for selection of the preferred USB transfer type
>>
>> That means that this changeset broke it:
>>
>>         em28xx: use common urb data copying function for vbi and non-vbi devices
> Oh good, when I saw the subject line for that patch, I got worried.
> Looking at the patch, it seems like he just calls the VBI version for
> both cases assuming the VBI version is a complete superset of the
> non-VBI version, which it is clearly not.

Devin, I've read the code carefully and both functions are basically
doing the same, except that the non-VBI-version bails out when it
detects a VBI-header (see the FIXME statement ;) ).
Btw: the header checks at the end of the non-VBI-version are incomplete,
which corrupts frames from time to time when using bulk transfers.
Fixing this would make both functions even more similar.

> That whole patch should just be reverted.  If he's going to spend the
> time to refactor the code to allow the VBI version to be used for both
> then fine, but blindly calling the VBI version without making real
> code changes is *NOT* going to work.

That's all plain wrong.
a) Nothing needs to be reverted, because these patches are not yet in
the repo.
b) I'm doing nothing blindly here, I tested the patch carefully and it
works with Silvercrest webcam (em2820).
c) the patch not just calls the VBI-version of the function, it also
fixes/improves some issues. And (as mentioned above), it does a few
things better than non-VBI-version, so I don't need to fix the latter.

> Frank, good job in naming your patch - it made me scream "WAIT!" when
> I saw it.

Ehm... ??? That sounded a bit different in your previous mail...

Citation:
"This is generally good stuff. When I originally added the VBI support,
I kept the URB handlers separate initially to reduce the risk of breaking
existing devices, and always assumed that at some point the two routines
would be merged."
> Bad job for blindly submitting a code change without any
> idea whether it actually worked.  ;-)

See above, it's plain wrong.

> I know developers have the tendency to look at code and say "oh,
> that's ugly, I should change that."  However it's more important that
> it actually work than it be pretty.

I agree.
And some developers have the tendency to just add tons of very similar
new code which is basically doing the same just because it saves time. ;)
But thinking about things a few minutes longer / doing some more testing
at the beginning saves much more time in the long run...

Devin, your whole message really isn't helpfull.
Instead of making lots of wrong assertions, it would be nice to get some
constructive comments regarding the code changes or hardware behavior.

Regards,
Frank

> Devin
>



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/23] em28xx: add support fur USB bulk transfers
  2012-10-21 16:52 [PATCH 00/23] em28xx: add support fur USB bulk transfers Frank Schäfer
                   ` (25 preceding siblings ...)
       [not found] ` <20121028175752.447c39d5@redhat.com>
@ 2012-10-31  1:39 ` Benny Amorsen
  2012-10-31 10:57   ` Ezequiel Garcia
  2012-10-31 11:50   ` Frank Schäfer
  26 siblings, 2 replies; 48+ messages in thread
From: Benny Amorsen @ 2012-10-31  1:39 UTC (permalink / raw)
  To: Frank Schäfer; +Cc: mchehab, linux-media

Frank Schäfer <fschaefer.oss@googlemail.com> writes:

> This patch series adds support for USB bulk transfers to the em28xx driver.

I tried these patches on my Raspberry Pi, 3.6.1 kernel, Nanostick 290e

options em28xx prefer_bulk=1 core_debug=1 usb_debug=1
options em28xx_dvb debug=1

[    5.469510] em28xx: New device PCTV Systems PCTV 290e @ 480 Mbps (2013:024f, interface 0, class 0)
[    5.890637] em28xx: DVB interface 0 found
[    6.025292] em28xx #0: chip ID is em28174
[    6.515383] em28xx #0: Identified as PCTV nanoStick T2 290e (card=78)
[    6.567066] em28xx #0: v4l2 driver version 0.1.3
[    6.614720] em28xx #0 em28xx_set_alternate :minimum isoc packet size: 2888 (alt=0)
[    6.663064] em28xx #0 em28xx_set_alternate :setting alternate 0 with wMaxPacketSize=0
[    6.715934] em28xx #0 em28xx_accumulator_set :em28xx Scale: (1,1)-(179,143)
[    6.765694] em28xx #0 em28xx_capture_area_set :em28xx Area Set: (180,144)
[    6.793060] em28xx #0: V4L2 video device registered as video0
[    6.808200] em28xx #0 em28xx_alloc_urbs :em28xx: called em28xx_alloc_isoc in mode 2
[    6.819456] em28xx #0: no endpoint for DVB mode and transfer type 1
[    6.829283] em28xx: Failed to pre-allocate USB transfer buffers for DVB.
[    6.839454] em28xx: probe of 1-1.3.1:1.0 failed with error -22
[    6.852511] usbcore: registered new interface driver em28xx
[    7.255738] em28xx #0 em28xx_accumulator_set :em28xx Scale: (1,1)-(179,143)
[    7.291575] em28xx #0 em28xx_capture_area_set :em28xx Area Set: (180,144)
[    7.326200] em28xx #0 em28xx_uninit_usb_xfer :em28xx: called em28xx_uninit_usb_xfer in mode 1

Is the Nanostick 290e just fundamentally incompatible with bulk
transfers, or is there hope yet?

It works great with isochronous transfers on my PC and the Fedora
kernel, but the Raspberry USB host blows up when trying to do
isochronous mode.


/Benny

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/23] em28xx: add support fur USB bulk transfers
  2012-10-31  1:39 ` Benny Amorsen
@ 2012-10-31 10:57   ` Ezequiel Garcia
  2012-10-31 12:03     ` Frank Schäfer
  2012-10-31 20:22     ` Benny Amorsen
  2012-10-31 11:50   ` Frank Schäfer
  1 sibling, 2 replies; 48+ messages in thread
From: Ezequiel Garcia @ 2012-10-31 10:57 UTC (permalink / raw)
  To: Benny Amorsen; +Cc: Frank Schäfer, mchehab, linux-media

On Tue, Oct 30, 2012 at 10:39 PM, Benny Amorsen <benny+usenet@amorsen.dk> wrote:
> Frank Schäfer <fschaefer.oss@googlemail.com> writes:
>
>> This patch series adds support for USB bulk transfers to the em28xx driver.
>
> I tried these patches on my Raspberry Pi, 3.6.1 kernel, Nanostick 290e
>
> options em28xx prefer_bulk=1 core_debug=1 usb_debug=1
> options em28xx_dvb debug=1
>
> [    5.469510] em28xx: New device PCTV Systems PCTV 290e @ 480 Mbps (2013:024f, interface 0, class 0)
> [    5.890637] em28xx: DVB interface 0 found
> [    6.025292] em28xx #0: chip ID is em28174
> [    6.515383] em28xx #0: Identified as PCTV nanoStick T2 290e (card=78)
> [    6.567066] em28xx #0: v4l2 driver version 0.1.3
> [    6.614720] em28xx #0 em28xx_set_alternate :minimum isoc packet size: 2888 (alt=0)
> [    6.663064] em28xx #0 em28xx_set_alternate :setting alternate 0 with wMaxPacketSize=0
> [    6.715934] em28xx #0 em28xx_accumulator_set :em28xx Scale: (1,1)-(179,143)
> [    6.765694] em28xx #0 em28xx_capture_area_set :em28xx Area Set: (180,144)
> [    6.793060] em28xx #0: V4L2 video device registered as video0
> [    6.808200] em28xx #0 em28xx_alloc_urbs :em28xx: called em28xx_alloc_isoc in mode 2
> [    6.819456] em28xx #0: no endpoint for DVB mode and transfer type 1
> [    6.829283] em28xx: Failed to pre-allocate USB transfer buffers for DVB.
> [    6.839454] em28xx: probe of 1-1.3.1:1.0 failed with error -22
> [    6.852511] usbcore: registered new interface driver em28xx
> [    7.255738] em28xx #0 em28xx_accumulator_set :em28xx Scale: (1,1)-(179,143)
> [    7.291575] em28xx #0 em28xx_capture_area_set :em28xx Area Set: (180,144)
> [    7.326200] em28xx #0 em28xx_uninit_usb_xfer :em28xx: called em28xx_uninit_usb_xfer in mode 1
>
> Is the Nanostick 290e just fundamentally incompatible with bulk
> transfers, or is there hope yet?
>
> It works great with isochronous transfers on my PC and the Fedora
> kernel, but the Raspberry USB host blows up when trying to do
> isochronous mode.
>
>

Isn't this completely OT?

Anyway, RPI has known issues regarding USB bandwidth.

See here

https://github.com/ezequielgarcia/stk1160-standalone/issues/8
https://github.com/ezequielgarcia/stk1160-standalone/issues/2
http://www.raspberrypi.org/phpBB3/viewtopic.php?p=196918#p196918

Regards,

    Ezequiel

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/23] em28xx: add support fur USB bulk transfers
  2012-10-31  1:39 ` Benny Amorsen
  2012-10-31 10:57   ` Ezequiel Garcia
@ 2012-10-31 11:50   ` Frank Schäfer
  2012-10-31 19:58     ` Benny Amorsen
  1 sibling, 1 reply; 48+ messages in thread
From: Frank Schäfer @ 2012-10-31 11:50 UTC (permalink / raw)
  To: benny+usenet; +Cc: linux-media

Hi Benny,

Am 31.10.2012 03:39, schrieb Benny Amorsen:
> Frank Schäfer <fschaefer.oss@googlemail.com> writes:
>
>> This patch series adds support for USB bulk transfers to the em28xx driver.
> I tried these patches on my Raspberry Pi, 3.6.1 kernel, Nanostick 290e

Thank you for testing !

> options em28xx prefer_bulk=1 core_debug=1 usb_debug=1
> options em28xx_dvb debug=1
>
> [    5.469510] em28xx: New device PCTV Systems PCTV 290e @ 480 Mbps (2013:024f, interface 0, class 0)
> [    5.890637] em28xx: DVB interface 0 found
> [    6.025292] em28xx #0: chip ID is em28174
> [    6.515383] em28xx #0: Identified as PCTV nanoStick T2 290e (card=78)
> [    6.567066] em28xx #0: v4l2 driver version 0.1.3
> [    6.614720] em28xx #0 em28xx_set_alternate :minimum isoc packet size: 2888 (alt=0)
> [    6.663064] em28xx #0 em28xx_set_alternate :setting alternate 0 with wMaxPacketSize=0
> [    6.715934] em28xx #0 em28xx_accumulator_set :em28xx Scale: (1,1)-(179,143)
> [    6.765694] em28xx #0 em28xx_capture_area_set :em28xx Area Set: (180,144)
> [    6.793060] em28xx #0: V4L2 video device registered as video0
> [    6.808200] em28xx #0 em28xx_alloc_urbs :em28xx: called em28xx_alloc_isoc in mode 2
> [    6.819456] em28xx #0: no endpoint for DVB mode and transfer type 1
> [    6.829283] em28xx: Failed to pre-allocate USB transfer buffers for DVB.
> [    6.839454] em28xx: probe of 1-1.3.1:1.0 failed with error -22
> [    6.852511] usbcore: registered new interface driver em28xx
> [    7.255738] em28xx #0 em28xx_accumulator_set :em28xx Scale: (1,1)-(179,143)
> [    7.291575] em28xx #0 em28xx_capture_area_set :em28xx Area Set: (180,144)
> [    7.326200] em28xx #0 em28xx_uninit_usb_xfer :em28xx: called em28xx_uninit_usb_xfer in mode 1
>
> Is the Nanostick 290e just fundamentally incompatible with bulk
> transfers, or is there hope yet?

It seems like your device has no bulk endpoint for DVB.
What does lsusb say ?

The module parameter is called prefer_bulk, but what it actually does is
"force bulk" (which doesn't make much sense when the device has no bulk
endpoints).
I will fix this in v2 of the patch series.

> It works great with isochronous transfers on my PC and the Fedora
> kernel, but the Raspberry USB host blows up when trying to do
> isochronous mode.

Is this a regression caused by patches or a general issue with the
Raspberry board ?

Regards,
Frank

> /Benny



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/23] em28xx: add support fur USB bulk transfers
  2012-10-31 10:57   ` Ezequiel Garcia
@ 2012-10-31 12:03     ` Frank Schäfer
  2012-10-31 20:24       ` Benny Amorsen
  2012-10-31 20:22     ` Benny Amorsen
  1 sibling, 1 reply; 48+ messages in thread
From: Frank Schäfer @ 2012-10-31 12:03 UTC (permalink / raw)
  To: Benny Amorsen; +Cc: linux-media

Am 31.10.2012 12:57, schrieb Ezequiel Garcia:
> On Tue, Oct 30, 2012 at 10:39 PM, Benny Amorsen <benny+usenet@amorsen.dk> wrote:
>> Frank Schäfer <fschaefer.oss@googlemail.com> writes:
>>
>>> This patch series adds support for USB bulk transfers to the em28xx driver.
>> I tried these patches on my Raspberry Pi, 3.6.1 kernel, Nanostick 290e
>>
>> options em28xx prefer_bulk=1 core_debug=1 usb_debug=1
>> options em28xx_dvb debug=1
>>
>> [    5.469510] em28xx: New device PCTV Systems PCTV 290e @ 480 Mbps (2013:024f, interface 0, class 0)
>> [    5.890637] em28xx: DVB interface 0 found
>> [    6.025292] em28xx #0: chip ID is em28174
>> [    6.515383] em28xx #0: Identified as PCTV nanoStick T2 290e (card=78)
>> [    6.567066] em28xx #0: v4l2 driver version 0.1.3
>> [    6.614720] em28xx #0 em28xx_set_alternate :minimum isoc packet size: 2888 (alt=0)
>> [    6.663064] em28xx #0 em28xx_set_alternate :setting alternate 0 with wMaxPacketSize=0
>> [    6.715934] em28xx #0 em28xx_accumulator_set :em28xx Scale: (1,1)-(179,143)
>> [    6.765694] em28xx #0 em28xx_capture_area_set :em28xx Area Set: (180,144)
>> [    6.793060] em28xx #0: V4L2 video device registered as video0
>> [    6.808200] em28xx #0 em28xx_alloc_urbs :em28xx: called em28xx_alloc_isoc in mode 2
>> [    6.819456] em28xx #0: no endpoint for DVB mode and transfer type 1
>> [    6.829283] em28xx: Failed to pre-allocate USB transfer buffers for DVB.
>> [    6.839454] em28xx: probe of 1-1.3.1:1.0 failed with error -22
>> [    6.852511] usbcore: registered new interface driver em28xx
>> [    7.255738] em28xx #0 em28xx_accumulator_set :em28xx Scale: (1,1)-(179,143)
>> [    7.291575] em28xx #0 em28xx_capture_area_set :em28xx Area Set: (180,144)
>> [    7.326200] em28xx #0 em28xx_uninit_usb_xfer :em28xx: called em28xx_uninit_usb_xfer in mode 1
>>
>> Is the Nanostick 290e just fundamentally incompatible with bulk
>> transfers, or is there hope yet?
>>
>> It works great with isochronous transfers on my PC and the Fedora
>> kernel, but the Raspberry USB host blows up when trying to do
>> isochronous mode.
>>
>>
> Isn't this completely OT?
>
> Anyway, RPI has known issues regarding USB bandwidth.
>
> See here
>
> https://github.com/ezequielgarcia/stk1160-standalone/issues/8
> https://github.com/ezequielgarcia/stk1160-standalone/issues/2
> http://www.raspberrypi.org/phpBB3/viewtopic.php?p=196918#p196918

For DVB, the em28xx always selects the alternate setting with the
largest wMaxPacketSize.
There is a module parameter 'alt' to select it manually for experiments,
but the current code unfortunately applies it for analog capturing only. :(

Hope this helps,
Frank

> Regards,
>
>     Ezequiel


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/23] em28xx: add support fur USB bulk transfers
  2012-10-31 11:50   ` Frank Schäfer
@ 2012-10-31 19:58     ` Benny Amorsen
  2012-10-31 20:25       ` Ezequiel Garcia
  0 siblings, 1 reply; 48+ messages in thread
From: Benny Amorsen @ 2012-10-31 19:58 UTC (permalink / raw)
  To: Frank Schäfer; +Cc: linux-media


Frank Schäfer <fschaefer.oss@googlemail.com> writes:

> It seems like your device has no bulk endpoint for DVB.
> What does lsusb say ?

lsusb mentions 4 different end points, all isochronous. So out of luck
there. I did not know I could use lsusb to find this out.

> The module parameter is called prefer_bulk, but what it actually does is
> "force bulk" (which doesn't make much sense when the device has no bulk
> endpoints).
> I will fix this in v2 of the patch series.

Well, I was hoping to get "force_bulk", so that part is not a problem
for me.

> Am 31.10.2012 03:39, schrieb Benny Amorsen:

>> It works great with isochronous transfers on my PC and the Fedora
>> kernel, but the Raspberry USB host blows up when trying to do
>> isochronous mode.
>
> Is this a regression caused by patches or a general issue with the
> Raspberry board ?

It is a general issue with the Raspberry USB host controller or driver.
Bulk transfers work, isochronous transfers have problems. I was hoping I
could somehow convince the Nanostick to use bulk transfers instead of
isochronous transfers. Since that seems to require a firmware change, I
will have to give up on it.


/Benny


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/23] em28xx: add support fur USB bulk transfers
  2012-10-31 10:57   ` Ezequiel Garcia
  2012-10-31 12:03     ` Frank Schäfer
@ 2012-10-31 20:22     ` Benny Amorsen
  1 sibling, 0 replies; 48+ messages in thread
From: Benny Amorsen @ 2012-10-31 20:22 UTC (permalink / raw)
  To: Ezequiel Garcia; +Cc: Frank Schäfer, mchehab, linux-media

Ezequiel Garcia <elezegarcia@gmail.com> writes:

> Isn't this completely OT?

It may be off topic, but those issues were the reason I was testing the
patches...

> Anyway, RPI has known issues regarding USB bandwidth.

Indeed. Thank you for the links, I had not followed the latest
development and did not know about Gordon implementing EHCI in firmware.
That will be interesting.


/Benny


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/23] em28xx: add support fur USB bulk transfers
  2012-10-31 12:03     ` Frank Schäfer
@ 2012-10-31 20:24       ` Benny Amorsen
  0 siblings, 0 replies; 48+ messages in thread
From: Benny Amorsen @ 2012-10-31 20:24 UTC (permalink / raw)
  To: Frank Schäfer; +Cc: linux-media

Frank Schäfer <fschaefer.oss@googlemail.com> writes:

> For DVB, the em28xx always selects the alternate setting with the
> largest wMaxPacketSize.
> There is a module parameter 'alt' to select it manually for experiments,
> but the current code unfortunately applies it for analog capturing only. :(

What is the meaning of "alternate setting" here? Would I gain anything
if the driver was modified to apply alternate setting for DVB as well?


/Benny


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/23] em28xx: add support fur USB bulk transfers
  2012-10-31 19:58     ` Benny Amorsen
@ 2012-10-31 20:25       ` Ezequiel Garcia
  2012-10-31 22:26         ` Benny Amorsen
  0 siblings, 1 reply; 48+ messages in thread
From: Ezequiel Garcia @ 2012-10-31 20:25 UTC (permalink / raw)
  To: Benny Amorsen; +Cc: Frank Schäfer, linux-media

Benny,

On Wed, Oct 31, 2012 at 4:58 PM, Benny Amorsen <benny+usenet@amorsen.dk> wrote:
>>
>> Is this a regression caused by patches or a general issue with the
>> Raspberry board ?
>
> It is a general issue with the Raspberry USB host controller or driver.
> Bulk transfers work, isochronous transfers have problems. I was hoping I
> could somehow convince the Nanostick to use bulk transfers instead of
> isochronous transfers. Since that seems to require a firmware change, I
> will have to give up on it.
>
>

Very interesting. Let me see if I understand this: you say it's not a
problem with USB bandwidth,
but with isochronous transfers, in the sense it could achieve enough
speed for streaming
if bulk transfers were used?

Do you have any links supporting this?

Thanks,

    Ezequiel

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/23] em28xx: add support fur USB bulk transfers
  2012-10-31 20:25       ` Ezequiel Garcia
@ 2012-10-31 22:26         ` Benny Amorsen
  0 siblings, 0 replies; 48+ messages in thread
From: Benny Amorsen @ 2012-10-31 22:26 UTC (permalink / raw)
  To: Ezequiel Garcia; +Cc: Frank Schäfer, linux-media

Ezequiel Garcia <elezegarcia@gmail.com> writes:

> Very interesting. Let me see if I understand this: you say it's not a
> problem with USB bandwidth, but with isochronous transfers, in the
> sense it could achieve enough speed for streaming if bulk transfers
> were used?

It is more of a hope than a statement... I have no proof.

> Do you have any links supporting this?

Only old stuff like http://www.mail-archive.com/linux-usb@vger.kernel.org/msg04232.html

There are quite a few reports of problems with USB cameras in general
and Kinect in particular. That seems to point at problems with
isochronous transfers. A typical USB camera does not need particularly
much bandwidth.

The Nanostick only needs 40Mbps + overhead for me -- the size of the
largest MUX in the UK currently. That is less than 10% of the 480Mbps
theoretically available.

The other problem reports tend to be about "full speed" (11Mbps) USB
devices which are difficult for the Pi hardware to handle. Most of the
reports are getting old, some have reported that driver upgrades fixed
the problems.

I believe most people experience stable ethernet performance (and the
ethernet is USB attached as you are undoubtedly aware). That is a lot
more demanding than a USB camera or a Nanostick. However, the ethernet
chip uses bulk transfers, not isochronous ones.


/Benny


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/23] em28xx: add support fur USB bulk transfers
  2012-10-30 17:18             ` Frank Schäfer
@ 2012-11-08 18:03               ` Frank Schäfer
  2012-11-09 15:02                 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 48+ messages in thread
From: Frank Schäfer @ 2012-11-08 18:03 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media

Am 30.10.2012 19:18, schrieb Frank Schäfer:
> Am 30.10.2012 06:06, schrieb Mauro Carvalho Chehab:
>
> <snip>
>> Did a git bisect. The last patch where the bug doesn't occur is this 
>> changeset:
>> 	em28xx: add module parameter for selection of the preferred USB transfer type
>>
>> That means that this changeset broke it:
>>
>> 	em28xx: use common urb data copying function for vbi and non-vbi devices
> Ok, thanks.
> That means we are VERY close...
>
> I think this is the only change that could cause the trouble:
>> @@ -599,6 +491,7 @@ static inline int em28xx_urb_data_copy_vbi(struct em28xx *dev, struct urb *urb)
>>  			len = actual_length - 4;
>>  		} else if (p[0] == 0x22 && p[1] == 0x5a) {
>>  			/* start video */
>> +			dev->capture_type = 1;
>>  			p += 4;
>>  			len = actual_length - 4;
>>  		} else {
> Could you try again with this line commented out ? (em28xx-video.c, line
> 494 in the patched file).
> usb_debug=1 would be usefull, too.
>
>> I didn't test them with my Silvercrest webcam yet.
> I re-tested 5 minutes ago with this device and it works fine.
> Btw, which frame rates do you get  ? ;)
>
> Regards,
> Frank

Today I had the chance to test these patches with a Hauppauge HVR-930c.
Couldn't test analog TV (not supported yet), but DVB works fine, too.

So patches 1 to 21 have been tested now and do at least not cause any
regressions.

I would like to drop the last two patches (22+23) of this series, because
- they are actually not related to USB bulk transfers
- patch 22 needs to be fixed for analog+vbi (will get an analog device
for testing next week)
- I'm working on further improvements/changes in this area (including
em25xx support)
So I will better come up with a separate patch series later.

Will send a v2 of this patch series soon.

Regards,
Frank



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/23] em28xx: add support fur USB bulk transfers
  2012-11-08 18:03               ` Frank Schäfer
@ 2012-11-09 15:02                 ` Mauro Carvalho Chehab
  2012-11-09 16:03                   ` Frank Schäfer
  0 siblings, 1 reply; 48+ messages in thread
From: Mauro Carvalho Chehab @ 2012-11-09 15:02 UTC (permalink / raw)
  To: Frank Schäfer; +Cc: linux-media

Em Thu, 08 Nov 2012 20:03:47 +0200
Frank Schäfer <fschaefer.oss@googlemail.com> escreveu:

> Am 30.10.2012 19:18, schrieb Frank Schäfer:
> > Am 30.10.2012 06:06, schrieb Mauro Carvalho Chehab:
> >
> > <snip>
> >> Did a git bisect. The last patch where the bug doesn't occur is this 
> >> changeset:
> >> 	em28xx: add module parameter for selection of the preferred USB transfer type
> >>
> >> That means that this changeset broke it:
> >>
> >> 	em28xx: use common urb data copying function for vbi and non-vbi devices
> > Ok, thanks.
> > That means we are VERY close...
> >
> > I think this is the only change that could cause the trouble:
> >> @@ -599,6 +491,7 @@ static inline int em28xx_urb_data_copy_vbi(struct em28xx *dev, struct urb *urb)
> >>  			len = actual_length - 4;
> >>  		} else if (p[0] == 0x22 && p[1] == 0x5a) {
> >>  			/* start video */
> >> +			dev->capture_type = 1;
> >>  			p += 4;
> >>  			len = actual_length - 4;
> >>  		} else {
> > Could you try again with this line commented out ? (em28xx-video.c, line
> > 494 in the patched file).
> > usb_debug=1 would be usefull, too.
> >
> >> I didn't test them with my Silvercrest webcam yet.
> > I re-tested 5 minutes ago with this device and it works fine.
> > Btw, which frame rates do you get  ? ;)
> >
> > Regards,
> > Frank
> 
> Today I had the chance to test these patches with a Hauppauge HVR-930c.
> Couldn't test analog TV (not supported yet), but DVB works fine, too.

While I would love to have it, analog support for HVR-930C would likely
not happen. I don't know anyone working on it. There are two issues there:
1) it uses an unsupported micronas analog demod chipset;
2) drx-k requrires some changes to tune on analog  mode.

As usual, patches for it are of course very welcome.

> 
> So patches 1 to 21 have been tested now and do at least not cause any
> regressions.
> 
> I would like to drop the last two patches (22+23) of this series, because
> - they are actually not related to USB bulk transfers
> - patch 22 needs to be fixed for analog+vbi (will get an analog device
> for testing next week)
> - I'm working on further improvements/changes in this area (including
> em25xx support)
> So I will better come up with a separate patch series later.

OK.

> Will send a v2 of this patch series soon.
> 
> Regards,
> Frank
> 
> 

Cheers,
Mauro

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/23] em28xx: add support fur USB bulk transfers
  2012-11-09 15:02                 ` Mauro Carvalho Chehab
@ 2012-11-09 16:03                   ` Frank Schäfer
  0 siblings, 0 replies; 48+ messages in thread
From: Frank Schäfer @ 2012-11-09 16:03 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, linux-media

Am 09.11.2012 17:02, schrieb Mauro Carvalho Chehab:
> Em Thu, 08 Nov 2012 20:03:47 +0200
> Frank Schäfer <fschaefer.oss@googlemail.com> escreveu:
>
>> Am 30.10.2012 19:18, schrieb Frank Schäfer:
>>> Am 30.10.2012 06:06, schrieb Mauro Carvalho Chehab:
>>>
>>> <snip>
>>>> Did a git bisect. The last patch where the bug doesn't occur is this 
>>>> changeset:
>>>> 	em28xx: add module parameter for selection of the preferred USB transfer type
>>>>
>>>> That means that this changeset broke it:
>>>>
>>>> 	em28xx: use common urb data copying function for vbi and non-vbi devices
>>> Ok, thanks.
>>> That means we are VERY close...
>>>
>>> I think this is the only change that could cause the trouble:
>>>> @@ -599,6 +491,7 @@ static inline int em28xx_urb_data_copy_vbi(struct em28xx *dev, struct urb *urb)
>>>>  			len = actual_length - 4;
>>>>  		} else if (p[0] == 0x22 && p[1] == 0x5a) {
>>>>  			/* start video */
>>>> +			dev->capture_type = 1;
>>>>  			p += 4;
>>>>  			len = actual_length - 4;
>>>>  		} else {
>>> Could you try again with this line commented out ? (em28xx-video.c, line
>>> 494 in the patched file).
>>> usb_debug=1 would be usefull, too.
>>>
>>>> I didn't test them with my Silvercrest webcam yet.
>>> I re-tested 5 minutes ago with this device and it works fine.
>>> Btw, which frame rates do you get  ? ;)
>>>
>>> Regards,
>>> Frank
>> Today I had the chance to test these patches with a Hauppauge HVR-930c.
>> Couldn't test analog TV (not supported yet), but DVB works fine, too.
> While I would love to have it, analog support for HVR-930C would likely
> not happen. I don't know anyone working on it. There are two issues there:
> 1) it uses an unsupported micronas analog demod chipset;
> 2) drx-k requrires some changes to tune on analog  mode.

Yeah, I heard about that. :(

> As usual, patches for it are of course very welcome.

I don't own this device, just borrowed it for some minutes for testing.
Apart from that, it seems I will be busy with the Laplace webcam support
for the next years... :D

Regards,
Frank

>
>> So patches 1 to 21 have been tested now and do at least not cause any
>> regressions.
>>
>> I would like to drop the last two patches (22+23) of this series, because
>> - they are actually not related to USB bulk transfers
>> - patch 22 needs to be fixed for analog+vbi (will get an analog device
>> for testing next week)
>> - I'm working on further improvements/changes in this area (including
>> em25xx support)
>> So I will better come up with a separate patch series later.
> OK.
>
>> Will send a v2 of this patch series soon.
>>
>> Regards,
>> Frank
>>
>>
> Cheers,
> Mauro


^ permalink raw reply	[flat|nested] 48+ messages in thread

end of thread, other threads:[~2012-11-09 17:03 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-21 16:52 [PATCH 00/23] em28xx: add support fur USB bulk transfers Frank Schäfer
2012-10-21 16:52 ` [PATCH 01/23] em28xx: fix wrong data offset for non-interlaced mode in em28xx_copy_video Frank Schäfer
2012-10-21 16:52 ` [PATCH 02/23] em28xx: clarify meaning of field 'progressive' in struct em28xx Frank Schäfer
2012-10-21 16:52 ` [PATCH 03/23] em28xx: rename isoc packet number constants and parameters Frank Schäfer
2012-10-21 16:52 ` [PATCH 04/23] em28xx: rename struct em28xx_usb_isoc_bufs to em28xx_usb_bufs Frank Schäfer
2012-10-21 16:52 ` [PATCH 05/23] em28xx: rename struct em28xx_usb_isoc_ctl to em28xx_usb_ctl Frank Schäfer
2012-10-21 16:52 ` [PATCH 06/23] em28xx: remove obsolete #define EM28XX_URB_TIMEOUT Frank Schäfer
2012-10-21 16:52 ` [PATCH 07/23] em28xx: update description of em28xx_irq_callback Frank Schäfer
2012-10-21 16:52 ` [PATCH 08/23] em28xx: rename function em28xx_uninit_isoc to em28xx_uninit_usb_xfer Frank Schäfer
2012-10-21 16:52 ` [PATCH 09/23] em28xx: create a common function for isoc and bulk URB allocation and setup Frank Schäfer
2012-10-21 16:52 ` [PATCH 10/23] em28xx: create a common function for isoc and bulk USB transfer initialization Frank Schäfer
2012-10-21 16:52 ` Frank Schäfer
2012-10-21 16:52 ` [PATCH 11/23] em28xx: clear USB halt/stall condition in em28xx_init_usb_xfer when using bulk transfers Frank Schäfer
2012-10-21 16:52 ` [PATCH 12/23] em28xx: remove double checks for urb->status == -ENOENT in urb_data_copy functions Frank Schäfer
2012-10-21 16:52 ` [PATCH 13/23] em28xx: rename function em28xx_isoc_copy and extend for USB bulk transfers Frank Schäfer
2012-10-21 16:52 ` [PATCH 14/23] em28xx: rename function em28xx_isoc_copy_vbi " Frank Schäfer
2012-10-21 16:52 ` [PATCH 15/23] em28xx: rename function em28xx_dvb_isoc_copy " Frank Schäfer
2012-10-21 16:52 ` [PATCH 16/23] em28xx: rename usb debugging module parameter and macro Frank Schäfer
2012-10-21 16:52 ` [PATCH 17/23] em28xx: rename some USB parameter fields in struct em28xx to clarify their role Frank Schäfer
2012-10-21 16:52 ` [PATCH 18/23] em28xx: add fields for analog and DVB USB transfer type selection to struct em28xx Frank Schäfer
2012-10-21 16:52 ` [PATCH 19/23] em28xx: set USB alternate settings for analog video bulk transfers properly Frank Schäfer
2012-10-21 16:52 ` [PATCH 20/23] em28xx: improve USB endpoint logic, also use bulk transfers Frank Schäfer
2012-10-21 16:52 ` [PATCH 21/23] em28xx: add module parameter for selection of the preferred USB transfer type Frank Schäfer
2012-10-21 16:52 ` [PATCH 22/23] em28xx: use common urb data copying function for vbi and non-vbi devices Frank Schäfer
2012-10-21 16:52 ` [PATCH 23/23] em28xx: enable VBI-support for em2840 devices Frank Schäfer
2012-10-21 18:13 ` [PATCH 00/23] em28xx: add support fur USB bulk transfers Devin Heitmueller
2012-10-23 19:02   ` Frank Schäfer
     [not found] ` <20121028175752.447c39d5@redhat.com>
2012-10-29 15:33   ` Frank Schäfer
2012-10-29 20:03     ` Mauro Carvalho Chehab
2012-10-29 21:14       ` Frank Schäfer
2012-10-30  3:00         ` Mauro Carvalho Chehab
2012-10-30  4:06           ` Mauro Carvalho Chehab
2012-10-30 13:08             ` Devin Heitmueller
2012-10-30 14:03               ` Mauro Carvalho Chehab
2012-10-30 17:29               ` Frank Schäfer
2012-10-30 17:18             ` Frank Schäfer
2012-11-08 18:03               ` Frank Schäfer
2012-11-09 15:02                 ` Mauro Carvalho Chehab
2012-11-09 16:03                   ` Frank Schäfer
2012-10-31  1:39 ` Benny Amorsen
2012-10-31 10:57   ` Ezequiel Garcia
2012-10-31 12:03     ` Frank Schäfer
2012-10-31 20:24       ` Benny Amorsen
2012-10-31 20:22     ` Benny Amorsen
2012-10-31 11:50   ` Frank Schäfer
2012-10-31 19:58     ` Benny Amorsen
2012-10-31 20:25       ` Ezequiel Garcia
2012-10-31 22:26         ` Benny Amorsen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.