[media] cx23885: Add si2165 support for HVR-5500
authorMatthias Schwarzott <zzam@gentoo.org>
Tue, 22 Jul 2014 20:12:13 +0000 (17:12 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Sun, 27 Jul 2014 20:01:59 +0000 (17:01 -0300)
The same card entry is used for HVR-4400 and HVR-5500.
Only HVR-5500 has been tested.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/pci/cx23885/Kconfig
drivers/media/pci/cx23885/cx23885-cards.c
drivers/media/pci/cx23885/cx23885-dvb.c

index 5158133c653554da4921be58b3232149584b49e5..e12c006e6e2dc3be8470e454f64c5a055258791c 100644 (file)
@@ -31,6 +31,7 @@ config VIDEO_CX23885
        select DVB_TDA10071 if MEDIA_SUBDRV_AUTOSELECT
        select DVB_A8293 if MEDIA_SUBDRV_AUTOSELECT
        select DVB_MB86A20S if MEDIA_SUBDRV_AUTOSELECT
+       select DVB_SI2165 if MEDIA_SUBDRV_AUTOSELECT
        select MEDIA_TUNER_MT2063 if MEDIA_SUBDRV_AUTOSELECT
        select MEDIA_TUNER_MT2131 if MEDIA_SUBDRV_AUTOSELECT
        select MEDIA_TUNER_XC2028 if MEDIA_SUBDRV_AUTOSELECT
index 1d1550a8116ab728fe270287ce8a8fa74bb2179c..c2b6080071908722706cd335917e6c99b4064dee 100644 (file)
@@ -619,7 +619,12 @@ struct cx23885_board cx23885_boards[] = {
        },
        [CX23885_BOARD_HAUPPAUGE_HVR4400] = {
                .name           = "Hauppauge WinTV-HVR4400",
+               .porta          = CX23885_ANALOG_VIDEO,
                .portb          = CX23885_MPEG_DVB,
+               .portc          = CX23885_MPEG_DVB,
+               .tuner_type     = TUNER_NXP_TDA18271,
+               .tuner_addr     = 0x60, /* 0xc0 >> 1 */
+               .tuner_bus      = 1,
        },
        [CX23885_BOARD_AVERMEDIA_HC81R] = {
                .name           = "AVerTV Hybrid Express Slim HC81R",
@@ -1486,13 +1491,16 @@ void cx23885_gpio_setup(struct cx23885_dev *dev)
                break;
        case CX23885_BOARD_HAUPPAUGE_HVR4400:
                /* GPIO-8 tda10071 demod reset */
+               /* GPIO-9 si2165 demod reset */
 
                /* Put the parts into reset and back */
-               cx23885_gpio_enable(dev, GPIO_8, 1);
-               cx23885_gpio_clear(dev, GPIO_8);
+               cx23885_gpio_enable(dev, GPIO_8 | GPIO_9, 1);
+
+               cx23885_gpio_clear(dev, GPIO_8 | GPIO_9);
                mdelay(100);
-               cx23885_gpio_set(dev, GPIO_8);
+               cx23885_gpio_set(dev, GPIO_8 | GPIO_9);
                mdelay(100);
+
                break;
        case CX23885_BOARD_AVERMEDIA_HC81R:
                cx_clear(MC417_CTL, 1);
@@ -1839,6 +1847,9 @@ void cx23885_card_setup(struct cx23885_dev *dev)
                ts1->gen_ctrl_val  = 0xc; /* Serial bus + punctured clock */
                ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
                ts1->src_sel_val   = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
+               ts2->gen_ctrl_val  = 0xc; /* Serial bus + punctured clock */
+               ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
+               ts2->src_sel_val   = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
                break;
        case CX23885_BOARD_HAUPPAUGE_HVR1250:
        case CX23885_BOARD_HAUPPAUGE_HVR1500:
index 6968706b83b889eefaef9eaf2207ee3086de5781..968fecc32f9cad35413945e0af9f7ce9edbde5bb 100644 (file)
@@ -72,6 +72,7 @@
 #include "tda10071.h"
 #include "a8293.h"
 #include "mb86a20s.h"
+#include "si2165.h"
 
 static unsigned int debug;
 
@@ -303,6 +304,11 @@ static struct tda18271_config hauppauge_hvr1210_tuner_config = {
        .output_opt = TDA18271_OUTPUT_LT_OFF,
 };
 
+static struct tda18271_config hauppauge_hvr4400_tuner_config = {
+       .gate    = TDA18271_GATE_DIGITAL,
+       .output_opt = TDA18271_OUTPUT_LT_OFF,
+};
+
 static struct tda18271_std_map hauppauge_hvr127x_std_map = {
        .atsc_6   = { .if_freq = 3250, .agc_mode = 3, .std = 4,
                      .if_lvl = 1, .rfagc_top = 0x58 },
@@ -703,6 +709,12 @@ static const struct a8293_config hauppauge_a8293_config = {
        .i2c_addr = 0x0b,
 };
 
+static const struct si2165_config hauppauge_hvr4400_si2165_config = {
+       .i2c_addr       = 0x64,
+       .chip_mode      = SI2165_MODE_PLL_XTAL,
+       .ref_freq_Hz    = 16000000,
+};
+
 static int netup_altera_fpga_rw(void *device, int flag, int data, int read)
 {
        struct cx23885_dev *dev = (struct cx23885_dev *)device;
@@ -1459,13 +1471,34 @@ static int dvb_register(struct cx23885_tsport *port)
                break;
        case CX23885_BOARD_HAUPPAUGE_HVR4400:
                i2c_bus = &dev->i2c_bus[0];
-               fe0->dvb.frontend = dvb_attach(tda10071_attach,
+               i2c_bus2 = &dev->i2c_bus[1];
+               switch (port->nr) {
+               /* port b */
+               case 1:
+                       fe0->dvb.frontend = dvb_attach(tda10071_attach,
                                                &hauppauge_tda10071_config,
                                                &i2c_bus->i2c_adap);
-               if (fe0->dvb.frontend != NULL) {
-                       dvb_attach(a8293_attach, fe0->dvb.frontend,
-                                  &i2c_bus->i2c_adap,
-                                  &hauppauge_a8293_config);
+                       if (fe0->dvb.frontend != NULL) {
+                               if (!dvb_attach(a8293_attach, fe0->dvb.frontend,
+                                               &i2c_bus->i2c_adap,
+                                               &hauppauge_a8293_config))
+                                       goto frontend_detach;
+                       }
+                       break;
+               /* port c */
+               case 2:
+                       fe0->dvb.frontend = dvb_attach(si2165_attach,
+                                       &hauppauge_hvr4400_si2165_config,
+                                       &i2c_bus->i2c_adap);
+                       if (fe0->dvb.frontend != NULL) {
+                               fe0->dvb.frontend->ops.i2c_gate_ctrl = 0;
+                               if (!dvb_attach(tda18271_attach,
+                                               fe0->dvb.frontend,
+                                               0x60, &i2c_bus2->i2c_adap,
+                                         &hauppauge_hvr4400_tuner_config))
+                                       goto frontend_detach;
+                       }
+                       break;
                }
                break;
        default: