Re: [PATCH] support of GoTView PCI-E X5 3D Hybrid in cx23885

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sunday 05 December 2010 17:20:05 Igor M. Liplianin wrote:
> Ð ÑÐÐÐÑÐÐÐÐ ÐÑ 21 ÐÐÑÐÑÑ 2010 01:51:36 ÐÐÑÐÑ Alexey Chernov ÐÐÐÐÑÐÐ:
> > Hello,
> 
> Hello Alexey,

Hello Igor,

thank you very much for reviewing the patch and your suggestions. I've fixed 
everything you've mentioned:

> > I've added support of GoTView PCI-E X5 3D Hybrid to cx23885 module
> > (thanks to help of Gotview support team). Some details:
> > 1. Everything initialize properly except radio.
> > 2. All analog inputs (TV, composite, S-Video) are tested by myself in
> > several TV norms (SECAM-D, PAL, NTSC), everything work fine. DVB isn't
> > tested properly due to absense of DVB signal.
> > 
> > So the patch adds general support/detection of the card with working
> > analog part and hopefully working (untested) DVB part. I hope it will be
> > useful.
> > 
> > Signed-off-by: Alexey Chernov <4ernov@xxxxxxxxx>
> > 
> > diff -uprB v4l-dvb.orig/drivers/media/video/cx23885/cx23885-cards.c v4l-
> > dvb/drivers/media/video/cx23885/cx23885-cards.c
> > --- v4l-dvb.orig/drivers/media/video/cx23885/cx23885-cards.c	2010-11-20
> > 22:24:11.000000000 +0300
> > +++ v4l-dvb/drivers/media/video/cx23885/cx23885-cards.c	2010-11-21
> > 02:09:54.000000000 +0300
> > @@ -309,6 +309,24 @@ struct cx23885_board cx23885_boards[] =
> > 
> >  				  CX25840_COMPONENT_ON,
> >  		
> >  		} },
> >  	
> >  	},
> > 
> > +	[CX23885_BOARD_GOTVIEW_X5_3D_HYBRID] = {
> > +		.name		= "GoTView X5 3D Hybrid",
> > +		.tuner_type = TUNER_XC5000,
> > +		.tuner_addr = 0x64,
> > +		.porta		= CX23885_ANALOG_VIDEO,
> > +		.portb		= CX23885_MPEG_DVB,
> > +		.input          = {{
> > +			.type   = CX23885_VMUX_TELEVISION,
> > +			.vmux   = CX25840_VIN2_CH1 | CX25840_VIN5_CH2,
> > +			.gpio0	= 0x02,
> > +		}, {
> > +			.type   = CX23885_VMUX_COMPOSITE1,
> > +			.vmux   =	CX23885_VMUX_COMPOSITE1,
> > +		}, {
> > +			.type   = CX23885_VMUX_SVIDEO,
> > +			.vmux   =	CX25840_SVIDEO_LUMA3 | CX25840_SVIDEO_CHROMA4,
> > +	    } },
> > +	},
> > 
> >  };
> >  const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards);
> > 
> > @@ -496,6 +514,10 @@ struct cx23885_subid cx23885_subids[] =
> > 
> >  		.subvendor = 0x107d,
> >  		.subdevice = 0x6f22,
> >  		.card      = CX23885_BOARD_LEADTEK_WINFAST_PXTV1200,
> > 
> > +	}, {
> > +		.subvendor = 0x5654,
> > +		.subdevice = 0x2390,
> > +		.card      = CX23885_BOARD_GOTVIEW_X5_3D_HYBRID,
> > 
> >  	},
> >  
> >  };
> >  const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids);
> > 
> > @@ -712,6 +734,10 @@ int cx23885_tuner_callback(void *priv, i
> > 
> >  		else if (port->nr == 2)
> >  		
> >  			bitmask = 0x04;
> >  		
> >  		break;
> > 
> > +	case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
> > +		/* Tuner Reset Command */
> > +		bitmask = 0x02;
> > +		break;
> > 
> >  	}
> >  	
> >  	if (bitmask) {
> > 
> > @@ -1218,6 +1244,7 @@ void cx23885_card_setup(struct cx23885_d
> > 
> >  	case CX23885_BOARD_HAUPPAUGE_HVR1850:
> >  	case CX23885_BOARD_COMPRO_VIDEOMATE_E800:
> > 
> >  	case CX23885_BOARD_HAUPPAUGE_HVR1290:
> > +	case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
> >  	default:
> >  		ts2->gen_ctrl_val  = 0xc; /* Serial bus + punctured clock */
> >  		ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
> > 
> > @@ -1245,6 +1272,7 @@ void cx23885_card_setup(struct cx23885_d
> > 
> >  	case CX23885_BOARD_MAGICPRO_PROHDTVE2:
> >  	case CX23885_BOARD_HAUPPAUGE_HVR1290:
> > 
> >  	case CX23885_BOARD_LEADTEK_WINFAST_PXTV1200:
> > +	case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
> >  		dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev,
> >  		
> >  				&dev->i2c_bus[2].i2c_adap,
> >  				NULL, "cx25840", 0x88 >> 1, NULL);
> > 
> > ÐÐÐÑÐÐ Ð v4l-dvb/drivers/media/video/cx23885: cx23885-cards.c~
> > diff -uprB v4l-dvb.orig/drivers/media/video/cx23885/cx23885-dvb.c v4l-
> > dvb/drivers/media/video/cx23885/cx23885-dvb.c
> > --- v4l-dvb.orig/drivers/media/video/cx23885/cx23885-dvb.c	2010-11-20
> > 22:24:11.000000000 +0300
> > +++ v4l-dvb/drivers/media/video/cx23885/cx23885-dvb.c	2010-11-21
> > 02:09:54.000000000 +0300
> > @@ -460,6 +460,10 @@ static struct xc5000_config mygica_x8506
> > 
> >  	.if_khz = 5380,
> >  
> >  };
> > 
> > +static struct zl10353_config gotview_x5_3d_hybrid_zl10353_config = {
> > +	.demod_address         = 0x0F,
> 
> Why is this not lower case?

Fixed it.

> > +};
> > +
> > 
> >  static int cx23885_dvb_set_frontend(struct dvb_frontend *fe,
> >  
> >  				    struct dvb_frontend_parameters *param)
> >  
> >  {
> > 
> > @@ -484,6 +488,9 @@ static int cx23885_dvb_set_frontend(stru
> > 
> >  		/* Select Digital TV */
> >  		cx23885_gpio_set(dev, GPIO_0);
> >  		break;
> > 
> > +	case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
> > +		cx23885_gpio_set(dev, GPIO_1);
> > +		break;
> > 
> >  	}
> >  	return 0;
> >  
> >  }
> > 
> > @@ -966,6 +973,24 @@ static int dvb_register(struct cx23885_t
> > 
> >  			break;
> >  		
> >  		}
> >  		break;
> > 
> > +	case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
> > +		i2c_bus = &dev->i2c_bus[port->nr - 1];
> 
> Port B number is 1, so
> 		i2c_bus = &dev->i2c_bus[0];

Yes, I defined it with port->nr to make more general but it's obviously not 
necessary here. Fixed.

> > +
> > +		fe0->dvb.frontend = dvb_attach(zl10353_attach,
> > +				&gotview_x5_3d_hybrid_zl10353_config,
> > +				&i2c_bus->i2c_adap);
> > +
> > +		if (fe0->dvb.frontend != NULL) {
> > +			struct xc5000_config	  cfg;
> > +			cfg.i2c_address = 0x64;
> 
> Why not to declare earlier as static structure?

Yes, my fault. I moved it to a static structure in updated version.

> > +
> > +			i2c_bus = &dev->i2c_bus[port->nr];
> > +
> > +			dvb_attach(xc5000_attach, fe0->dvb.frontend,
> > +					&i2c_bus->i2c_adap,
> 
> Maybe it is better to use &dev->i2c_bus[1].i2c_adap instead,
> then redeclaring i2c_bus is not needed.

I used i2c_bus2 instead, it's unused in my branch so I thought it's the better 
way as two i2c buses are actually used.

> > +					&cfg);
> > +		}
> > +		break;
> > 
> >  	default:
> >  		printk(KERN_INFO "%s: The frontend of your DVB/ATSC card "
> > 
> > diff -uprB v4l-dvb.orig/drivers/media/video/cx23885/cx23885.h v4l-
> > dvb/drivers/media/video/cx23885/cx23885.h
> > --- v4l-dvb.orig/drivers/media/video/cx23885/cx23885.h	2010-11-20
> > 22:24:11.000000000 +0300
> > +++ v4l-dvb/drivers/media/video/cx23885/cx23885.h	2010-11-21
> > 02:09:54.000000000 +0300
> > @@ -84,6 +84,7 @@
> > 
> >  #define CX23885_BOARD_HAUPPAUGE_HVR1290        26
> >  #define CX23885_BOARD_MYGICA_X8558PRO          27
> >  #define CX23885_BOARD_LEADTEK_WINFAST_PXTV1200 28
> > 
> > +#define CX23885_BOARD_GOTVIEW_X5_3D_HYBRID     29
> > 
> >  #define GPIO_0 0x00000001
> >  #define GPIO_1 0x00000002
> > 
> > --
> 
> Anyway, this is my acked-by line:
> Acked-by: Igor M. Liplianin <liplianin@xxxxx>

Thank you very much for acking! I'm posting an updated version of my patch. Is 
it necessary to ack it once again?

So, here's updated version of the patch.

Some comments:
1. Everything initialize properly except radio.
2. All analog inputs (TV, composite, S-Video) are tested by myself in several 
TV norms (SECAM-D, PAL, NTSC), everything work fine. DVB isn't tested properly 
due to absense of DVB signal.

So the patch adds general support/detection of the card with working analog 
part and hopefully working (untested) DVB part.

Signed-off-by: Alexey Chernov <4ernov@xxxxxxxxx>

diff -upr v4l-dvb.orig/drivers/media/video/cx23885/cx23885-cards.c v4l-
dvb/drivers/media/video/cx23885/cx23885-cards.c
--- v4l-dvb.orig/drivers/media/video/cx23885/cx23885-cards.c	2010-12-03 
00:16:09.000000000 +0300
+++ v4l-dvb/drivers/media/video/cx23885/cx23885-cards.c	2010-12-03 
01:04:18.000000000 +0300
@@ -309,6 +309,26 @@ struct cx23885_board cx23885_boards[] = 
 				  CX25840_COMPONENT_ON,
 		} },
 	},
