Web lists-archives.org

Re: When xc3028/xc2028 will be supported?




Hi Dâniel,

Please test those two patches. The first one (add_xc2028_callbacks.patch) adds
xc3028 tuner callback for cx88. The other one will add several xc3028 cards to
cx88 driver.

In order to use, you'll need to retrieve xc3028 v2.7 firmware. Please use the
extract script available at linux/Documentation/video4linux/extract_xc3028.pl.

The instructions are at the beginning of the perl script.

The patches were generated against v4l/dvb development tree, and are based on
Markus patch.

Cheers,
Mauro.

On Sun, 27 Jan 2008 17:31:32 -0200
Dâniel Fraga <fragabr@xxxxxxxxx> wrote:

> 	I bought a cx88/xc2028 based device more than 1 year ago.
> 
> 	Markus Rechberger provided some code that made my device work,
> but is was never incorporated in the kernel.
> 
> 	Ok... inside the kernel documentation, I can read:
> 
> CARDLIST.tuner:
> 
> tuner=71 - Xceive xc3028
> 
> 	***
> 
> tuner-types.c
> 
>         [TUNER_XCEIVE_XC3028] = { /* Xceive 3028 */
>                 .name   = "Xceive xc3028",
>                 /* see xc3028.c for details */
> 
> 	But in fact this code is empty... So, will it be supported?
> When?
> 
> 	If it won't be supported I suggest that this entry be removed,
> otherwise disinformed users could believe that this tuner is supported,
> when, in fact, it is not.
> 
> 	Thank you!
> 




Cheers,
Mauro
cx88: Add xc2028/3028 boards

From: Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxx>

This patch ports a patch from Markus Rechberger to work with tuner-xc2028.
It adds entries for several cx88 boards with xc2038/3028 tuners.

Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxx>

---
 linux/drivers/media/video/cx88/cx88-cards.c |  190 +++++++++++++++++++++++++++-
 linux/drivers/media/video/cx88/cx88-dvb.c   |   42 ++++++
 linux/drivers/media/video/cx88/cx88.h       |    4 
 3 files changed, 235 insertions(+), 1 deletion(-)

--- master.orig/linux/drivers/media/video/cx88/cx88-cards.c
+++ master/linux/drivers/media/video/cx88/cx88-cards.c
@@ -1448,6 +1448,126 @@ static const struct cx88_board cx88_boar
 		}},
 		.mpeg           = CX88_MPEG_DVB,
 	},
