V4L/DVB (7673): cx23885: Add support for the Hauppauge HVR1400
authorSteven Toth <stoth@hauppauge.com>
Tue, 22 Apr 2008 18:38:26 +0000 (15:38 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Thu, 24 Apr 2008 17:09:45 +0000 (14:09 -0300)
DVB-T mode is now supported using the DiBcom dib7000p demodulator
and the Xceive xc3028L silicon tuner. Analog mode is not supported.

Signed-off-by: Steven Toth <stoth@hauppauge.com>
Reviewed-by: Patrick Boettcher <pb@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Documentation/video4linux/CARDLIST.cx23885
drivers/media/video/cx23885/cx23885-cards.c
drivers/media/video/cx23885/cx23885-dvb.c
drivers/media/video/cx23885/cx23885-i2c.c
drivers/media/video/cx23885/cx23885.h

index b057a3c9f8ff5a9c1e7527626cea2a605d677e5a..929b90c8387fafc30ed3e0715171a504e257b0e7 100644 (file)
@@ -7,3 +7,4 @@
   6 -> Hauppauge WinTV-HVR1500                             [0070:7710,0070:7717]
   7 -> Hauppauge WinTV-HVR1200                             [0070:71d1]
   8 -> Hauppauge WinTV-HVR1700                             [0070:8101]
+  9 -> Hauppauge WinTV-HVR1400                             [0070:8010]
index 859510f7469cbc973dcf16492d7ae3db66695373..0f4b325f2d89030026c8ab49afdf3146aaaa6a43 100644 (file)
@@ -138,6 +138,10 @@ struct cx23885_board cx23885_boards[] = {
                .name           = "Hauppauge WinTV-HVR1700",
                .portc          = CX23885_MPEG_DVB,
        },
+       [CX23885_BOARD_HAUPPAUGE_HVR1400] = {
+               .name           = "Hauppauge WinTV-HVR1400",
+               .portc          = CX23885_MPEG_DVB,
+       },
 };
 const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards);
 
@@ -197,6 +201,10 @@ struct cx23885_subid cx23885_subids[] = {
                .subvendor = 0x0070,
                .subdevice = 0x8101,
                .card      = CX23885_BOARD_HAUPPAUGE_HVR1700,
+       }, {
+               .subvendor = 0x0070,
+               .subdevice = 0x8010,
+               .card      = CX23885_BOARD_HAUPPAUGE_HVR1400,
        },
 };
 const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids);
@@ -251,6 +259,9 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data)
        case 79561: /* WinTV-HVR1250 (PCIe, OEM, No IR, half height, ATSC and Basic analog */
        case 79571: /* WinTV-HVR1250 (PCIe, OEM, No IR, full height, ATSC and Basic analog */
        case 79671: /* WinTV-HVR1250 (PCIe, OEM, No IR, half height, ATSC and Basic analog */
+       case 80019:
+               /* WinTV-HVR1400 (Express Card, Retail, IR,
+                * DVB-T and Basic analog */
        case 81519:
                /* WinTV-HVR1700 (PCIe, Retail, No IR, half height,
                 * DVB-T and MPEG2 HW Encoder */
@@ -358,6 +369,18 @@ void cx23885_gpio_setup(struct cx23885_dev *dev)
                /* GPIO-22 IIS WCLK */
                /* GPIO-23 IIS BCLK */
 
+               /* Put the parts into reset and back */
+               cx_set(GP0_IO, 0x00050000);
+               mdelay(20);
+               cx_clear(GP0_IO, 0x00000005);
+               mdelay(20);
+               cx_set(GP0_IO, 0x00050005);
+               break;
+       case CX23885_BOARD_HAUPPAUGE_HVR1400:
+               /* GPIO-0  Dibcom7000p demodulator reset */
+               /* GPIO-2  xc3028L tuner reset */
+               /* GPIO-13 LED */
+
                /* Put the parts into reset and back */
                cx_set(GP0_IO, 0x00050000);
                mdelay(20);
@@ -376,6 +399,7 @@ int cx23885_ir_init(struct cx23885_dev *dev)
        case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
        case CX23885_BOARD_HAUPPAUGE_HVR1800:
        case CX23885_BOARD_HAUPPAUGE_HVR1200:
+       case CX23885_BOARD_HAUPPAUGE_HVR1400:
                /* FIXME: Implement me */
                break;
        }
@@ -400,6 +424,7 @@ void cx23885_card_setup(struct cx23885_dev *dev)
        case CX23885_BOARD_HAUPPAUGE_HVR1250:
        case CX23885_BOARD_HAUPPAUGE_HVR1500:
        case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
+       case CX23885_BOARD_HAUPPAUGE_HVR1400:
                if (dev->i2c_bus[0].i2c_rc == 0)
                        hauppauge_eeprom(dev, eeprom+0x80);
                break;
@@ -425,6 +450,7 @@ void cx23885_card_setup(struct cx23885_dev *dev)
        case CX23885_BOARD_HAUPPAUGE_HVR1800lp:
        case CX23885_BOARD_HAUPPAUGE_HVR1200:
        case CX23885_BOARD_HAUPPAUGE_HVR1700:
+       case CX23885_BOARD_HAUPPAUGE_HVR1400:
        default:
                ts2->gen_ctrl_val  = 0xc; /* Serial bus + punctured clock */
                ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
index 1b9a85e43d443f56b4d7923eb972b9b4361c2100..870d6e197d65152f8c54b1ef0efcf848edbfd6f6 100644 (file)
@@ -40,6 +40,8 @@
 #include "dvb-pll.h"
 #include "tuner-xc2028.h"
 #include "tuner-simple.h"
+#include "dib7000p.h"
+#include "dibx000_common.h"
 
 static unsigned int debug;
 
@@ -189,6 +191,92 @@ static struct tda18271_config hauppauge_hvr1200_tuner_config = {
        .gate    = TDA18271_GATE_ANALOG,
 };
 
+struct dibx000_agc_config xc3028_agc_config = {
+       BAND_VHF | BAND_UHF,    /* band_caps */
+
+       /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=0,
+        * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
+        * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0,
+        * P_agc_nb_est=2, P_agc_write=0
+        */
+       (0 << 15) | (0 << 14) | (0 << 11) | (0 << 10) | (0 << 9) | (0 << 8) |
+               (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), /* setup */
+
+       712,    /* inv_gain */
+       21,     /* time_stabiliz */
+
+       0,      /* alpha_level */
+       118,    /* thlock */
+
+       0,      /* wbd_inv */
+       2867,   /* wbd_ref */
+       0,      /* wbd_sel */
+       2,      /* wbd_alpha */
+
+       0,      /* agc1_max */
+       0,      /* agc1_min */
+       39718,  /* agc2_max */
+       9930,   /* agc2_min */
+       0,      /* agc1_pt1 */
+       0,      /* agc1_pt2 */
+       0,      /* agc1_pt3 */
+       0,      /* agc1_slope1 */
+       0,      /* agc1_slope2 */
+       0,      /* agc2_pt1 */
+       128,    /* agc2_pt2 */
+       29,     /* agc2_slope1 */
+       29,     /* agc2_slope2 */
+
+       17,     /* alpha_mant */
+       27,     /* alpha_exp */
+       23,     /* beta_mant */
+       51,     /* beta_exp */
+
+       1,      /* perform_agc_softsplit */
+};
+
+/* PLL Configuration for COFDM BW_MHz = 8.000000
+ * With external clock = 30.000000 */
+struct dibx000_bandwidth_config xc3028_bw_config = {
+       60000,  /* internal */
+       30000,  /* sampling */
+       1,      /* pll_cfg: prediv */
+       8,      /* pll_cfg: ratio */
+       3,      /* pll_cfg: range */
+       1,      /* pll_cfg: reset */
+       0,      /* pll_cfg: bypass */
+       0,      /* misc: refdiv */
+       0,      /* misc: bypclk_div */
+       1,      /* misc: IO_CLK_en_core */
+       1,      /* misc: ADClkSrc */
+       0,      /* misc: modulo */
+       (3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, freq_15k */
+       (1 << 25) | 5816102, /* ifreq = 5.200000 MHz */
+       20452225, /* timf */
+       30000000  /* xtal_hz */
+};
+
+static struct dib7000p_config hauppauge_hvr1400_dib7000_config = {
+       .output_mpeg2_in_188_bytes = 1,
+       .hostbus_diversity = 1,
+       .tuner_is_baseband = 0,
+       .update_lna  = NULL,
+
+       .agc_config_count = 1,
+       .agc = &xc3028_agc_config,
+       .bw  = &xc3028_bw_config,
+
+       .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
+       .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
+       .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
+
+       .pwm_freq_div = 0,
+       .agc_control  = NULL,
+       .spur_protect = 0,
+
+       .output_mode = OUTMODE_MPEG2_SERIAL,
+};
+
 static int cx23885_hvr1500_xc3028_callback(void *ptr, int command, int arg)
 {
        struct cx23885_tsport *port = ptr;
@@ -343,6 +431,31 @@ static int dvb_register(struct cx23885_tsport *port)
                                &hauppauge_hvr1200_tuner_config);
                }
                break;
