diff mbox series

[4/4] pvrusb2: Add Hauppauge HVR1955/1975 devices

Message ID 1545343031-20935-5-git-send-email-brad@nextdimension.cc (mailing list archive)
State New, archived
Headers show
Series Add Hauppauge HVR1955/1975 devices | expand

Commit Message

Brad Love Dec. 20, 2018, 9:57 p.m. UTC
Includes support to identify and use two Hauppauge device.
HVR-1955:
- LGDT3306a ATSC/QAM demod
- si2177 tuner
- cx25840 decoder for analog tv/composite/s-video/audio

HVR-1975 dual-frontend:
- LGDT3306a ATSC/QAM demod
- si2168 DVB-C/T/T2 demod
- si2177 tuner
- cx25840 decoder for analog tv/composite/s-video/audio

Signed-off-by: Brad Love <brad@nextdimension.cc>
---
 drivers/media/usb/pvrusb2/Kconfig               |   2 +
 drivers/media/usb/pvrusb2/pvrusb2-cx2584x-v4l.c |  25 ++++
 drivers/media/usb/pvrusb2/pvrusb2-devattr.c     | 166 ++++++++++++++++++++++++
 drivers/media/usb/pvrusb2/pvrusb2-devattr.h     |   1 +
 drivers/media/usb/pvrusb2/pvrusb2-fx2-cmd.h     |   4 +
 drivers/media/usb/pvrusb2/pvrusb2-hdw.c         |  36 ++++-
 6 files changed, 233 insertions(+), 1 deletion(-)

Comments

kernel test robot Dec. 21, 2018, 4:56 a.m. UTC | #1
Hi Brad,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v4.20-rc7 next-20181220]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Brad-Love/Add-Hauppauge-HVR1955-1975-devices/20181221-122142
base:   git://linuxtv.org/media_tree.git master
config: x86_64-randconfig-x006-201850 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

>> drivers/media/usb/pvrusb2/pvrusb2-devattr.c:483:38: warning: 'struct pvr2_dvb_adapter' declared inside parameter list will not be visible outside of this definition or declaration
    static int pvr2_si2157_attach(struct pvr2_dvb_adapter *adap)
                                         ^~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c: In function 'pvr2_si2157_attach':
>> drivers/media/usb/pvrusb2/pvrusb2-devattr.c:485:9: error: variable 'si2157_config' has initializer but incomplete type
     struct si2157_config si2157_config = {};
            ^~~~~~~~~~~~~
>> drivers/media/usb/pvrusb2/pvrusb2-devattr.c:485:23: error: storage size of 'si2157_config' isn't known
     struct si2157_config si2157_config = {};
                          ^~~~~~~~~~~~~
>> drivers/media/usb/pvrusb2/pvrusb2-devattr.c:488:25: error: dereferencing pointer to incomplete type 'struct pvr2_dvb_adapter'
     si2157_config.fe = adap->fe[0];
                            ^~
