All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: cx231xx : Add support for OTG102 aka EZGrabber2
       [not found] <4B487EF5847E47F0A8C1E96B9CA6B6D6@ucdenver.pvt>
@ 2013-03-01  7:52 ` Hans Verkuil
  2013-03-01 23:53   ` Matt Gomboc
  0 siblings, 1 reply; 6+ messages in thread
From: Hans Verkuil @ 2013-03-01  7:52 UTC (permalink / raw)
  To: Matt Gomboc; +Cc: linux-media

On Fri March 1 2013 00:34:38 Matt Gomboc wrote:
> This is a patch I have created that enables basic support for a product
> marketed as EZGrabber2, which is identified as an OTG102 board by dmesg and
> lsusb.
> 
> I have documented some detail about the product and this patch at
> http://linuxtv.org/wiki/index.php/OTG102. In summary, it has a peculiarly
> marked chipset, CX78921-11z, although the packaged windows drivers looked
> similar enough to the cx23100 series. With some experimentation, was able to
> get the device to operate properly by replicating much of the code for the
> CX231XX_BOARD_CNXT_VIDEO_GRABBER, but with the
> agc_analog_digital_select_gpio information from the windows driver inf file
> and defining .dont_use_port_3.
> 
> The vendor documentation states the device supports hardware encoding of
> MPEG1/2/4. If I don't include the .has_417=1 option in the device
> definition, it creates a single /dev/video0 device which works and provides
> uncompressed video. If I do include that option, the working device is moved
> to video1, and video0 is created but no data comes out of it. The Geniatech
> driver also contains a firmware image called cx416enc.rom which is very
> similar (in binary comparison) to the v4l-cx23885-enc.fw/ hcw85enc.rom. 

Yeah, I never was able to get the 417 part working either. The code for
that seems to be highly unstable.

> The patch is against my local gentoo-3.6 kernel. As I am a first time
> contributor to this mailing list, and only have a superficial understanding
> of the cx231xx and related drivers and the v4l2 framework (and c programming
> in general), any stylistic or procedural guidance for improving the patch
> for eventual submission, information posted to the linuxtv wiki, etc, would
> be welcome.

It's not bad for a first time :-)

The main thing to remember is to post the patch as part of the email, not as
an attachment. That makes it easier for us to review.

I also need a 'Signed-of-by' line before a patch can be submitted. See:

http://linuxtv.org/wiki/index.php/Development:_How_to_submit_patches

> Also considering the recently submitted patch for the "Elgato Video Capture
> V2" which also adds device 16 to cx2311.h and the many recent patches by
> Hans Verkuil, this may take some further working to align it with a moving
> target.

It shouldn't be too bad, but it probably makes life easier if we wait with
applying this patch until after my patch series has been merged.

> If you desire any further information, let me know. Thanks.
> 
> Matt 

Some small comments regarding this patch:

