From 4386136d29327a6645f7dba963d609d2452db843 Mon Sep 17 00:00:00 2001 From: Michel Ludwig Date: Mon, 24 Sep 2007 17:01:49 -0300 Subject: [PATCH] V4L/DVB (12801): tm6000: Add support for ADSTech Mini Dual TV (PTV-339). Signed-off-by: Michel Ludwig Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 19 +++++++++++++++++-- drivers/staging/tm6000/tm6000-core.c | 7 ++++++- drivers/staging/tm6000/tm6000-dvb.c | 19 ++++++++++++++----- drivers/staging/tm6000/tm6000-i2c.c | 6 ++++-- drivers/staging/tm6000/tm6000.h | 1 + 5 files changed, 42 insertions(+), 10 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index 608de59c9c13..c16f765aae57 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -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,9 +118,23 @@ 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 = { + .has_tuner = 1, + .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, @@ -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 }, { }, }; diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index 3f2727d5b957..7728e40a34db 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c @@ -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; diff --git a/drivers/staging/tm6000/tm6000-dvb.c b/drivers/staging/tm6000/tm6000-dvb.c index d2ec6ca766cb..9df93cfe3106 100644 --- a/drivers/staging/tm6000/tm6000-dvb.c +++ b/drivers/staging/tm6000/tm6000-dvb.c @@ -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); diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c index 48473bdabb76..10c7d947d53e 100644 --- a/drivers/staging/tm6000/tm6000-i2c.c +++ b/drivers/staging/tm6000/tm6000-i2c.c @@ -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; } } diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h index a5977e7ce51b..ffc55019390d 100644 --- a/drivers/staging/tm6000/tm6000.h +++ b/drivers/staging/tm6000/tm6000.h @@ -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 { -- 2.30.2