V4L/DVB (6199): cx23885: Changes to allow demodulators on each transport bus
[safe/jmp/linux-2.6] / drivers / media / video / cx23885 / cx23885-dvb.c
index bd0afc2..e0dc149 100644 (file)
 
 #include "s5h1409.h"
 #include "mt2131.h"
+#include "lgdt330x.h"
+#include "dvb-pll.h"
 
-static unsigned int debug = 2;
+static unsigned int debug = 0;
 
 #define dprintk(level,fmt, arg...)     if (debug >= level) \
        printk(KERN_DEBUG "%s: " fmt, dev->name, ## arg)
@@ -79,31 +81,32 @@ static struct videobuf_queue_ops dvb_qops = {
        .buf_release  = dvb_buf_release,
 };
 
-static struct s5h1409_config hauppauge_hvr1800lp_config = {
+static struct s5h1409_config hauppauge_generic_config = {
        .demod_address = 0x32 >> 1,
        .output_mode   = S5H1409_SERIAL_OUTPUT,
-       .gpio          = S5H1409_GPIO_OFF,
+       .gpio          = S5H1409_GPIO_ON,
        .if_freq       = 44000,
        .inversion     = S5H1409_INVERSION_OFF,
        .status_mode   = S5H1409_DEMODLOCKING
 };
 
-static struct s5h1409_config hauppauge_hvr1800_config = {
+static struct s5h1409_config hauppauge_hvr1800lp_config = {
        .demod_address = 0x32 >> 1,
        .output_mode   = S5H1409_SERIAL_OUTPUT,
-       .gpio          = S5H1409_GPIO_ON,
+       .gpio          = S5H1409_GPIO_OFF,
        .if_freq       = 44000,
        .inversion     = S5H1409_INVERSION_OFF,
        .status_mode   = S5H1409_DEMODLOCKING
 };
 
-
-static struct mt2131_config hauppauge_hvr1800lp_rev2_tunerconfig = {
+static struct mt2131_config hauppauge_generic_tunerconfig = {
        0x61
 };
 
-static struct mt2131_config hauppauge_hvr1800_tunerconfig = {
-       0x61
+static struct lgdt330x_config fusionhdtv_5_express = {
+       .demod_address = 0x0e,
+       .demod_chip = LGDT3303,
+       .serial_mpeg = 0x40,
 };
 
 static int dvb_register(struct cx23885_tsport *port)
@@ -115,24 +118,35 @@ static int dvb_register(struct cx23885_tsport *port)
 
        /* init frontend */
        switch (dev->board) {
-       case CX23885_BOARD_HAUPPAUGE_HVR1800lp:
+       case CX23885_BOARD_HAUPPAUGE_HVR1250:
+       case CX23885_BOARD_HAUPPAUGE_HVR1800:
                port->dvb.frontend = dvb_attach(s5h1409_attach,
-                                               &hauppauge_hvr1800lp_config,
+                                               &hauppauge_generic_config,
                                                &dev->i2c_bus[0].i2c_adap);
                if (port->dvb.frontend != NULL) {
                        dvb_attach(mt2131_attach, port->dvb.frontend,
                                   &dev->i2c_bus[0].i2c_adap,
-                                  &hauppauge_hvr1800lp_rev2_tunerconfig, 0);
+                                  &hauppauge_generic_tunerconfig, 0);
                }
                break;
-       case CX23885_BOARD_HAUPPAUGE_HVR1800:
+       case CX23885_BOARD_HAUPPAUGE_HVR1800lp:
                port->dvb.frontend = dvb_attach(s5h1409_attach,
-                                               &hauppauge_hvr1800_config,
+                                               &hauppauge_hvr1800lp_config,
                                                &dev->i2c_bus[0].i2c_adap);
                if (port->dvb.frontend != NULL) {
                        dvb_attach(mt2131_attach, port->dvb.frontend,
                                   &dev->i2c_bus[0].i2c_adap,
-                                  &hauppauge_hvr1800_tunerconfig, 0);
+                                  &hauppauge_generic_tunerconfig, 0);
+               }
+               break;
+       case CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP:
+               port->dvb.frontend = dvb_attach(lgdt330x_attach,
+                                               &fusionhdtv_5_express,
+                                               &dev->i2c_bus[0].i2c_adap);
+               if (port->dvb.frontend != NULL) {
+                       dvb_attach(dvb_pll_attach, port->dvb.frontend,
+                                  0x61, &dev->i2c_bus[0].i2c_adap,
+                                  DVB_PLL_LG_TDVS_H06XF);
                }
                break;
        default:
@@ -146,6 +160,7 @@ static int dvb_register(struct cx23885_tsport *port)
        }
 
        /* Put the analog decoder in standby to keep it quiet */
+       /* Assumption here: analog decoder is only on i2c bus 0 */
        cx23885_call_i2c_clients (&dev->i2c_bus[0], TUNER_SET_STANDBY, NULL);
 
        /* register everything */
@@ -166,8 +181,6 @@ int cx23885_dvb_register(struct cx23885_tsport *port)
                dev->pci_slot);
 
        err = -ENODEV;
-       if (!(cx23885_boards[dev->board].portc & CX23885_MPEG_DVB))
-               goto fail_core;
 
        /* dvb stuff */
        printk("%s: cx23885 based dvb card\n", dev->name);
@@ -178,7 +191,6 @@ int cx23885_dvb_register(struct cx23885_tsport *port)
        if (err != 0)
                printk("%s() dvb_register failed err = %d\n", __FUNCTION__, err);
 
- fail_core:
        return err;
 }