> diff -uprN linux-3.6/drivers/media/video/cx231xx/cx231xx-avcore.c linux-3.6.new/drivers/media/video/cx231xx/cx231xx-avcore.c
> --- linux-3.6/drivers/media/video/cx231xx/cx231xx-avcore.c	2012-09-30 17:47:46.000000000 -0600
> +++ linux-3.6.new/drivers/media/video/cx231xx/cx231xx-avcore.c	2013-02-26 19:58:51.096793077 -0700
> @@ -352,6 +352,7 @@ int cx231xx_afe_update_power_control(str
>  	case CX231XX_BOARD_CNXT_RDE_253S:
>  	case CX231XX_BOARD_CNXT_RDU_253S:
>  	case CX231XX_BOARD_CNXT_VIDEO_GRABBER:
> +	case CX231XX_BOARD_OTG102:
>  	case CX231XX_BOARD_HAUPPAUGE_EXETER:
>  	case CX231XX_BOARD_HAUPPAUGE_USBLIVE2:
>  	case CX231XX_BOARD_PV_PLAYTV_USB_HYBRID:
> @@ -1719,6 +1720,7 @@ int cx231xx_dif_set_standard(struct cx23
>  	case CX231XX_BOARD_CNXT_SHELBY:
>  	case CX231XX_BOARD_CNXT_RDU_250:
>  	case CX231XX_BOARD_CNXT_VIDEO_GRABBER:
> +	case CX231XX_BOARD_OTG102:
>  	case CX231XX_BOARD_HAUPPAUGE_EXETER:
>  		func_mode = 0x03;
>  		break;
> diff -uprN linux-3.6/drivers/media/video/cx231xx/cx231xx-cards.c linux-3.6.new/drivers/media/video/cx231xx/cx231xx-cards.c
> --- linux-3.6/drivers/media/video/cx231xx/cx231xx-cards.c	2012-09-30 17:47:46.000000000 -0600
> +++ linux-3.6.new/drivers/media/video/cx231xx/cx231xx-cards.c	2013-02-28 12:23:58.925869674 -0700
> @@ -280,6 +280,37 @@ struct cx231xx_board cx231xx_boards[] =
>  			}
>  		},
>  	},
> +	[CX231XX_BOARD_OTG102] = {
> +                .name = "Geniatech OTG102",
> +                .tuner_type = TUNER_ABSENT,
> +                .decoder = CX231XX_AVDECODER,
> +                .output_mode = OUT_MODE_VIP11,
> +                .ctl_pin_status_mask = 0xFFFFFFC4,
> +                .agc_analog_digital_select_gpio = 0x0c, /* According with PV CxPlrCAP.inf file */
> +                .gpio_pin_status_mask = 0x4001000,
> +                .norm = V4L2_STD_NTSC,
> +                .no_alt_vanc = 1,
> +                .external_av = 1,
> +                .dont_use_port_3 = 1,
> +		//.has_417 = 1,

Don't use //, always use /* */ (coding style issue).

> +		/* this board has hardware encoding chip supporting mpeg1/2/4, but as the 417 is apparently not working for the
> +		   reference board it is not on this one either. building the driver with this option and then loading the module
> +		   creates a second video device node, but nothing comes out of it.  */

These comments shouldn't go over column 80.


> +                .input = {{
> +                                .type = CX231XX_VMUX_COMPOSITE1,
> +                                .vmux = CX231XX_VIN_2_1,
> +                                .amux = CX231XX_AMUX_LINE_IN,
> +                                .gpio = NULL,
> +                        }, {
> +                                .type = CX231XX_VMUX_SVIDEO,
> +                                .vmux = CX231XX_VIN_1_1 |
> +                                        (CX231XX_VIN_1_2 << 8) |
> +                                        CX25840_SVIDEO_ON,
> +                                .amux = CX231XX_AMUX_LINE_IN,
> +                                .gpio = NULL,
> +                        }
> +                },
> +        },
>  	[CX231XX_BOARD_CNXT_RDE_250] = {
>  		.name = "Conexant Hybrid TV - rde 250",
>  		.tuner_type = TUNER_XC5000,
> @@ -620,6 +651,8 @@ struct usb_device_id cx231xx_id_table[]
>  	 .driver_info = CX231XX_BOARD_CNXT_RDU_253S},
>  	{USB_DEVICE(0x0572, 0x58A6),
>  	 .driver_info = CX231XX_BOARD_CNXT_VIDEO_GRABBER},
> +	{USB_DEVICE(0x1F4D, 0x0102),
> +	 .driver_info = CX231XX_BOARD_OTG102},
>  	{USB_DEVICE(0x0572, 0x589E),
>  	 .driver_info = CX231XX_BOARD_CNXT_RDE_250},
>  	{USB_DEVICE(0x0572, 0x58A0),
> @@ -904,6 +937,12 @@ static int cx231xx_init_dev(struct cx231
>  		cx231xx_set_alt_setting(dev, INDEX_VIDEO, 3);
>  		cx231xx_set_alt_setting(dev, INDEX_VANC, 1);
>  	}
> +/*

Why is this commented out? Can't this just be removed?

> +	if (dev->model == CX231XX_OTG102) {
> +		cx231xx_set_alt_setting(dev, INDEX_VIDEO, 3);
> +		cx231xx_set_alt_setting(dev, INDEX_VANC, 1);
> +	}
> +*/
>  	/* Cx231xx pre card setup */
>  	cx231xx_pre_card_setup(dev);
>  
> @@ -1295,6 +1334,12 @@ static int cx231xx_usb_probe(struct usb_
>  		cx231xx_enable_OSC(dev);
>  		cx231xx_reset_out(dev);
>  		cx231xx_set_alt_setting(dev, INDEX_VIDEO, 3);
> +	}
> +	
> +	if (dev->model == CX231XX_BOARD_OTG102) {
> +		cx231xx_enable_OSC(dev);
> +		cx231xx_reset_out(dev);
> +		cx231xx_set_alt_setting(dev, INDEX_VIDEO, 3);
>  	}
>  
>  	if (dev->model == CX231XX_BOARD_CNXT_RDE_253S)
> diff -uprN linux-3.6/drivers/media/video/cx231xx/cx231xx.h linux-3.6.new/drivers/media/video/cx231xx/cx231xx.h
> --- linux-3.6/drivers/media/video/cx231xx/cx231xx.h	2012-09-30 17:47:46.000000000 -0600
> +++ linux-3.6.new/drivers/media/video/cx231xx/cx231xx.h	2013-02-26 16:01:58.924653199 -0700
> @@ -68,6 +68,7 @@
>  #define CX231XX_BOARD_ICONBIT_U100 13
>  #define CX231XX_BOARD_HAUPPAUGE_USB2_FM_PAL 14
>  #define CX231XX_BOARD_HAUPPAUGE_USB2_FM_NTSC 15
> +#define CX231XX_BOARD_OTG102 16
>  
>  /* Limits minimum and default number of buffers */
>  #define CX231XX_MIN_BUF                 4

I recommend creating your patch on top of my patch series which is available
here: http://git.linuxtv.org/hverkuil/media_tree.git/shortlog/refs/heads/cx231xx

That way I can just add your patch to my patch series and the whole lot will
be merged in one go by Mauro.

Regards,

	Hans

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

* Re: cx231xx : Add support for OTG102 aka EZGrabber2
  2013-03-01  7:52 ` cx231xx : Add support for OTG102 aka EZGrabber2 Hans Verkuil
@ 2013-03-01 23:53   ` Matt Gomboc
  2013-03-06 19:56     ` Hans Verkuil
  0 siblings, 1 reply; 6+ messages in thread
From: Matt Gomboc @ 2013-03-01 23:53 UTC (permalink / raw)
  To: Hans Verkuil, linux-media

Thanks for the response, I have done as you suggested.

Below is an updated patch for the OTG102 device against http://git.linuxtv.org/hverkuil/media_tree.git/shortlog/refs/heads/cx231xx, kernel version 3.8.

With further testing it appears the extra clauses in cx231xx-cards.c were not necessary (in static in cx231xx_init_dev and static int cx231xx_usb_probe), so those have been also been removed.


Signed-off-by: Matt Gomboc <gomboc0@gmail.com>
--
 drivers/media/usb/cx231xx/cx231xx-avcore.c |  2 ++
 drivers/media/usb/cx231xx/cx231xx-cards.c  | 35 ++++++++++++++++++++++++++++++
 drivers/media/usb/cx231xx/cx231xx.h        |  1 +
 3 files changed, 38 insertions(+)

diff --git a/drivers/media/usb/cx231xx/cx231xx-avcore.c b/drivers/media/usb/cx231xx/cx231xx-avcore.c
index 2e51fb9..235ba65 100644
--- a/drivers/media/usb/cx231xx/cx231xx-avcore.c
+++ b/drivers/media/usb/cx231xx/cx231xx-avcore.c
@@ -357,6 +357,7 @@ int cx231xx_afe_update_power_control(struct cx231xx *dev,
 	case CX231XX_BOARD_PV_PLAYTV_USB_HYBRID:
 	case CX231XX_BOARD_HAUPPAUGE_USB2_FM_PAL:
 	case CX231XX_BOARD_HAUPPAUGE_USB2_FM_NTSC:
+	case CX231XX_BOARD_OTG102:
 		if (avmode == POLARIS_AVMODE_ANALOGT_TV) {
 			while (afe_power_status != (FLD_PWRDN_TUNING_BIAS |
 						FLD_PWRDN_ENABLE_PLL)) {
@@ -1720,6 +1721,7 @@ int cx231xx_dif_set_standard(struct cx231xx *dev, u32 standard)
 	case CX231XX_BOARD_CNXT_RDU_250:
 	case CX231XX_BOARD_CNXT_VIDEO_GRABBER:
 	case CX231XX_BOARD_HAUPPAUGE_EXETER:
+	case CX231XX_BOARD_OTG102:
 		func_mode = 0x03;
 		break;
 	case CX231XX_BOARD_CNXT_RDE_253S:
diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c
index b7b1acd..13249e5 100644
--- a/drivers/media/usb/cx231xx/cx231xx-cards.c
+++ b/drivers/media/usb/cx231xx/cx231xx-cards.c
@@ -634,6 +634,39 @@ struct cx231xx_board cx231xx_boards[] = {
 			.gpio = NULL,
 		} },
 	},
+	[CX231XX_BOARD_OTG102] = {
+		.name = "Geniatech OTG102",
+		.tuner_type = TUNER_ABSENT,
+		.decoder = CX231XX_AVDECODER,
+		.output_mode = OUT_MODE_VIP11,
+		.ctl_pin_status_mask = 0xFFFFFFC4,
+		.agc_analog_digital_select_gpio = 0x0c, 
+			/* According with PV CxPlrCAP.inf file */
+		.gpio_pin_status_mask = 0x4001000,
+		.norm = V4L2_STD_NTSC,
+		.no_alt_vanc = 1,
+		.external_av = 1,
+		.dont_use_port_3 = 1,
+		/*.has_417 = 1, */
+		/* This board is believed to have a hardware encoding chip
+		 * supporting mpeg1/2/4, but as the 417 is apparently not
+		 * working for the reference board it is not here either. */
+
+		.input = {{
+				.type = CX231XX_VMUX_COMPOSITE1,
+				.vmux = CX231XX_VIN_2_1,
+				.amux = CX231XX_AMUX_LINE_IN,
+				.gpio = NULL,
+			}, {
+				.type = CX231XX_VMUX_SVIDEO,
+				.vmux = CX231XX_VIN_1_1 |
+					(CX231XX_VIN_1_2 << 8) |
+					CX25840_SVIDEO_ON,
+				.amux = CX231XX_AMUX_LINE_IN,
+				.gpio = NULL,
+			}
+		},
+	},
 };
 const unsigned int cx231xx_bcount = ARRAY_SIZE(cx231xx_boards);
 
@@ -675,6 +708,8 @@ struct usb_device_id cx231xx_id_table[] = {
 	 .driver_info = CX231XX_BOARD_ICONBIT_U100},
 	{USB_DEVICE(0x0fd9, 0x0037),
 	 .driver_info = CX231XX_BOARD_ELGATO_VIDEO_CAPTURE_V2},
+	{USB_DEVICE(0x1f4d, 0x0102),
+	 .driver_info = CX231XX_BOARD_OTG102},
 	{},
 };
 
diff --git a/drivers/media/usb/cx231xx/cx231xx.h b/drivers/media/usb/cx231xx/cx231xx.h
index a8e50d2..dff3f1d 100644
--- a/drivers/media/usb/cx231xx/cx231xx.h
+++ b/drivers/media/usb/cx231xx/cx231xx.h
@@ -71,6 +71,7 @@
 #define CX231XX_BOARD_HAUPPAUGE_USB2_FM_PAL 14
 #define CX231XX_BOARD_HAUPPAUGE_USB2_FM_NTSC 15
 #define CX231XX_BOARD_ELGATO_VIDEO_CAPTURE_V2 16
+#define CX231XX_BOARD_OTG102 17
 
 /* Limits minimum and default number of buffers */
 #define CX231XX_MIN_BUF                 4


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

* Re: cx231xx : Add support for OTG102 aka EZGrabber2
  2013-03-01 23:53   ` Matt Gomboc
@ 2013-03-06 19:56     ` Hans Verkuil
  2013-03-06 23:05       ` Matt Gomboc
  0 siblings, 1 reply; 6+ messages in thread
From: Hans Verkuil @ 2013-03-06 19:56 UTC (permalink / raw)
  To: gomboc0; +Cc: linux-media

Hi Matt,

While I added this patch to my cx231xx patch series, Mauro didn't pick it
up for some reason. So for when he gets around to looking at your patch, I want to
add my:

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Regards,

	Hans

On Sat March 2 2013 00:53:30 Matt Gomboc wrote:
> Thanks for the response, I have done as you suggested.
> 
> Below is an updated patch for the OTG102 device against http://git.linuxtv.org/hverkuil/media_tree.git/shortlog/refs/heads/cx231xx, kernel version 3.8.
> 
> With further testing it appears the extra clauses in cx231xx-cards.c were not necessary (in static in cx231xx_init_dev and static int cx231xx_usb_probe), so those have been also been removed.
> 
> 
> Signed-off-by: Matt Gomboc <gomboc0@gmail.com>
> --
>  drivers/media/usb/cx231xx/cx231xx-avcore.c |  2 ++
>  drivers/media/usb/cx231xx/cx231xx-cards.c  | 35 ++++++++++++++++++++++++++++++
>  drivers/media/usb/cx231xx/cx231xx.h        |  1 +
>  3 files changed, 38 insertions(+)
> 
> diff --git a/drivers/media/usb/cx231xx/cx231xx-avcore.c b/drivers/media/usb/cx231xx/cx231xx-avcore.c
> index 2e51fb9..235ba65 100644
> --- a/drivers/media/usb/cx231xx/cx231xx-avcore.c
> +++ b/drivers/media/usb/cx231xx/cx231xx-avcore.c
> @@ -357,6 +357,7 @@ int cx231xx_afe_update_power_control(struct cx231xx *dev,
>  	case CX231XX_BOARD_PV_PLAYTV_USB_HYBRID:
>  	case CX231XX_BOARD_HAUPPAUGE_USB2_FM_PAL:
>  	case CX231XX_BOARD_HAUPPAUGE_USB2_FM_NTSC:
> +	case CX231XX_BOARD_OTG102:
>  		if (avmode == POLARIS_AVMODE_ANALOGT_TV) {
>  			while (afe_power_status != (FLD_PWRDN_TUNING_BIAS |
>  						FLD_PWRDN_ENABLE_PLL)) {
> @@ -1720,6 +1721,7 @@ int cx231xx_dif_set_standard(struct cx231xx *dev, u32 standard)
>  	case CX231XX_BOARD_CNXT_RDU_250:
>  	case CX231XX_BOARD_CNXT_VIDEO_GRABBER:
>  	case CX231XX_BOARD_HAUPPAUGE_EXETER:
> +	case CX231XX_BOARD_OTG102:
>  		func_mode = 0x03;
>  		break;
>  	case CX231XX_BOARD_CNXT_RDE_253S:
> diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c
> index b7b1acd..13249e5 100644
> --- a/drivers/media/usb/cx231xx/cx231xx-cards.c
> +++ b/drivers/media/usb/cx231xx/cx231xx-cards.c
> @@ -634,6 +634,39 @@ struct cx231xx_board cx231xx_boards[] = {
>  			.gpio = NULL,
>  		} },
>  	},
> +	[CX231XX_BOARD_OTG102] = {
> +		.name = "Geniatech OTG102",
> +		.tuner_type = TUNER_ABSENT,
> +		.decoder = CX231XX_AVDECODER,
> +		.output_mode = OUT_MODE_VIP11,
> +		.ctl_pin_status_mask = 0xFFFFFFC4,
> +		.agc_analog_digital_select_gpio = 0x0c, 
> +			/* According with PV CxPlrCAP.inf file */
> +		.gpio_pin_status_mask = 0x4001000,
> +		.norm = V4L2_STD_NTSC,
> +		.no_alt_vanc = 1,
> +		.external_av = 1,
> +		.dont_use_port_3 = 1,
> +		/*.has_417 = 1, */
> +		/* This board is believed to have a hardware encoding chip
> +		 * supporting mpeg1/2/4, but as the 417 is apparently not
> +		 * working for the reference board it is not here either. */
> +
> +		.input = {{
> +				.type = CX231XX_VMUX_COMPOSITE1,
> +				.vmux = CX231XX_VIN_2_1,
> +				.amux = CX231XX_AMUX_LINE_IN,
> +				.gpio = NULL,
> +			}, {
> +				.type = CX231XX_VMUX_SVIDEO,
> +				.vmux = CX231XX_VIN_1_1 |
> +					(CX231XX_VIN_1_2 << 8) |
> +					CX25840_SVIDEO_ON,
> +				.amux = CX231XX_AMUX_LINE_IN,
> +				.gpio = NULL,
> +			}
> +		},
> +	},
>  };
>  const unsigned int cx231xx_bcount = ARRAY_SIZE(cx231xx_boards);
>  
> @@ -675,6 +708,8 @@ struct usb_device_id cx231xx_id_table[] = {
>  	 .driver_info = CX231XX_BOARD_ICONBIT_U100},
>  	{USB_DEVICE(0x0fd9, 0x0037),
>  	 .driver_info = CX231XX_BOARD_ELGATO_VIDEO_CAPTURE_V2},
> +	{USB_DEVICE(0x1f4d, 0x0102),
> +	 .driver_info = CX231XX_BOARD_OTG102},
>  	{},
>  };
>  
> diff --git a/drivers/media/usb/cx231xx/cx231xx.h b/drivers/media/usb/cx231xx/cx231xx.h
> index a8e50d2..dff3f1d 100644
> --- a/drivers/media/usb/cx231xx/cx231xx.h
> +++ b/drivers/media/usb/cx231xx/cx231xx.h
> @@ -71,6 +71,7 @@
>  #define CX231XX_BOARD_HAUPPAUGE_USB2_FM_PAL 14
>  #define CX231XX_BOARD_HAUPPAUGE_USB2_FM_NTSC 15
>  #define CX231XX_BOARD_ELGATO_VIDEO_CAPTURE_V2 16
> +#define CX231XX_BOARD_OTG102 17
>  
>  /* Limits minimum and default number of buffers */
>  #define CX231XX_MIN_BUF                 4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

