]> err.no Git - linux-2.6/blobdiff - drivers/media/video/cx23885/cx23885-cards.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
[linux-2.6] / drivers / media / video / cx23885 / cx23885-cards.c
index fbf93c63dcaa3657299ae92b7ec3f1ceaafbf984..2d414dad5c31ac2b9c184459d6d04a6b42746dce 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/delay.h>
+#include <media/cx25840.h>
 
 #include "cx23885.h"
 
@@ -32,6 +33,8 @@
 struct cx23885_board cx23885_boards[] = {
        [CX23885_BOARD_UNKNOWN] = {
                .name           = "UNKNOWN/GENERIC",
+               /* Ensure safe default for unknown boards */
+               .clk_freq       = 0,
                .input          = {{
                        .type   = CX23885_VMUX_COMPOSITE1,
                        .vmux   = 0,
@@ -69,23 +72,29 @@ struct cx23885_board cx23885_boards[] = {
        },
        [CX23885_BOARD_HAUPPAUGE_HVR1800] = {
                .name           = "Hauppauge WinTV-HVR1800",
+               .porta          = CX23885_ANALOG_VIDEO,
                .portc          = CX23885_MPEG_DVB,
+               .tuner_type     = TUNER_PHILIPS_TDA8290,
+               .tuner_addr     = 0x42, /* 0x84 >> 1 */
                .input          = {{
                        .type   = CX23885_VMUX_TELEVISION,
-                       .vmux   = 0,
-                       .gpio0  = 0xff00,
-               },{
-                       .type   = CX23885_VMUX_DEBUG,
-                       .vmux   = 0,
-                       .gpio0  = 0xff01,
+                       .vmux   =       CX25840_VIN7_CH3 |
+                                       CX25840_VIN5_CH2 |
+                                       CX25840_VIN2_CH1,
+                       .gpio0  = 0,
                },{
                        .type   = CX23885_VMUX_COMPOSITE1,
-                       .vmux   = 1,
-                       .gpio0  = 0xff02,
+                       .vmux   =       CX25840_VIN7_CH3 |
+                                       CX25840_VIN4_CH2 |
+                                       CX25840_VIN6_CH1,
+                       .gpio0  = 0,
                },{
                        .type   = CX23885_VMUX_SVIDEO,
-                       .vmux   = 2,
-                       .gpio0  = 0xff02,
+                       .vmux   =       CX25840_VIN7_CH3 |
+                                       CX25840_VIN4_CH2 |
+                                       CX25840_VIN8_CH1 |
+                                       CX25840_SVIDEO_ON,
+                       .gpio0  = 0,
                }},
        },
        [CX23885_BOARD_HAUPPAUGE_HVR1250] = {
@@ -144,6 +153,10 @@ struct cx23885_subid cx23885_subids[] = {
                .subvendor = 0x0070,
                .subdevice = 0x7801,
                .card      = CX23885_BOARD_HAUPPAUGE_HVR1800,
+       },{
+               .subvendor = 0x0070,
+               .subdevice = 0x7809,
+               .card      = CX23885_BOARD_HAUPPAUGE_HVR1800,
        },{
                .subvendor = 0x0070,
                .subdevice = 0x7911,
@@ -152,10 +165,18 @@ struct cx23885_subid cx23885_subids[] = {
                .subvendor = 0x18ac,
                .subdevice = 0xd500,
                .card      = CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP,
+       },{
+               .subvendor = 0x0070,
+               .subdevice = 0x7790,
+               .card      = CX23885_BOARD_HAUPPAUGE_HVR1500Q,
        },{
                .subvendor = 0x0070,
                .subdevice = 0x7797,
                .card      = CX23885_BOARD_HAUPPAUGE_HVR1500Q,
+       },{
+               .subvendor = 0x0070,
+               .subdevice = 0x7710,
+               .card      = CX23885_BOARD_HAUPPAUGE_HVR1500,
        },{
                .subvendor = 0x0070,
                .subdevice = 0x7717,
@@ -200,10 +221,19 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data)
        switch (tv.model)
        {
        case 76601: /* WinTV-HVR1800lp (PCIe, Retail, No IR, Dual channel ATSC and MPEG2 HW Encoder */
-       case 77001: /* WinTV-HVR1500 (Express Card, Retail, No IR, ATSC and Basic analog */
-       case 77041: /* WinTV-HVR1500Q (Express Card, Retail, No IR, ATSC/QAM and Basic analog */
-       case 78501: /* WinTV-HVR1800 (PCIe, Retail, IR, Dual channel ATSC and MPEG2 HW Encoder */
-       case 78521: /* WinTV-HVR1800 (PCIe, Retail, IR, Dual channel ATSC and MPEG2 HW Encoder */
+       case 77001: /* WinTV-HVR1500 (Express Card, OEM, No IR, ATSC and Basic analog */
+       case 77011: /* WinTV-HVR1500 (Express Card, Retail, No IR, ATSC and Basic analog */
+       case 77041: /* WinTV-HVR1500Q (Express Card, OEM, No IR, ATSC/QAM and Basic analog */
+       case 77051: /* WinTV-HVR1500Q (Express Card, Retail, No IR, ATSC/QAM and Basic analog */
+       case 78011: /* WinTV-HVR1800 (PCIe, Retail, 3.5mm in, IR, No FM, Dual channel ATSC and MPEG2 HW Encoder */
+       case 78501: /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM, Dual channel ATSC and MPEG2 HW Encoder */
+       case 78521: /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM, Dual channel ATSC and MPEG2 HW Encoder */
+       case 78531: /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, No FM, Dual channel ATSC and MPEG2 HW Encoder */
+       case 78631: /* WinTV-HVR1800 (PCIe, OEM, No IR, No FM, Dual channel ATSC and MPEG2 HW Encoder */
+       case 79001: /* WinTV-HVR1250 (PCIe, Retail, IR, full height, ATSC and Basic analog */
+       case 79101: /* WinTV-HVR1250 (PCIe, Retail, 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 */
                break;
        default:
                printk("%s: warning: unknown hauppauge model #%d\n", dev->name, tv.model);
@@ -214,6 +244,34 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data)
                        dev->name, tv.model);
 }
 
+/* Tuner callback function for cx23885 boards. Currently only needed
+ * for HVR1500Q, which has an xc5000 tuner.
+ */
+int cx23885_tuner_callback(void *priv, int command, int arg)
+{
+       struct cx23885_i2c *bus = priv;
+       struct cx23885_dev *dev = bus->dev;
+
+       switch(dev->board) {
+       case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
+               if(command == 0) {      /* Tuner Reset Command from xc5000 */
+                       /* Drive the tuner into reset and out */
+                       cx_clear(GP0_IO, 0x00000004);
+                       mdelay(200);
+                       cx_set(GP0_IO, 0x00000004);
+                       return 0;
+               }
+               else {
+                       printk(KERN_ERR
+                               "%s(): Unknow command.\n", __FUNCTION__);
+                       return -EINVAL;
+               }
+               break;
+       }
+
+       return 0; /* Should never be here */
+}
+
 void cx23885_gpio_setup(struct cx23885_dev *dev)
 {
        switch(dev->board) {
@@ -247,7 +305,13 @@ void cx23885_gpio_setup(struct cx23885_dev *dev)
                /* GPIO-15-18 cx23417 READY, CS, RD, WR */
                /* GPIO-19 IR_RX */
 
-               cx_set(GP0_IO, 0x00040004); /* Bring the tuner out of reset */
+               /* Force the TDA8295A into reset and back */
+               cx_set(GP0_IO, 0x00040004);
+               mdelay(20);
+               cx_clear(GP0_IO, 0x00000004);
+               mdelay(20);
+               cx_set(GP0_IO, 0x00040004);
+               mdelay(20);
                break;
        }
 }