]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/video/au0828/au0828-cards.c
Merge branches 'at91', 'dyntick', 'ep93xx', 'iop', 'ixp', 'misc', 'orion', 'omap...
[linux-2.6-omap-h63xx.git] / drivers / media / video / au0828 / au0828-cards.c
index c4cb11e9d6fcbf879eed9cff9264966e5116c49a..898e12395e7c26e1f829beff5f773c85cd5671f8 100644 (file)
 #include "au0828.h"
 #include "au0828-cards.h"
 
-#define _dbg(level, fmt, arg...)\
-       do {\
-               if (debug >= level) \
-                       printk(KERN_DEBUG DRIVER_NAME "/0: " fmt, ## arg);\
-       } while (0)
-
 struct au0828_board au0828_boards[] = {
        [AU0828_BOARD_UNKNOWN] = {
                .name   = "Unknown board",
@@ -42,7 +36,6 @@ struct au0828_board au0828_boards[] = {
                .name   = "DViCO FusionHDTV USB",
        },
 };
-const unsigned int au0828_bcount = ARRAY_SIZE(au0828_boards);
 
 /* Tuner callback function for au0828 boards. Currently only needed
  * for HVR1500Q, which has an xc5000 tuner.
@@ -51,11 +44,13 @@ int au0828_tuner_callback(void *priv, int command, int arg)
 {
        struct au0828_dev *dev = priv;
 
-       switch(dev->board) {
+       dprintk(1, "%s()\n", __func__);
+
+       switch (dev->board) {
        case AU0828_BOARD_HAUPPAUGE_HVR850:
        case AU0828_BOARD_HAUPPAUGE_HVR950Q:
        case AU0828_BOARD_DVICO_FUSIONHDTV7:
-               if(command == 0) {
+               if (command == 0) {
                        /* Tuner Reset Command from xc5000 */
                        /* Drive the tuner into reset and out */
                        au0828_clear(dev, REG_001, 2);
@@ -63,10 +58,9 @@ int au0828_tuner_callback(void *priv, int command, int arg)
                        au0828_set(dev, REG_001, 2);
                        mdelay(50);
                        return 0;
-               }
-               else {
+               } else {
                        printk(KERN_ERR
-                               "%s(): Unknown command.\n", __FUNCTION__);
+                               "%s(): Unknown command.\n", __func__);
                        return -EINVAL;
                }
                break;
@@ -75,14 +69,63 @@ int au0828_tuner_callback(void *priv, int command, int arg)
        return 0; /* Should never be here */
 }
 
+static void hauppauge_eeprom(struct au0828_dev *dev, u8 *eeprom_data)
+{
+       struct tveeprom tv;
+
+       tveeprom_hauppauge_analog(&dev->i2c_client, &tv, eeprom_data);
+
+       /* Make sure we support the board model */
+       switch (tv.model) {
+       case 72000: /* WinTV-HVR950q (Retail, IR, ATSC/QAM */
+       case 72001: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and basic analog video */
+       case 72211: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and basic analog video */
+       case 72221: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and basic analog video */
+       case 72231: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and basic analog video */
+       case 72241: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM and basic analog video */
+       case 72301: /* WinTV-HVR850 (Retail, IR, ATSC and basic analog video */
+       case 72500: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM */
+               break;
+       default:
+               printk(KERN_WARNING "%s: warning: "
+                      "unknown hauppauge model #%d\n", __func__, tv.model);
+               break;
+       }
+
+       printk(KERN_INFO "%s: hauppauge eeprom: model=%d\n",
+              __func__, tv.model);
+}
+
+void au0828_card_setup(struct au0828_dev *dev)
+{
+       static u8 eeprom[256];
+
+       dprintk(1, "%s()\n", __func__);
+
+       if (dev->i2c_rc == 0) {
+               dev->i2c_client.addr = 0xa0 >> 1;
+               tveeprom_read(&dev->i2c_client, eeprom, sizeof(eeprom));
+       }
+
+       switch (dev->board) {
+       case AU0828_BOARD_HAUPPAUGE_HVR850:
+       case AU0828_BOARD_HAUPPAUGE_HVR950Q:
+               if (dev->i2c_rc == 0)
+                       hauppauge_eeprom(dev, eeprom+0xa0);
+               break;
+       }
+}
+
 /*
  * The bridge has between 8 and 12 gpios.
  * Regs 1 and 0 deal with output enables.
- * Regs 3 and 2 deal with direction.
+ * Regs 3 and 2 deal with direction.
  */
 void au0828_gpio_setup(struct au0828_dev *dev)
 {
-       switch(dev->board) {
+       dprintk(1, "%s()\n", __func__);
+
+       switch (dev->board) {
        case AU0828_BOARD_HAUPPAUGE_HVR850:
        case AU0828_BOARD_HAUPPAUGE_HVR950Q:
                /* GPIO's
@@ -138,6 +181,18 @@ struct usb_device_id au0828_usb_id_table [] = {
                .driver_info = AU0828_BOARD_HAUPPAUGE_HVR850 },
        { USB_DEVICE(0x0fe9, 0xd620),
                .driver_info = AU0828_BOARD_DVICO_FUSIONHDTV7 },
+       { USB_DEVICE(0x2040, 0x7210),
+               .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
+       { USB_DEVICE(0x2040, 0x7217),
+               .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
+       { USB_DEVICE(0x2040, 0x721b),
+               .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
+       { USB_DEVICE(0x2040, 0x721f),
+               .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
+       { USB_DEVICE(0x2040, 0x7280),
+               .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
+       { USB_DEVICE(0x0fd9, 0x0008),
+               .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
        { },
 };