[media] cx231xx: add support for Hauppauge EXETER
authorMichael Krufky <mkrufky@kernellabs.com>
Tue, 6 Jul 2010 21:23:53 +0000 (18:23 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 21 Oct 2010 03:17:11 +0000 (01:17 -0200)
Add support for various Hauppauge EXETER designs.

Note by DJH: fixed a few minor 'make checkpatch' warnings before commit.

Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/cx231xx/cx231xx-avcore.c
drivers/media/video/cx231xx/cx231xx-cards.c
drivers/media/video/cx231xx/cx231xx-core.c
drivers/media/video/cx231xx/cx231xx-dvb.c
drivers/media/video/cx231xx/cx231xx.h

index 3e467ce1b06f65265cea74ad2d7506f71b53ac57..64e07d335e77b755c99d53cf642ca940af4a1154 100644 (file)
@@ -352,6 +352,7 @@ int cx231xx_afe_update_power_control(struct cx231xx *dev,
        case CX231XX_BOARD_CNXT_RDE_253S:
        case CX231XX_BOARD_CNXT_RDU_253S:
        case CX231XX_BOARD_CNXT_VIDEO_GRABBER:
+       case CX231XX_BOARD_HAUPPAUGE_EXETER:
                if (avmode == POLARIS_AVMODE_ANALOGT_TV) {
                        while (afe_power_status != (FLD_PWRDN_TUNING_BIAS |
                                                FLD_PWRDN_ENABLE_PLL)) {
@@ -1187,6 +1188,7 @@ int cx231xx_set_audio_decoder_input(struct cx231xx *dev,
                        break;
                case CX231XX_BOARD_CNXT_RDE_253S:
                case CX231XX_BOARD_CNXT_RDU_253S:
+               case CX231XX_BOARD_HAUPPAUGE_EXETER:
                        status = cx231xx_read_modify_write_i2c_dword(dev,
                                        VID_BLK_I2C_ADDRESS,
                                        CHIP_CTRL,
@@ -1750,6 +1752,7 @@ int cx231xx_dif_set_standard(struct cx231xx *dev, u32 standard)
        case CX231XX_BOARD_CNXT_SHELBY:
        case CX231XX_BOARD_CNXT_RDU_250:
        case CX231XX_BOARD_CNXT_VIDEO_GRABBER:
+       case CX231XX_BOARD_HAUPPAUGE_EXETER:
                func_mode = 0x03;
                break;
        case CX231XX_BOARD_CNXT_RDE_253S:
@@ -2359,6 +2362,12 @@ int cx231xx_set_power_mode(struct cx231xx *dev, enum AV_MODE mode)
                    (dev->model == CX231XX_BOARD_CNXT_RDU_253S)) {
                        /* tuner path to channel 1 from port 3 */
                        cx231xx_enable_i2c_for_tuner(dev, I2C_3);
+                       if (dev->cx231xx_reset_analog_tuner)
+                               dev->cx231xx_reset_analog_tuner(dev);
+               } else if (dev->model == CX231XX_BOARD_HAUPPAUGE_EXETER) {
+                       /* tuner path to channel 1 from port 1 ?? */
+                       cx231xx_enable_i2c_for_tuner(dev, I2C_1);
+
                        if (dev->cx231xx_reset_analog_tuner)
                                dev->cx231xx_reset_analog_tuner(dev);
                }
@@ -2434,6 +2443,12 @@ int cx231xx_set_power_mode(struct cx231xx *dev, enum AV_MODE mode)
                    (dev->model == CX231XX_BOARD_CNXT_RDU_253S)) {
                        /* tuner path to channel 1 from port 3 */
                        cx231xx_enable_i2c_for_tuner(dev, I2C_3);
+                       if (dev->cx231xx_reset_analog_tuner)
+                               dev->cx231xx_reset_analog_tuner(dev);
+               } else if (dev->model == CX231XX_BOARD_HAUPPAUGE_EXETER) {
+                       /* tuner path to channel 1 from port 1 ?? */
+                       cx231xx_enable_i2c_for_tuner(dev, I2C_1);
+
                        if (dev->cx231xx_reset_analog_tuner)
                                dev->cx231xx_reset_analog_tuner(dev);
                }
index 59e273324f5a12b1bf252982283a9f93e7cb6286..a19248495c2aa6f12d639de81e17cb0466bf8412 100644 (file)
@@ -340,6 +340,44 @@ struct cx231xx_board cx231xx_boards[] = {
                        }
                },
        },
+       [CX231XX_BOARD_HAUPPAUGE_EXETER] = {
+               .name = "Hauppauge EXETER",
+               .tuner_type = TUNER_NXP_TDA18271,
+               .tuner_addr = 0x60,
+               .tuner_gpio = RDE250_XCV_TUNER,
+               .tuner_sif_gpio = 0x05,
+               .tuner_scl_gpio = 0x1a,
+               .tuner_sda_gpio = 0x1b,
+               .decoder = CX231XX_AVDECODER,
+               .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_NTSC,
+
+               .input = {{
+                       .type = CX231XX_VMUX_TELEVISION,
+                       .vmux = CX231XX_VIN_3_1,
+                       .amux = CX231XX_AMUX_VIDEO,
+                       .gpio = 0,
+               }, {
+                       .type = CX231XX_VMUX_COMPOSITE1,
+                       .vmux = CX231XX_VIN_2_1,
+                       .amux = CX231XX_AMUX_LINE_IN,
+                       .gpio = 0,
+               }, {
+                       .type = CX231XX_VMUX_SVIDEO,
+                       .vmux = CX231XX_VIN_1_1 |
+                               (CX231XX_VIN_1_2 << 8) |
+                               CX25840_SVIDEO_ON,
+                       .amux = CX231XX_AMUX_LINE_IN,
+                       .gpio = 0,
+               } },
+       },
 
 
 
@@ -352,6 +390,8 @@ const unsigned int cx231xx_bcount = ARRAY_SIZE(cx231xx_boards);
 struct usb_device_id cx231xx_id_table[] = {
        {USB_DEVICE(0x0572, 0x5A3C),
         .driver_info = CX231XX_BOARD_UNKNOWN},
+       {USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x4000,0x4fff),
+        .driver_info = CX231XX_BOARD_UNKNOWN},
        {USB_DEVICE(0x0572, 0x58A2),
         .driver_info = CX231XX_BOARD_CNXT_CARRAERA},
        {USB_DEVICE(0x0572, 0x58A1),
@@ -366,8 +406,8 @@ struct usb_device_id cx231xx_id_table[] = {
         .driver_info = CX231XX_BOARD_CNXT_RDE_250},
        {USB_DEVICE(0x0572, 0x58A0),
         .driver_info = CX231XX_BOARD_CNXT_RDU_250},
-       {USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x4000,0x4fff),
-        .driver_info = CX231XX_BOARD_UNKNOWN},
+       {USB_DEVICE(0x2040, 0xb120),
+        .driver_info = CX231XX_BOARD_HAUPPAUGE_EXETER},
        {},
 };
 
@@ -515,6 +555,8 @@ void cx231xx_register_i2c_ir(struct cx231xx *dev)
                break;
        case CX231XX_BOARD_CNXT_VIDEO_GRABBER:
                break;
+       case CX231XX_BOARD_HAUPPAUGE_EXETER:
+               break;
        default:
                break;
        }