>> drivers/media/usb/pvrusb2/pvrusb2-devattr.c:490:27: error: implicit declaration of function 'dvb_module_probe'; did you mean '__module_get'? [-Werror=implicit-function-declaration]
     adap->i2c_client_tuner = dvb_module_probe("si2157", "si2177",
                              ^~~~~~~~~~~~~~~~
                              __module_get
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:485:23: warning: unused variable 'si2157_config' [-Wunused-variable]
     struct si2157_config si2157_config = {};
                          ^~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c: At top level:
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:505:38: warning: 'struct pvr2_dvb_adapter' declared inside parameter list will not be visible outside of this definition or declaration
    static int pvr2_si2157_attach(struct pvr2_dvb_adapter *adap);
                                         ^~~~~~~~~~~~~~~~
>> drivers/media/usb/pvrusb2/pvrusb2-devattr.c:505:12: error: conflicting types for 'pvr2_si2157_attach'
    static int pvr2_si2157_attach(struct pvr2_dvb_adapter *adap);
               ^~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:483:12: note: previous definition of 'pvr2_si2157_attach' was here
    static int pvr2_si2157_attach(struct pvr2_dvb_adapter *adap)
               ^~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:506:39: warning: 'struct pvr2_dvb_adapter' declared inside parameter list will not be visible outside of this definition or declaration
    static int pvr2_dual_fe_attach(struct pvr2_dvb_adapter *adap);
                                          ^~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:507:41: warning: 'struct pvr2_dvb_adapter' declared inside parameter list will not be visible outside of this definition or declaration
    static int pvr2_lgdt3306a_attach(struct pvr2_dvb_adapter *adap);
                                            ^~~~~~~~~~~~~~~~
>> drivers/media/usb/pvrusb2/pvrusb2-devattr.c:509:21: error: variable 'pvr2_160000_dvb_props' has initializer but incomplete type
    static const struct pvr2_dvb_props pvr2_160000_dvb_props = {
                        ^~~~~~~~~~~~~~
>> drivers/media/usb/pvrusb2/pvrusb2-devattr.c:510:3: error: 'const struct pvr2_dvb_props' has no member named 'frontend_attach'
     .frontend_attach = pvr2_dual_fe_attach,
      ^~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:510:21: warning: excess elements in struct initializer
     .frontend_attach = pvr2_dual_fe_attach,
                        ^~~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:510:21: note: (near initialization for 'pvr2_160000_dvb_props')
>> drivers/media/usb/pvrusb2/pvrusb2-devattr.c:511:3: error: 'const struct pvr2_dvb_props' has no member named 'tuner_attach'
     .tuner_attach    = pvr2_si2157_attach,
      ^~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:511:21: warning: excess elements in struct initializer
     .tuner_attach    = pvr2_si2157_attach,
                        ^~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:511:21: note: (near initialization for 'pvr2_160000_dvb_props')
>> drivers/media/usb/pvrusb2/pvrusb2-devattr.c:540:21: error: variable 'pvr2_160111_dvb_props' has initializer but incomplete type
    static const struct pvr2_dvb_props pvr2_160111_dvb_props = {
                        ^~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:541:3: error: 'const struct pvr2_dvb_props' has no member named 'frontend_attach'
     .frontend_attach = pvr2_lgdt3306a_attach,
      ^~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:541:21: warning: excess elements in struct initializer
     .frontend_attach = pvr2_lgdt3306a_attach,
                        ^~~~~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:541:21: note: (near initialization for 'pvr2_160111_dvb_props')
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:542:3: error: 'const struct pvr2_dvb_props' has no member named 'tuner_attach'
     .tuner_attach    = pvr2_si2157_attach,
      ^~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:542:21: warning: excess elements in struct initializer
     .tuner_attach    = pvr2_si2157_attach,
                        ^~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:542:21: note: (near initialization for 'pvr2_160111_dvb_props')
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:571:38: warning: 'struct pvr2_dvb_adapter' declared inside parameter list will not be visible outside of this definition or declaration
    static int pvr2_si2168_attach(struct pvr2_dvb_adapter *adap)
                                         ^~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c: In function 'pvr2_si2168_attach':
>> drivers/media/usb/pvrusb2/pvrusb2-devattr.c:573:9: error: variable 'si2168_config' has initializer but incomplete type
     struct si2168_config si2168_config = {};
            ^~~~~~~~~~~~~
>> drivers/media/usb/pvrusb2/pvrusb2-devattr.c:573:23: error: storage size of 'si2168_config' isn't known
     struct si2168_config si2168_config = {};
                          ^~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:578:26: error: dereferencing pointer to incomplete type 'struct pvr2_dvb_adapter'
     si2168_config.fe = &adap->fe[1];
                             ^~
>> drivers/media/usb/pvrusb2/pvrusb2-devattr.c:580:26: error: 'SI2168_TS_PARALLEL' undeclared (first use in this function)
     si2168_config.ts_mode = SI2168_TS_PARALLEL; /*2, 1-serial, 2-parallel.*/
                             ^~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:580:26: note: each undeclared identifier is reported only once for each function it appears in
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:573:23: warning: unused variable 'si2168_config' [-Wunused-variable]
     struct si2168_config si2168_config = {};
                          ^~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c: At top level:
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:595:41: warning: 'struct pvr2_dvb_adapter' declared inside parameter list will not be visible outside of this definition or declaration
    static int pvr2_lgdt3306a_attach(struct pvr2_dvb_adapter *adap)
                                            ^~~~~~~~~~~~~~~~
>> drivers/media/usb/pvrusb2/pvrusb2-devattr.c:595:12: error: conflicting types for 'pvr2_lgdt3306a_attach'
    static int pvr2_lgdt3306a_attach(struct pvr2_dvb_adapter *adap)
               ^~~~~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:507:12: note: previous declaration of 'pvr2_lgdt3306a_attach' was here
    static int pvr2_lgdt3306a_attach(struct pvr2_dvb_adapter *adap);
               ^~~~~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c: In function 'pvr2_lgdt3306a_attach':
>> drivers/media/usb/pvrusb2/pvrusb2-devattr.c:597:26: error: storage size of 'lgdt3306a_config' isn't known
     struct lgdt3306a_config lgdt3306a_config;
                             ^~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:603:29: error: dereferencing pointer to incomplete type 'struct pvr2_dvb_adapter'
     lgdt3306a_config.fe = &adap->fe[0];
                                ^~
>> drivers/media/usb/pvrusb2/pvrusb2-devattr.c:609:31: error: 'LGDT3306A_MPEG_PARALLEL' undeclared (first use in this function)
     lgdt3306a_config.mpeg_mode = LGDT3306A_MPEG_PARALLEL;
                                  ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/media/usb/pvrusb2/pvrusb2-devattr.c:610:32: error: 'LGDT3306A_TPCLK_FALLING_EDGE' undeclared (first use in this function); did you mean 'LGDT3306A_MPEG_PARALLEL'?
     lgdt3306a_config.tpclk_edge = LGDT3306A_TPCLK_FALLING_EDGE;
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                   LGDT3306A_MPEG_PARALLEL
>> drivers/media/usb/pvrusb2/pvrusb2-devattr.c:611:38: error: 'LGDT3306A_TP_VALID_LOW' undeclared (first use in this function); did you mean 'LGDT3306A_MPEG_PARALLEL'?
     lgdt3306a_config.tpvalid_polarity = LGDT3306A_TP_VALID_LOW;
                                         ^~~~~~~~~~~~~~~~~~~~~~
                                         LGDT3306A_MPEG_PARALLEL
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:612:31: warning: left-hand operand of comma expression has no effect [-Wunused-value]
     lgdt3306a_config.xtalMHz = 25, /* demod clock MHz; 24/25 supported */
                                  ^
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:597:26: warning: unused variable 'lgdt3306a_config' [-Wunused-variable]
     struct lgdt3306a_config lgdt3306a_config;
                             ^~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c: At top level:
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:624:39: warning: 'struct pvr2_dvb_adapter' declared inside parameter list will not be visible outside of this definition or declaration
    static int pvr2_dual_fe_attach(struct pvr2_dvb_adapter *adap)
                                          ^~~~~~~~~~~~~~~~
>> drivers/media/usb/pvrusb2/pvrusb2-devattr.c:624:12: error: conflicting types for 'pvr2_dual_fe_attach'
    static int pvr2_dual_fe_attach(struct pvr2_dvb_adapter *adap)
               ^~~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:506:12: note: previous declaration of 'pvr2_dual_fe_attach' was here
    static int pvr2_dual_fe_attach(struct pvr2_dvb_adapter *adap);
               ^~~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c: In function 'pvr2_dual_fe_attach':
>> drivers/media/usb/pvrusb2/pvrusb2-devattr.c:628:28: error: passing argument 1 of 'pvr2_lgdt3306a_attach' from incompatible pointer type [-Werror=incompatible-pointer-types]
     if (pvr2_lgdt3306a_attach(adap) != 0)
                               ^~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:595:12: note: expected 'struct pvr2_dvb_adapter *' but argument is of type 'struct pvr2_dvb_adapter *'
    static int pvr2_lgdt3306a_attach(struct pvr2_dvb_adapter *adap)
               ^~~~~~~~~~~~~~~~~~~~~

vim +/si2157_config +485 drivers/media/usb/pvrusb2/pvrusb2-devattr.c

   482	
 > 483	static int pvr2_si2157_attach(struct pvr2_dvb_adapter *adap)
   484	{
 > 485		struct si2157_config si2157_config = {};
   486	
   487		si2157_config.inversion = 1;
 > 488		si2157_config.fe = adap->fe[0];
   489	
 > 490		adap->i2c_client_tuner = dvb_module_probe("si2157", "si2177",
   491							&adap->channel.hdw->i2c_adap,
   492							0x60, &si2157_config);
   493	
   494		if (!adap->i2c_client_tuner)
   495			return -ENODEV;
   496	
   497		return 0;
   498	}
   499	
   500	#define PVR2_FIRMWARE_160xxx "v4l-pvrusb2-160xxx-01.fw"
   501	static const char *pvr2_fw1_names_160xxx[] = {
   502			PVR2_FIRMWARE_160xxx,
   503	};
   504	
 > 505	static int pvr2_si2157_attach(struct pvr2_dvb_adapter *adap);
 > 506	static int pvr2_dual_fe_attach(struct pvr2_dvb_adapter *adap);
 > 507	static int pvr2_lgdt3306a_attach(struct pvr2_dvb_adapter *adap);
   508	
 > 509	static const struct pvr2_dvb_props pvr2_160000_dvb_props = {
 > 510		.frontend_attach = pvr2_dual_fe_attach,
 > 511		.tuner_attach    = pvr2_si2157_attach,
   512	};
   513	static const struct pvr2_device_client_desc pvr2_cli_160000[] = {
   514		{ .module_id = PVR2_CLIENT_ID_CX25840 },
   515	};
   516	static const struct pvr2_device_desc pvr2_device_160000 = {
   517			.description = "WinTV HVR-1975 Model 160000",
   518			.shortname = "160000",
   519			.client_table.lst = pvr2_cli_160000,
   520			.client_table.cnt = ARRAY_SIZE(pvr2_cli_160000),
   521			.fx2_firmware.lst = pvr2_fw1_names_160xxx,
   522			.fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_160xxx),
   523			.default_tuner_type = TUNER_ABSENT,
   524			.flag_has_cx25840 = !0,
   525			.flag_has_hauppauge_rom = !0,
   526			.flag_has_analogtuner = !0,
   527			.flag_has_composite = !0,
   528			.flag_has_svideo = !0,
   529			.flag_fx2_16kb = !0,
   530			.signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
   531			.digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
   532			.default_std_mask = V4L2_STD_NTSC_M,
   533			.led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
   534			.ir_scheme = PVR2_IR_SCHEME_ZILOG,
   535	#ifdef CONFIG_VIDEO_PVRUSB2_DVB
   536			.dvb_props = &pvr2_160000_dvb_props,
   537	#endif
   538	};
   539	
 > 540	static const struct pvr2_dvb_props pvr2_160111_dvb_props = {
   541		.frontend_attach = pvr2_lgdt3306a_attach,
 > 542		.tuner_attach    = pvr2_si2157_attach,
   543	};
   544	static const struct pvr2_device_client_desc pvr2_cli_160111[] = {
   545		{ .module_id = PVR2_CLIENT_ID_CX25840 },
   546	};
   547	static const struct pvr2_device_desc pvr2_device_160111 = {
   548			.description = "WinTV HVR-1955 Model 160111",
   549			.shortname = "160111",
   550			.client_table.lst = pvr2_cli_160111,
   551			.client_table.cnt = ARRAY_SIZE(pvr2_cli_160111),
   552			.fx2_firmware.lst = pvr2_fw1_names_160xxx,
   553			.fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_160xxx),
   554			.default_tuner_type = TUNER_ABSENT,
   555			.flag_has_cx25840 = !0,
   556			.flag_has_hauppauge_rom = !0,
   557			.flag_has_analogtuner = !0,
   558			.flag_has_composite = !0,
   559			.flag_has_svideo = !0,
   560			.flag_fx2_16kb = !0,
   561			.signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
   562			.digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
   563			.default_std_mask = V4L2_STD_NTSC_M,
   564			.led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
   565			.ir_scheme = PVR2_IR_SCHEME_ZILOG,
   566	#ifdef CONFIG_VIDEO_PVRUSB2_DVB
   567			.dvb_props = &pvr2_160111_dvb_props,
   568	#endif
   569	};
   570	
   571	static int pvr2_si2168_attach(struct pvr2_dvb_adapter *adap)
   572	{
 > 573		struct si2168_config si2168_config = {};
   574		struct i2c_adapter *adapter;
   575	
   576		pr_debug("%s()\n", __func__);
   577	
   578		si2168_config.fe = &adap->fe[1];
   579		si2168_config.i2c_adapter = &adapter;
 > 580		si2168_config.ts_mode = SI2168_TS_PARALLEL; /*2, 1-serial, 2-parallel.*/
   581		si2168_config.ts_clock_gapped = 1; /*0-disabled, 1-enabled.*/
   582		si2168_config.ts_clock_inv = 0; /*0-not-invert, 1-invert*/
   583		si2168_config.spectral_inversion = 1; /*0-not-invert, 1-invert*/
   584	
   585		adap->i2c_client_demod[1] = dvb_module_probe("si2168", NULL,
   586							&adap->channel.hdw->i2c_adap,
   587							0x64, &si2168_config);
   588	
   589		if (!adap->i2c_client_demod[1])
   590			return -ENODEV;
   591	
   592		return 0;
   593	}
   594	
 > 595	static int pvr2_lgdt3306a_attach(struct pvr2_dvb_adapter *adap)
   596	{
 > 597		struct lgdt3306a_config lgdt3306a_config;
   598		struct i2c_adapter *adapter;
   599	
   600		pr_debug("%s()\n", __func__);
   601	
   602		/* attach demod */
   603		lgdt3306a_config.fe = &adap->fe[0];
   604		lgdt3306a_config.i2c_adapter = &adapter;
   605		lgdt3306a_config.deny_i2c_rptr = 1;
   606		lgdt3306a_config.spectral_inversion = 1;
   607		lgdt3306a_config.qam_if_khz = 4000;
   608		lgdt3306a_config.vsb_if_khz = 3250;
 > 609		lgdt3306a_config.mpeg_mode = LGDT3306A_MPEG_PARALLEL;
 > 610		lgdt3306a_config.tpclk_edge = LGDT3306A_TPCLK_FALLING_EDGE;
 > 611		lgdt3306a_config.tpvalid_polarity = LGDT3306A_TP_VALID_LOW;
   612		lgdt3306a_config.xtalMHz = 25, /* demod clock MHz; 24/25 supported */
   613	
   614		adap->i2c_client_demod[0] = dvb_module_probe("lgdt3306a", NULL,
   615							&adap->channel.hdw->i2c_adap,
   616							0x59, &lgdt3306a_config);
   617	
   618		if (!adap->i2c_client_demod[0])
   619			return -ENODEV;
   620	
   621		return 0;
   622	}
   623	
 > 624	static int pvr2_dual_fe_attach(struct pvr2_dvb_adapter *adap)
   625	{
   626		pr_debug("%s()\n", __func__);
   627	
 > 628		if (pvr2_lgdt3306a_attach(adap) != 0)
   629			return -ENODEV;
   630	
 > 631		if (pvr2_si2168_attach(adap) != 0) {
 > 632			dvb_module_release(adap->i2c_client_demod[0]);
   633			return -ENODEV;
   634		}
   635	
   636		return 0;
   637	}
   638	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot Dec. 21, 2018, 4:57 a.m. UTC | #2
Hi Brad,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v4.20-rc7 next-20181220]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Brad-Love/Add-Hauppauge-HVR1955-1975-devices/20181221-122142
base:   git://linuxtv.org/media_tree.git master
config: x86_64-randconfig-x018-201850 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:483:38: warning: 'struct pvr2_dvb_adapter' declared inside parameter list will not be visible outside of this definition or declaration
    static int pvr2_si2157_attach(struct pvr2_dvb_adapter *adap)
                                         ^~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c: In function 'pvr2_si2157_attach':
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:485:9: error: variable 'si2157_config' has initializer but incomplete type
     struct si2157_config si2157_config = {};
            ^~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:485:23: error: storage size of 'si2157_config' isn't known
     struct si2157_config si2157_config = {};
                          ^~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:488:25: error: dereferencing pointer to incomplete type 'struct pvr2_dvb_adapter'
     si2157_config.fe = adap->fe[0];
                            ^~