+	[CX23885_BOARD_GOTVIEW_X5_3D_HYBRID] = {
+		.name		= "GoTView X5 3D Hybrid",
+		.tuner_type	= TUNER_XC5000,
+		.tuner_addr	= 0x64,
+		.porta		= CX23885_ANALOG_VIDEO,
+		.portb		= CX23885_MPEG_DVB,
+		.input          = {{
+			.type   = CX23885_VMUX_TELEVISION,
+			.vmux   = CX25840_VIN2_CH1 |
+				  CX25840_VIN5_CH2,
+			.gpio0	= 0x02,
+		}, {
+			.type   = CX23885_VMUX_COMPOSITE1,
+			.vmux   = CX23885_VMUX_COMPOSITE1,
+		}, {
+			.type   = CX23885_VMUX_SVIDEO,
+			.vmux   = CX25840_SVIDEO_LUMA3 |
+				  CX25840_SVIDEO_CHROMA4,
+		} },
+	},
 };
 const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards);
 
@@ -496,6 +516,10 @@ struct cx23885_subid cx23885_subids[] = 
 		.subvendor = 0x107d,
 		.subdevice = 0x6f22,
 		.card      = CX23885_BOARD_LEADTEK_WINFAST_PXTV1200,
+	}, {
+		.subvendor = 0x5654,
+		.subdevice = 0x2390,
+		.card      = CX23885_BOARD_GOTVIEW_X5_3D_HYBRID,
 	},
 };
 const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids);