+       [CX88_BOARD_PINNACLE_HYBRID_PCTV] = {
+	       .name           = "Pinnacle Hybrid PCTV",
+	       .tuner_type     = TUNER_XC2028,
+	       .tuner_addr     = 0x61,
+	       .input          = {{
+		       .type   = CX88_VMUX_TELEVISION,
+		       .vmux   = 0,
+	       },{
+		       .type   = CX88_VMUX_COMPOSITE1,
+		       .vmux   = 1,
+	       },{
+		       .type   = CX88_VMUX_SVIDEO,
+		       .vmux   = 2,
+	       }},
+	       .radio = {
+		       .type   = CX88_RADIO,
+		       .gpio0  = 0x004ff,
+		       .gpio1  = 0x010ff,
+		       .gpio2  = 0x0ff,
+	       },
+#if 0
+	       .mpeg           = CX88_MPEG_DVB, /* needs some more GPIO work */
+#endif
+       },
+       [CX88_BOARD_WINFAST_TV2000_XP_GLOBAL] = {
+	       .name           = "Winfast TV2000 XP Global",
+	       .tuner_type     = TUNER_XC2028,
+	       .tuner_addr     = 0x61,
+	       .input          = {{
+		       .type   = CX88_VMUX_TELEVISION,
+		       .vmux   = 0,
+		       .gpio0  = 0x0400, /* pin 2:mute = 0 (off?) */
+		       .gpio1  = 0x0000,
+		       .gpio2  = 0x0800, /* pin 19:audio = 0 (tv) */
+
+	       },{
+		       .type   = CX88_VMUX_COMPOSITE1,
+		       .vmux   = 1,
+		       .gpio0  = 0x0400, /* probably?  or 0x0404 to turn mute on */
+		       .gpio1  = 0x0000,
+		       .gpio2  = 0x0808, /* pin 19:audio = 1 (line) */
+
+	       },{
+		       .type   = CX88_VMUX_SVIDEO,
+		       .vmux   = 2,
+	       }},
+	       .radio = {
+		       .type   = CX88_RADIO,
+		       .gpio0  = 0x004ff,
+		       .gpio1  = 0x010ff,
+		       .gpio2  = 0x0ff,
+	       },
+       },
+       [CX88_BOARD_POWERCOLOR_REAL_ANGEL] = {
+	       .name           = "PowerColor Real Angel 330",
+	       .tuner_type     = TUNER_XC2028,
+	       .tuner_addr     = 0x61,
+	       .input          = {{
+		       .type   = CX88_VMUX_TELEVISION,
+		       .vmux   = 0,
+		       .gpio0 = 0x0400, /* pin 2:mute = 0 (off?) */
+		       .gpio1 = 0x0000,
+		       .gpio2 = 0x0800, /* pin 19:audio = 0 (tv) */
+	       },{
+		       .type   = CX88_VMUX_COMPOSITE1,
+		       .vmux   = 1,
+		       .gpio0 = 0x0400, /* probably?  or 0x0404 to turn mute on */
+		       .gpio1 = 0x0000,
+		       .gpio2 = 0x0808, /* pin 19:audio = 1 (line) */
+	       },{
+		       .type   = CX88_VMUX_SVIDEO,
+		       .vmux   = 2,
+		       .gpio0  = 0x000ff,
+		       .gpio1  = 0x0f37d,
+		       .gpio2  = 0x00019,
+		       .gpio3  = 0x00000,
+	       }},
+	       .radio = {
+		       .type   = CX88_RADIO,
+		       .gpio0  = 0x000ff,
+		       .gpio1  = 0x0f35d,
+		       .gpio2  = 0x00019,
+		       .gpio3  = 0x00000,
+	       },
+       },
+       [CX88_BOARD_GENIATECH_X8000_MT] = {
+	       .name           = "Geniatech X8000-MT DVBT",//PowerColor Real Angel 330",//Geniatech X800 OEM
+	       .tuner_type     = TUNER_XC2028,
+	       .tuner_addr     = 0x61,
+	       .input          = {{
+		       .type   = CX88_VMUX_TELEVISION,
+		       .vmux   = 0,
+		       .gpio0  = 0x00000000,
+		       .gpio1  = 0x00e3e341,
+		       .gpio2  = 0x00000000,
+		       .gpio3  = 0x00000000,
+	       },{
+		       .type   = CX88_VMUX_COMPOSITE1,
+		       .vmux   = 1,
+		       .gpio0  = 0x00000000,
+		       .gpio1  = 0x00e3e361,
+		       .gpio2  = 0x00000000,
+		       .gpio3  = 0x00000000,
+	       },{
+		       .type   = CX88_VMUX_SVIDEO,
+		       .vmux   = 2,
+		       .gpio0  = 0x00000000,
+		       .gpio1  = 0x00e3e361,
+		       .gpio2  = 0x00000000,
+		       .gpio3  = 0x00000000,
+	       }},
+	       .radio = {
+		       .type   = CX88_RADIO,
+		       .gpio0  = 0x00000000,
+		       .gpio1  = 0x00e3e341,
+		       .gpio2  = 0x00000000,
+		       .gpio3  = 0x00000000,
+	       },
+	       .mpeg           = CX88_MPEG_DVB,
+       }
 };
 
 /* ------------------------------------------------------------------ */
@@ -1761,7 +1881,23 @@ static const struct cx88_subid cx88_subi
 		.subvendor = 0x11bd,
 		.subdevice = 0x0051,
 		.card      = CX88_BOARD_PINNACLE_PCTV_HD_800i,
-	},
+	},{
+		.subvendor = 0x12ab,
+		.subdevice = 0x1788,
+		.card      = CX88_BOARD_PINNACLE_HYBRID_PCTV,
+	},{
+		.subvendor = 0x14f1,
+		.subdevice = 0xea3d,
+		.card      = CX88_BOARD_POWERCOLOR_REAL_ANGEL,
+	},{
+		.subvendor = 0x107d,
+		.subdevice = 0x6f18,
+		.card      = CX88_BOARD_WINFAST_TV2000_XP_GLOBAL,
+	},{
+		.subvendor = 0x14f1,
+		.subdevice = 0x8852,
+		.card      = CX88_BOARD_GENIATECH_X8000_MT,
+	}
 };
 
 /* ----------------------------------------------------------------------- */
