[media] cx231xx: Add digital support for HVR930C-HD model 1114xx
authorMatthias Schwarzott <zzam@gentoo.org>
Tue, 22 Jul 2014 20:12:16 +0000 (17:12 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Sun, 27 Jul 2014 20:03:07 +0000 (17:03 -0300)
Add support for:
[2040:b131] Hauppauge WinTV 930C-HD (model 1114xx)

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

index 036454ede5c0cbdb96d3ccb13bb36abdf2cd77e6..569aa298c03f9d744cee5a0760c2807d8b0d8ea6 100644 (file)
@@ -48,6 +48,7 @@ config VIDEO_CX231XX_DVB
        select DVB_LGDT3305 if MEDIA_SUBDRV_AUTOSELECT
        select DVB_TDA18271C2DD if MEDIA_SUBDRV_AUTOSELECT
        select DVB_SI2165 if MEDIA_SUBDRV_AUTOSELECT
+       select MEDIA_TUNER_SI2157 if MEDIA_SUBDRV_AUTOSELECT
 
        ---help---
          This adds support for DVB cards based on the
index 5dd185e629cdac225ec428a14741b9fc63348197..3953a19204427ada2471d8e0ee3c8fd71336d1ad 100644 (file)
@@ -724,6 +724,45 @@ struct cx231xx_board cx231xx_boards[] = {
                .demod_addr = 0x0e,
                .norm = V4L2_STD_PAL,
 
+               .input = {{
+                       .type = CX231XX_VMUX_TELEVISION,
+                       .vmux = CX231XX_VIN_3_1,
+                       .amux = CX231XX_AMUX_VIDEO,
+                       .gpio = NULL,
+               }, {
+                       .type = CX231XX_VMUX_COMPOSITE1,
+                       .vmux = CX231XX_VIN_2_1,
+                       .amux = CX231XX_AMUX_LINE_IN,
+                       .gpio = NULL,
+               }, {
+                       .type = CX231XX_VMUX_SVIDEO,
+                       .vmux = CX231XX_VIN_1_1 |
+                               (CX231XX_VIN_1_2 << 8) |
+                               CX25840_SVIDEO_ON,
+                       .amux = CX231XX_AMUX_LINE_IN,
+                       .gpio = NULL,
+               } },
+       },
+       [CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx] = {
+               .name = "Hauppauge WinTV 930C-HD (1114xx)",
+               .tuner_type = TUNER_ABSENT,
+               .tuner_addr = 0x60,
+               .tuner_gpio = RDE250_XCV_TUNER,
+               .tuner_sif_gpio = 0x05,
+               .tuner_scl_gpio = 0x1a,
+               .tuner_sda_gpio = 0x1b,
+               .decoder = CX231XX_AVDECODER,
+               .output_mode = OUT_MODE_VIP11,
+               .demod_xfer_mode = 0,
+               .ctl_pin_status_mask = 0xFFFFFFC4,
+               .agc_analog_digital_select_gpio = 0x0c,
+               .gpio_pin_status_mask = 0x4001000,
+               .tuner_i2c_master = 1,
+               .demod_i2c_master = 2,
+               .has_dvb = 1,
+               .demod_addr = 0x0e,
+               .norm = V4L2_STD_PAL,
+
                .input = {{
                        .type = CX231XX_VMUX_TELEVISION,
                        .vmux = CX231XX_VIN_3_1,
@@ -774,6 +813,8 @@ struct usb_device_id cx231xx_id_table[] = {
         .driver_info = CX231XX_BOARD_HAUPPAUGE_EXETER},
        {USB_DEVICE(0x2040, 0xb130),
         .driver_info = CX231XX_BOARD_HAUPPAUGE_930C_HD_1113xx},
+       {USB_DEVICE(0x2040, 0xb131),
+        .driver_info = CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx},
        {USB_DEVICE(0x2040, 0xb140),
         .driver_info = CX231XX_BOARD_HAUPPAUGE_EXETER},
        {USB_DEVICE(0x2040, 0xc200),
@@ -998,6 +1039,7 @@ void cx231xx_card_setup(struct cx231xx *dev)
 
        switch (dev->model) {
        case CX231XX_BOARD_HAUPPAUGE_930C_HD_1113xx:
+       case CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx:
                {
                        struct tveeprom tvee;
                        static u8 eeprom[256];
index 4ff6f7f7aa5c58bdef62a1cdf419a0e8416694ec..1fa79741d1991f0709cfebfb961d5f11d54fb166 100644 (file)
@@ -34,6 +34,7 @@
 #include "lgdt3305.h"
 #include "si2165.h"
 #include "mb86a20s.h"
+#include "si2157.h"
 
 MODULE_DESCRIPTION("driver for cx231xx based DVB cards");
 MODULE_AUTHOR("Srinivasa Deevi <srinivasa.deevi@conexant.com>");
@@ -159,6 +160,12 @@ static const struct si2165_config hauppauge_930C_HD_1113xx_si2165_config = {
        .ref_freq_Hz    = 16000000,
 };
 
+static const struct si2165_config pctv_quatro_stick_1114xx_si2165_config = {
+       .i2c_addr       = 0x64,
+       .chip_mode      = SI2165_MODE_PLL_EXT,
+       .ref_freq_Hz    = 24000000,
+};
+
 static inline void print_err_status(struct cx231xx *dev, int packet, int status)
 {
        char *errmsg = "Unknown";
@@ -746,6 +753,62 @@ static int dvb_init(struct cx231xx *dev)
                dev->cx231xx_reset_analog_tuner = NULL;
                break;
 
+       case CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx:
+       {
+               struct i2c_client *client;
+               struct i2c_board_info info;
+               struct si2157_config si2157_config;
+
+               memset(&info, 0, sizeof(struct i2c_board_info));
+
+               dev->dvb->frontend = dvb_attach(si2165_attach,
+                       &pctv_quatro_stick_1114xx_si2165_config,
+                       &dev->i2c_bus[dev->board.tuner_i2c_master].i2c_adap
+                       );
+
+               if (dev->dvb->frontend == NULL) {
+                       printk(DRIVER_NAME
+                              ": Failed to attach SI2165 front end\n");
+                       result = -EINVAL;
+                       goto out_free;
+               }
+
+               dev->dvb->frontend->ops.i2c_gate_ctrl = 0;
+
+               /* define general-purpose callback pointer */
+               dvb->frontend->callback = cx231xx_tuner_callback;
+
+               /* attach tuner */
+               memset(&si2157_config, 0, sizeof(si2157_config));
+               si2157_config.fe = dev->dvb->frontend;
+               si2157_config.inversion = true;
+               strlcpy(info.type, "si2157", I2C_NAME_SIZE);
+               info.addr = 0x60;
+               info.platform_data = &si2157_config;
+               request_module("si2157");
+
+               client = i2c_new_device(
+                       &dev->i2c_bus[dev->board.tuner_i2c_master].i2c_adap,
+                       &info);
+               if (client == NULL || client->dev.driver == NULL) {
+                       dvb_frontend_detach(dev->dvb->frontend);
+                       result = -ENODEV;
+                       goto out_free;
+               }
+
+               if (!try_module_get(client->dev.driver->owner)) {
+                       i2c_unregister_device(client);
+                       dvb_frontend_detach(dev->dvb->frontend);
+                       result = -ENODEV;
+                       goto out_free;
+               }
+
+               dev->cx231xx_reset_analog_tuner = NULL;
+
+               dev->dvb->i2c_client_tuner = client;
+               break;
+       }
+
        case CX231XX_BOARD_PV_PLAYTV_USB_HYBRID:
        case CX231XX_BOARD_KWORLD_UB430_USB_HYBRID:
 
index a6373ba781ab9b3bfa96a6801f98be63f96fa17f..aeb1bf42b88dff7c81116987e2e5ef6c04091599 100644 (file)
@@ -74,6 +74,7 @@
 #define CX231XX_BOARD_OTG102 17
 #define CX231XX_BOARD_KWORLD_UB445_USB_HYBRID 18
 #define CX231XX_BOARD_HAUPPAUGE_930C_HD_1113xx 19
+#define CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx 20
 
 /* Limits minimum and default number of buffers */
 #define CX231XX_MIN_BUF                 4