All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V3 2/2] Add support for the Avermedia TD310
@ 2019-03-05 18:37 Jose Alberto Reguero
       [not found] ` <201903080602.9no0UbXr%fengguang.wu@intel.com>
  2019-03-07 23:04 ` kbuild test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Jose Alberto Reguero @ 2019-03-05 18:37 UTC (permalink / raw)
  To: Linux media, Sean Young, Antti Palosaari, Andreas Kemnade,
	jose.alberto.reguero

This patch add support for Avermedia TD310 usb stick. 

V3 add a table for the i2c addresses an other needed options.


Signed-off-by: Jose Alberto Reguero <jose.alberto.reguero@gmail.com> 

diff -upr linux/drivers/media/usb/dvb-usb-v2/af9035.c linux.new/drivers/media/usb/dvb-usb-v2/af9035.c
--- linux/drivers/media/usb/dvb-usb-v2/af9035.c	2019-03-05 18:44:34.936077251 +0100
+++ linux.new/drivers/media/usb/dvb-usb-v2/af9035.c	2019-03-05 18:43:31.512806221 +0100
@@ -846,6 +846,7 @@ static int af9035_read_config(struct dvb
 	state->af9033_config[1].adc_multiplier = AF9033_ADC_MULTIPLIER_2X;
 	state->af9033_config[0].ts_mode = AF9033_TS_MODE_USB;
 	state->af9033_config[1].ts_mode = AF9033_TS_MODE_SERIAL;
+	state->it930x_addresses = 0;
 
 	if (state->chip_type == 0x9135) {
 		/* feed clock for integrated RF tuner */
@@ -872,6 +873,10 @@ static int af9035_read_config(struct dvb
 		 * IT930x is an USB bridge, only single demod-single tuner
 		 * configurations seen so far.
 		 */
+		if ((le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_AVERMEDIA) &&
+		    (le16_to_cpu(d->udev->descriptor.idProduct) == USB_PID_AVERMEDIA_TD310)) {
+			state->it930x_addresses = 1;
+		}
 		return 0;
 	}
 
@@ -1267,8 +1272,9 @@ static int it930x_frontend_attach(struct
 
 	state->af9033_config[adap->id].fe = &adap->fe[0];
 	state->af9033_config[adap->id].ops = &state->ops;
-	ret = af9035_add_i2c_dev(d, "si2168", 0x67, &si2168_config,
-				&d->i2c_adap);
+	ret = af9035_add_i2c_dev(d, "si2168",
+				 it930x_addresses_table[state->it930x_addresses].frontend_i2c_addr,
+				 &si2168_config, &d->i2c_adap);
 	if (ret)
 		goto err;
 
@@ -1619,10 +1625,10 @@ static int it930x_tuner_attach(struct dv
 
 	memset(&si2157_config, 0, sizeof(si2157_config));
 	si2157_config.fe = adap->fe[0];
-	si2157_config.if_port = 1;
-	ret = af9035_add_i2c_dev(d, "si2157", 0x63,
-			&si2157_config, state->i2c_adapter_demod);
-
+	si2157_config.if_port = it930x_addresses_table[state->it930x_addresses].tuner_if_port;
+	ret = af9035_add_i2c_dev(d, "si2157",
+				 it930x_addresses_table[state->it930x_addresses].tuner_i2c_addr,
+				 &si2157_config, state->i2c_adapter_demod);
 	if (ret)
 		goto err;
 
@@ -2128,6 +2134,8 @@ static const struct usb_device_id af9035
 	/* IT930x devices */
 	{ DVB_USB_DEVICE(USB_VID_ITETECH, USB_PID_ITETECH_IT9303,
 		&it930x_props, "ITE 9303 Generic", NULL) },
+	{ DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_TD310,
+		&it930x_props, "AVerMedia TD310 DVB-T2", NULL) },
 	{ }
 };
 MODULE_DEVICE_TABLE(usb, af9035_id_table);
diff -upr linux/drivers/media/usb/dvb-usb-v2/af9035.h linux.new/drivers/media/usb/dvb-usb-v2/af9035.h
--- linux/drivers/media/usb/dvb-usb-v2/af9035.h	2017-02-01 06:41:13.000000000 +0100
+++ linux.new/drivers/media/usb/dvb-usb-v2/af9035.h	2019-03-05 18:19:31.450331996 +0100
@@ -69,6 +69,7 @@ struct state {
 	u8 dual_mode:1;
 	u8 no_read:1;
 	u8 af9033_i2c_addr[2];
+	u8 it930x_addresses;
 	struct af9033_config af9033_config[2];
 	struct af9033_ops ops;
 	#define AF9035_I2C_CLIENT_MAX 4
@@ -77,6 +78,17 @@ struct state {
 	struct platform_device *platform_device_tuner[2];
 };
 
+struct address_table {
+	u8 frontend_i2c_addr;
+	u8 tuner_i2c_addr;
+	u8 tuner_if_port;
+};
+
+static const struct address_table it930x_addresses_table[] = {
+	{ 0x67, 0x63, 1 },
+	{ 0x64, 0x60, 0 },
+};
+
 static const u32 clock_lut_af9035[] = {
 	20480000, /*      FPGA */
 	16384000, /* 16.38 MHz */

-- 
Enviado desde mi dispositivo Android con K-9 Mail. Por favor, disculpa mi brevedad.

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

* Re: [PATCH V3 2/2] Add support for the Avermedia TD310
       [not found] ` <201903080602.9no0UbXr%fengguang.wu@intel.com>
@ 2019-03-07 22:51   ` Jose Alberto Reguero
  0 siblings, 0 replies; 3+ messages in thread
From: Jose Alberto Reguero @ 2019-03-07 22:51 UTC (permalink / raw)
  To: kbuild test robot
  Cc: kbuild-all, Linux media, Sean Young, Antti Palosaari,
	Andreas Kemnade, jose.alberto.reguero

El 7 de marzo de 2019 23:38:47 CET, kbuild test robot <lkp@intel.com> escribió:
>Hi Jose,
>
>Thank you for the patch! Yet something to improve:
>
>[auto build test ERROR on linuxtv-media/master]
>[also build test ERROR on v5.0 next-20190306]
>[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/Jose-Alberto-Reguero/init-i2c-already-in-it930x_frontend_attach/20190308-055354
>base:   git://linuxtv.org/media_tree.git master
>config: nds32-allyesconfig (attached as .config)
>compiler: nds32le-linux-gcc (GCC) 6.4.0
>reproduce:
>wget
>https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross
>-O ~/bin/make.cross
>        chmod +x ~/bin/make.cross
>        # save the attached .config to linux build tree
>        GCC_VERSION=6.4.0 make.cross ARCH=nds32 
>
>All errors (new ones prefixed by >>):
>
>drivers/media/usb/dvb-usb-v2/af9035.c: In function
>'af9035_read_config':
>>> drivers/media/usb/dvb-usb-v2/af9035.c:877:54: error:
>'USB_PID_AVERMEDIA_TD310' undeclared (first use in this function)
>(le16_to_cpu(d->udev->descriptor.idProduct) ==
>USB_PID_AVERMEDIA_TD310)) {
>                                                ^~~~~~~~~~~~~~~~~~~~~~~

I missed a part of the patch. I resend the series.

Jose Alberto

>drivers/media/usb/dvb-usb-v2/af9035.c:877:54: note: each undeclared
>identifier is reported only once for each function it appears in
>   In file included from drivers/media/usb/dvb-usb-v2/af9035.h:26:0,
>                    from drivers/media/usb/dvb-usb-v2/af9035.c:22:
>   drivers/media/usb/dvb-usb-v2/af9035.c: At top level:
>>> drivers/media/usb/dvb-usb-v2/af9035.c:2137:38: error:
>'USB_PID_AVERMEDIA_TD310' undeclared here (not in a function)
>     { DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_TD310,
>                                         ^
>drivers/media/usb/dvb-usb-v2/dvb_usb.h:105:16: note: in definition of
>macro 'DVB_USB_DEVICE'
>     .idProduct = (prod), \
>                   ^~~~
>
>vim +/USB_PID_AVERMEDIA_TD310 +877
>drivers/media/usb/dvb-usb-v2/af9035.c
>
>   833	
>   834	static int af9035_read_config(struct dvb_usb_device *d)
>   835	{
>   836		struct usb_interface *intf = d->intf;
>   837		struct state *state = d_to_priv(d);
>   838		int ret, i;
>   839		u8 tmp;
>   840		u16 tmp16;
>   841	
>   842		/* Demod I2C address */
>   843		state->af9033_i2c_addr[0] = 0x1c;
>   844		state->af9033_i2c_addr[1] = 0x1d;
>845		state->af9033_config[0].adc_multiplier = AF9033_ADC_MULTIPLIER_2X;
>846		state->af9033_config[1].adc_multiplier = AF9033_ADC_MULTIPLIER_2X;
>   847		state->af9033_config[0].ts_mode = AF9033_TS_MODE_USB;
>   848		state->af9033_config[1].ts_mode = AF9033_TS_MODE_SERIAL;
>   849		state->it930x_addresses = 0;
>   850	
>   851		if (state->chip_type == 0x9135) {
>   852			/* feed clock for integrated RF tuner */
>   853			state->af9033_config[0].dyn0_clk = true;
>   854			state->af9033_config[1].dyn0_clk = true;
>   855	
>   856			if (state->chip_version == 0x02) {
>   857				state->af9033_config[0].tuner = AF9033_TUNER_IT9135_60;
>   858				state->af9033_config[1].tuner = AF9033_TUNER_IT9135_60;
>   859			} else {
>   860				state->af9033_config[0].tuner = AF9033_TUNER_IT9135_38;
>   861				state->af9033_config[1].tuner = AF9033_TUNER_IT9135_38;
>   862			}
>   863	
>   864			if (state->no_eeprom) {
>   865				/* Remote controller to NEC polling by default */
>   866				state->ir_mode = 0x05;
>   867				state->ir_type = 0x00;
>   868	
>   869				goto skip_eeprom;
>   870			}
>   871		} else if (state->chip_type == 0x9306) {
>   872			/*
>   873			 * IT930x is an USB bridge, only single demod-single tuner
>   874			 * configurations seen so far.
>   875			 */
>876			if ((le16_to_cpu(d->udev->descriptor.idVendor) ==
>USB_VID_AVERMEDIA) &&
>> 877			    (le16_to_cpu(d->udev->descriptor.idProduct) ==
>USB_PID_AVERMEDIA_TD310)) {
>   878				state->it930x_addresses = 1;
>   879			}
>   880			return 0;
>   881		}
>   882	
>   883		/* Remote controller */
>   884		state->ir_mode = state->eeprom[EEPROM_IR_MODE];
>   885		state->ir_type = state->eeprom[EEPROM_IR_TYPE];
>   886	
>   887		if (state->dual_mode) {
>   888			/* Read 2nd demodulator I2C address. 8-bit format on eeprom */
>   889			tmp = state->eeprom[EEPROM_2ND_DEMOD_ADDR];
>   890			if (tmp)
>   891				state->af9033_i2c_addr[1] = tmp >> 1;
>   892	
>   893			dev_dbg(&intf->dev, "2nd demod I2C addr=%02x\n",
>   894				state->af9033_i2c_addr[1]);
>   895		}
>   896	
>   897		for (i = 0; i < state->dual_mode + 1; i++) {
>   898			unsigned int eeprom_offset = 0;
>   899	
>   900			/* tuner */
>   901			tmp = state->eeprom[EEPROM_1_TUNER_ID + eeprom_offset];
>   902			dev_dbg(&intf->dev, "[%d]tuner=%02x\n", i, tmp);
>   903	
>   904			/* tuner sanity check */
>   905			if (state->chip_type == 0x9135) {
>   906				if (state->chip_version == 0x02) {
>   907					/* IT9135 BX (v2) */
>   908					switch (tmp) {
>   909					case AF9033_TUNER_IT9135_60:
>   910					case AF9033_TUNER_IT9135_61:
>   911					case AF9033_TUNER_IT9135_62:
>   912						state->af9033_config[i].tuner = tmp;
>   913						break;
>   914					}
>   915				} else {
>   916					/* IT9135 AX (v1) */
>   917					switch (tmp) {
>   918					case AF9033_TUNER_IT9135_38:
>   919					case AF9033_TUNER_IT9135_51:
>   920					case AF9033_TUNER_IT9135_52:
>   921						state->af9033_config[i].tuner = tmp;
>   922						break;
>   923					}
>   924				}
>   925			} else {
>   926				/* AF9035 */
>   927				state->af9033_config[i].tuner = tmp;
>   928			}
>   929	
>   930			if (state->af9033_config[i].tuner != tmp) {
>931				dev_info(&intf->dev, "[%d] overriding tuner from %02x to
>%02x\n",
>   932					 i, tmp, state->af9033_config[i].tuner);
>   933			}
>   934	
>   935			switch (state->af9033_config[i].tuner) {
>   936			case AF9033_TUNER_TUA9001:
>   937			case AF9033_TUNER_FC0011:
>   938			case AF9033_TUNER_MXL5007T:
>   939			case AF9033_TUNER_TDA18218:
>   940			case AF9033_TUNER_FC2580:
>   941			case AF9033_TUNER_FC0012:
>   942				state->af9033_config[i].spec_inv = 1;
>   943				break;
>   944			case AF9033_TUNER_IT9135_38:
>   945			case AF9033_TUNER_IT9135_51:
>   946			case AF9033_TUNER_IT9135_52:
>   947			case AF9033_TUNER_IT9135_60:
>   948			case AF9033_TUNER_IT9135_61:
>   949			case AF9033_TUNER_IT9135_62:
>   950				break;
>   951			default:
>952				dev_warn(&intf->dev, "tuner id=%02x not supported, please
>report!",
>   953					 tmp);
>   954			}
>   955	
>   956			/* disable dual mode if driver does not support it */
>   957			if (i == 1)
>   958				switch (state->af9033_config[i].tuner) {
>   959				case AF9033_TUNER_FC0012:
>   960				case AF9033_TUNER_IT9135_38:
>   961				case AF9033_TUNER_IT9135_51:
>   962				case AF9033_TUNER_IT9135_52:
>   963				case AF9033_TUNER_IT9135_60:
>   964				case AF9033_TUNER_IT9135_61:
>   965				case AF9033_TUNER_IT9135_62:
>   966				case AF9033_TUNER_MXL5007T:
>   967					break;
>   968				default:
>   969					state->dual_mode = false;
>970					dev_info(&intf->dev, "driver does not support 2nd tuner and
>will disable it");
>   971			}
>   972	
>   973			/* tuner IF frequency */
>   974			tmp = state->eeprom[EEPROM_1_IF_L + eeprom_offset];
>   975			tmp16 = tmp << 0;
>   976			tmp = state->eeprom[EEPROM_1_IF_H + eeprom_offset];
>   977			tmp16 |= tmp << 8;
>   978			dev_dbg(&intf->dev, "[%d]IF=%d\n", i, tmp16);
>   979	
>   980			eeprom_offset += 0x10; /* shift for the 2nd tuner params */
>   981		}
>   982	
>   983	skip_eeprom:
>   984		/* get demod clock */
>   985		ret = af9035_rd_reg(d, 0x00d800, &tmp);
>   986		if (ret < 0)
>   987			goto err;
>   988	
>   989		tmp = (tmp >> 0) & 0x0f;
>   990	
>   991		for (i = 0; i < ARRAY_SIZE(state->af9033_config); i++) {
>   992			if (state->chip_type == 0x9135)
>   993				state->af9033_config[i].clock = clock_lut_it9135[tmp];
>   994			else
>   995				state->af9033_config[i].clock = clock_lut_af9035[tmp];
>   996		}
>   997	
>   998		state->no_read = false;
>999		/* Some MXL5007T devices cannot properly handle tuner I2C read
>ops. */
>  1000		if (state->af9033_config[0].tuner == AF9033_TUNER_MXL5007T &&
> 1001			le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_AVERMEDIA)
>  1002	
>  1003			switch (le16_to_cpu(d->udev->descriptor.idProduct)) {
>  1004			case USB_PID_AVERMEDIA_A867:
>  1005			case USB_PID_AVERMEDIA_TWINSTAR:
>  1006				dev_info(&intf->dev,
>1007					 "Device may have issues with I2C read operations. Enabling
>fix.\n");
>  1008				state->no_read = true;
>  1009				break;
>  1010			}
>  1011	
>  1012		return 0;
>  1013	
>  1014	err:
>  1015		dev_dbg(&intf->dev, "failed=%d\n", ret);
>  1016	
>  1017		return ret;
>  1018	}
>  1019	
>
>---
>0-DAY kernel test infrastructure                Open Source Technology
>Center
>https://lists.01.org/pipermail/kbuild-all                   Intel
>Corporation


-- 
Enviado desde mi dispositivo Android con K-9 Mail. Por favor, disculpa mi brevedad.

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

* Re: [PATCH V3 2/2] Add support for the Avermedia TD310
  2019-03-05 18:37 [PATCH V3 2/2] Add support for the Avermedia TD310 Jose Alberto Reguero
       [not found] ` <201903080602.9no0UbXr%fengguang.wu@intel.com>
@ 2019-03-07 23:04 ` kbuild test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2019-03-07 23:04 UTC (permalink / raw)
  To: Jose Alberto Reguero
  Cc: kbuild-all, Linux media, Sean Young, Antti Palosaari,
	Andreas Kemnade, jose.alberto.reguero

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

Hi Jose,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v5.0 next-20190306]
[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/Jose-Alberto-Reguero/init-i2c-already-in-it930x_frontend_attach/20190308-055354
base:   git://linuxtv.org/media_tree.git master
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 8.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=8.2.0 make.cross ARCH=xtensa 

All errors (new ones prefixed by >>):

   drivers/media/usb/dvb-usb-v2/af9035.c: In function 'af9035_read_config':
>> drivers/media/usb/dvb-usb-v2/af9035.c:877:54: error: 'USB_PID_AVERMEDIA_TD310' undeclared (first use in this function); did you mean 'USB_PID_AVERMEDIA_TD110'?
          (le16_to_cpu(d->udev->descriptor.idProduct) == USB_PID_AVERMEDIA_TD310)) {
                                                         ^~~~~~~~~~~~~~~~~~~~~~~
                                                         USB_PID_AVERMEDIA_TD110
   drivers/media/usb/dvb-usb-v2/af9035.c:877:54: note: each undeclared identifier is reported only once for each function it appears in
   In file included from drivers/media/usb/dvb-usb-v2/af9035.h:26,
                    from drivers/media/usb/dvb-usb-v2/af9035.c:22:
   drivers/media/usb/dvb-usb-v2/af9035.c: At top level:
>> drivers/media/usb/dvb-usb-v2/af9035.c:2137:38: error: 'USB_PID_AVERMEDIA_TD310' undeclared here (not in a function); did you mean 'USB_PID_AVERMEDIA_TD110'?
     { DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_TD310,
                                         ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/usb/dvb-usb-v2/dvb_usb.h:105:16: note: in definition of macro 'DVB_USB_DEVICE'
     .idProduct = (prod), \
                   ^~~~

vim +877 drivers/media/usb/dvb-usb-v2/af9035.c

   833	
   834	static int af9035_read_config(struct dvb_usb_device *d)
   835	{
   836		struct usb_interface *intf = d->intf;
   837		struct state *state = d_to_priv(d);
   838		int ret, i;
   839		u8 tmp;
   840		u16 tmp16;
   841	
   842		/* Demod I2C address */
   843		state->af9033_i2c_addr[0] = 0x1c;
   844		state->af9033_i2c_addr[1] = 0x1d;
   845		state->af9033_config[0].adc_multiplier = AF9033_ADC_MULTIPLIER_2X;
   846		state->af9033_config[1].adc_multiplier = AF9033_ADC_MULTIPLIER_2X;
   847		state->af9033_config[0].ts_mode = AF9033_TS_MODE_USB;
   848		state->af9033_config[1].ts_mode = AF9033_TS_MODE_SERIAL;
   849		state->it930x_addresses = 0;
   850	
   851		if (state->chip_type == 0x9135) {
   852			/* feed clock for integrated RF tuner */
   853			state->af9033_config[0].dyn0_clk = true;
   854			state->af9033_config[1].dyn0_clk = true;
   855	
   856			if (state->chip_version == 0x02) {
   857				state->af9033_config[0].tuner = AF9033_TUNER_IT9135_60;
   858				state->af9033_config[1].tuner = AF9033_TUNER_IT9135_60;
   859			} else {
   860				state->af9033_config[0].tuner = AF9033_TUNER_IT9135_38;
   861				state->af9033_config[1].tuner = AF9033_TUNER_IT9135_38;
   862			}
   863	
   864			if (state->no_eeprom) {
   865				/* Remote controller to NEC polling by default */
   866				state->ir_mode = 0x05;
   867				state->ir_type = 0x00;
   868	
   869				goto skip_eeprom;
   870			}
   871		} else if (state->chip_type == 0x9306) {
   872			/*
   873			 * IT930x is an USB bridge, only single demod-single tuner
   874			 * configurations seen so far.
   875			 */
   876			if ((le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_AVERMEDIA) &&
 > 877			    (le16_to_cpu(d->udev->descriptor.idProduct) == USB_PID_AVERMEDIA_TD310)) {
   878				state->it930x_addresses = 1;
   879			}
   880			return 0;
   881		}
   882	
   883		/* Remote controller */
   884		state->ir_mode = state->eeprom[EEPROM_IR_MODE];
   885		state->ir_type = state->eeprom[EEPROM_IR_TYPE];
   886	
   887		if (state->dual_mode) {
   888			/* Read 2nd demodulator I2C address. 8-bit format on eeprom */
   889			tmp = state->eeprom[EEPROM_2ND_DEMOD_ADDR];
   890			if (tmp)
   891				state->af9033_i2c_addr[1] = tmp >> 1;
   892	
   893			dev_dbg(&intf->dev, "2nd demod I2C addr=%02x\n",
   894				state->af9033_i2c_addr[1]);
   895		}
   896	
   897		for (i = 0; i < state->dual_mode + 1; i++) {
   898			unsigned int eeprom_offset = 0;
   899	
   900			/* tuner */
   901			tmp = state->eeprom[EEPROM_1_TUNER_ID + eeprom_offset];
   902			dev_dbg(&intf->dev, "[%d]tuner=%02x\n", i, tmp);
   903	
   904			/* tuner sanity check */
   905			if (state->chip_type == 0x9135) {
   906				if (state->chip_version == 0x02) {
   907					/* IT9135 BX (v2) */
   908					switch (tmp) {
   909					case AF9033_TUNER_IT9135_60:
   910					case AF9033_TUNER_IT9135_61:
   911					case AF9033_TUNER_IT9135_62:
   912						state->af9033_config[i].tuner = tmp;
   913						break;
   914					}
   915				} else {
   916					/* IT9135 AX (v1) */
   917					switch (tmp) {
   918					case AF9033_TUNER_IT9135_38:
   919					case AF9033_TUNER_IT9135_51:
   920					case AF9033_TUNER_IT9135_52:
   921						state->af9033_config[i].tuner = tmp;
   922						break;
   923					}
   924				}
   925			} else {
   926				/* AF9035 */
   927				state->af9033_config[i].tuner = tmp;
   928			}
   929	
   930			if (state->af9033_config[i].tuner != tmp) {
   931				dev_info(&intf->dev, "[%d] overriding tuner from %02x to %02x\n",
   932					 i, tmp, state->af9033_config[i].tuner);
   933			}
   934	
   935			switch (state->af9033_config[i].tuner) {
   936			case AF9033_TUNER_TUA9001:
   937			case AF9033_TUNER_FC0011:
   938			case AF9033_TUNER_MXL5007T:
   939			case AF9033_TUNER_TDA18218:
   940			case AF9033_TUNER_FC2580:
   941			case AF9033_TUNER_FC0012:
   942				state->af9033_config[i].spec_inv = 1;
   943				break;
   944			case AF9033_TUNER_IT9135_38:
   945			case AF9033_TUNER_IT9135_51:
   946			case AF9033_TUNER_IT9135_52:
   947			case AF9033_TUNER_IT9135_60:
   948			case AF9033_TUNER_IT9135_61:
   949			case AF9033_TUNER_IT9135_62:
   950				break;
   951			default:
   952				dev_warn(&intf->dev, "tuner id=%02x not supported, please report!",
   953					 tmp);
   954			}
   955	
   956			/* disable dual mode if driver does not support it */
   957			if (i == 1)
   958				switch (state->af9033_config[i].tuner) {
   959				case AF9033_TUNER_FC0012:
   960				case AF9033_TUNER_IT9135_38:
   961				case AF9033_TUNER_IT9135_51:
   962				case AF9033_TUNER_IT9135_52:
   963				case AF9033_TUNER_IT9135_60:
   964				case AF9033_TUNER_IT9135_61:
   965				case AF9033_TUNER_IT9135_62:
   966				case AF9033_TUNER_MXL5007T:
   967					break;
   968				default:
   969					state->dual_mode = false;
   970					dev_info(&intf->dev, "driver does not support 2nd tuner and will disable it");
   971			}
   972	
   973			/* tuner IF frequency */
   974			tmp = state->eeprom[EEPROM_1_IF_L + eeprom_offset];
   975			tmp16 = tmp << 0;
   976			tmp = state->eeprom[EEPROM_1_IF_H + eeprom_offset];
   977			tmp16 |= tmp << 8;
   978			dev_dbg(&intf->dev, "[%d]IF=%d\n", i, tmp16);
   979	
   980			eeprom_offset += 0x10; /* shift for the 2nd tuner params */
   981		}
   982	
   983	skip_eeprom:
   984		/* get demod clock */
   985		ret = af9035_rd_reg(d, 0x00d800, &tmp);
   986		if (ret < 0)
   987			goto err;
   988	
   989		tmp = (tmp >> 0) & 0x0f;
   990	
   991		for (i = 0; i < ARRAY_SIZE(state->af9033_config); i++) {
   992			if (state->chip_type == 0x9135)
   993				state->af9033_config[i].clock = clock_lut_it9135[tmp];
   994			else
   995				state->af9033_config[i].clock = clock_lut_af9035[tmp];
   996		}
   997	
   998		state->no_read = false;
   999		/* Some MXL5007T devices cannot properly handle tuner I2C read ops. */
  1000		if (state->af9033_config[0].tuner == AF9033_TUNER_MXL5007T &&
  1001			le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_AVERMEDIA)
  1002	
  1003			switch (le16_to_cpu(d->udev->descriptor.idProduct)) {
  1004			case USB_PID_AVERMEDIA_A867:
  1005			case USB_PID_AVERMEDIA_TWINSTAR:
  1006				dev_info(&intf->dev,
  1007					 "Device may have issues with I2C read operations. Enabling fix.\n");
  1008				state->no_read = true;
  1009				break;
  1010			}
  1011	
  1012		return 0;
  1013	
  1014	err:
  1015		dev_dbg(&intf->dev, "failed=%d\n", ret);
  1016	
  1017		return ret;
  1018	}
  1019	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 56219 bytes --]

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

end of thread, other threads:[~2019-03-07 23:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-05 18:37 [PATCH V3 2/2] Add support for the Avermedia TD310 Jose Alberto Reguero
     [not found] ` <201903080602.9no0UbXr%fengguang.wu@intel.com>
2019-03-07 22:51   ` Jose Alberto Reguero
2019-03-07 23:04 ` kbuild test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.