+       case CX23885_BOARD_HAUPPAUGE_HVR1400:
+               i2c_bus = &dev->i2c_bus[0];
+               port->dvb.frontend = dvb_attach(dib7000p_attach,
+                       &i2c_bus->i2c_adap,
+                       0x12, &hauppauge_hvr1400_dib7000_config);
+               if (port->dvb.frontend != NULL) {
+                       struct dvb_frontend *fe;
+                       struct xc2028_config cfg = {
+                               .i2c_adap  = &dev->i2c_bus[1].i2c_adap,
+                               .i2c_addr  = 0x64,
+                               .callback  = cx23885_hvr1500_xc3028_callback,
+                       };
+                       static struct xc2028_ctrl ctl = {
+                               .fname   = "xc3028L-v36.fw",
+                               .max_len = 64,
+                               .demod   = 5000,
+                               .d2633   = 1
+                       };
+
+                       fe = dvb_attach(xc2028_attach,
+                                       port->dvb.frontend, &cfg);
+                       if (fe != NULL && fe->ops.tuner_ops.set_config != NULL)
+                               fe->ops.tuner_ops.set_config(fe, &ctl);
+               }
+               break;
        default:
                printk("%s: The frontend of your DVB/ATSC card isn't supported yet\n",
                       dev->name);
index 85f9d5ef17d020a0bc55e36e1cd85aa2618a116a..3928945df5f58aadfaf7933fdd2d3755796e612b 100644 (file)
@@ -354,6 +354,7 @@ static struct i2c_client cx23885_i2c_client_template = {
 
 static char *i2c_devs[128] = {
        [0x10 >> 1]   = "tda10048",
+       [0x12 >> 1]   = "dib7000pc",
        [ 0x1c >> 1 ] = "lgdt3303",
        [ 0x86 >> 1 ] = "tda9887",
        [ 0x32 >> 1 ] = "cx24227",
@@ -361,7 +362,8 @@ static char *i2c_devs[128] = {
        [ 0x84 >> 1 ] = "tda8295",
        [ 0xa0 >> 1 ] = "eeprom",
        [ 0xc0 >> 1 ] = "tuner/mt2131/tda8275",
-       [ 0xc2 >> 1 ] = "tuner/mt2131/tda8275/xc5000",
+       [0xc2 >> 1] = "tuner/mt2131/tda8275/xc5000/xc3028",
+       [0xc8 >> 1]   = "tuner/xc3028L",
 };
 
 static void do_i2c_scan(char *name, struct i2c_client *c)
index c5496e08c949d7ea3211fc27d99e9fbf2cd0cd63..3705e6019ce9659b101216c8b30aaa2fce4b230a 100644 (file)
@@ -61,6 +61,7 @@
 #define CX23885_BOARD_HAUPPAUGE_HVR1500        6
 #define CX23885_BOARD_HAUPPAUGE_HVR1200        7
 #define CX23885_BOARD_HAUPPAUGE_HVR1700        8
+#define CX23885_BOARD_HAUPPAUGE_HVR1400        9
 
 /* Currently unsupported by the driver: PAL/H, NTSC/Kr, SECAM B/G/H/LC */
 #define CX23885_NORMS (\