>> drivers/media/usb/pvrusb2/pvrusb2-devattr.c:490:27: error: implicit declaration of function 'dvb_module_probe'; did you mean 'module_put'? [-Werror=implicit-function-declaration]
     adap->i2c_client_tuner = dvb_module_probe("si2157", "si2177",
                              ^~~~~~~~~~~~~~~~
                              module_put
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:485:23: warning: unused variable 'si2157_config' [-Wunused-variable]
     struct si2157_config si2157_config = {};
                          ^~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c: At top level:
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:505:38: warning: 'struct pvr2_dvb_adapter' declared inside parameter list will not be visible outside of this definition or declaration
    static int pvr2_si2157_attach(struct pvr2_dvb_adapter *adap);
                                         ^~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:505:12: error: conflicting types for 'pvr2_si2157_attach'
    static int pvr2_si2157_attach(struct pvr2_dvb_adapter *adap);
               ^~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:483:12: note: previous definition of 'pvr2_si2157_attach' was here
    static int pvr2_si2157_attach(struct pvr2_dvb_adapter *adap)
               ^~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:506:39: warning: 'struct pvr2_dvb_adapter' declared inside parameter list will not be visible outside of this definition or declaration
    static int pvr2_dual_fe_attach(struct pvr2_dvb_adapter *adap);
                                          ^~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:507:41: warning: 'struct pvr2_dvb_adapter' declared inside parameter list will not be visible outside of this definition or declaration
    static int pvr2_lgdt3306a_attach(struct pvr2_dvb_adapter *adap);
                                            ^~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:509:21: error: variable 'pvr2_160000_dvb_props' has initializer but incomplete type
    static const struct pvr2_dvb_props pvr2_160000_dvb_props = {
                        ^~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:510:3: error: 'const struct pvr2_dvb_props' has no member named 'frontend_attach'
     .frontend_attach = pvr2_dual_fe_attach,
      ^~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:510:21: warning: excess elements in struct initializer
     .frontend_attach = pvr2_dual_fe_attach,
                        ^~~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:510:21: note: (near initialization for 'pvr2_160000_dvb_props')
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:511:3: error: 'const struct pvr2_dvb_props' has no member named 'tuner_attach'
     .tuner_attach    = pvr2_si2157_attach,
      ^~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:511:21: warning: excess elements in struct initializer
     .tuner_attach    = pvr2_si2157_attach,
                        ^~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:511:21: note: (near initialization for 'pvr2_160000_dvb_props')
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:540:21: error: variable 'pvr2_160111_dvb_props' has initializer but incomplete type
    static const struct pvr2_dvb_props pvr2_160111_dvb_props = {
                        ^~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:541:3: error: 'const struct pvr2_dvb_props' has no member named 'frontend_attach'
     .frontend_attach = pvr2_lgdt3306a_attach,
      ^~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:541:21: warning: excess elements in struct initializer
     .frontend_attach = pvr2_lgdt3306a_attach,
                        ^~~~~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:541:21: note: (near initialization for 'pvr2_160111_dvb_props')
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:542:3: error: 'const struct pvr2_dvb_props' has no member named 'tuner_attach'
     .tuner_attach    = pvr2_si2157_attach,
      ^~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:542:21: warning: excess elements in struct initializer
     .tuner_attach    = pvr2_si2157_attach,
                        ^~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:542:21: note: (near initialization for 'pvr2_160111_dvb_props')
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:571:38: warning: 'struct pvr2_dvb_adapter' declared inside parameter list will not be visible outside of this definition or declaration
    static int pvr2_si2168_attach(struct pvr2_dvb_adapter *adap)
                                         ^~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c: In function 'pvr2_si2168_attach':
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:573:9: error: variable 'si2168_config' has initializer but incomplete type
     struct si2168_config si2168_config = {};
            ^~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:573:23: error: storage size of 'si2168_config' isn't known
     struct si2168_config si2168_config = {};
                          ^~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:578:26: error: dereferencing pointer to incomplete type 'struct pvr2_dvb_adapter'
     si2168_config.fe = &adap->fe[1];
                             ^~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:580:26: error: 'SI2168_TS_PARALLEL' undeclared (first use in this function)
     si2168_config.ts_mode = SI2168_TS_PARALLEL; /*2, 1-serial, 2-parallel.*/
                             ^~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:580:26: note: each undeclared identifier is reported only once for each function it appears in
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:573:23: warning: unused variable 'si2168_config' [-Wunused-variable]
     struct si2168_config si2168_config = {};
                          ^~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c: At top level:
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:595:41: warning: 'struct pvr2_dvb_adapter' declared inside parameter list will not be visible outside of this definition or declaration
    static int pvr2_lgdt3306a_attach(struct pvr2_dvb_adapter *adap)
                                            ^~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:595:12: error: conflicting types for 'pvr2_lgdt3306a_attach'
    static int pvr2_lgdt3306a_attach(struct pvr2_dvb_adapter *adap)
               ^~~~~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:507:12: note: previous declaration of 'pvr2_lgdt3306a_attach' was here
    static int pvr2_lgdt3306a_attach(struct pvr2_dvb_adapter *adap);
               ^~~~~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c: In function 'pvr2_lgdt3306a_attach':
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:597:26: error: storage size of 'lgdt3306a_config' isn't known
     struct lgdt3306a_config lgdt3306a_config;
                             ^~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:603:29: error: dereferencing pointer to incomplete type 'struct pvr2_dvb_adapter'
     lgdt3306a_config.fe = &adap->fe[0];
                                ^~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:609:31: error: 'LGDT3306A_MPEG_PARALLEL' undeclared (first use in this function)
     lgdt3306a_config.mpeg_mode = LGDT3306A_MPEG_PARALLEL;
                                  ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:610:32: error: 'LGDT3306A_TPCLK_FALLING_EDGE' undeclared (first use in this function); did you mean 'LGDT3306A_MPEG_PARALLEL'?
     lgdt3306a_config.tpclk_edge = LGDT3306A_TPCLK_FALLING_EDGE;
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                   LGDT3306A_MPEG_PARALLEL
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:611:38: error: 'LGDT3306A_TP_VALID_LOW' undeclared (first use in this function); did you mean 'LGDT3306A_MPEG_PARALLEL'?
     lgdt3306a_config.tpvalid_polarity = LGDT3306A_TP_VALID_LOW;
                                         ^~~~~~~~~~~~~~~~~~~~~~
                                         LGDT3306A_MPEG_PARALLEL
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:612:31: warning: left-hand operand of comma expression has no effect [-Wunused-value]
     lgdt3306a_config.xtalMHz = 25, /* demod clock MHz; 24/25 supported */
                                  ^
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:597:26: warning: unused variable 'lgdt3306a_config' [-Wunused-variable]
     struct lgdt3306a_config lgdt3306a_config;
                             ^~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c: At top level:
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:624:39: warning: 'struct pvr2_dvb_adapter' declared inside parameter list will not be visible outside of this definition or declaration
    static int pvr2_dual_fe_attach(struct pvr2_dvb_adapter *adap)
                                          ^~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:624:12: error: conflicting types for 'pvr2_dual_fe_attach'
    static int pvr2_dual_fe_attach(struct pvr2_dvb_adapter *adap)
               ^~~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:506:12: note: previous declaration of 'pvr2_dual_fe_attach' was here
    static int pvr2_dual_fe_attach(struct pvr2_dvb_adapter *adap);
               ^~~~~~~~~~~~~~~~~~~
   In file included from include/linux/string.h:6:0,
                    from include/linux/uuid.h:20,
                    from include/linux/mod_devicetable.h:13,
                    from drivers/media/usb/pvrusb2/pvrusb2-devattr.h:19,
                    from drivers/media/usb/pvrusb2/pvrusb2-devattr.c:25:
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c: In function 'pvr2_dual_fe_attach':
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:628:28: error: passing argument 1 of 'pvr2_lgdt3306a_attach' from incompatible pointer type [-Werror=incompatible-pointer-types]
     if (pvr2_lgdt3306a_attach(adap) != 0)
                               ^
   include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> drivers/media/usb/pvrusb2/pvrusb2-devattr.c:628:2: note: in expansion of macro 'if'
     if (pvr2_lgdt3306a_attach(adap) != 0)
     ^~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:595:12: note: expected 'struct pvr2_dvb_adapter *' but argument is of type 'struct pvr2_dvb_adapter *'
    static int pvr2_lgdt3306a_attach(struct pvr2_dvb_adapter *adap)
               ^~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/string.h:6:0,
                    from include/linux/uuid.h:20,
                    from include/linux/mod_devicetable.h:13,
                    from drivers/media/usb/pvrusb2/pvrusb2-devattr.h:19,
                    from drivers/media/usb/pvrusb2/pvrusb2-devattr.c:25:
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:628:28: error: passing argument 1 of 'pvr2_lgdt3306a_attach' from incompatible pointer type [-Werror=incompatible-pointer-types]
     if (pvr2_lgdt3306a_attach(adap) != 0)
                               ^
   include/linux/compiler.h:58:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^~~~
>> drivers/media/usb/pvrusb2/pvrusb2-devattr.c:628:2: note: in expansion of macro 'if'
     if (pvr2_lgdt3306a_attach(adap) != 0)
     ^~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:595:12: note: expected 'struct pvr2_dvb_adapter *' but argument is of type 'struct pvr2_dvb_adapter *'
    static int pvr2_lgdt3306a_attach(struct pvr2_dvb_adapter *adap)
               ^~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/string.h:6:0,
                    from include/linux/uuid.h:20,
                    from include/linux/mod_devicetable.h:13,
                    from drivers/media/usb/pvrusb2/pvrusb2-devattr.h:19,
                    from drivers/media/usb/pvrusb2/pvrusb2-devattr.c:25:
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:628:28: error: passing argument 1 of 'pvr2_lgdt3306a_attach' from incompatible pointer type [-Werror=incompatible-pointer-types]
     if (pvr2_lgdt3306a_attach(adap) != 0)
                               ^
   include/linux/compiler.h:69:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^~~~
>> drivers/media/usb/pvrusb2/pvrusb2-devattr.c:628:2: note: in expansion of macro 'if'
     if (pvr2_lgdt3306a_attach(adap) != 0)
     ^~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:595:12: note: expected 'struct pvr2_dvb_adapter *' but argument is of type 'struct pvr2_dvb_adapter *'
    static int pvr2_lgdt3306a_attach(struct pvr2_dvb_adapter *adap)
               ^~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/string.h:6:0,
                    from include/linux/uuid.h:20,
                    from include/linux/mod_devicetable.h:13,
                    from drivers/media/usb/pvrusb2/pvrusb2-devattr.h:19,
                    from drivers/media/usb/pvrusb2/pvrusb2-devattr.c:25:
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:631:25: error: passing argument 1 of 'pvr2_si2168_attach' from incompatible pointer type [-Werror=incompatible-pointer-types]
     if (pvr2_si2168_attach(adap) != 0) {
                            ^
   include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:631:2: note: in expansion of macro 'if'
     if (pvr2_si2168_attach(adap) != 0) {
     ^~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:571:12: note: expected 'struct pvr2_dvb_adapter *' but argument is of type 'struct pvr2_dvb_adapter *'
    static int pvr2_si2168_attach(struct pvr2_dvb_adapter *adap)
               ^~~~~~~~~~~~~~~~~~
   In file included from include/linux/string.h:6:0,
                    from include/linux/uuid.h:20,
                    from include/linux/mod_devicetable.h:13,
                    from drivers/media/usb/pvrusb2/pvrusb2-devattr.h:19,
                    from drivers/media/usb/pvrusb2/pvrusb2-devattr.c:25:
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:631:25: error: passing argument 1 of 'pvr2_si2168_attach' from incompatible pointer type [-Werror=incompatible-pointer-types]
     if (pvr2_si2168_attach(adap) != 0) {
                            ^
   include/linux/compiler.h:58:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:631:2: note: in expansion of macro 'if'
     if (pvr2_si2168_attach(adap) != 0) {
     ^~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:571:12: note: expected 'struct pvr2_dvb_adapter *' but argument is of type 'struct pvr2_dvb_adapter *'
    static int pvr2_si2168_attach(struct pvr2_dvb_adapter *adap)
               ^~~~~~~~~~~~~~~~~~
   In file included from include/linux/string.h:6:0,
                    from include/linux/uuid.h:20,
                    from include/linux/mod_devicetable.h:13,
                    from drivers/media/usb/pvrusb2/pvrusb2-devattr.h:19,
                    from drivers/media/usb/pvrusb2/pvrusb2-devattr.c:25:
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:631:25: error: passing argument 1 of 'pvr2_si2168_attach' from incompatible pointer type [-Werror=incompatible-pointer-types]
     if (pvr2_si2168_attach(adap) != 0) {
                            ^
   include/linux/compiler.h:69:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:631:2: note: in expansion of macro 'if'
     if (pvr2_si2168_attach(adap) != 0) {
     ^~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:571:12: note: expected 'struct pvr2_dvb_adapter *' but argument is of type 'struct pvr2_dvb_adapter *'
    static int pvr2_si2168_attach(struct pvr2_dvb_adapter *adap)
               ^~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:632:3: error: implicit declaration of function 'dvb_module_release'; did you mean 'complete_release'? [-Werror=implicit-function-declaration]
      dvb_module_release(adap->i2c_client_demod[0]);
      ^~~~~~~~~~~~~~~~~~
      complete_release
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:632:26: error: dereferencing pointer to incomplete type 'struct pvr2_dvb_adapter'
      dvb_module_release(adap->i2c_client_demod[0]);
                             ^~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c: At top level:
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:509:36: error: storage size of 'pvr2_160000_dvb_props' isn't known
    static const struct pvr2_dvb_props pvr2_160000_dvb_props = {
                                       ^~~~~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:540:36: error: storage size of 'pvr2_160111_dvb_props' isn't known
    static const struct pvr2_dvb_props pvr2_160111_dvb_props = {
                                       ^~~~~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:505:12: warning: 'pvr2_si2157_attach' used but never defined
    static int pvr2_si2157_attach(struct pvr2_dvb_adapter *adap);
               ^~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:506:12: warning: 'pvr2_dual_fe_attach' used but never defined
    static int pvr2_dual_fe_attach(struct pvr2_dvb_adapter *adap);
               ^~~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:507:12: warning: 'pvr2_lgdt3306a_attach' used but never defined
    static int pvr2_lgdt3306a_attach(struct pvr2_dvb_adapter *adap);
               ^~~~~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:624:12: warning: 'pvr2_dual_fe_attach' defined but not used [-Wunused-function]
    static int pvr2_dual_fe_attach(struct pvr2_dvb_adapter *adap)
               ^~~~~~~~~~~~~~~~~~~
   drivers/media/usb/pvrusb2/pvrusb2-devattr.c:483:12: warning: 'pvr2_si2157_attach' defined but not used [-Wunused-function]
    static int pvr2_si2157_attach(struct pvr2_dvb_adapter *adap)
               ^~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +490 drivers/media/usb/pvrusb2/pvrusb2-devattr.c

   482	
   483	static int pvr2_si2157_attach(struct pvr2_dvb_adapter *adap)
   484	{
 > 485		struct si2157_config si2157_config = {};
   486	
   487		si2157_config.inversion = 1;
   488		si2157_config.fe = adap->fe[0];
   489	
 > 490		adap->i2c_client_tuner = dvb_module_probe("si2157", "si2177",
   491							&adap->channel.hdw->i2c_adap,
   492							0x60, &si2157_config);
   493	
   494		if (!adap->i2c_client_tuner)
   495			return -ENODEV;
   496	
   497		return 0;
   498	}
   499	
   500	#define PVR2_FIRMWARE_160xxx "v4l-pvrusb2-160xxx-01.fw"
   501	static const char *pvr2_fw1_names_160xxx[] = {
   502			PVR2_FIRMWARE_160xxx,
   503	};
   504	
   505	static int pvr2_si2157_attach(struct pvr2_dvb_adapter *adap);
   506	static int pvr2_dual_fe_attach(struct pvr2_dvb_adapter *adap);
   507	static int pvr2_lgdt3306a_attach(struct pvr2_dvb_adapter *adap);
   508	
   509	static const struct pvr2_dvb_props pvr2_160000_dvb_props = {
   510		.frontend_attach = pvr2_dual_fe_attach,
   511		.tuner_attach    = pvr2_si2157_attach,
   512	};
   513	static const struct pvr2_device_client_desc pvr2_cli_160000[] = {
   514		{ .module_id = PVR2_CLIENT_ID_CX25840 },
   515	};
   516	static const struct pvr2_device_desc pvr2_device_160000 = {
   517			.description = "WinTV HVR-1975 Model 160000",
   518			.shortname = "160000",
   519			.client_table.lst = pvr2_cli_160000,
   520			.client_table.cnt = ARRAY_SIZE(pvr2_cli_160000),
   521			.fx2_firmware.lst = pvr2_fw1_names_160xxx,
   522			.fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_160xxx),
   523			.default_tuner_type = TUNER_ABSENT,
   524			.flag_has_cx25840 = !0,
   525			.flag_has_hauppauge_rom = !0,
   526			.flag_has_analogtuner = !0,
   527			.flag_has_composite = !0,
   528			.flag_has_svideo = !0,
   529			.flag_fx2_16kb = !0,
   530			.signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
   531			.digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
   532			.default_std_mask = V4L2_STD_NTSC_M,
   533			.led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
   534			.ir_scheme = PVR2_IR_SCHEME_ZILOG,
   535	#ifdef CONFIG_VIDEO_PVRUSB2_DVB
   536			.dvb_props = &pvr2_160000_dvb_props,
   537	#endif
   538	};
   539	
   540	static const struct pvr2_dvb_props pvr2_160111_dvb_props = {
   541		.frontend_attach = pvr2_lgdt3306a_attach,
   542		.tuner_attach    = pvr2_si2157_attach,
   543	};
   544	static const struct pvr2_device_client_desc pvr2_cli_160111[] = {
   545		{ .module_id = PVR2_CLIENT_ID_CX25840 },
   546	};
   547	static const struct pvr2_device_desc pvr2_device_160111 = {
   548			.description = "WinTV HVR-1955 Model 160111",
   549			.shortname = "160111",
   550			.client_table.lst = pvr2_cli_160111,
   551			.client_table.cnt = ARRAY_SIZE(pvr2_cli_160111),
   552			.fx2_firmware.lst = pvr2_fw1_names_160xxx,
   553			.fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_160xxx),
   554			.default_tuner_type = TUNER_ABSENT,
   555			.flag_has_cx25840 = !0,
   556			.flag_has_hauppauge_rom = !0,
   557			.flag_has_analogtuner = !0,
   558			.flag_has_composite = !0,
   559			.flag_has_svideo = !0,
   560			.flag_fx2_16kb = !0,
   561			.signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
   562			.digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
   563			.default_std_mask = V4L2_STD_NTSC_M,
   564			.led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
   565			.ir_scheme = PVR2_IR_SCHEME_ZILOG,
   566	#ifdef CONFIG_VIDEO_PVRUSB2_DVB
   567			.dvb_props = &pvr2_160111_dvb_props,
   568	#endif
   569	};
   570	
   571	static int pvr2_si2168_attach(struct pvr2_dvb_adapter *adap)
   572	{
   573		struct si2168_config si2168_config = {};
   574		struct i2c_adapter *adapter;
   575	
   576		pr_debug("%s()\n", __func__);
   577	
   578		si2168_config.fe = &adap->fe[1];
   579		si2168_config.i2c_adapter = &adapter;
   580		si2168_config.ts_mode = SI2168_TS_PARALLEL; /*2, 1-serial, 2-parallel.*/
   581		si2168_config.ts_clock_gapped = 1; /*0-disabled, 1-enabled.*/
   582		si2168_config.ts_clock_inv = 0; /*0-not-invert, 1-invert*/
   583		si2168_config.spectral_inversion = 1; /*0-not-invert, 1-invert*/
   584	
   585		adap->i2c_client_demod[1] = dvb_module_probe("si2168", NULL,
   586							&adap->channel.hdw->i2c_adap,
   587							0x64, &si2168_config);
   588	
   589		if (!adap->i2c_client_demod[1])
   590			return -ENODEV;
   591	
   592		return 0;
   593	}
   594	
   595	static int pvr2_lgdt3306a_attach(struct pvr2_dvb_adapter *adap)
   596	{
   597		struct lgdt3306a_config lgdt3306a_config;
   598		struct i2c_adapter *adapter;
   599	
   600		pr_debug("%s()\n", __func__);
   601	
   602		/* attach demod */
   603		lgdt3306a_config.fe = &adap->fe[0];
   604		lgdt3306a_config.i2c_adapter = &adapter;
   605		lgdt3306a_config.deny_i2c_rptr = 1;
   606		lgdt3306a_config.spectral_inversion = 1;
   607		lgdt3306a_config.qam_if_khz = 4000;
   608		lgdt3306a_config.vsb_if_khz = 3250;
   609		lgdt3306a_config.mpeg_mode = LGDT3306A_MPEG_PARALLEL;
   610		lgdt3306a_config.tpclk_edge = LGDT3306A_TPCLK_FALLING_EDGE;
   611		lgdt3306a_config.tpvalid_polarity = LGDT3306A_TP_VALID_LOW;
   612		lgdt3306a_config.xtalMHz = 25, /* demod clock MHz; 24/25 supported */
   613	
   614		adap->i2c_client_demod[0] = dvb_module_probe("lgdt3306a", NULL,
   615							&adap->channel.hdw->i2c_adap,
   616							0x59, &lgdt3306a_config);
   617	
   618		if (!adap->i2c_client_demod[0])
   619			return -ENODEV;
   620	
   621		return 0;
   622	}
   623	
   624	static int pvr2_dual_fe_attach(struct pvr2_dvb_adapter *adap)
   625	{
   626		pr_debug("%s()\n", __func__);
   627	
 > 628		if (pvr2_lgdt3306a_attach(adap) != 0)
   629			return -ENODEV;
   630	
   631		if (pvr2_si2168_attach(adap) != 0) {
   632			dvb_module_release(adap->i2c_client_demod[0]);
   633			return -ENODEV;
   634		}
   635	
   636		return 0;
   637	}
   638	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox series

Patch

diff --git a/drivers/media/usb/pvrusb2/Kconfig b/drivers/media/usb/pvrusb2/Kconfig
index 1ad913f..144631c 100644
--- a/drivers/media/usb/pvrusb2/Kconfig
+++ b/drivers/media/usb/pvrusb2/Kconfig
@@ -40,6 +40,8 @@  config VIDEO_PVRUSB2_DVB
 	select DVB_S5H1409 if MEDIA_SUBDRV_AUTOSELECT
 	select DVB_S5H1411 if MEDIA_SUBDRV_AUTOSELECT
 	select DVB_TDA10048 if MEDIA_SUBDRV_AUTOSELECT
+	select DVB_LGDT3306A if MEDIA_SUBDRV_AUTOSELECT
+	select DVB_SI2168 if MEDIA_SUBDRV_AUTOSELECT
 	select MEDIA_TUNER_TDA18271 if MEDIA_SUBDRV_AUTOSELECT
 	select MEDIA_TUNER_SIMPLE if MEDIA_SUBDRV_AUTOSELECT
 	select MEDIA_TUNER_TDA8290 if MEDIA_SUBDRV_AUTOSELECT
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-cx2584x-v4l.c b/drivers/media/usb/pvrusb2/pvrusb2-cx2584x-v4l.c
index d5bec0f..36016ab 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-cx2584x-v4l.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-cx2584x-v4l.c
@@ -111,10 +111,35 @@  static const struct routing_scheme routing_defav400 = {
 	.cnt = ARRAY_SIZE(routing_schemeav400),
 };
 
+static const struct routing_scheme_item routing_scheme160xxx[] = {
+	[PVR2_CVAL_INPUT_TV] = {
+		.vid = CX25840_COMPOSITE7,
+		.aud = CX25840_AUDIO8,
+	},
+	[PVR2_CVAL_INPUT_RADIO] = {
+		.vid = CX25840_COMPOSITE4,
+		.aud = CX25840_AUDIO6,
+	},
+	[PVR2_CVAL_INPUT_COMPOSITE] = {
+		.vid = CX25840_COMPOSITE3,
+		.aud = CX25840_AUDIO_SERIAL,
+	},
+	[PVR2_CVAL_INPUT_SVIDEO] = {
+		.vid = CX25840_SVIDEO1,
+		.aud = CX25840_AUDIO_SERIAL,
+	},
+};
+
+static const struct routing_scheme routing_def160xxx = {
+	.def = routing_scheme160xxx,
+	.cnt = ARRAY_SIZE(routing_scheme160xxx),
+};
+
 static const struct routing_scheme *routing_schemes[] = {
 	[PVR2_ROUTING_SCHEME_HAUPPAUGE] = &routing_def0,
 	[PVR2_ROUTING_SCHEME_GOTVIEW] = &routing_defgv,
 	[PVR2_ROUTING_SCHEME_AV400] = &routing_defav400,
+	[PVR2_ROUTING_SCHEME_HAUP160XXX] = &routing_def160xxx,
 };
 
 void pvr2_cx25840_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-devattr.c b/drivers/media/usb/pvrusb2/pvrusb2-devattr.c
index ef36b62..ecec688 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-devattr.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-devattr.c
@@ -37,6 +37,9 @@  pvr2_device_desc structures.
 #include "tda18271.h"
 #include "tda8290.h"
 #include "tuner-simple.h"
+#include "si2157.h"
+#include "lgdt3306a.h"
+#include "si2168.h"
 #endif
 
 
@@ -474,6 +477,165 @@  static const struct pvr2_dvb_props pvr2_751xx_dvb_props = {
 };
 #endif
 
+/*------------------------------------------------------------------------*/
+/*    Hauppauge PVR-USB2 Model 160000 / 160111 -- HVR-1955 / HVR-1975     */
+
+static int pvr2_si2157_attach(struct pvr2_dvb_adapter *adap)
+{
+	struct si2157_config si2157_config = {};
+
+	si2157_config.inversion = 1;
+	si2157_config.fe = adap->fe[0];
+
+	adap->i2c_client_tuner = dvb_module_probe("si2157", "si2177",
+						&adap->channel.hdw->i2c_adap,
+						0x60, &si2157_config);
+
+	if (!adap->i2c_client_tuner)
+		return -ENODEV;
+
+	return 0;
+}
+
+#define PVR2_FIRMWARE_160xxx "v4l-pvrusb2-160xxx-01.fw"
+static const char *pvr2_fw1_names_160xxx[] = {
+		PVR2_FIRMWARE_160xxx,
+};
+
+static int pvr2_si2157_attach(struct pvr2_dvb_adapter *adap);
+static int pvr2_dual_fe_attach(struct pvr2_dvb_adapter *adap);
+static int pvr2_lgdt3306a_attach(struct pvr2_dvb_adapter *adap);
+
+static const struct pvr2_dvb_props pvr2_160000_dvb_props = {
+	.frontend_attach = pvr2_dual_fe_attach,
+	.tuner_attach    = pvr2_si2157_attach,
+};
+static const struct pvr2_device_client_desc pvr2_cli_160000[] = {
+	{ .module_id = PVR2_CLIENT_ID_CX25840 },
+};
+static const struct pvr2_device_desc pvr2_device_160000 = {
+		.description = "WinTV HVR-1975 Model 160000",
+		.shortname = "160000",
+		.client_table.lst = pvr2_cli_160000,
+		.client_table.cnt = ARRAY_SIZE(pvr2_cli_160000),
+		.fx2_firmware.lst = pvr2_fw1_names_160xxx,
+		.fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_160xxx),
+		.default_tuner_type = TUNER_ABSENT,
+		.flag_has_cx25840 = !0,
+		.flag_has_hauppauge_rom = !0,
+		.flag_has_analogtuner = !0,
+		.flag_has_composite = !0,
+		.flag_has_svideo = !0,
+		.flag_fx2_16kb = !0,
+		.signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
+		.digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
+		.default_std_mask = V4L2_STD_NTSC_M,
+		.led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
+		.ir_scheme = PVR2_IR_SCHEME_ZILOG,
+#ifdef CONFIG_VIDEO_PVRUSB2_DVB
+		.dvb_props = &pvr2_160000_dvb_props,
+#endif
+};
+
+static const struct pvr2_dvb_props pvr2_160111_dvb_props = {
+	.frontend_attach = pvr2_lgdt3306a_attach,
+	.tuner_attach    = pvr2_si2157_attach,
+};
+static const struct pvr2_device_client_desc pvr2_cli_160111[] = {
+	{ .module_id = PVR2_CLIENT_ID_CX25840 },
+};
+static const struct pvr2_device_desc pvr2_device_160111 = {
+		.description = "WinTV HVR-1955 Model 160111",
+		.shortname = "160111",
+		.client_table.lst = pvr2_cli_160111,
+		.client_table.cnt = ARRAY_SIZE(pvr2_cli_160111),
+		.fx2_firmware.lst = pvr2_fw1_names_160xxx,
+		.fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_160xxx),
+		.default_tuner_type = TUNER_ABSENT,
+		.flag_has_cx25840 = !0,
+		.flag_has_hauppauge_rom = !0,
+		.flag_has_analogtuner = !0,
+		.flag_has_composite = !0,
+		.flag_has_svideo = !0,
+		.flag_fx2_16kb = !0,
+		.signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
+		.digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
+		.default_std_mask = V4L2_STD_NTSC_M,
+		.led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
+		.ir_scheme = PVR2_IR_SCHEME_ZILOG,
+#ifdef CONFIG_VIDEO_PVRUSB2_DVB
+		.dvb_props = &pvr2_160111_dvb_props,
+#endif
+};
+
+static int pvr2_si2168_attach(struct pvr2_dvb_adapter *adap)
+{
+	struct si2168_config si2168_config = {};
+	struct i2c_adapter *adapter;
+
+	pr_debug("%s()\n", __func__);
+
+	si2168_config.fe = &adap->fe[1];
+	si2168_config.i2c_adapter = &adapter;
+	si2168_config.ts_mode = SI2168_TS_PARALLEL; /*2, 1-serial, 2-parallel.*/
+	si2168_config.ts_clock_gapped = 1; /*0-disabled, 1-enabled.*/
+	si2168_config.ts_clock_inv = 0; /*0-not-invert, 1-invert*/
+	si2168_config.spectral_inversion = 1; /*0-not-invert, 1-invert*/
+
+	adap->i2c_client_demod[1] = dvb_module_probe("si2168", NULL,
+						&adap->channel.hdw->i2c_adap,
+						0x64, &si2168_config);
+
+	if (!adap->i2c_client_demod[1])
+		return -ENODEV;
+
+	return 0;
+}
+
+static int pvr2_lgdt3306a_attach(struct pvr2_dvb_adapter *adap)
+{
+	struct lgdt3306a_config lgdt3306a_config;
+	struct i2c_adapter *adapter;
+
+	pr_debug("%s()\n", __func__);
+
+	/* attach demod */
+	lgdt3306a_config.fe = &adap->fe[0];
+	lgdt3306a_config.i2c_adapter = &adapter;
+	lgdt3306a_config.deny_i2c_rptr = 1;
+	lgdt3306a_config.spectral_inversion = 1;
+	lgdt3306a_config.qam_if_khz = 4000;
+	lgdt3306a_config.vsb_if_khz = 3250;
+	lgdt3306a_config.mpeg_mode = LGDT3306A_MPEG_PARALLEL;
+	lgdt3306a_config.tpclk_edge = LGDT3306A_TPCLK_FALLING_EDGE;
+	lgdt3306a_config.tpvalid_polarity = LGDT3306A_TP_VALID_LOW;
+	lgdt3306a_config.xtalMHz = 25, /* demod clock MHz; 24/25 supported */
+
+	adap->i2c_client_demod[0] = dvb_module_probe("lgdt3306a", NULL,
+						&adap->channel.hdw->i2c_adap,
+						0x59, &lgdt3306a_config);
+
+	if (!adap->i2c_client_demod[0])
+		return -ENODEV;
+
+	return 0;
+}
+
+static int pvr2_dual_fe_attach(struct pvr2_dvb_adapter *adap)
+{
+	pr_debug("%s()\n", __func__);
+
+	if (pvr2_lgdt3306a_attach(adap) != 0)
+		return -ENODEV;
+
+	if (pvr2_si2168_attach(adap) != 0) {
+		dvb_module_release(adap->i2c_client_demod[0]);
+		return -ENODEV;
+	}
+
+	return 0;
+}
+
 #define PVR2_FIRMWARE_75xxx "v4l-pvrusb2-73xxx-01.fw"
 static const char *pvr2_fw1_names_75xxx[] = {
 		PVR2_FIRMWARE_75xxx,
@@ -552,6 +714,10 @@  struct usb_device_id pvr2_device_table[] = {
 	  .driver_info = (kernel_ulong_t)&pvr2_device_751xx},
 	{ USB_DEVICE(0x0ccd, 0x0039),
 	  .driver_info = (kernel_ulong_t)&pvr2_device_av400},
+	{ USB_DEVICE(0x2040, 0x7502),
+	  .driver_info = (kernel_ulong_t)&pvr2_device_160111},
+	{ USB_DEVICE(0x2040, 0x7510),
+	  .driver_info = (kernel_ulong_t)&pvr2_device_160000},
 	{ }
 };
 
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-devattr.h b/drivers/media/usb/pvrusb2/pvrusb2-devattr.h
index c1e7d48..ea0b2bf 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-devattr.h
+++ b/drivers/media/usb/pvrusb2/pvrusb2-devattr.h
@@ -66,6 +66,7 @@  struct pvr2_string_table {
 #define PVR2_ROUTING_SCHEME_GOTVIEW 1
 #define PVR2_ROUTING_SCHEME_ONAIR 2
 #define PVR2_ROUTING_SCHEME_AV400 3
+#define PVR2_ROUTING_SCHEME_HAUP160XXX 4
 
 #define PVR2_DIGITAL_SCHEME_NONE 0
 #define PVR2_DIGITAL_SCHEME_HAUPPAUGE 1
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-fx2-cmd.h b/drivers/media/usb/pvrusb2/pvrusb2-fx2-cmd.h
index 0a01de4..640b033 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-fx2-cmd.h
+++ b/drivers/media/usb/pvrusb2/pvrusb2-fx2-cmd.h
@@ -38,6 +38,10 @@ 
 
 #define FX2CMD_FWPOST1          0x52u
 
+/* These 2 only exist on Model 160xxx */
+#define FX2CMD_HCW_DEMOD_RESET_PIN 0xd4u
+#define FX2CMD_HCW_MAKO_SLEEP_PIN  0xd5u
+
 #define FX2CMD_POWER_OFF        0xdcu
 #define FX2CMD_POWER_ON         0xdeu
 
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
index 446a999..ab9e822 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
@@ -316,6 +316,8 @@  static const struct pvr2_fx2cmd_descdef pvr2_fx2cmd_desc[] = {
 	{FX2CMD_ONAIR_DTV_STREAMING_OFF, "onair dtv stream off"},
 	{FX2CMD_ONAIR_DTV_POWER_ON, "onair dtv power on"},
 	{FX2CMD_ONAIR_DTV_POWER_OFF, "onair dtv power off"},
+	{FX2CMD_HCW_DEMOD_RESET_PIN, "hcw demod reset pin"},
+	{FX2CMD_HCW_MAKO_SLEEP_PIN, "hcw mako sleep pin"},
 };
 
 
@@ -2137,10 +2139,28 @@  static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw)
 				      ((0) << 16));
 	}
 
-	// This step MUST happen after the earlier powerup step.
+	/* This step MUST happen after the earlier powerup step */
 	pvr2_i2c_core_init(hdw);
 	if (!pvr2_hdw_dev_ok(hdw)) return;
 
+	/* Reset demod only on Hauppauge 160xxx platform */
+	if (hdw->usb_dev->descriptor.idVendor == 0x2040 &&
+	    (hdw->usb_dev->descriptor.idProduct == 0x7502 ||
+	     hdw->usb_dev->descriptor.idProduct == 0x7510)) {
+		pr_info("%s(): resetting 160xxx demod\n", __func__);
+		/* TODO: not sure this is proper place to reset once only */
+		pvr2_issue_simple_cmd(hdw,
+				     FX2CMD_HCW_DEMOD_RESET_PIN |
+				     (1 << 8) |
+				     ((0) << 16));
+		usleep_range(10000, 11000);
+		pvr2_issue_simple_cmd(hdw,
+				     FX2CMD_HCW_DEMOD_RESET_PIN |
+				     (1 << 8) |
+				     ((1) << 16));
+		usleep_range(10000, 11000);
+	}
+
 	pvr2_hdw_load_modules(hdw);
 	if (!pvr2_hdw_dev_ok(hdw)) return;
 
@@ -4011,6 +4031,20 @@  int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *hdw)
 static int pvr2_hdw_cmd_hcw_demod_reset(struct pvr2_hdw *hdw, int onoff)
 {
 	hdw->flag_ok = !0;
+
+	/* Use this for Hauppauge 160xxx only */
+	if (hdw->usb_dev->descriptor.idVendor == 0x2040 &&
+	    (hdw->usb_dev->descriptor.idProduct == 0x7502 ||
+	     hdw->usb_dev->descriptor.idProduct == 0x7510)) {
+		pr_debug("%s(): resetting demod on Hauppauge 160xxx platform skipped\n",
+			__func__);
+		/* Can't reset 160xxx or it will trash Demod tristate */
+		return pvr2_issue_simple_cmd(hdw,
+				     FX2CMD_HCW_MAKO_SLEEP_PIN |
+				     (1 << 8) |
+				     ((onoff ? 1 : 0) << 16));
+	}
+
 	return pvr2_issue_simple_cmd(hdw,
 				     FX2CMD_HCW_DEMOD_RESETIN |
 				     (1 << 8) |