@@ -1894,6 +2030,50 @@ static void gdi_eeprom(struct cx88_core 
 }
 
 /* ----------------------------------------------------------------------- */
+/* some Geniatech specific stuff                                           */
+
+static int cx88_xc3028_geniatech_tuner_callback(void *priv, int command, int mode)
+{
+	struct i2c_algo_bit_data *i2c_algo = priv;
+	struct cx88_core *core = i2c_algo->data;
+
+	switch (command) {
+	case XC2028_TUNER_RESET:
+		switch (INPUT(core->input).type) {
+		case CX88_RADIO:
+			cx_write(MO_GP1_IO, 0x101010);
+			mdelay(50);
+			cx_write(MO_GP1_IO, 0x101000);
+			mdelay(50);
+			cx_write(MO_GP1_IO, 0x101010);
+			mdelay(50);
+			return 0;
+		 case CX88_VMUX_DVB:
+			cx_write(MO_GP1_IO, 0x030302);
+			mdelay(50);
+			cx_write(MO_GP1_IO, 0x101010);
+			mdelay(50);
+			cx_write(MO_GP1_IO, 0x101000);
+			mdelay(50);
+			cx_write(MO_GP1_IO, 0x101010);
+			mdelay(50);
+			return 0;
+		 default:
+			cx_write(MO_GP1_IO, 0x030301);
+			mdelay(50);
+			cx_write(MO_GP1_IO, 0x101010);
+			mdelay(50);
+			cx_write(MO_GP1_IO, 0x101000);
+			mdelay(50);
+			cx_write(MO_GP1_IO, 0x101010);
+			mdelay(50);
+			return 0;
+		 }
+	}
+	return -EINVAL;
+}
+
+/* ----------------------------------------------------------------------- */
 /* some DViCO specific stuff                                               */
 
 static void dvico_fusionhdtv_hybrid_init(struct cx88_core *core)