@@ -712,6 +736,10 @@ int cx23885_tuner_callback(void *priv, i
 		else if (port->nr == 2)
 			bitmask = 0x04;
 		break;
+	case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
+		/* Tuner Reset Command */
+		bitmask = 0x02;
+		break;
 	}
 
 	if (bitmask) {
@@ -967,6 +995,9 @@ void cx23885_gpio_setup(struct cx23885_d
 		/* CX24228 GPIO */
 		/* Connected to IF / Mux */
 		break;
+	case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
+		cx_set(GP0_IO, 0x00010001); /* Bring the part out of reset */
+		break;
 	}
 }
 
@@ -1218,6 +1249,7 @@ void cx23885_card_setup(struct cx23885_d
 	case CX23885_BOARD_HAUPPAUGE_HVR1850:
 	case CX23885_BOARD_COMPRO_VIDEOMATE_E800:
 	case CX23885_BOARD_HAUPPAUGE_HVR1290:
+	case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
 	default:
 		ts2->gen_ctrl_val  = 0xc; /* Serial bus + punctured clock */
 		ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
@@ -1245,6 +1277,7 @@ void cx23885_card_setup(struct cx23885_d
 	case CX23885_BOARD_MAGICPRO_PROHDTVE2:
 	case CX23885_BOARD_HAUPPAUGE_HVR1290:
 	case CX23885_BOARD_LEADTEK_WINFAST_PXTV1200:
+	case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
 		dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev,
 				&dev->i2c_bus[2].i2c_adap,
 				NULL, "cx25840", 0x88 >> 1, NULL);
diff -upr v4l-dvb.orig/drivers/media/video/cx23885/cx23885-dvb.c v4l-
dvb/drivers/media/video/cx23885/cx23885-dvb.c
--- v4l-dvb.orig/drivers/media/video/cx23885/cx23885-dvb.c	2010-12-03 
00:16:09.000000000 +0300
+++ v4l-dvb/drivers/media/video/cx23885/cx23885-dvb.c	2010-12-05 
17:44:04.000000000 +0300
@@ -460,6 +460,14 @@ static struct xc5000_config mygica_x8506
 	.if_khz = 5380,
 };
 
