V4L/DVB (7673): cx23885: Add support for the Hauppauge HVR1400
[deliverable/linux.git] / drivers / media / video / cx23885 / cx23885-dvb.c
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);
This page took 0.026537 seconds and 5 git commands to generate.