V4L/DVB (7020): Add USB ID for a newer variant of Hauppauge WinTV USB2
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / media / video / em28xx / em28xx-cards.c
index c4204c90fb01d9586c9319599b7ba29ae4408811..fe0ee4518479f9f678f792d4cb9ba3bb4af1c9f5 100644 (file)
@@ -174,12 +174,14 @@ struct em28xx_board em28xx_boards[] = {
                } },
        },
        [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950] = {
-               .name         = "Hauppauge WinTV HVR 950",
-               .vchannels    = 3,
-               .tda9887_conf = TDA9887_PRESENT,
-               .tuner_type   = TUNER_XC2028,
-               .has_tuner    = 1,
-               .decoder      = EM28XX_TVP5150,
+               .name           = "Hauppauge WinTV HVR 950",
+               .vchannels      = 3,
+               .tda9887_conf   = TDA9887_PRESENT,
+               .tuner_type     = TUNER_XC2028,
+               .has_tuner      = 1,
+               .mts_firmware   = 1,
+               .has_12mhz_i2s  = 1,
+               .decoder        = EM28XX_TVP5150,
                .input          = { {
                        .type     = EM28XX_VMUX_TELEVISION,
                        .vmux     = TVP5150_COMPOSITE0,
@@ -193,6 +195,9 @@ struct em28xx_board em28xx_boards[] = {
                        .vmux     = TVP5150_SVIDEO,
                        .amux     = 1,
                } },
+
+               /* gpio's 4, 1, 0 */
+               .analog_gpio = 0x003d2d,
        },
        [EM2880_BOARD_TERRATEC_HYBRID_XS] = {
                .name         = "Terratec Hybrid XS",
@@ -329,7 +334,7 @@ struct em28xx_board em28xx_boards[] = {
                } },
        },
        [EM2820_BOARD_PINNACLE_DVC_90] = {
-               .name         = "Pinnacle Dazzle DVC 90",
+               .name         = "Pinnacle Dazzle DVC 90/DVC 100",
                .vchannels    = 3,
                .has_tuner    = 0,
                .decoder      = EM28XX_SAA7113,
@@ -414,8 +419,12 @@ struct usb_device_id em28xx_id_table [] = {
                        .driver_info = EM2820_BOARD_PINNACLE_USB_2 },
        { USB_DEVICE(0x2040, 0x4200),
                        .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
+       { USB_DEVICE(0x2040, 0x4201),
+                       .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
        { USB_DEVICE(0x2304, 0x0207),
                        .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
+       { USB_DEVICE(0x2304, 0x021a),
+                       .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
        { USB_DEVICE(0x2040, 0x6500),
                        .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 },
        { USB_DEVICE(0x2040, 0x6513),
@@ -451,8 +460,18 @@ void em28xx_pre_card_setup(struct em28xx *dev)
        case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
        case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950:
        case EM2880_BOARD_TERRATEC_HYBRID_XS:
-               /* reset through GPIO? */
-               em28xx_write_regs_req(dev, 0x00, 0x08, "\x7d", 1);
+               em28xx_write_regs(dev, XCLK_REG, "\x27", 1);
+               em28xx_write_regs(dev, I2C_CLK_REG, "\x40", 1);
+               em28xx_write_regs(dev, 0x08, "\xff", 1);
+               em28xx_write_regs(dev, 0x04, "\x00", 1);
+               msleep(100);
+               em28xx_write_regs(dev, 0x04, "\x08", 1);
+               msleep(100);
+               em28xx_write_regs(dev, 0x08, "\xff", 1);
+               msleep(50);
+               em28xx_write_regs(dev, 0x08, "\x2d", 1);
+               msleep(50);
+               em28xx_write_regs(dev, 0x08, "\x3d", 1);
                break;
        }
 }
@@ -467,13 +486,35 @@ static int em28xx_tuner_callback(void *ptr, int command, int arg)
 
        switch (command) {
        case XC2028_TUNER_RESET:
-               /* FIXME: This is device-dependent */
+       {
+               /* GPIO and initialization codes for analog TV and radio
+                  This code should be complemented for DTV, since reset
+                  codes are different.
+                */
+
                dev->em28xx_write_regs_req(dev, 0x00, 0x48, "\x00", 1);
                dev->em28xx_write_regs_req(dev, 0x00, 0x12, "\x67", 1);
 
-               msleep(140);
+               if (dev->analog_gpio) {
+                       char gpio0 = dev->analog_gpio & 0xff;
+                       char gpio1 = (dev->analog_gpio >> 8) & 0xff;
+                       char gpio4 = dev->analog_gpio >> 24;
+
+                       if (gpio4) {
+                               dev->em28xx_write_regs(dev, 0x04, &gpio4, 1);
+                               msleep(140);
+                       }
+
+                       msleep(6);
+                       dev->em28xx_write_regs(dev, 0x08, &gpio0, 1);
+                       msleep(10);
+                       dev->em28xx_write_regs(dev, 0x08, &gpio1, 1);
+                       msleep(5);
+               }
+
                break;
        }
+       }
        return rc;
 }
 
@@ -606,6 +647,8 @@ static void em28xx_set_model(struct em28xx *dev)
        dev->tda9887_conf = em28xx_boards[dev->model].tda9887_conf;
        dev->decoder = em28xx_boards[dev->model].decoder;
        dev->video_inputs = em28xx_boards[dev->model].vchannels;
+       dev->analog_gpio = em28xx_boards[dev->model].analog_gpio;
+       dev->has_12mhz_i2s = em28xx_boards[dev->model].has_12mhz_i2s;
 
        if (!em28xx_boards[dev->model].has_tuner)
                dev->tuner_type = UNSET;
@@ -641,8 +684,6 @@ void em28xx_card_setup(struct em28xx *dev)
                if (tv.has_ir)
                        request_module("ir-kbd-i2c");
 #endif
-               /* FIXME: Should also retrieve decoder processor type */
-
                break;
        }
        case EM2820_BOARD_KWORLD_PVRTV2800RF: