[media] cx23885: add DVBSky T982(Dual DVB-T2/T/C) support
authorNibble Max <nibble.max@gmail.com>
Wed, 12 Nov 2014 04:23:12 +0000 (01:23 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Fri, 14 Nov 2014 20:28:41 +0000 (18:28 -0200)
DVBSky T982 DVB-T2/T/C dual PCIe card:
1>dvb frontend: SI2158A20(tuner),SI2168A30(demod)
2>PCIe bridge: CX23885(port b: parallel mode, port c: serial mode)
3>rc: cx23885 integrated.

Signed-off-by: Nibble Max <nibble.max@gmail.com>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/pci/cx23885/cx23885-cards.c
drivers/media/pci/cx23885/cx23885-dvb.c
drivers/media/pci/cx23885/cx23885-input.c
drivers/media/pci/cx23885/cx23885.h

index 4bad27d1caa22e9fddabb408eb7cc9fcb4a6f472..db99ca2613ba422d20c60afcbe34a4750a9876c0 100644 (file)
@@ -701,6 +701,11 @@ struct cx23885_board cx23885_boards[] = {
                .portb          = CX23885_MPEG_DVB,
                .portc          = CX23885_MPEG_DVB,
        },
+       [CX23885_BOARD_DVBSKY_T982] = {
+               .name           = "DVBSky T982",
+               .portb          = CX23885_MPEG_DVB,
+               .portc          = CX23885_MPEG_DVB,
+       },
 };
 const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards);
 
@@ -980,6 +985,10 @@ struct cx23885_subid cx23885_subids[] = {
                .subvendor = 0x4254,
                .subdevice = 0x0952,
                .card      = CX23885_BOARD_DVBSKY_S952,
+       }, {
+               .subvendor = 0x4254,
+               .subdevice = 0x0982,
+               .card      = CX23885_BOARD_DVBSKY_T982,
        },
 };
 const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids);
@@ -1576,6 +1585,7 @@ void cx23885_gpio_setup(struct cx23885_dev *dev)
                break;
        case CX23885_BOARD_DVBSKY_T9580:
        case CX23885_BOARD_DVBSKY_S952:
+       case CX23885_BOARD_DVBSKY_T982:
                /* enable GPIO3-18 pins */
                cx_write(MC417_CTL, 0x00000037);
                cx23885_gpio_enable(dev, GPIO_2 | GPIO_11, 1);
@@ -1708,6 +1718,7 @@ int cx23885_ir_init(struct cx23885_dev *dev)
        case CX23885_BOARD_TT_CT2_4500_CI:
        case CX23885_BOARD_DVBSKY_S950:
        case CX23885_BOARD_DVBSKY_S952:
+       case CX23885_BOARD_DVBSKY_T982:
                if (!enable_885_ir)
                        break;
                dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_AV_CORE);
@@ -1760,6 +1771,7 @@ void cx23885_ir_fini(struct cx23885_dev *dev)
        case CX23885_BOARD_TT_CT2_4500_CI:
        case CX23885_BOARD_DVBSKY_S950:
        case CX23885_BOARD_DVBSKY_S952:
+       case CX23885_BOARD_DVBSKY_T982:
                cx23885_irq_remove(dev, PCI_MSK_AV_CORE);
                /* sd_ir is a duplicate pointer to the AV Core, just clear it */
                dev->sd_ir = NULL;
@@ -1813,6 +1825,7 @@ void cx23885_ir_pci_int_enable(struct cx23885_dev *dev)
        case CX23885_BOARD_TT_CT2_4500_CI:
        case CX23885_BOARD_DVBSKY_S950:
        case CX23885_BOARD_DVBSKY_S952:
+       case CX23885_BOARD_DVBSKY_T982:
                if (dev->sd_ir)
                        cx23885_irq_add_enable(dev, PCI_MSK_AV_CORE);
                break;
@@ -1968,6 +1981,7 @@ void cx23885_card_setup(struct cx23885_dev *dev)
                ts2->src_sel_val   = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
                break;
        case CX23885_BOARD_DVBSKY_T9580:
+       case CX23885_BOARD_DVBSKY_T982:
                ts1->gen_ctrl_val  = 0x5; /* Parallel */
                ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
                ts1->src_sel_val   = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
@@ -2051,6 +2065,7 @@ void cx23885_card_setup(struct cx23885_dev *dev)
        case CX23885_BOARD_TT_CT2_4500_CI:
        case CX23885_BOARD_DVBSKY_S950:
        case CX23885_BOARD_DVBSKY_S952:
+       case CX23885_BOARD_DVBSKY_T982:
                dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev,
                                &dev->i2c_bus[2].i2c_adap,
                                "cx25840", 0x88 >> 1, NULL);
index 2457b6483a404f9b3d77bbaa7bc923e9f1800f33..1ed92eeb46d1ffdfb51de3c476c1803cfa61ae5c 100644 (file)
@@ -1943,6 +1943,63 @@ static int dvb_register(struct cx23885_tsport *port)
                        fe0->dvb.frontend->ops.set_voltage;
                fe0->dvb.frontend->ops.set_voltage = p_set_voltage;
 
