[media] af9035: add support for the tda18218 tuner
authorGianluca Gennari <gennarone@gmail.com>
Mon, 2 Apr 2012 20:25:14 +0000 (17:25 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 9 Apr 2012 17:52:34 +0000 (14:52 -0300)
Add basic support for the tda18218 tuner and the AVerMedia A835 devices.

Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/dvb-usb/Kconfig
drivers/media/dvb/dvb-usb/af9035.c
drivers/media/dvb/dvb-usb/dvb-usb-ids.h
drivers/media/dvb/frontends/af9033.c
drivers/media/dvb/frontends/af9033.h
drivers/media/dvb/frontends/af9033_priv.h

index f53fb3c8530e14c9393e013e21cafb881c2094fb..be1db75091ff649feb22eafe4cc0db609f518f6c 100644 (file)
@@ -430,6 +430,7 @@ config DVB_USB_AF9035
        select MEDIA_TUNER_TUA9001 if !MEDIA_TUNER_CUSTOMISE
        select MEDIA_TUNER_FC0011 if !MEDIA_TUNER_CUSTOMISE
        select MEDIA_TUNER_MXL5007T if !MEDIA_TUNER_CUSTOMISE
+       select MEDIA_TUNER_TDA18218 if !MEDIA_TUNER_CUSTOMISE
        help
          Say Y here to support the Afatech AF9035 based DVB USB receiver.
 
index 9ac3b4174d22c8d8bb6f5f2c2f2a158d6b606d60..970bdb6bb60a55cf1f82cfb01e7e9c70b19796d9 100644 (file)
@@ -24,6 +24,7 @@
 #include "tua9001.h"
 #include "fc0011.h"
 #include "mxl5007t.h"
+#include "tda18218.h"
 
 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
 static DEFINE_MUTEX(af9035_usb_mutex);
@@ -502,6 +503,7 @@ static int af9035_read_mac_address(struct dvb_usb_device *d, u8 mac[6])
                case AF9033_TUNER_TUA9001:
                case AF9033_TUNER_FC0011:
                case AF9033_TUNER_MXL5007T:
+               case AF9033_TUNER_TDA18218:
                        af9035_af9033_config[i].spec_inv = 1;
                        break;
                default:
@@ -678,6 +680,11 @@ static struct mxl5007t_config af9035_mxl5007t_config = {
        .clk_out_amp = MxL_CLKOUT_AMP_0_94V,
 };
 
+static struct tda18218_config af9035_tda18218_config = {
+       .i2c_address = 0x60,
+       .i2c_wr_max = 21,
+};
+
 static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
 {
        int ret;
@@ -772,6 +779,11 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
                fe = dvb_attach(mxl5007t_attach, adap->fe_adap[0].fe,
                                &adap->dev->i2c_adap, 0x60, &af9035_mxl5007t_config);
                break;
+       case AF9033_TUNER_TDA18218:
+               /* attach tuner */
+               fe = dvb_attach(tda18218_attach, adap->fe_adap[0].fe,
+                               &adap->dev->i2c_adap, &af9035_tda18218_config);
+               break;
        default:
                fe = NULL;
        }
@@ -793,6 +805,8 @@ enum af9035_id_entry {
        AF9035_0CCD_0093,
        AF9035_15A4_9035,
        AF9035_15A4_1001,
+       AF9035_07CA_A835,
+       AF9035_07CA_B835,
        AF9035_07CA_1867,
        AF9035_07CA_A867,
 };
@@ -804,6 +818,10 @@ static struct usb_device_id af9035_id[] = {
                USB_DEVICE(USB_VID_AFATECH, USB_PID_AFATECH_AF9035)},
        [AF9035_15A4_1001] = {
                USB_DEVICE(USB_VID_AFATECH, USB_PID_AFATECH_AF9035_2)},
+       [AF9035_07CA_A835] = {
+               USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A835)},
+       [AF9035_07CA_B835] = {
+               USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_B835)},
        [AF9035_07CA_1867] = {
                USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_1867)},
        [AF9035_07CA_A867] = {
@@ -850,7 +868,7 @@ static struct dvb_usb_device_properties af9035_properties[] = {
 
                .i2c_algo = &af9035_i2c_algo,
 
-               .num_device_descs = 3,
+               .num_device_descs = 4,
                .devices = {
                        {
                                .name = "TerraTec Cinergy T Stick",
@@ -863,6 +881,12 @@ static struct dvb_usb_device_properties af9035_properties[] = {
                                        &af9035_id[AF9035_15A4_9035],
                                        &af9035_id[AF9035_15A4_1001],
                                },
+                       }, {
+                               .name = "AVerMedia AVerTV Volar HD/PRO (A835)",
+                               .cold_ids = {
+                                       &af9035_id[AF9035_07CA_A835],
+                                       &af9035_id[AF9035_07CA_B835],
+                               },
                        }, {
                                .name = "AVerMedia HD Volar (A867)",
                                .cold_ids = {
index 3cf002b423f7b94c630125c5261b04f2b4fcbde6..6a761c546a984cec09cd3a45d55a58e74cd730dd 100644 (file)
 #define USB_PID_AVERMEDIA_A850T                                0x850b
 #define USB_PID_AVERMEDIA_A805                         0xa805
 #define USB_PID_AVERMEDIA_A815M                                0x815a
+#define USB_PID_AVERMEDIA_A835                         0xa835
+#define USB_PID_AVERMEDIA_B835                         0xb835
 #define USB_PID_AVERMEDIA_1867                         0x1867
 #define USB_PID_AVERMEDIA_A867                         0xa867
 #define USB_PID_TECHNOTREND_CONNECT_S2400               0x3006
index 8c0f4a3ef0f0f9f4b5cf63cd1727d4f3b80396ba..5fadee79b325680b7d78692c1ee34d833beed3d6 100644 (file)
@@ -305,6 +305,10 @@ static int af9033_init(struct dvb_frontend *fe)
                len = ARRAY_SIZE(tuner_init_mxl5007t);
                init = tuner_init_mxl5007t;
                break;
+       case AF9033_TUNER_TDA18218:
+               len = ARRAY_SIZE(tuner_init_tda18218);
+               init = tuner_init_tda18218;
+               break;
        default:
                pr_debug("%s: unsupported tuner ID=%d\n", __func__,
                                state->cfg.tuner);
index dcf7e290b6fef10ec68764a43c1c7983873fbdd5..9e302c3f0f7d1e91a780117c40c557603b1a20ca 100644 (file)
@@ -41,6 +41,7 @@ struct af9033_config {
 #define AF9033_TUNER_TUA9001     0x27 /* Infineon TUA 9001 */
 #define AF9033_TUNER_FC0011      0x28 /* Fitipower FC0011 */
 #define AF9033_TUNER_MXL5007T    0xa0 /* MaxLinear MxL5007T */
+#define AF9033_TUNER_TDA18218    0xa1 /* NXP TDA 18218HN */
        u8 tuner;
 
        /*
index e6041bc7c2fc1420fa1855e5f8608d0dad9bf502..0b783b9ed75ebc44b0ec5c5ae2aaa0ba102eb03f 100644 (file)
@@ -432,5 +432,39 @@ static const struct reg_val tuner_init_mxl5007t[] = {
        { 0x80f1e6, 0x00 },
 };
 
+/* NXP TDA 18218HN tuner init
+   AF9033_TUNER_TDA18218    = 0xa1 */
+static const struct reg_val tuner_init_tda18218[] = {
+       {0x800046, 0xa1},
+       {0x800057, 0x01},
+       {0x800058, 0x01},
+       {0x80005f, 0x00},
+       {0x800060, 0x00},
+       {0x800071, 0x05},
+       {0x800072, 0x02},
+       {0x800074, 0x01},
+       {0x800079, 0x01},
+       {0x800093, 0x00},
+       {0x800094, 0x00},
+       {0x800095, 0x00},
+       {0x800096, 0x00},
+       {0x8000b3, 0x01},
+       {0x8000c3, 0x01},
+       {0x8000c4, 0x00},
+       {0x80f007, 0x00},
+       {0x80f00c, 0x19},
+       {0x80f00d, 0x1a},
+       {0x80f012, 0xda},
+       {0x80f013, 0x00},
+       {0x80f014, 0x00},
+       {0x80f015, 0x02},
+       {0x80f01f, 0x82},
+       {0x80f020, 0x00},
+       {0x80f029, 0x82},
+       {0x80f02a, 0x00},
+       {0x80f077, 0x02},
+       {0x80f1e6, 0x00},
+};
+
 #endif /* AF9033_PRIV_H */