* RE: cx231xx : Add support for OTG102 aka EZGrabber2
  2013-03-06 19:56     ` Hans Verkuil
@ 2013-03-06 23:05       ` Matt Gomboc
  0 siblings, 0 replies; 6+ messages in thread
From: Matt Gomboc @ 2013-03-06 23:05 UTC (permalink / raw)
  To: 'Hans Verkuil'; +Cc: linux-media

That is welcome by me, let me know if any action is needed on my end. 

I was also wondering about adding the definition for the device 0572:58a3
which is identically identified in the distributed Windows driver from
Geniatech, but as it is not verified and may not even be in production, I
suppose it is best to wait until someone with such a device cares to test
it.

Thanks,

Matt

-----Original Message-----
From: Hans Verkuil [mailto:hverkuil@xs4all.nl] 
Sent: Wednesday, March 06, 2013 12:56 PM
To: gomboc0@gmail.com
Cc: linux-media@vger.kernel.org
Subject: Re: cx231xx : Add support for OTG102 aka EZGrabber2

Hi Matt,

While I added this patch to my cx231xx patch series, Mauro didn't pick it
up for some reason. So for when he gets around to looking at your patch, I
want to
add my:

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Regards,

	Hans

On Sat March 2 2013 00:53:30 Matt Gomboc wrote:
> Thanks for the response, I have done as you suggested.
> 
> Below is an updated patch for the OTG102 device against
http://git.linuxtv.org/hverkuil/media_tree.git/shortlog/refs/heads/cx231xx,
kernel version 3.8.
> 
> With further testing it appears the extra clauses in cx231xx-cards.c were
not necessary (in static in cx231xx_init_dev and static int
cx231xx_usb_probe), so those have been also been removed.
> 
> 
> Signed-off-by: Matt Gomboc <gomboc0@gmail.com>
> --
>  drivers/media/usb/cx231xx/cx231xx-avcore.c |  2 ++
>  drivers/media/usb/cx231xx/cx231xx-cards.c  | 35
++++++++++++++++++++++++++++++
>  drivers/media/usb/cx231xx/cx231xx.h        |  1 +
>  3 files changed, 38 insertions(+)
> 
> diff --git a/drivers/media/usb/cx231xx/cx231xx-avcore.c
b/drivers/media/usb/cx231xx/cx231xx-avcore.c
> index 2e51fb9..235ba65 100644
> --- a/drivers/media/usb/cx231xx/cx231xx-avcore.c
> +++ b/drivers/media/usb/cx231xx/cx231xx-avcore.c
> @@ -357,6 +357,7 @@ int cx231xx_afe_update_power_control(struct cx231xx
*dev,
>  	case CX231XX_BOARD_PV_PLAYTV_USB_HYBRID:
>  	case CX231XX_BOARD_HAUPPAUGE_USB2_FM_PAL:
>  	case CX231XX_BOARD_HAUPPAUGE_USB2_FM_NTSC:
> +	case CX231XX_BOARD_OTG102:
>  		if (avmode == POLARIS_AVMODE_ANALOGT_TV) {
>  			while (afe_power_status != (FLD_PWRDN_TUNING_BIAS |
>  						FLD_PWRDN_ENABLE_PLL)) {
> @@ -1720,6 +1721,7 @@ int cx231xx_dif_set_standard(struct cx231xx *dev,
u32 standard)
>  	case CX231XX_BOARD_CNXT_RDU_250:
>  	case CX231XX_BOARD_CNXT_VIDEO_GRABBER:
>  	case CX231XX_BOARD_HAUPPAUGE_EXETER:
> +	case CX231XX_BOARD_OTG102:
>  		func_mode = 0x03;
>  		break;
>  	case CX231XX_BOARD_CNXT_RDE_253S:
> diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c
b/drivers/media/usb/cx231xx/cx231xx-cards.c
> index b7b1acd..13249e5 100644
> --- a/drivers/media/usb/cx231xx/cx231xx-cards.c
> +++ b/drivers/media/usb/cx231xx/cx231xx-cards.c
> @@ -634,6 +634,39 @@ struct cx231xx_board cx231xx_boards[] = {
>  			.gpio = NULL,
>  		} },
>  	},
> +	[CX231XX_BOARD_OTG102] = {
> +		.name = "Geniatech OTG102",
> +		.tuner_type = TUNER_ABSENT,
> +		.decoder = CX231XX_AVDECODER,
> +		.output_mode = OUT_MODE_VIP11,
> +		.ctl_pin_status_mask = 0xFFFFFFC4,
> +		.agc_analog_digital_select_gpio = 0x0c, 
> +			/* According with PV CxPlrCAP.inf file */
> +		.gpio_pin_status_mask = 0x4001000,
> +		.norm = V4L2_STD_NTSC,
> +		.no_alt_vanc = 1,
> +		.external_av = 1,
> +		.dont_use_port_3 = 1,
> +		/*.has_417 = 1, */
> +		/* This board is believed to have a hardware encoding chip
> +		 * supporting mpeg1/2/4, but as the 417 is apparently not
> +		 * working for the reference board it is not here either. */
> +
> +		.input = {{
> +				.type = CX231XX_VMUX_COMPOSITE1,
> +				.vmux = CX231XX_VIN_2_1,
> +				.amux = CX231XX_AMUX_LINE_IN,
> +				.gpio = NULL,
> +			}, {
> +				.type = CX231XX_VMUX_SVIDEO,
> +				.vmux = CX231XX_VIN_1_1 |
> +					(CX231XX_VIN_1_2 << 8) |
> +					CX25840_SVIDEO_ON,
> +				.amux = CX231XX_AMUX_LINE_IN,
> +				.gpio = NULL,
> +			}
> +		},
> +	},
>  };
>  const unsigned int cx231xx_bcount = ARRAY_SIZE(cx231xx_boards);
>  
> @@ -675,6 +708,8 @@ struct usb_device_id cx231xx_id_table[] = {
>  	 .driver_info = CX231XX_BOARD_ICONBIT_U100},
>  	{USB_DEVICE(0x0fd9, 0x0037),
>  	 .driver_info = CX231XX_BOARD_ELGATO_VIDEO_CAPTURE_V2},
> +	{USB_DEVICE(0x1f4d, 0x0102),
> +	 .driver_info = CX231XX_BOARD_OTG102},
>  	{},
>  };
>  
> diff --git a/drivers/media/usb/cx231xx/cx231xx.h
b/drivers/media/usb/cx231xx/cx231xx.h
> index a8e50d2..dff3f1d 100644
> --- a/drivers/media/usb/cx231xx/cx231xx.h
> +++ b/drivers/media/usb/cx231xx/cx231xx.h
> @@ -71,6 +71,7 @@
>  #define CX231XX_BOARD_HAUPPAUGE_USB2_FM_PAL 14
>  #define CX231XX_BOARD_HAUPPAUGE_USB2_FM_NTSC 15
>  #define CX231XX_BOARD_ELGATO_VIDEO_CAPTURE_V2 16
> +#define CX231XX_BOARD_OTG102 17
>  
>  /* Limits minimum and default number of buffers */
>  #define CX231XX_MIN_BUF                 4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


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