+               port->i2c_client_tuner = client_tuner;
+               break;
+       case CX23885_BOARD_DVBSKY_T982:
+               memset(&si2168_config, 0, sizeof(si2168_config));
+               switch (port->nr) {
+               /* port b */
+               case 1:
+                       i2c_bus = &dev->i2c_bus[1];
+                       si2168_config.ts_mode = SI2168_TS_PARALLEL;
+                       break;
+               /* port c */
+               case 2:
+                       i2c_bus = &dev->i2c_bus[0];
+                       si2168_config.ts_mode = SI2168_TS_SERIAL;
+                       break;
+               }
+
+               /* attach frontend */
+               si2168_config.i2c_adapter = &adapter;
+               si2168_config.fe = &fe0->dvb.frontend;
+               memset(&info, 0, sizeof(struct i2c_board_info));
+               strlcpy(info.type, "si2168", I2C_NAME_SIZE);
+               info.addr = 0x64;
+               info.platform_data = &si2168_config;
+               request_module(info.type);
+               client_demod = i2c_new_device(&i2c_bus->i2c_adap, &info);
+               if (client_demod == NULL ||
+                               client_demod->dev.driver == NULL)
+                       goto frontend_detach;
+               if (!try_module_get(client_demod->dev.driver->owner)) {
+                       i2c_unregister_device(client_demod);
+                       goto frontend_detach;
+               }
+               port->i2c_client_demod = client_demod;
+
+               /* attach tuner */
+               memset(&si2157_config, 0, sizeof(si2157_config));
+               si2157_config.fe = fe0->dvb.frontend;
+               memset(&info, 0, sizeof(struct i2c_board_info));
+               strlcpy(info.type, "si2157", I2C_NAME_SIZE);
+               info.addr = 0x60;
+               info.platform_data = &si2157_config;
+               request_module(info.type);
+               client_tuner = i2c_new_device(adapter, &info);
+               if (client_tuner == NULL ||
+                               client_tuner->dev.driver == NULL) {
+                       module_put(client_demod->dev.driver->owner);
+                       i2c_unregister_device(client_demod);
+                       goto frontend_detach;
+               }
+               if (!try_module_get(client_tuner->dev.driver->owner)) {
+                       i2c_unregister_device(client_tuner);
+                       module_put(client_demod->dev.driver->owner);
+                       i2c_unregister_device(client_demod);
+                       port->i2c_client_demod = NULL;
+                       goto frontend_detach;
+               }
                port->i2c_client_tuner = client_tuner;
                break;
        default:
@@ -2021,7 +2078,8 @@ static int dvb_register(struct cx23885_tsport *port)
                }
        case CX23885_BOARD_DVBSKY_T9580:
        case CX23885_BOARD_DVBSKY_S950:
-       case CX23885_BOARD_DVBSKY_S952: {
+       case CX23885_BOARD_DVBSKY_S952:
+       case CX23885_BOARD_DVBSKY_T982: {
                u8 eeprom[256]; /* 24C02 i2c eeprom */
 
                if (port->nr > 2)
index a1f4894443551e0e73b852912c1e28d6a700a3ff..088799c3b49bd2c019023f09d11ed50b13506aca 100644 (file)
@@ -93,6 +93,7 @@ void cx23885_input_rx_work_handler(struct cx23885_dev *dev, u32 events)
        case CX23885_BOARD_TT_CT2_4500_CI:
        case CX23885_BOARD_DVBSKY_S950:
        case CX23885_BOARD_DVBSKY_S952:
+       case CX23885_BOARD_DVBSKY_T982:
                /*
                 * The only boards we handle right now.  However other boards
                 * using the CX2388x integrated IR controller should be similar
@@ -151,6 +152,7 @@ static int cx23885_input_ir_start(struct cx23885_dev *dev)
        case CX23885_BOARD_TT_CT2_4500_CI:
        case CX23885_BOARD_DVBSKY_S950:
        case CX23885_BOARD_DVBSKY_S952:
+       case CX23885_BOARD_DVBSKY_T982:
                /*
                 * The IR controller on this board only returns pulse widths.
                 * Any other mode setting will fail to set up the device.
@@ -322,6 +324,7 @@ int cx23885_input_init(struct cx23885_dev *dev)
        case CX23885_BOARD_DVBSKY_S950C:
        case CX23885_BOARD_DVBSKY_S950:
        case CX23885_BOARD_DVBSKY_S952:
+       case CX23885_BOARD_DVBSKY_T982:
                /* Integrated CX23885 IR controller */
                driver_type = RC_DRIVER_IR_RAW;
                allowed_protos = RC_BIT_ALL;
index 58c5038c816b829d9ff1166e47e0cd2ef82960fe..cf4efa461ce206f6e94d1c35121b1de020829210 100644 (file)
@@ -98,6 +98,7 @@
 #define CX23885_BOARD_TT_CT2_4500_CI           48
 #define CX23885_BOARD_DVBSKY_S950              49
 #define CX23885_BOARD_DVBSKY_S952              50
+#define CX23885_BOARD_DVBSKY_T982              51
 
 #define GPIO_0 0x00000001
 #define GPIO_1 0x00000002