@@ -1932,6 +2112,14 @@ static int cx88_xc2028_tuner_callback(vo
 	struct i2c_algo_bit_data *i2c_algo = priv;
 	struct cx88_core *core = i2c_algo->data;
 
+	/* Board-specific callbacks */
+	switch (core->boardnr) {
+        case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL:
+        case CX88_BOARD_POWERCOLOR_REAL_ANGEL:
+        case CX88_BOARD_GENIATECH_X8000_MT:
+		return cx88_xc3028_geniatech_tuner_callback(priv, command, arg);
+	}
+
 	switch (command) {
 	case XC2028_TUNER_RESET:
 	{
--- master.orig/linux/drivers/media/video/cx88/cx88-dvb.c
+++ master/linux/drivers/media/video/cx88/cx88-dvb.c
@@ -390,6 +390,18 @@ static struct xc5000_config pinnacle_pct
 	.tuner_callback	= cx88_tuner_callback,
 };
 
+static struct zl10353_config cx88_geniatech_x8000_mt = {
+       .demod_address = (0x1e >> 1),
+       .no_tuner = 1,
+#if 0
+       .input_frequency = 0xe609,
+       .parallel_ts =1,
+       .r56_agc_targets =  0x2b,
+       .r5c_clk_mpegts_output = 0x75,
+#endif
+};
+
+
 static int dvb_register(struct cx8802_dev *dev)
 {
 	/* init struct videobuf_dvb */
@@ -659,6 +671,36 @@ static int dvb_register(struct cx8802_de
 				   &pinnacle_pctv_hd_800i_tuner_config);
 		}
 		break;
+       case CX88_BOARD_PINNACLE_HYBRID_PCTV:
+	       dev->dvb.frontend = dvb_attach(zl10353_attach, &cx88_geniatech_x8000_mt,
+					      &dev->core->i2c_adap);
+
+	       if (dev->dvb.frontend != NULL) {
+			/* tuner_config.video_dev must point to
+			 * i2c_adap.algo_data
+			 */
+			cx88_geniatech_x8000_mt.priv = dev->core->i2c_adap.algo_data;
+
+			dvb_attach(tuner_stub_attach, dev->dvb.frontend,
+				   &dev->core->i2c_adap, NULL, NULL, &config);
+			break;
+	       }
+	       break;
+
+       case CX88_BOARD_GENIATECH_X8000_MT:
+	       dev->ts_gen_cntrl = 0x00;
+
+	       dev->dvb.frontend = dvb_attach(zl10353_attach, &cx88_geniatech_x8000_mt,
+					      &dev->core->i2c_adap);
+	       if (dev->dvb.frontend != NULL) {
+			cx88_geniatech_x8000_mt.priv = dev->core->i2c_adap.algo_data;
+
+			dvb_attach(tuner_stub_attach, dev->dvb.frontend,
+				   &dev->core->i2c_adap, NULL, NULL, &config);
+			break;
+	       }
+	       break;
+
 	default:
 		printk(KERN_ERR "%s/2: The frontend of your DVB/ATSC card isn't supported yet\n",
 		       dev->core->name);
--- master.orig/linux/drivers/media/video/cx88/cx88.h
+++ master/linux/drivers/media/video/cx88/cx88.h
@@ -214,6 +214,10 @@ extern struct sram_channel cx88_sram_cha
 #define CX88_BOARD_HAUPPAUGE_HVR1300       56
 #define CX88_BOARD_ADSTECH_PTV_390         57
 #define CX88_BOARD_PINNACLE_PCTV_HD_800i   58
+#define CX88_BOARD_PINNACLE_HYBRID_PCTV    59
+#define CX88_BOARD_WINFAST_TV2000_XP_GLOBAL 60
+#define CX88_BOARD_POWERCOLOR_REAL_ANGEL   61
+#define CX88_BOARD_GENIATECH_X8000_MT      62
 
 enum cx88_itype {
 	CX88_VMUX_COMPOSITE1 = 1,
cx88: Add xc2028/3028 callbacks

From: Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxx>

Thanks to Markus Rechberger for retrieving the data for the required GPIO
output needed for the various modes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxx>

---
 linux/drivers/media/video/cx88/cx88-cards.c |   99 ++++++++++++++++++++++++----
 linux/drivers/media/video/cx88/cx88-mpeg.c  |    2 
 2 files changed, 87 insertions(+), 14 deletions(-)

--- master.orig/linux/drivers/media/video/cx88/cx88-cards.c
+++ master/linux/drivers/media/video/cx88/cx88-cards.c
@@ -28,6 +28,7 @@
 #include "compat.h"
 #include "cx88.h"
 #include "tea5767.h"
+#include "tuner-xc2028.h"
 
 static unsigned int tuner[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
 static unsigned int radio[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
@@ -1926,26 +1927,71 @@ static void dvico_fusionhdtv_hybrid_init
 	}
 }
 
+static int cx88_xc2028_tuner_callback(void *priv, int command, int arg)
+{
+	struct i2c_algo_bit_data *i2c_algo = priv;
+	struct cx88_core *core = i2c_algo->data;
+
+	switch (command) {
+	case XC2028_TUNER_RESET:
+	{
+		switch (INPUT(core->input).type) {
+		case CX88_RADIO:
+			printk(KERN_INFO "setting GPIO to radio!\n");
+			cx_write(MO_GP0_IO, 0x4ff);
+			mdelay(250);
+			cx_write(MO_GP2_IO, 0xff);
+			mdelay(250);
+			cx_write(MO_GP1_IO, 0x101010);
+			mdelay(250);
+			cx_write(MO_GP1_IO, 0x101000);
+			mdelay(250);
+			cx_write(MO_GP1_IO, 0x101010);
+			mdelay(250);
+			return 0;
+		case CX88_VMUX_DVB:
+			printk(KERN_INFO "setting GPIO to DVB-T!\n");
+			cx_write(MO_GP1_IO, 0x101010);
+			mdelay(250);
+			cx_write(MO_GP1_IO, 0x101000);
+			mdelay(250);
+			cx_write(MO_GP1_IO, 0x101010);
+			mdelay(250);
+			return 0;
+		default:  /* Analog TV */
+			printk(KERN_INFO "setting GPIO to analog TV!\n");
+			cx_write(MO_GP1_IO, 0x101010);
+			mdelay(250);
+			cx_write(MO_GP1_IO, 0x101000);
+			mdelay(250);
+			cx_write(MO_GP1_IO, 0x101010);
+			mdelay(250);
+			return 0;
+		}
+	}
+	}
+	return -EINVAL;
+}
+
 /* ----------------------------------------------------------------------- */
 /* Tuner callback function. Currently only needed for the Pinnacle 	   *
  * PCTV HD 800i with an xc5000 sillicon tuner. This is used for both	   *
  * analog tuner attach (tuner-core.c) and dvb tuner attach (cx88-dvb.c)    */
 
-int cx88_tuner_callback(void *priv, int command, int arg)
+static int cx88_xc5000_tuner_callback(void *priv, int command, int arg)
 {
 	struct i2c_algo_bit_data *i2c_algo = priv;
 	struct cx88_core *core = i2c_algo->data;
 
-	switch(core->boardnr) {
+	switch (core->boardnr) {
 	case CX88_BOARD_PINNACLE_PCTV_HD_800i:
-		if(command == 0) { /* This is the reset command from xc5000 */
+		if (command == 0) { /* This is the reset command from xc5000 */
 			/* Reset XC5000 tuner via SYS_RSTO_pin */
 			cx_write(MO_SRST_IO, 0);
 			msleep(10);
 			cx_write(MO_SRST_IO, 1);
 			return 0;
-		}
-		else {
+		} else {
 			printk(KERN_ERR
 				"xc5000: unknown tuner callback command.\n");
 			return -EINVAL;
@@ -1954,6 +2000,20 @@ int cx88_tuner_callback(void *priv, int 
 	}
 	return 0; /* Should never be here */
 }
+
+int cx88_tuner_callback(void *priv, int command, int arg)
+{
+	struct i2c_algo_bit_data *i2c_algo = priv;
+	struct cx88_core *core = i2c_algo->data;
+
+	switch (core->board.tuner_type) {
+		case TUNER_XC2028:
+			return cx88_xc2028_tuner_callback(priv, command, arg);
+		case TUNER_XC5000:
+			return cx88_xc5000_tuner_callback(priv, command, arg);
+	}
+	return -EINVAL;
+}
 EXPORT_SYMBOL(cx88_tuner_callback);
 
 /* ----------------------------------------------------------------------- */
@@ -2108,6 +2168,26 @@ static void cx88_card_setup(struct cx88_
 		cx88_call_i2c_clients(core, TUNER_SET_CONFIG, &tea5767_cfg);
 	}
 	}
+
+        if (core->board.tuner_type == TUNER_XC2028) {
+	        struct v4l2_priv_tun_config  xc2028_cfg;
+        	struct xc2028_ctrl           ctl;
+
+                memset(&xc2028_cfg, 0, sizeof(ctl));
+                memset(&ctl, 0, sizeof(ctl));
+
+                ctl.fname   = XC2028_DEFAULT_FIRMWARE;
+                ctl.max_len = 64;
+		/* FIXME: Those should be device-dependent */
+		ctl.demod = XC3028_FE_OREN538;
+                ctl.mts = 1;
+
+                xc2028_cfg.tuner = TUNER_XC2028;
+                xc2028_cfg.priv  = &ctl;
+
+                cx88_call_i2c_clients(core, TUNER_SET_CONFIG, &xc2028_cfg);
+        }
+
 }
 
 /* ------------------------------------------------------------------ */
@@ -2248,12 +2328,3 @@ struct cx88_core *cx88_core_create(struc
 
 	return core;
 }
-
-/* ------------------------------------------------------------------ */
-
-/*
- * Local variables:
- * c-basic-offset: 8
- * End:
- * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off
- */
--- master.orig/linux/drivers/media/video/cx88/cx88-mpeg.c
+++ master/linux/drivers/media/video/cx88/cx88-mpeg.c
@@ -670,6 +670,8 @@ static int cx8802_request_acquire(struct
 	if (core->active_type_id != CX88_BOARD_NONE)
 		return -EBUSY;
 
+	core->input = CX88_VMUX_DVB;
+
 	if (drv->advise_acquire)
 	{
 		core->active_type_id = drv->type_id;
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list