* cx231xx : Add support for OTG102 aka EZGrabber2
@ 2013-02-28 23:48 Matt Gomboc
  0 siblings, 0 replies; 6+ messages in thread
From: Matt Gomboc @ 2013-02-28 23:48 UTC (permalink / raw)
  To: linux-media

[-- Attachment #1: Type: text/plain, Size: 1972 bytes --]

The text was inadvertently dropped from my first email, reincluding here.
-----------------

This is a patch I have created that enables basic support for a product
marketed as EZGrabber2, which is identified as an OTG102 board by dmesg and
lsusb.

I have documented some detail about the product and this patch at
http://linuxtv.org/wiki/index.php/OTG102. In summary, it has a peculiarly
marked chipset, CX78921-11z, although the packaged windows drivers looked
similar enough to the cx23100 series. With some experimentation, was able to
get the device to operate properly by replicating much of the code for the
CX231XX_BOARD_CNXT_VIDEO_GRABBER, but with the
agc_analog_digital_select_gpio information from the windows driver inf file
and defining .dont_use_port_3.

The vendor documentation states the device supports hardware encoding of
MPEG1/2/4. If I don't include the .has_417=1 option in the device
definition, it creates a single /dev/video0 device which works and provides
uncompressed video. If I do include that option, the working device is moved
to video1, and video0 is created but no data comes out of it. The Geniatech
driver also contains a firmware image called cx416enc.rom which is very
similar (in binary comparison) to the v4l-cx23885-enc.fw/ hcw85enc.rom. 

The patch is against my local gentoo-3.6 kernel. As I am a first time
contributor to this mailing list, and only have a superficial understanding
of the cx231xx and related drivers and the v4l2 framework (and c programming
in general), any stylistic or procedural guidance for improving the patch
for eventual submission, information posted to the linuxtv wiki, etc, would
be welcome.

Also considering the recently submitted patch for the "Elgato Video Capture
V2" which also adds device 16 to cx2311.h and the many recent patches by
Hans Verkuil, this may take some further working to align it with a moving
target.

If you desire any further information, let me know. Thanks.

Matt 



[-- Attachment #2: OTG102.patch --]
[-- Type: application/octet-stream, Size: 4826 bytes --]

diff -uprN linux-3.6/drivers/media/video/cx231xx/cx231xx-avcore.c linux-3.6.new/drivers/media/video/cx231xx/cx231xx-avcore.c
--- linux-3.6/drivers/media/video/cx231xx/cx231xx-avcore.c	2012-09-30 17:47:46.000000000 -0600
+++ linux-3.6.new/drivers/media/video/cx231xx/cx231xx-avcore.c	2013-02-26 19:58:51.096793077 -0700
@@ -352,6 +352,7 @@ int cx231xx_afe_update_power_control(str
 	case CX231XX_BOARD_CNXT_RDE_253S:
 	case CX231XX_BOARD_CNXT_RDU_253S:
 	case CX231XX_BOARD_CNXT_VIDEO_GRABBER:
+	case CX231XX_BOARD_OTG102:
 	case CX231XX_BOARD_HAUPPAUGE_EXETER:
 	case CX231XX_BOARD_HAUPPAUGE_USBLIVE2:
 	case CX231XX_BOARD_PV_PLAYTV_USB_HYBRID:
@@ -1719,6 +1720,7 @@ int cx231xx_dif_set_standard(struct cx23
 	case CX231XX_BOARD_CNXT_SHELBY:
 	case CX231XX_BOARD_CNXT_RDU_250:
 	case CX231XX_BOARD_CNXT_VIDEO_GRABBER:
+	case CX231XX_BOARD_OTG102:
 	case CX231XX_BOARD_HAUPPAUGE_EXETER:
 		func_mode = 0x03;
 		break;
diff -uprN linux-3.6/drivers/media/video/cx231xx/cx231xx-cards.c linux-3.6.new/drivers/media/video/cx231xx/cx231xx-cards.c
--- linux-3.6/drivers/media/video/cx231xx/cx231xx-cards.c	2012-09-30 17:47:46.000000000 -0600
+++ linux-3.6.new/drivers/media/video/cx231xx/cx231xx-cards.c	2013-02-28 12:23:58.925869674 -0700
@@ -280,6 +280,37 @@ struct cx231xx_board cx231xx_boards[] =
 			}
 		},
 	},
+	[CX231XX_BOARD_OTG102] = {
+                .name = "Geniatech OTG102",
+                .tuner_type = TUNER_ABSENT,
+                .decoder = CX231XX_AVDECODER,
+                .output_mode = OUT_MODE_VIP11,
+                .ctl_pin_status_mask = 0xFFFFFFC4,
+                .agc_analog_digital_select_gpio = 0x0c, /* According with PV CxPlrCAP.inf file */
+                .gpio_pin_status_mask = 0x4001000,
+                .norm = V4L2_STD_NTSC,
+                .no_alt_vanc = 1,
+                .external_av = 1,
+                .dont_use_port_3 = 1,
+		//.has_417 = 1,
+		/* this board has hardware encoding chip supporting mpeg1/2/4, but as the 417 is apparently not working for the
+		   reference board it is not on this one either. building the driver with this option and then loading the module
+		   creates a second video device node, but nothing comes out of it.  */
+                .input = {{
+                                .type = CX231XX_VMUX_COMPOSITE1,
+                                .vmux = CX231XX_VIN_2_1,
+                                .amux = CX231XX_AMUX_LINE_IN,
+                                .gpio = NULL,
+                        }, {
+                                .type = CX231XX_VMUX_SVIDEO,
+                                .vmux = CX231XX_VIN_1_1 |
+                                        (CX231XX_VIN_1_2 << 8) |
+                                        CX25840_SVIDEO_ON,
+                                .amux = CX231XX_AMUX_LINE_IN,
+                                .gpio = NULL,
+                        }
+                },
+        },
 	[CX231XX_BOARD_CNXT_RDE_250] = {
 		.name = "Conexant Hybrid TV - rde 250",
 		.tuner_type = TUNER_XC5000,
@@ -620,6 +651,8 @@ struct usb_device_id cx231xx_id_table[]
 	 .driver_info = CX231XX_BOARD_CNXT_RDU_253S},
 	{USB_DEVICE(0x0572, 0x58A6),
 	 .driver_info = CX231XX_BOARD_CNXT_VIDEO_GRABBER},
+	{USB_DEVICE(0x1F4D, 0x0102),
+	 .driver_info = CX231XX_BOARD_OTG102},
 	{USB_DEVICE(0x0572, 0x589E),
 	 .driver_info = CX231XX_BOARD_CNXT_RDE_250},
 	{USB_DEVICE(0x0572, 0x58A0),
@@ -904,6 +937,12 @@ static int cx231xx_init_dev(struct cx231
 		cx231xx_set_alt_setting(dev, INDEX_VIDEO, 3);
 		cx231xx_set_alt_setting(dev, INDEX_VANC, 1);
 	}
+/*
+	if (dev->model == CX231XX_OTG102) {
+		cx231xx_set_alt_setting(dev, INDEX_VIDEO, 3);
+		cx231xx_set_alt_setting(dev, INDEX_VANC, 1);
+	}
+*/
 	/* Cx231xx pre card setup */
 	cx231xx_pre_card_setup(dev);
 
@@ -1295,6 +1334,12 @@ static int cx231xx_usb_probe(struct usb_
 		cx231xx_enable_OSC(dev);
 		cx231xx_reset_out(dev);
 		cx231xx_set_alt_setting(dev, INDEX_VIDEO, 3);
+	}
+	
+	if (dev->model == CX231XX_BOARD_OTG102) {
+		cx231xx_enable_OSC(dev);
+		cx231xx_reset_out(dev);
+		cx231xx_set_alt_setting(dev, INDEX_VIDEO, 3);
 	}
 
 	if (dev->model == CX231XX_BOARD_CNXT_RDE_253S)
diff -uprN linux-3.6/drivers/media/video/cx231xx/cx231xx.h linux-3.6.new/drivers/media/video/cx231xx/cx231xx.h
--- linux-3.6/drivers/media/video/cx231xx/cx231xx.h	2012-09-30 17:47:46.000000000 -0600
+++ linux-3.6.new/drivers/media/video/cx231xx/cx231xx.h	2013-02-26 16:01:58.924653199 -0700
@@ -68,6 +68,7 @@
 #define CX231XX_BOARD_ICONBIT_U100 13
 #define CX231XX_BOARD_HAUPPAUGE_USB2_FM_PAL 14
 #define CX231XX_BOARD_HAUPPAUGE_USB2_FM_NTSC 15
+#define CX231XX_BOARD_OTG102 16
 
 /* Limits minimum and default number of buffers */
 #define CX231XX_MIN_BUF                 4

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

* cx231xx : Add support for OTG102 aka EZGrabber2
@ 2013-02-28 23:36 Matt Gomboc
  0 siblings, 0 replies; 6+ messages in thread
From: Matt Gomboc @ 2013-02-28 23:36 UTC (permalink / raw)
  To: linux-media

[-- Attachment #1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2: OTG102.patch --]
[-- Type: application/octet-stream, Size: 4826 bytes --]

diff -uprN linux-3.6/drivers/media/video/cx231xx/cx231xx-avcore.c linux-3.6.new/drivers/media/video/cx231xx/cx231xx-avcore.c
--- linux-3.6/drivers/media/video/cx231xx/cx231xx-avcore.c	2012-09-30 17:47:46.000000000 -0600
+++ linux-3.6.new/drivers/media/video/cx231xx/cx231xx-avcore.c	2013-02-26 19:58:51.096793077 -0700
@@ -352,6 +352,7 @@ int cx231xx_afe_update_power_control(str
 	case CX231XX_BOARD_CNXT_RDE_253S:
 	case CX231XX_BOARD_CNXT_RDU_253S:
 	case CX231XX_BOARD_CNXT_VIDEO_GRABBER:
+	case CX231XX_BOARD_OTG102:
 	case CX231XX_BOARD_HAUPPAUGE_EXETER:
 	case CX231XX_BOARD_HAUPPAUGE_USBLIVE2:
 	case CX231XX_BOARD_PV_PLAYTV_USB_HYBRID:
@@ -1719,6 +1720,7 @@ int cx231xx_dif_set_standard(struct cx23
 	case CX231XX_BOARD_CNXT_SHELBY:
 	case CX231XX_BOARD_CNXT_RDU_250:
 	case CX231XX_BOARD_CNXT_VIDEO_GRABBER:
+	case CX231XX_BOARD_OTG102:
 	case CX231XX_BOARD_HAUPPAUGE_EXETER:
 		func_mode = 0x03;
 		break;
diff -uprN linux-3.6/drivers/media/video/cx231xx/cx231xx-cards.c linux-3.6.new/drivers/media/video/cx231xx/cx231xx-cards.c
--- linux-3.6/drivers/media/video/cx231xx/cx231xx-cards.c	2012-09-30 17:47:46.000000000 -0600
+++ linux-3.6.new/drivers/media/video/cx231xx/cx231xx-cards.c	2013-02-28 12:23:58.925869674 -0700
@@ -280,6 +280,37 @@ struct cx231xx_board cx231xx_boards[] =
 			}
 		},
 	},
+	[CX231XX_BOARD_OTG102] = {
+                .name = "Geniatech OTG102",
+                .tuner_type = TUNER_ABSENT,
+                .decoder = CX231XX_AVDECODER,
+                .output_mode = OUT_MODE_VIP11,
+                .ctl_pin_status_mask = 0xFFFFFFC4,
+                .agc_analog_digital_select_gpio = 0x0c, /* According with PV CxPlrCAP.inf file */
+                .gpio_pin_status_mask = 0x4001000,
+                .norm = V4L2_STD_NTSC,
+                .no_alt_vanc = 1,
+                .external_av = 1,
+                .dont_use_port_3 = 1,
+		//.has_417 = 1,
+		/* this board has hardware encoding chip supporting mpeg1/2/4, but as the 417 is apparently not working for the
+		   reference board it is not on this one either. building the driver with this option and then loading the module
+		   creates a second video device node, but nothing comes out of it.  */
+                .input = {{
+                                .type = CX231XX_VMUX_COMPOSITE1,
+                                .vmux = CX231XX_VIN_2_1,
+                                .amux = CX231XX_AMUX_LINE_IN,
+                                .gpio = NULL,
+                        }, {
+                                .type = CX231XX_VMUX_SVIDEO,
+                                .vmux = CX231XX_VIN_1_1 |
+                                        (CX231XX_VIN_1_2 << 8) |
+                                        CX25840_SVIDEO_ON,
+                                .amux = CX231XX_AMUX_LINE_IN,
+                                .gpio = NULL,
+                        }
+                },
+        },
 	[CX231XX_BOARD_CNXT_RDE_250] = {
 		.name = "Conexant Hybrid TV - rde 250",
 		.tuner_type = TUNER_XC5000,
@@ -620,6 +651,8 @@ struct usb_device_id cx231xx_id_table[]
 	 .driver_info = CX231XX_BOARD_CNXT_RDU_253S},
 	{USB_DEVICE(0x0572, 0x58A6),
 	 .driver_info = CX231XX_BOARD_CNXT_VIDEO_GRABBER},
+	{USB_DEVICE(0x1F4D, 0x0102),
+	 .driver_info = CX231XX_BOARD_OTG102},
 	{USB_DEVICE(0x0572, 0x589E),
 	 .driver_info = CX231XX_BOARD_CNXT_RDE_250},
 	{USB_DEVICE(0x0572, 0x58A0),
@@ -904,6 +937,12 @@ static int cx231xx_init_dev(struct cx231
 		cx231xx_set_alt_setting(dev, INDEX_VIDEO, 3);
 		cx231xx_set_alt_setting(dev, INDEX_VANC, 1);
 	}
+/*
+	if (dev->model == CX231XX_OTG102) {
+		cx231xx_set_alt_setting(dev, INDEX_VIDEO, 3);
+		cx231xx_set_alt_setting(dev, INDEX_VANC, 1);
+	}
+*/
 	/* Cx231xx pre card setup */
 	cx231xx_pre_card_setup(dev);
 
@@ -1295,6 +1334,12 @@ static int cx231xx_usb_probe(struct usb_
 		cx231xx_enable_OSC(dev);
 		cx231xx_reset_out(dev);
 		cx231xx_set_alt_setting(dev, INDEX_VIDEO, 3);
+	}
+	
+	if (dev->model == CX231XX_BOARD_OTG102) {
+		cx231xx_enable_OSC(dev);
+		cx231xx_reset_out(dev);
+		cx231xx_set_alt_setting(dev, INDEX_VIDEO, 3);
 	}
 
 	if (dev->model == CX231XX_BOARD_CNXT_RDE_253S)
diff -uprN linux-3.6/drivers/media/video/cx231xx/cx231xx.h linux-3.6.new/drivers/media/video/cx231xx/cx231xx.h
--- linux-3.6/drivers/media/video/cx231xx/cx231xx.h	2012-09-30 17:47:46.000000000 -0600
+++ linux-3.6.new/drivers/media/video/cx231xx/cx231xx.h	2013-02-26 16:01:58.924653199 -0700
@@ -68,6 +68,7 @@
 #define CX231XX_BOARD_ICONBIT_U100 13
 #define CX231XX_BOARD_HAUPPAUGE_USB2_FM_PAL 14
 #define CX231XX_BOARD_HAUPPAUGE_USB2_FM_NTSC 15
+#define CX231XX_BOARD_OTG102 16
 
 /* Limits minimum and default number of buffers */
 #define CX231XX_MIN_BUF                 4

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

end of thread, other threads:[~2013-03-06 23:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <4B487EF5847E47F0A8C1E96B9CA6B6D6@ucdenver.pvt>
2013-03-01  7:52 ` cx231xx : Add support for OTG102 aka EZGrabber2 Hans Verkuil
2013-03-01 23:53   ` Matt Gomboc
2013-03-06 19:56     ` Hans Verkuil
2013-03-06 23:05       ` Matt Gomboc
2013-02-28 23:48 Matt Gomboc
  -- strict thread matches above, loose matches on Subject: below --
2013-02-28 23:36 Matt Gomboc

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.