V4L/DVB (6607): saa7134: add support for reading Hauppauge eeprom
authorMichael Krufky <mkrufky@linuxtv.org>
Thu, 15 Nov 2007 13:34:33 +0000 (10:34 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Fri, 25 Jan 2008 21:02:13 +0000 (19:02 -0200)
Increased size of dev->eedata from 128 to 256, since the Hauppauge data begins
at byte 128.  This has been tested on boards with smaller eeproms, and caused
no problems.

Added comments to distinguish between the various versions of the HVR1110.

Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/saa7134/saa7134-cards.c
drivers/media/video/saa7134/saa7134.h

index 138cec8bb0237353e4232d7ac9c4ed065058cc2b..533fb02394fb592a85f23e7463fa3def54cd2800 100644 (file)
@@ -26,6 +26,7 @@
 #include "saa7134-reg.h"
 #include "saa7134.h"
 #include <media/v4l2-common.h>
+#include <media/tveeprom.h>
 
 /* commly used strings */
 static char name_mute[]    = "mute";
@@ -4381,6 +4382,34 @@ static void board_flyvideo(struct saa7134_dev *dev)
 
 /* ----------------------------------------------------------- */
 
+static void hauppauge_eeprom(struct saa7134_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 67019: /* WinTV-HVR1110 (Retail, IR Blaster, hybrid, FM, SVid/Comp, 3.5mm audio in) */
+       case 67109: /* WinTV-HVR1000 (Retail, IR Receive, analog, no FM, SVid/Comp, 3.5mm audio in) */
+       case 67559: /* WinTV-HVR1110 (OEM, no IR, hybrid, FM, SVid/Comp, RCA aud) */
+       case 67569: /* WinTV-HVR1110 (OEM, no IR, hybrid, FM) */
+       case 67579: /* WinTV-HVR1110 (OEM, no IR, hybrid, no FM) */
+       case 67589: /* WinTV-HVR1110 (OEM, no IR, hybrid, no FM, SVid/Comp, RCA aud) */
+       case 67599: /* WinTV-HVR1110 (OEM, no IR, hybrid, no FM, SVid/Comp, RCA aud) */
+               break;
+       default:
+               printk(KERN_WARNING "%s: warning: "
+                      "unknown hauppauge model #%d\n", dev->name, tv.model);
+               break;
+       }
+
+       printk(KERN_INFO "%s: hauppauge eeprom: model=%d\n",
+              dev->name, tv.model);
+}
+
+/* ----------------------------------------------------------- */
+
 int saa7134_board_init1(struct saa7134_dev *dev)
 {
        /* Always print gpio, often manufacturers encode tuner type and other info. */
@@ -4661,13 +4690,15 @@ int saa7134_board_init2(struct saa7134_dev *dev)
                i2c_transfer(&dev->i2c_adap, &msg, 1);
                }
                break;
+       case SAA7134_BOARD_HAUPPAUGE_HVR1110:
+               hauppauge_eeprom(dev, dev->eedata+0x80);
+               /* break intentionally omitted */
        case SAA7134_BOARD_PINNACLE_PCTV_310i:
        case SAA7134_BOARD_KWORLD_DVBT_210:
        case SAA7134_BOARD_TEVION_DVBT_220RF:
        case SAA7134_BOARD_ASUSTeK_P7131_DUAL:
        case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA:
        case SAA7134_BOARD_MEDION_MD8800_QUADRO:
-       case SAA7134_BOARD_HAUPPAUGE_HVR1110:
                /* this is a hybrid board, initialize to analog mode
                 * and configure firmware eeprom address
                 */
index 16f4b5ce34d90e459bb0eb1e33e030288834993e..a531e3c6c94196899c15fe5d84de06f0327f817e 100644 (file)
@@ -481,7 +481,7 @@ struct saa7134_dev {
        /* i2c i/o */
        struct i2c_adapter         i2c_adap;
        struct i2c_client          i2c_client;
-       unsigned char              eedata[128];
+       unsigned char              eedata[256];
 
        /* video overlay */
        struct v4l2_framebuffer    ovbuf;