+static struct zl10353_config gotview_x5_3d_hybrid_zl10353_config = {
+	.demod_address = 0x0f,
+};
+
+static struct xc5000_config gotview_x5_3d_hybrid_xc5000_config = {
+	.i2c_address = 0x64,
+};
+
 static int cx23885_dvb_set_frontend(struct dvb_frontend *fe,
 				    struct dvb_frontend_parameters *param)
 {
@@ -484,6 +492,9 @@ static int cx23885_dvb_set_frontend(stru
 		/* Select Digital TV */
 		cx23885_gpio_set(dev, GPIO_0);
 		break;
+	case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
+		cx23885_gpio_set(dev, GPIO_1);
+		break;
 	}
 	return 0;
 }
@@ -966,6 +977,18 @@ static int dvb_register(struct cx23885_t
 			break;
 		}
 		break;
+	case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
+		i2c_bus = &dev->i2c_bus[0];
+		i2c_bus2 = &dev->i2c_bus[1];	
+		fe0->dvb.frontend = dvb_attach(zl10353_attach,
+			&gotview_x5_3d_hybrid_zl10353_config,
+			&i2c_bus->i2c_adap);
+		if (fe0->dvb.frontend != NULL) {
+			dvb_attach(xc5000_attach, fe0->dvb.frontend,
+				&i2c_bus2->i2c_adap,
+				&gotview_x5_3d_hybrid_xc5000_config);
+		}
+		break;
 
 	default:
 		printk(KERN_INFO "%s: The frontend of your DVB/ATSC card "
diff -upr v4l-dvb.orig/drivers/media/video/cx23885/cx23885.h v4l-
dvb/drivers/media/video/cx23885/cx23885.h
--- v4l-dvb.orig/drivers/media/video/cx23885/cx23885.h	2010-12-03 
00:16:09.000000000 +0300
+++ v4l-dvb/drivers/media/video/cx23885/cx23885.h	2010-12-03 
01:10:10.000000000 +0300
@@ -84,6 +84,7 @@
 #define CX23885_BOARD_HAUPPAUGE_HVR1290        26
 #define CX23885_BOARD_MYGICA_X8558PRO          27
 #define CX23885_BOARD_LEADTEK_WINFAST_PXTV1200 28
+#define CX23885_BOARD_GOTVIEW_X5_3D_HYBRID     29
 
 #define GPIO_0 0x00000001
 #define GPIO_1 0x00000002

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux