V4L/DVB (6898): cx23885: add support for Hauppauge WinTV HVR-1500
Michael Krufky [Tue, 18 Dec 2007 04:09:11 +0000 (01:09 -0300)]
Signed-off-by: Michael Krufky <mkrufky@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.h

index 54d06e4..698971d 100644 (file)
@@ -4,3 +4,4 @@
   3 -> Hauppauge WinTV-HVR1250                             [0070:7911]
   4 -> DViCO FusionHDTV5 Express                           [18ac:d500]
   5 -> Hauppauge WinTV-HVR1500Q                            [0070:7797]
+  6 -> Hauppauge WinTV-HVR1500                             [0070:7717]
index d40232c..e11fa10 100644 (file)
@@ -117,7 +117,10 @@ struct cx23885_board cx23885_boards[] = {
                .name           = "Hauppauge WinTV-HVR1500Q",
                .portc          = CX23885_MPEG_DVB,
        },
-
+       [CX23885_BOARD_HAUPPAUGE_HVR1500] = {
+               .name           = "Hauppauge WinTV-HVR1500",
+               .portc          = CX23885_MPEG_DVB,
+       },
 };
 const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards);
 
@@ -153,6 +156,10 @@ struct cx23885_subid cx23885_subids[] = {
                .subvendor = 0x0070,
                .subdevice = 0x7797,
                .card      = CX23885_BOARD_HAUPPAUGE_HVR1500Q,
+       },{
+               .subvendor = 0x0070,
+               .subdevice = 0x7717,
+               .card      = CX23885_BOARD_HAUPPAUGE_HVR1500,
        },
 };
 const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids);
@@ -214,6 +221,18 @@ void cx23885_gpio_setup(struct cx23885_dev *dev)
                /* GPIO-0 cx24227 demodulator reset */
                cx_set(GP0_IO, 0x00010001); /* Bring the part out of reset */
                break;
+       case CX23885_BOARD_HAUPPAUGE_HVR1500:
+               /* GPIO-0 cx24227 demodulator */
+               /* GPIO-2 xc3028 tuner */
+
+               /* Put the parts into reset */
+               cx_set(GP0_IO, 0x00050000);
+               cx_clear(GP0_IO, 0x00000005);
+               msleep(5);
+
+               /* Bring the parts out of reset */
+               cx_set(GP0_IO, 0x00050005);
+               break;
        case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
                /* GPIO-0 cx24227 demodulator reset */
                /* GPIO-2 xc5000 tuner reset */
@@ -236,6 +255,7 @@ int cx23885_ir_init(struct cx23885_dev *dev)
 {
        switch (dev->board) {
        case CX23885_BOARD_HAUPPAUGE_HVR1250:
+       case CX23885_BOARD_HAUPPAUGE_HVR1500:
        case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
        case CX23885_BOARD_HAUPPAUGE_HVR1800:
                /* FIXME: Implement me */
@@ -260,6 +280,7 @@ void cx23885_card_setup(struct cx23885_dev *dev)
 
        switch (dev->board) {
        case CX23885_BOARD_HAUPPAUGE_HVR1250:
+       case CX23885_BOARD_HAUPPAUGE_HVR1500:
        case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
        case CX23885_BOARD_HAUPPAUGE_HVR1800:
        case CX23885_BOARD_HAUPPAUGE_HVR1800lp:
@@ -275,6 +296,7 @@ void cx23885_card_setup(struct cx23885_dev *dev)
                ts1->src_sel_val   = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
                break;
        case CX23885_BOARD_HAUPPAUGE_HVR1250:
+       case CX23885_BOARD_HAUPPAUGE_HVR1500:
        case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
        case CX23885_BOARD_HAUPPAUGE_HVR1800:
        case CX23885_BOARD_HAUPPAUGE_HVR1800lp:
index f0882dd..c130911 100644 (file)
@@ -35,6 +35,8 @@
 #include "lgdt330x.h"
 #include "xc5000.h"
 #include "dvb-pll.h"
+#include "tuner-xc2028.h"
+#include "tuner-xc2028-types.h"
 
 static unsigned int debug = 0;
 
@@ -126,6 +128,14 @@ static struct s5h1409_config hauppauge_hvr1800lp_config = {
        .status_mode   = S5H1409_DEMODLOCKING
 };
 
+static struct s5h1409_config hauppauge_hvr1500_config = {
+       .demod_address = 0x32 >> 1,
+       .output_mode   = S5H1409_SERIAL_OUTPUT,
+       .gpio          = S5H1409_GPIO_OFF,
+       .inversion     = S5H1409_INVERSION_OFF,
+       .status_mode   = S5H1409_DEMODLOCKING
+};
+
 static struct mt2131_config hauppauge_generic_tunerconfig = {
        0x61
 };
@@ -152,6 +162,36 @@ static struct xc5000_config hauppauge_hvr1500q_tunerconfig = {
        .tuner_reset      = hauppauge_hvr1500q_tuner_reset
 };
 
+static int cx23885_hvr1500_xc3028_callback(void *ptr, int command, int arg)
+{
+       struct cx23885_tsport *port = ptr;
+       struct cx23885_dev *dev = port->dev;
+
+       switch (command) {
+       case XC2028_TUNER_RESET:
+               /* Send the tuner in then out of reset */
+               /* GPIO-2 xc3028 tuner */
+               dprintk(1, "%s: XC2028_TUNER_RESET %d\n", __FUNCTION__, arg);
+
+               cx_set(GP0_IO, 0x00040000);
+               cx_clear(GP0_IO, 0x00000004);
+               msleep(5);
+
+               cx_set(GP0_IO, 0x00040004);
+               msleep(5);
+               break;
+       case XC2028_RESET_CLK:
+               dprintk(1, "%s: XC2028_RESET_CLK %d\n", __FUNCTION__, arg);
+               break;
+       default:
+               dprintk(1, "%s: unknown command %d, arg %d\n", __FUNCTION__,
+                       command, arg);
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
 static int dvb_register(struct cx23885_tsport *port)
 {
        struct cx23885_dev *dev = port->dev;
@@ -206,6 +246,31 @@ static int dvb_register(struct cx23885_tsport *port)
                                &hauppauge_hvr1500q_tunerconfig);
                }
                break;
+       case CX23885_BOARD_HAUPPAUGE_HVR1500:
+               i2c_bus = &dev->i2c_bus[1];
+               port->dvb.frontend = dvb_attach(s5h1409_attach,
+                                               &hauppauge_hvr1500_config,
+                                               &dev->i2c_bus[0].i2c_adap);
+               if (port->dvb.frontend != NULL) {
+                       struct dvb_frontend *fe;
+                       struct xc2028_config cfg = {
+                               .i2c_adap  = &i2c_bus->i2c_adap,
+                               .i2c_addr  = 0x61,
+                               .video_dev = port,
+                               .callback  = cx23885_hvr1500_xc3028_callback,
+                       };
+                       static struct xc2028_ctrl ctl = {
+                               .fname       = "xc3028-v27.fw",
+                               .max_len     = 64,
+                               .scode_table = OREN538,
+                       };
+
+                       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 3f019f3..974ec14 100644 (file)
@@ -54,6 +54,7 @@
 #define CX23885_BOARD_HAUPPAUGE_HVR1250        3
 #define CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP   4
 #define CX23885_BOARD_HAUPPAUGE_HVR1500Q       5
+#define CX23885_BOARD_HAUPPAUGE_HVR1500        6
 
 enum cx23885_itype {
        CX23885_VMUX_COMPOSITE1 = 1,