Commit c51f3b7f authored by Jose Alberto Reguero's avatar Jose Alberto Reguero Committed by Mauro Carvalho Chehab
Browse files

media: dvb: Add support for the Avermedia TD310



This patch add support for Avermedia TD310 usb stick.

Signed-off-by: default avatarJose Alberto Reguero <jose.alberto.reguero@gmail.com>
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 1cb11bfa
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -846,6 +846,7 @@ static int af9035_read_config(struct dvb_usb_device *d)
	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_usb_device *d)
		 * 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 dvb_usb_adapter *adap)

	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 dvb_usb_adapter *adap)

	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.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_id_table[] = {
	/* 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);
+12 −0
Original line number Diff line number Diff line
@@ -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 */
+1 −0
Original line number Diff line number Diff line
@@ -258,6 +258,7 @@
#define USB_PID_AVERMEDIA_A867				0xa867
#define USB_PID_AVERMEDIA_H335				0x0335
#define USB_PID_AVERMEDIA_TD110				0xa110
#define USB_PID_AVERMEDIA_TD310				0x1871
#define USB_PID_AVERMEDIA_TWINSTAR			0x0825
#define USB_PID_TECHNOTREND_CONNECT_S2400               0x3006
#define USB_PID_TECHNOTREND_CONNECT_S2400_8KEEPROM	0x3009