V4L/DVB (12801): tm6000: Add support for ADSTech Mini Dual TV (PTV-339).
authorMichel Ludwig <michel.ludwig@gmail.com>
Mon, 24 Sep 2007 20:01:49 +0000 (17:01 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 18 May 2010 03:39:46 +0000 (00:39 -0300)
Signed-off-by: Michel Ludwig <michel.ludwig@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/staging/tm6000/tm6000-cards.c
drivers/staging/tm6000/tm6000-core.c
drivers/staging/tm6000/tm6000-dvb.c
drivers/staging/tm6000/tm6000-i2c.c
drivers/staging/tm6000/tm6000.h

index 608de59..c16f765 100644 (file)
@@ -37,6 +37,7 @@
 #define TM5600_BOARD_10MOONS_UT330             4
 #define TM6000_BOARD_ADSTECH_DUAL_TV           5
 #define TM6000_BOARD_FREECOM_AND_SIMILAR       6
+#define TM6000_BOARD_ADSTECH_MINI_DUAL_TV      7
 
 #define TM6000_MAXBOARDS        16
 static unsigned int card[]     = {[0 ... (TM6000_MAXBOARDS - 1)] = UNSET };
@@ -55,7 +56,6 @@ struct tm6000_board {
        int             gpio_addr_tun_reset;    /* GPIO used for tuner reset */
 };
 
-
 struct tm6000_board tm6000_boards[] = {
        [TM6000_BOARD_UNKNOWN] = {
                .name         = "Unknown tm6000 video grabber",
@@ -118,7 +118,7 @@ struct tm6000_board tm6000_boards[] = {
        },
        [TM6000_BOARD_FREECOM_AND_SIMILAR] = {
                .name         = "Freecom Hybrid Stick / Moka DVB-T Receiver Dual",
-               .tuner_type   = TUNER_XC2028,
+               .tuner_type   = TUNER_XC2028, /* has a XC3028 */
                .tuner_addr   = 0xc2,
                .demod_addr   = 0x1e,
                .caps = {
@@ -126,6 +126,20 @@ struct tm6000_board tm6000_boards[] = {
                        .has_dvb      = 1,
                        .has_zl10353  = 1,
                        .has_eeprom   = 0,
+                       .has_remote   = 1,
+               },
+               .gpio_addr_tun_reset = TM6000_GPIO_4,
+       },
+       [TM6000_BOARD_ADSTECH_MINI_DUAL_TV] = {
+               .name         = "ADSTECH Mini Dual TV USB",
+               .tuner_type   = TUNER_XC2028, /* has a XC3028 */
+               .tuner_addr   = 0xc8,
+               .demod_addr   = 0x1e,
+               .caps = {
+                       .has_tuner    = 1,
+                       .has_dvb      = 1,
+                       .has_zl10353  = 1,
+                       .has_eeprom   = 0,
                },
                .gpio_addr_tun_reset = TM6000_GPIO_4,
        },
@@ -136,6 +150,7 @@ struct usb_device_id tm6000_id_table [] = {
        { USB_DEVICE(0x6000, 0x0001), .driver_info = TM5600_BOARD_10MOONS_UT821 },
        { USB_DEVICE(0x06e1, 0xf332), .driver_info = TM6000_BOARD_ADSTECH_DUAL_TV },
        { USB_DEVICE(0x14aa, 0x0620), .driver_info = TM6000_BOARD_FREECOM_AND_SIMILAR },
+       { USB_DEVICE(0x06e1, 0xb339), .driver_info = TM6000_BOARD_ADSTECH_MINI_DUAL_TV },
        { },
 };
 
index 3f2727d..7728e40 100644 (file)
@@ -226,12 +226,17 @@ int tm6000_init_digital_mode (struct tm6000_core *dev)
        tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00d1, 0xd8);
        tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00d2, 0xc0);
        tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00d6, 0x60);
+
+       tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00e2, 0x0c);
+       tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00e8, 0xff);
+       tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00eb, 0x08);
        msleep(50);
 
        tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, 0x0020, 0x00);
+       msleep(50);
        tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, 0x0020, 0x01);
+       msleep(50);
        tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, 0x0020, 0x00);
-
        msleep(100);
 
        return 0;
index d2ec6ca..9df93cf 100644 (file)
@@ -61,10 +61,6 @@ int tm6000_start_stream(struct tm6000_core *dev)
 
        tm6000_init_digital_mode(dev);
 
-//     ret = usb_set_interface(dev->udev, 0, 1);
-//     if (ret<0)
-//             return ret;
-
 /*
        ret = tm6000_set_led_status(tm6000_dev, 0x1);
        if(ret < 0) {
@@ -94,10 +90,17 @@ int tm6000_start_stream(struct tm6000_core *dev)
                                                 dvb->bulk_urb->transfer_buffer,
                                                 maxPaketSize,
                                                 tm6000_urb_received, dev);
+
+       ret = usb_set_interface(dev->udev, 0, 1);
+       if(ret < 0) {
+               printk(KERN_ERR "tm6000: error %i in %s during set interface\n", ret, __FUNCTION__);
+               return ret;
+       }
+
        ret = usb_clear_halt(dev->udev, pipe);
        if(ret < 0) {
                printk(KERN_ERR "tm6000: error %i in %s during pipe reset\n",ret,__FUNCTION__);
-//             return ret;
+               return ret;
        }
        else {
                printk(KERN_ERR "tm6000: pipe resetted\n");
@@ -121,10 +124,16 @@ int tm6000_start_stream(struct tm6000_core *dev)
 
 void tm6000_stop_stream(struct tm6000_core *dev)
 {
+       int ret;
        struct tm6000_dvb *dvb = dev->dvb;
 
 //     tm6000_set_led_status(tm6000_dev, 0x0);
 
+       ret = usb_set_interface(dev->udev, 0, 0);
+       if(ret < 0) {
+               printk(KERN_ERR "tm6000: error %i in %s during set interface\n",ret,__FUNCTION__);
+       }
+
        if(dvb->bulk_urb) {
                usb_kill_urb(dvb->bulk_urb);
                kfree(dvb->bulk_urb->transfer_buffer);
index 48473bd..10c7d94 100644 (file)
@@ -299,9 +299,10 @@ static int tm6000_tuner_callback(void *ptr, int command, int arg)
                case 0:
                        tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
                                        dev->tuner_reset_gpio, 0x00);
-                       msleep(10);
+                       msleep(130);
                        tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
                                        dev->tuner_reset_gpio, 0x01);
+                       msleep(130);
                        break;
                case 1:
                        tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT,
@@ -314,9 +315,10 @@ static int tm6000_tuner_callback(void *ptr, int command, int arg)
                                                TM6000_GPIO_CLK, 0);
                        if (rc<0)
                                return rc;
-                       msleep(10);
+                       msleep(100);
                        rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
                                                TM6000_GPIO_CLK, 1);
+                       msleep(100);
                        break;
                }
        }
index a5977e7..ffc5501 100644 (file)
@@ -103,6 +103,7 @@ struct tm6000_capabilities {
        unsigned int    has_dvb:1;
        unsigned int    has_zl10353:1;
        unsigned int    has_eeprom:1;
+       unsigned int    has_remote:1;
 };
 
 struct tm6000_dvb {