[media] Add support for PCTV nanoStick T2 290e [2013:024f]
authorAntti Palosaari <crope@iki.fi>
Thu, 7 Apr 2011 19:34:44 +0000 (16:34 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 20 May 2011 12:30:11 +0000 (09:30 -0300)
Supports DVB-T/T2/C, USB ID: 2013:024f.
Empia EM28174, Sony CXD2820R and NXP TDA18271HD/C2.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/em28xx/Kconfig
drivers/media/video/em28xx/em28xx-cards.c
drivers/media/video/em28xx/em28xx-dvb.c
drivers/media/video/em28xx/em28xx.h

index 04760b2a032c98bb5aefb565e9c7cea3a3fd41e7..3cb78f26df9033bb9068053f3ab80308d1a6ad04 100644 (file)
@@ -39,6 +39,7 @@ config VIDEO_EM28XX_DVB
        select DVB_TDA10023 if !DVB_FE_CUSTOMISE
        select DVB_S921 if !DVB_FE_CUSTOMISE
        select DVB_DRXD if !DVB_FE_CUSTOMISE
+       select DVB_CXD2820R if !DVB_FE_CUSTOMISE
        select VIDEOBUF_DVB
        ---help---
          This adds support for DVB cards based on the
index 9a5ac562ee33b5d3139809014b784dfd0f4818b1..4e37375decf54dbdea4e3c9617fcf52b9201912f 100644 (file)
@@ -289,6 +289,16 @@ static struct em28xx_reg_seq leadership_reset[] = {
        {       -1,             -1,     -1,     -1},
 };
 
+/* 2013:024f PCTV Systems nanoStick T2 290e
+ * GPIO_6 - demod reset
+ * GPIO_7 - LED
+ */
+static struct em28xx_reg_seq pctv_290e[] = {
+       {EM2874_R80_GPIO,       0x00,   0xff,           80},
+       {EM2874_R80_GPIO,       0x40,   0xff,           80}, /* GPIO_6 = 1 */
+       {EM2874_R80_GPIO,       0xc0,   0xff,           80}, /* GPIO_7 = 1 */
+       {-1,                    -1,     -1,             -1},
+};
 
 /*
  *  Board definitions
@@ -1760,6 +1770,17 @@ struct em28xx_board em28xx_boards[] = {
                .dvb_gpio   = kworld_a340_digital,
                .tuner_gpio = default_tuner_gpio,
        },
+       /* 2013:024f PCTV Systems nanoStick T2 290e.
+        * Empia EM28174, Sony CXD2820R and NXP TDA18271HD/C2 */
+       [EM28174_BOARD_PCTV_290E] = {
+               .i2c_speed      = EM2874_I2C_SECONDARY_BUS_SELECT |
+                       EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_FREQ_100_KHZ,
+               .xclk          = EM28XX_XCLK_FREQUENCY_12MHZ,
+               .name          = "PCTV Systems nanoStick T2 290e",
+               .tuner_type    = TUNER_ABSENT,
+               .tuner_gpio    = pctv_290e,
+               .has_dvb       = 1,
+       },
 };
 const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards);
 
@@ -1887,6 +1908,8 @@ struct usb_device_id em28xx_id_table[] = {
                        .driver_info = EM2860_BOARD_GADMEI_UTV330 },
        { USB_DEVICE(0x1b80, 0xa340),
                        .driver_info = EM2870_BOARD_KWORLD_A340 },
+       { USB_DEVICE(0x2013, 0x024f),
+                       .driver_info = EM28174_BOARD_PCTV_290E },
        { },
 };
 MODULE_DEVICE_TABLE(usb, em28xx_id_table);
index 0766bc6be14b22f33b90e07ed0a9f1a3c1f1eb67..7904ca4b69134d1fdb4af0d3d0a89b0acbeffdee 100644 (file)
@@ -39,6 +39,7 @@
 #include "tda18271.h"
 #include "s921.h"
 #include "drxd.h"
+#include "cxd2820r.h"
 
 MODULE_DESCRIPTION("driver for em28xx based DVB cards");
 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@infradead.org>");
@@ -334,6 +335,26 @@ static struct tda10023_config em28xx_tda10023_config = {
        .invert = 1,
 };
 
+static struct cxd2820r_config em28xx_cxd2820r_config = {
+       .i2c_address = (0xd8 >> 1),
+       .ts_mode = CXD2820R_TS_SERIAL,
+       .if_dvbt_6  = 3300,
+       .if_dvbt_7  = 3500,
+       .if_dvbt_8  = 4000,
+       .if_dvbt2_6 = 3300,
+       .if_dvbt2_7 = 3500,
+       .if_dvbt2_8 = 4000,
+       .if_dvbc    = 5000,
+
+       /* enable LNA for DVB-T2 and DVB-C */
+       .gpio_dvbt2[0] = CXD2820R_GPIO_E | CXD2820R_GPIO_O | CXD2820R_GPIO_L,
+       .gpio_dvbc[0] = CXD2820R_GPIO_E | CXD2820R_GPIO_O | CXD2820R_GPIO_L,
+};
+
+static struct tda18271_config em28xx_cxd2820r_tda18271_config = {
+       .output_opt = TDA18271_OUTPUT_LT_OFF,
+};
+
 /* ------------------------------------------------------------------ */
 
 static int attach_xc3028(u8 addr, struct em28xx *dev)
@@ -640,6 +661,34 @@ static int dvb_init(struct em28xx *dev)
                        dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
                                   &dev->i2c_adap, &kworld_a340_config);
                break;
+       case EM28174_BOARD_PCTV_290E:
+               /* MFE
+                * FE 0 = DVB-T/T2 + FE 1 = DVB-C, both sharing same tuner. */
+               /* FE 0 */
+               dvb->fe[0] = dvb_attach(cxd2820r_attach,
+                       &em28xx_cxd2820r_config, &dev->i2c_adap, NULL);
+               if (dvb->fe[0]) {
+                       struct i2c_adapter *i2c_tuner;
+                       i2c_tuner = cxd2820r_get_tuner_i2c_adapter(dvb->fe[0]);
+                       /* FE 0 attach tuner */
+                       if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
+                               i2c_tuner, &em28xx_cxd2820r_tda18271_config)) {
+                               dvb_frontend_detach(dvb->fe[0]);
+                               result = -EINVAL;
+                               goto out_free;
+                       }
+                       /* FE 1. This dvb_attach() cannot fail. */
+                       dvb->fe[1] = dvb_attach(cxd2820r_attach, NULL, NULL,
+                               dvb->fe[0]);
+                       dvb->fe[1]->id = 1;
+                       /* FE 1 attach tuner */
+                       if (!dvb_attach(tda18271_attach, dvb->fe[1], 0x60,
+                               i2c_tuner, &em28xx_cxd2820r_tda18271_config)) {
+                               dvb_frontend_detach(dvb->fe[1]);
+                               /* leave FE 0 still active */
+                       }
+               }
+               break;
        default:
                em28xx_errdev("/2: The frontend of your DVB/ATSC card"
                                " isn't supported yet\n");
index a2222fc6c016ecce27521d3945611811f801688b..3cca3312245086aed60a7ab0a2e65a525b8a2e56 100644 (file)
 #define EM2882_BOARD_DIKOM_DK300                 75
 #define EM2870_BOARD_KWORLD_A340                 76
 #define EM2874_LEADERSHIP_ISDBT                          77
+#define EM28174_BOARD_PCTV_290E                   78
 
 
 /* Limits minimum and default number of buffers */