@@ -559,6 +601,7 @@ void cx231xx_card_setup(struct cx231xx *dev)
        case CX231XX_BOARD_CNXT_RDE_253S:
        case CX231XX_BOARD_CNXT_RDU_253S:
        case CX231XX_BOARD_CNXT_VIDEO_GRABBER:
+       case CX231XX_BOARD_HAUPPAUGE_EXETER:
                if (dev->board.tuner_type != TUNER_ABSENT) {
                        dev->sd_tuner = v4l2_i2c_new_subdev(&dev->v4l2_dev,
                                        &dev->i2c_bus[1].i2c_adap,
index e258a6261ea43ea9c972cb2a4dcb129246582076..b75e9e7dd502ad15945ebed397d180caa7c976e2 100644 (file)
@@ -752,6 +752,7 @@ int cx231xx_set_mode(struct cx231xx *dev, enum cx231xx_mode set_mode)
                        break;
                case CX231XX_BOARD_CNXT_RDE_253S:
                case CX231XX_BOARD_CNXT_RDU_253S:
+               case CX231XX_BOARD_HAUPPAUGE_EXETER:
                errCode = cx231xx_set_agc_analog_digital_mux_select(dev, 1);
                        break;
                default:
@@ -768,6 +769,7 @@ int cx231xx_set_mode(struct cx231xx *dev, enum cx231xx_mode set_mode)
                        break;
                case CX231XX_BOARD_CNXT_RDE_253S:
                case CX231XX_BOARD_CNXT_RDU_253S:
+               case CX231XX_BOARD_HAUPPAUGE_EXETER:
                errCode = cx231xx_set_agc_analog_digital_mux_select(dev, 0);
                        break;
                default:
@@ -1306,14 +1308,14 @@ int cx231xx_dev_init(struct cx231xx *dev)
        /* External Master 1 Bus */
        dev->i2c_bus[0].nr = 0;
        dev->i2c_bus[0].dev = dev;
-       dev->i2c_bus[0].i2c_period = I2C_SPEED_1M;      /* 1MHz */
+       dev->i2c_bus[0].i2c_period = I2C_SPEED_100K;    /* 100 KHz */
        dev->i2c_bus[0].i2c_nostop = 0;
        dev->i2c_bus[0].i2c_reserve = 0;
 
        /* External Master 2 Bus */
        dev->i2c_bus[1].nr = 1;
        dev->i2c_bus[1].dev = dev;
-       dev->i2c_bus[1].i2c_period = I2C_SPEED_1M;      /* 1MHz */
+       dev->i2c_bus[1].i2c_period = I2C_SPEED_100K;    /* 100 KHz */
        dev->i2c_bus[1].i2c_nostop = 0;
        dev->i2c_bus[1].i2c_reserve = 0;
 
@@ -1411,6 +1413,7 @@ int cx231xx_dev_init(struct cx231xx *dev)
                break;
        case CX231XX_BOARD_CNXT_RDE_253S:
        case CX231XX_BOARD_CNXT_RDU_253S:
+       case CX231XX_BOARD_HAUPPAUGE_EXETER:
        errCode = cx231xx_set_agc_analog_digital_mux_select(dev, 0);
                break;
        default:
index 130794b971ce54d9e0e2dd3cdb3a3816bc7fc10f..3ff99e9f4a1ffe935fb27e443282517aafe447a0 100644 (file)
@@ -32,6 +32,7 @@
 #include "s5h1432.h"
 #include "tda18271.h"
 #include "s5h1411.h"
+#include "lgdt3305.h"
 
 MODULE_DESCRIPTION("driver for cx231xx based DVB cards");
 MODULE_AUTHOR("Srinivasa Deevi <srinivasa.deevi@conexant.com>");
@@ -110,6 +111,30 @@ static struct s5h1411_config xc5000_s5h1411_config = {
        .status_mode   = S5H1411_DEMODLOCKING,
        .mpeg_timing   = S5H1411_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK,
 };
+
+static struct lgdt3305_config hcw_lgdt3305_config = {
+       .i2c_addr           = 0x0e,
+       .mpeg_mode          = LGDT3305_MPEG_SERIAL,
+       .tpclk_edge         = LGDT3305_TPCLK_FALLING_EDGE,
+       .tpvalid_polarity   = LGDT3305_TP_VALID_HIGH,
+       .deny_i2c_rptr      = 1,
+       .spectral_inversion = 1,
+       .qam_if_khz         = 4000,
+       .vsb_if_khz         = 3250,
+};
+
+static struct tda18271_std_map hauppauge_tda18271_std_map = {
+       .atsc_6   = { .if_freq = 3250, .agc_mode = 3, .std = 4,
+                     .if_lvl = 1, .rfagc_top = 0x58, },
+       .qam_6    = { .if_freq = 4000, .agc_mode = 3, .std = 5,
+                     .if_lvl = 1, .rfagc_top = 0x58, },
+};
+
+static struct tda18271_config hcw_tda18271_config = {
+       .std_map = &hauppauge_tda18271_std_map,
+       .gate    = TDA18271_GATE_DIGITAL,
+};
+
 static inline void print_err_status(struct cx231xx *dev, int packet, int status)
 {
        char *errmsg = "Unknown";
@@ -639,6 +664,30 @@ static int dvb_init(struct cx231xx *dev)
                        goto out_free;
                }
                break;
+       case CX231XX_BOARD_HAUPPAUGE_EXETER:
+
+               printk(KERN_INFO "%s: looking for tuner / demod on i2c bus: %d\n",
+                      __func__, i2c_adapter_id(&dev->i2c_bus[1].i2c_adap));
+
+               dev->dvb->frontend = dvb_attach(lgdt3305_attach,
+                                               &hcw_lgdt3305_config,
+                                               &dev->i2c_bus[1].i2c_adap);
+
+               if (dev->dvb->frontend == NULL) {
+                       printk(DRIVER_NAME
+                              ": Failed to attach LG3305 front end\n");
+                       result = -EINVAL;
+                       goto out_free;
+               }
+
+               /* define general-purpose callback pointer */
+               dvb->frontend->callback = cx231xx_tuner_callback;
+
+               dvb_attach(tda18271_attach, dev->dvb->frontend,
+                          0x60, &dev->i2c_bus[1].i2c_adap,
+                          &hcw_tda18271_config);
+               break;
+
 
        default:
                printk(KERN_ERR "%s/2: The frontend of your DVB/ATSC card"
index d9a90c50aaa06909ac53c2f69ec60d1141acae66..634d595818d8abda0714e555dc4f3feddedc3a91 100644 (file)
@@ -62,6 +62,7 @@
 #define CX231XX_BOARD_CNXT_VIDEO_GRABBER       5
 #define CX231XX_BOARD_CNXT_RDE_250     6
 #define CX231XX_BOARD_CNXT_RDU_250             7
+#define CX231XX_BOARD_HAUPPAUGE_EXETER  8
 
 /* Limits minimum and default number of buffers */
 #define CX231XX_MIN_BUF                 4