>> >> No, we shouldn't add cx88 specific stuff to tuner.ko, but in >> cx88 where the VIDIOC_S_FREQUENCY ioctl is processed you should be able >> to open the i2c gate before cx88_call_i2c_clients(), no? >> >> > I was trying to avoid any changes outside of cx88_dvb.ko -- It was > probably unavoidable. > > A patch is attached for review. > I cleaned up this patch again this evening. See Attached. Purpose: Add support for the HVR1100 and HVR1100-LowProfile products. I propose adding two new entries to dvb_frontend_ops, namely 'enable_plli2c' and 'disable_plli2c'. The cx22702 demod driver uses these for references to the interal pll/i2c gate management functions. The cx88_call_i2c_clients function now acquires the associated DVB frontend->ops table for the product and calls the enable/disable plli2c functions if they are set (before and after triggering the V4L I2C i2c drivers). It's a clean approach in respect to cx88, this will work with any DVB frontend that has the enable/disable functions defined. It also cuts down on the number of exported symbols and keeps the module dependencies to an absolute minimum. As always, comments/feedback welcome. Steve -------------- next part -------------- Index: linux/Documentation/video4linux/CARDLIST.cx88 =================================================================== RCS file: /cvs/video4linux/v4l-dvb/linux/Documentation/video4linux/CARDLIST.cx88,v retrieving revision 1.16 diff -u -p -r1.16 CARDLIST.cx88 --- linux/Documentation/video4linux/CARDLIST.cx88 22 Nov 2005 19:32:26 -0000 1.16 +++ linux/Documentation/video4linux/CARDLIST.cx88 1 Dec 2005 06:39:31 -0000 @@ -38,3 +38,5 @@ 37 -> Hauppauge Nova-S-Plus DVB-S [0070:9201,0070:9202] 38 -> Hauppauge Nova-SE2 DVB-S [0070:9200] 39 -> KWorld DVB-S 100 [17de:08b2] + 40 -> Hauppauge WinTV-HVR1100 DVB-T/Hybrid [0070:9400,0070:9402] + 41 -> Hauppauge WinTV-HVR1100 DVB-T/Hybrid (Low Profile) [0070:9800,0070:9802] Index: linux/drivers/media/dvb/dvb-core/dvb_frontend.h =================================================================== RCS file: /cvs/video4linux/v4l-dvb/linux/drivers/media/dvb/dvb-core/dvb_frontend.h,v retrieving revision 1.25 diff -u -p -r1.25 dvb_frontend.h --- linux/drivers/media/dvb/dvb-core/dvb_frontend.h 26 Nov 2005 23:46:56 -0000 1.25 +++ linux/drivers/media/dvb/dvb-core/dvb_frontend.h 1 Dec 2005 06:39:31 -0000 @@ -85,6 +85,9 @@ struct dvb_frontend_ops { int (*set_voltage)(struct dvb_frontend* fe, fe_sec_voltage_t voltage); int (*enable_high_lnb_voltage)(struct dvb_frontend* fe, int arg); int (*dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned int cmd); + + int (*enable_plli2c)(struct dvb_frontend* fe); + int (*disable_plli2c)(struct dvb_frontend* fe); }; #define MAX_EVENT 8 Index: linux/drivers/media/dvb/frontends/cx22702.c =================================================================== RCS file: /cvs/video4linux/v4l-dvb/linux/drivers/media/dvb/frontends/cx22702.c,v retrieving revision 1.14 diff -u -p -r1.14 cx22702.c --- linux/drivers/media/dvb/frontends/cx22702.c 26 Nov 2005 23:46:56 -0000 1.14 +++ linux/drivers/media/dvb/frontends/cx22702.c 1 Dec 2005 06:39:31 -0000 @@ -195,6 +195,20 @@ static int cx22702_get_tps (struct cx227 return 0; } +static int cx22702_enable_plli2c(struct dvb_frontend* fe) +{ + struct cx22702_state* state = fe->demodulator_priv; + dprintk ("%s\n",__FUNCTION__); + return cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) &0xfe); +} + +static int cx22702_disable_plli2c(struct dvb_frontend* fe) +{ + struct cx22702_state* state = fe->demodulator_priv; + dprintk ("%s\n",__FUNCTION__); + return cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) | 1); +} + /* Talk to the demod, set the FEC, GUARD, QAM settings etc */ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_parameters *p) { @@ -202,7 +216,7 @@ static int cx22702_set_tps (struct dvb_f struct cx22702_state* state = fe->demodulator_priv; /* set PLL */ - cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) &0xfe); + cx22702_enable_plli2c(fe); if (state->config->pll_set) { state->config->pll_set(fe, p); } else if (state->config->pll_desc) { @@ -216,7 +230,7 @@ static int cx22702_set_tps (struct dvb_f } else { BUG(); } - cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) | 1); + cx22702_disable_plli2c(fe); /* set inversion */ cx22702_set_inversion (state, p->inversion); @@ -349,11 +363,10 @@ static int cx22702_init (struct dvb_fron cx22702_writereg (state, 0xf8, (state->config->output_mode << 1) & 0x02); /* init PLL */ - if (state->config->pll_init) { - cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) & 0xfe); + if (state->config->pll_init) state->config->pll_init(fe); - cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) | 1); - } + + cx22702_disable_plli2c(fe); return 0; } @@ -531,6 +544,9 @@ static struct dvb_frontend_ops cx22702_o .read_signal_strength = cx22702_read_signal_strength, .read_snr = cx22702_read_snr, .read_ucblocks = cx22702_read_ucblocks, + + .enable_plli2c = cx22702_enable_plli2c, + .disable_plli2c = cx22702_disable_plli2c, }; module_param(debug, int, 0644); Index: linux/drivers/media/video/cx88/cx88-cards.c =================================================================== RCS file: /cvs/video4linux/v4l-dvb/linux/drivers/media/video/cx88/cx88-cards.c,v retrieving revision 1.108 diff -u -p -r1.108 cx88-cards.c --- linux/drivers/media/video/cx88/cx88-cards.c 25 Nov 2005 10:24:13 -0000 1.108 +++ linux/drivers/media/video/cx88/cx88-cards.c 1 Dec 2005 06:39:31 -0000 @@ -903,7 +903,6 @@ struct cx88_board cx88_boards[] = { .radio_type = UNSET, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, - /* fixme: add the analog gpio stuff here */ .input = {{ .type = CX88_VMUX_DVB, .vmux = 0, @@ -946,6 +945,43 @@ struct cx88_board cx88_boards[] = { }}, .dvb = 1, }, + [CX88_BOARD_HAUPPAUGE_HVR1100] = { + .name = "Hauppauge WinTV-HVR1100 DVB-T/Hybrid", + .tuner_type = TUNER_PHILIPS_FMD1216ME_MK3, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .tda9887_conf = TDA9887_PRESENT, + .input = {{ + .type = CX88_VMUX_TELEVISION, + .vmux = 0, + },{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + }}, + /* fixme: Add radio support */ + .dvb = 1, + }, + [CX88_BOARD_HAUPPAUGE_HVR1100LP] = { + .name = "Hauppauge WinTV-HVR1100 DVB-T/Hybrid (Low Profile)", + .tuner_type = TUNER_PHILIPS_FMD1216ME_MK3, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .tda9887_conf = TDA9887_PRESENT, + .input = {{ + .type = CX88_VMUX_TELEVISION, + .vmux = 0, + },{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + }}, + /* fixme: Add radio support */ + .dvb = 1, + }, }; const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); @@ -1109,6 +1145,22 @@ struct cx88_subid cx88_subids[] = { .subvendor = 0x17de, .subdevice = 0x08b2, .card = CX88_BOARD_KWORLD_DVBS_100, + },{ + .subvendor = 0x0070, + .subdevice = 0x9400, + .card = CX88_BOARD_HAUPPAUGE_HVR1100, + },{ + .subvendor = 0x0070, + .subdevice = 0x9402, + .card = CX88_BOARD_HAUPPAUGE_HVR1100, + },{ + .subvendor = 0x0070, + .subdevice = 0x9800, + .card = CX88_BOARD_HAUPPAUGE_HVR1100LP, + },{ + .subvendor = 0x0070, + .subdevice = 0x9802, + .card = CX88_BOARD_HAUPPAUGE_HVR1100LP, }, }; const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids); @@ -1140,9 +1192,6 @@ static void __devinit leadtek_eeprom(str core->name, core->tuner_type, eeprom_data[0]); } - -/* ----------------------------------------------------------------------- */ - static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data) { struct tveeprom tv; @@ -1161,7 +1210,9 @@ static void hauppauge_eeprom(struct cx88 case 90500: /* Nova-T-PCI (oem) */ case 90501: /* Nova-T-PCI (oem/IR) */ case 92000: /* Nova-SE2 (OEM, No Video or IR) */ - + case 94009: /* WinTV-HVR1100 (Video and IR Retail) */ + case 94501: /* WinTV-HVR1100 (Video and IR OEM) */ + case 98559: /* WinTV-HVR1100LP (Video no IR, Retail - Low Profile) */ /* known */ break; default: @@ -1279,6 +1330,8 @@ void cx88_card_setup(struct cx88_core *c case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: case CX88_BOARD_HAUPPAUGE_NOVASE2_S1: case CX88_BOARD_HAUPPAUGE_DVB_T1: + case CX88_BOARD_HAUPPAUGE_HVR1100: + case CX88_BOARD_HAUPPAUGE_HVR1100LP: if (0 == core->i2c_rc) hauppauge_eeprom(core,eeprom); break; Index: linux/drivers/media/video/cx88/cx88-dvb.c =================================================================== RCS file: /cvs/video4linux/v4l-dvb/linux/drivers/media/video/cx88/cx88-dvb.c,v retrieving revision 1.74 diff -u -p -r1.74 cx88-dvb.c --- linux/drivers/media/video/cx88/cx88-dvb.c 22 Nov 2005 19:32:26 -0000 1.74 +++ linux/drivers/media/video/cx88/cx88-dvb.c 1 Dec 2005 06:39:32 -0000 @@ -197,6 +197,14 @@ static struct cx22702_config hauppauge_n .pll_address = 0x61, .pll_desc = &dvb_pll_thomson_dtt759x, }; +static struct cx22702_config hauppauge_hvr1100_config = { + .demod_address = 0x63, +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12) + .output_mode = CX22702_SERIAL_OUTPUT, +#endif + .pll_address = 0x61, + .pll_desc = &dvb_pll_fmd1216me, +}; #endif #ifdef HAVE_OR51132 @@ -376,6 +384,11 @@ static int dvb_register(struct cx8802_de dev->dvb.frontend = cx22702_attach(&connexant_refboard_config, &dev->core->i2c_adap); break; + case CX88_BOARD_HAUPPAUGE_HVR1100: + case CX88_BOARD_HAUPPAUGE_HVR1100LP: + dev->dvb.frontend = cx22702_attach(&hauppauge_hvr1100_config, + &dev->core->i2c_adap); + break; #endif #ifdef HAVE_MT352 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: @@ -538,6 +551,9 @@ static int __devinit dvb_probe(struct pc err = dvb_register(dev); if (0 != err) goto fail_fini; + + /* Maintain a reference to cx88-video can query the 8802 device. */ + core->dvbdev = dev; return 0; fail_fini: @@ -553,6 +569,9 @@ static void __devexit dvb_remove(struct { struct cx8802_dev *dev = pci_get_drvdata(pci_dev); + /* Destroy any 8802 reference. */ + dev->core->dvbdev = NULL; + /* dvb */ videobuf_dvb_unregister(&dev->dvb); Index: linux/drivers/media/video/cx88/cx88-i2c.c =================================================================== RCS file: /cvs/video4linux/v4l-dvb/linux/drivers/media/video/cx88/cx88-i2c.c,v retrieving revision 1.33 diff -u -p -r1.33 cx88-i2c.c --- linux/drivers/media/video/cx88/cx88-i2c.c 16 Oct 2005 12:13:58 -0000 1.33 +++ linux/drivers/media/video/cx88/cx88-i2c.c 1 Dec 2005 06:39:32 -0000 @@ -140,7 +140,20 @@ void cx88_call_i2c_clients(struct cx88_c { if (0 != core->i2c_rc) return; - i2c_clients_command(&core->i2c_adap, cmd, arg); + + if (core->dvbdev == NULL) { + i2c_clients_command(&core->i2c_adap, cmd, arg); + } else { + + if (core->dvbdev->dvb.frontend->ops->enable_plli2c) + core->dvbdev->dvb.frontend->ops->enable_plli2c(core->dvbdev->dvb.frontend); + + i2c_clients_command(&core->i2c_adap, cmd, arg); + + if (core->dvbdev->dvb.frontend->ops->disable_plli2c) + core->dvbdev->dvb.frontend->ops->disable_plli2c(core->dvbdev->dvb.frontend); + } + } static struct i2c_algo_bit_data cx8800_i2c_algo_template = { Index: linux/drivers/media/video/cx88/cx88-input.c =================================================================== RCS file: /cvs/video4linux/v4l-dvb/linux/drivers/media/video/cx88/cx88-input.c,v retrieving revision 1.23 diff -u -p -r1.23 cx88-input.c --- linux/drivers/media/video/cx88/cx88-input.c 18 Nov 2005 01:02:18 -0000 1.23 +++ linux/drivers/media/video/cx88/cx88-input.c 1 Dec 2005 06:39:32 -0000 @@ -385,6 +385,7 @@ int cx88_ir_init(struct cx88_core *core, case CX88_BOARD_HAUPPAUGE_DVB_T1: case CX88_BOARD_HAUPPAUGE_NOVASE2_S1: case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: + case CX88_BOARD_HAUPPAUGE_HVR1100: ir_codes = ir_codes_hauppauge_new; ir_type = IR_TYPE_RC5; ir->sampling = 1; Index: linux/drivers/media/video/cx88/cx88.h =================================================================== RCS file: /cvs/video4linux/v4l-dvb/linux/drivers/media/video/cx88/cx88.h,v retrieving revision 1.91 diff -u -p -r1.91 cx88.h --- linux/drivers/media/video/cx88/cx88.h 22 Nov 2005 19:32:26 -0000 1.91 +++ linux/drivers/media/video/cx88/cx88.h 1 Dec 2005 06:39:32 -0000 @@ -189,6 +189,8 @@ extern struct sram_channel cx88_sram_cha #define CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1 37 #define CX88_BOARD_HAUPPAUGE_NOVASE2_S1 38 #define CX88_BOARD_KWORLD_DVBS_100 39 +#define CX88_BOARD_HAUPPAUGE_HVR1100 40 +#define CX88_BOARD_HAUPPAUGE_HVR1100LP 41 enum cx88_itype { CX88_VMUX_COMPOSITE1 = 1, @@ -314,6 +316,9 @@ struct cx88_core { /* various v4l controls */ u32 freq; + + /* cx88-video needs to access cx8802 for hybrid tuner pll access. */ + struct cx8802_dev *dvbdev; }; struct cx8800_dev;