]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
media: dvb: Add support for the Avermedia TD310
authorJose Alberto Reguero <jose.alberto.reguero@gmail.com>
Thu, 7 Mar 2019 23:12:18 +0000 (18:12 -0500)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Tue, 19 Mar 2019 20:52:51 +0000 (16:52 -0400)
This patch add support for Avermedia TD310 usb stick.

Signed-off-by: Jose Alberto Reguero <jose.alberto.reguero@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/usb/dvb-usb-v2/af9035.c
drivers/media/usb/dvb-usb-v2/af9035.h
include/media/dvb-usb-ids.h

index e8ec53249db077602f7cea2a99a6549fb939e343..1b7f1af399fb7a822221e53b50308e00709e6c45 100644 (file)
@@ -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, 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_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);
index a76e6bf0ab1ee13801241dd3b912994e4e05dab8..bc41c16f9727d31744222192f87fea02407dd643 100644 (file)
@@ -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 */
index f9e73b4a6e893349896fb3729ff1dedbcdf5fd21..52875e3eee7196ff66fd1fb76195934c55f23969 100644 (file)
 #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