tm6000: add new hybrid-stick

Message ID 1268243877-29157-1-git-send-email-stefan.ringel@arcor.de (mailing list archive)
State Superseded, archived
Headers

Commit Message

Stefan Ringel March 10, 2010, 5:57 p.m. UTC
  From: Stefan Ringel <stefan.ringel@arcor.de>

-add Hauppauge WinTV HVR 900H/WinTV USB2-Stick
	vid/pid
	0x2040/6601
	0x2040/6610
	0x2040/6611

-add Terratec Cinergy Hybrid-Stick
	vid/pid
	0x0ccd/0x00a5

-add Twinhan TU501(704D1)
	vid/pid
	0x13d3/0x3240
	0x13d3/0x3241
	0x13d3/0x3243
	0x13d3/0x3264


Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
---
 drivers/staging/tm6000/tm6000-cards.c |   39 +++++++++++++++++++++++++++-----
 1 files changed, 33 insertions(+), 6 deletions(-)
  

Comments

Stefan Ringel March 14, 2010, 7:11 a.m. UTC | #1
Mauro,

you have accepted my patch, but it's not applied.

best regards

Stefan Ringel
  
Mauro Carvalho Chehab March 14, 2010, 6:26 p.m. UTC | #2
Stefan Ringel wrote:
> Mauro,
> 
> you have accepted my patch, but it's not applied.

This patch were applied on my git tree on Mar, 11:

commit 50e3fe3b336fb2936f05bb9af752ef933c8b74aa
Author:     Stefan Ringel <stefan.ringel@arcor.de>
AuthorDate: Wed Mar 10 14:57:57 2010 -0300
Commit:     Mauro Carvalho Chehab <mchehab@redhat.com>
CommitDate: Thu Mar 11 07:41:43 2010 -0300

    V4L/DVB: tm6000: add new hybrid-stick

That's why it were marked as applied. I have no idea when it were
backported to -hg, or if it is still on Douglas queue.

Cheers,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  
Stefan Ringel March 14, 2010, 8:19 p.m. UTC | #3
Am 14.03.2010 19:26, schrieb Mauro Carvalho Chehab:
> Stefan Ringel wrote:
>   
>> Mauro,
>>
>> you have accepted my patch, but it's not applied.
>>     
> This patch were applied on my git tree on Mar, 11:
>
> commit 50e3fe3b336fb2936f05bb9af752ef933c8b74aa
> Author:     Stefan Ringel <stefan.ringel@arcor.de>
> AuthorDate: Wed Mar 10 14:57:57 2010 -0300
> Commit:     Mauro Carvalho Chehab <mchehab@redhat.com>
> CommitDate: Thu Mar 11 07:41:43 2010 -0300
>
>     V4L/DVB: tm6000: add new hybrid-stick
>
> That's why it were marked as applied. I have no idea when it were
> backported to -hg, or if it is still on Douglas queue.
>
> Cheers,
> Mauro
>   

that is the lastest entrys in weblog. And no patch can I see from me.

v4l-dvb.git



3 days ago
    Mauro Carvalho...
    V4L/DVB: Fix bad whitespacing  master
    commit | commitdiff | tree


4 days ago
    Max Thrun
    V4L/DVB: gspca - ov534: Update copyright info
    commit | commitdiff | tree


4 days ago
    Mosalam Ebrahimi
    V4L/DVB: gspca - ov534: Add Powerline Frequency control
    commit | commitdiff | tree


4 days ago
    Antonio Ospite
    V4L/DVB: gspca - ov534: Cosmetics: fix indentation...
    commit | commitdiff | tree

please check it!

Cheers,
Stefan
  
Mauro Carvalho Chehab March 14, 2010, 11:06 p.m. UTC | #4
Stefan Ringel wrote:
> Am 14.03.2010 19:26, schrieb Mauro Carvalho Chehab:
>> Stefan Ringel wrote:
>>   
>>> Mauro,
>>>
>>> you have accepted my patch, but it's not applied.
>>>     
>> This patch were applied on my git tree on Mar, 11:
>>
>> commit 50e3fe3b336fb2936f05bb9af752ef933c8b74aa
>> Author:     Stefan Ringel <stefan.ringel@arcor.de>
>> AuthorDate: Wed Mar 10 14:57:57 2010 -0300
>> Commit:     Mauro Carvalho Chehab <mchehab@redhat.com>
>> CommitDate: Thu Mar 11 07:41:43 2010 -0300
>>
>>     V4L/DVB: tm6000: add new hybrid-stick
>>
>> That's why it were marked as applied. I have no idea when it were
>> backported to -hg, or if it is still on Douglas queue.
>>
>> Cheers,
>> Mauro
>>   
> 
> that is the lastest entrys in weblog. And no patch can I see from me.
> 
> v4l-dvb.git
> 
> 
> 
> 3 days ago
>     Mauro Carvalho...
>     V4L/DVB: Fix bad whitespacing  master
>     commit | commitdiff | tree
> 
> 
> 4 days ago
>     Max Thrun
>     V4L/DVB: gspca - ov534: Update copyright info
>     commit | commitdiff | tree
> 
> 
> 4 days ago
>     Mosalam Ebrahimi
>     V4L/DVB: gspca - ov534: Add Powerline Frequency control
>     commit | commitdiff | tree
> 
> 
> 4 days ago
>     Antonio Ospite
>     V4L/DVB: gspca - ov534: Cosmetics: fix indentation...
>     commit | commitdiff | tree
> 
> please check it!

I forgot to push from my local tree to the servers. I'm updating
them right now.
  
Stefan Ringel March 27, 2010, 2:55 p.m. UTC | #5
Hi Mauro,

First, I have a question, in the function "int tm6000_cards_setup(struct
tm6000_core *dev)" have you reset gpio 1 and 4, but why? In my lastest
patch I have add a few sticks and it's works with and without this
part.What for sticks use this part? For a week I have become a email
with usbsnoop log from a tm5600 based stick and I have analysed it.
Resume is that I think it use two reset gpio's.

1. GPIO1  = 0
2. GPIO4 = 0
3. wait a few ms
4. GPIO1 = 1
5. GPIO4 = 1

/*
     * Default initialization. Most of the devices seem to use GPIO1
     * and GPIO4.on the same way, so, this handles the common sequence
     * used by most devices.
     * If a device uses a different sequence or different GPIO pins for
     * reset, just add the code at the board-specific part
     */
    for (i = 0; i < 2; i++) {
        rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
                    dev->gpio.tuner_reset, 0x00);
        if (rc < 0) {
            printk(KERN_ERR "Error %i doing GPIO1 reset\n", rc);
            return rc;
        }

        msleep(10); /* Just to be conservative */
        rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
                    dev->gpio.tuner_reset, 0x01);
        if (rc < 0) {
            printk(KERN_ERR "Error %i doing GPIO1 reset\n", rc);
            return rc;
        }

        msleep(10);
        rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_4, 0);
        if (rc < 0) {
            printk(KERN_ERR "Error %i doing GPIO4 reset\n", rc);
            return rc;
        }

        msleep(10);
        rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_4, 1);
        if (rc < 0) {
            printk(KERN_ERR "Error %i doing GPIO4 reset\n", rc);
            return rc;
        }

        if (!i) {
            rc = tm6000_get_reg16(dev, 0x40, 0, 0);
            if (rc >= 0)
                printk(KERN_DEBUG "board=%d\n", rc);
        }
    }

For a week I have become a email with usbsnoop log from a tm5600 based
stick and I have analysed it. Resume is that I think it use two reset
gpio's.

1. GPIO1  = 0
2. GPIO4 = 0
3. wait a few ms
4. GPIO1 = 1
5. GPIO4 = 1

So I think, if it a part from function tm6000_cards_setup is, then is
that part wrong and must remove to tuner_callback function.

Second, I will rewrite the gpio's into a struct.

for example:

in tm6000.h

struct tm6000_gpio {
    int        tuner_reset;
    int        tuner_on;
    int        demod_reset;
    int        demod_on;
    int        power_led;
    int        dvb_led;
    int        ir;
};

in tm6000_card.c

[TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE] = {
        .name         = "Terratec Cinergy Hybrid XE / Cinergy Hybrid-Stick",
        .tuner_type   = TUNER_XC2028, /* has a XC3028 */
        .tuner_addr   = 0xc2 >> 1,
        .demod_addr   = 0x1e >> 1,
        .type         = TM6010,
        .caps = {
            .has_tuner    = 1,
            .has_dvb    = 1,
            .has_zl10353    = 1,
            .has_eeprom    = 1,
            .has_remote    = 1,
        },
        .gpio = {
            .tuner_reset     = TM6010_GPIO_2,
            .tuner_on    = TM6010_GPIO_3,
            .demod_reset    = TM6010_GPIO_1,
            .demod_on    = TM6010_GPIO_4,
            .power_led    = TM6010_GPIO_7,
            .dvb_led    = TM6010_GPIO_5,
            .ir        = TM6010_GPIO_0,
        },
    },

The rest I send in the patch email. So can the gpio's define in the
board struct and using per label in the functions.

Stefan Ringel
  

Patch

diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c
index 83cb4b9..2053008 100644
--- a/drivers/staging/tm6000/tm6000-cards.c
+++ b/drivers/staging/tm6000/tm6000-cards.c
@@ -47,6 +47,7 @@ 
 #define TM6010_BOARD_BEHOLD_WANDER		10
 #define TM6010_BOARD_BEHOLD_VOYAGER		11
 #define TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE	12
+#define TM6010_BOARD_TWINHAN_TU501		13
 
 #define TM6000_MAXBOARDS        16
 static unsigned int card[]     = {[0 ... (TM6000_MAXBOARDS - 1)] = UNSET };
@@ -169,7 +170,7 @@  struct tm6000_board tm6000_boards[] = {
 		.gpio_addr_tun_reset = TM6000_GPIO_4,
 	},
 	[TM6010_BOARD_HAUPPAUGE_900H] = {
-		.name         = "Hauppauge HVR-900H",
+		.name         = "Hauppauge WinTV HVR-900H / WinTV USB2-Stick",
 		.tuner_type   = TUNER_XC2028, /* has a XC3028 */
 		.tuner_addr   = 0xc2 >> 1,
 		.demod_addr   = 0x1e >> 1,
@@ -180,7 +181,7 @@  struct tm6000_board tm6000_boards[] = {
 			.has_zl10353  = 1,
 			.has_eeprom   = 1,
 		},
-		.gpio_addr_tun_reset = TM6000_GPIO_2,
+		.gpio_addr_tun_reset = TM6010_GPIO_2,
 	},
 	[TM6010_BOARD_BEHOLD_WANDER] = {
 		.name         = "Beholder Wander DVB-T/TV/FM USB2.0",
@@ -212,7 +213,22 @@  struct tm6000_board tm6000_boards[] = {
 		.gpio_addr_tun_reset = TM6000_GPIO_2,
 	},
 	[TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE] = {
-		.name         = "Terratec Cinergy Hybrid XE",
+		.name         = "Terratec Cinergy Hybrid XE / Cinergy Hybrid-Stick",
+		.tuner_type   = TUNER_XC2028, /* has a XC3028 */
+		.tuner_addr   = 0xc2 >> 1,
+		.demod_addr   = 0x1e >> 1,
+		.type         = TM6010,
+		.caps = {
+			.has_tuner    = 1,
+			.has_dvb      = 1,
+			.has_zl10353  = 1,
+			.has_eeprom   = 1,
+			.has_remote   = 1,
+		},
+		.gpio_addr_tun_reset = TM6010_GPIO_2,
+	},
+	[TM6010_BOARD_TWINHAN_TU501] = {
+		.name         = "Twinhan TU501(704D1)",
 		.tuner_type   = TUNER_XC2028, /* has a XC3028 */
 		.tuner_addr   = 0xc2 >> 1,
 		.demod_addr   = 0x1e >> 1,
@@ -236,9 +252,17 @@  struct usb_device_id tm6000_id_table [] = {
 	{ USB_DEVICE(0x14aa, 0x0620), .driver_info = TM6000_BOARD_FREECOM_AND_SIMILAR },
 	{ USB_DEVICE(0x06e1, 0xb339), .driver_info = TM6000_BOARD_ADSTECH_MINI_DUAL_TV },
 	{ USB_DEVICE(0x2040, 0x6600), .driver_info = TM6010_BOARD_HAUPPAUGE_900H },
+	{ USB_DEVICE(0x2040, 0x6601), .driver_info = TM6010_BOARD_HAUPPAUGE_900H },
+	{ USB_DEVICE(0x2040, 0x6610), .driver_info = TM6010_BOARD_HAUPPAUGE_900H },
+	{ USB_DEVICE(0x2040, 0x6611), .driver_info = TM6010_BOARD_HAUPPAUGE_900H },
 	{ USB_DEVICE(0x6000, 0xdec0), .driver_info = TM6010_BOARD_BEHOLD_WANDER },
 	{ USB_DEVICE(0x6000, 0xdec1), .driver_info = TM6010_BOARD_BEHOLD_VOYAGER },
 	{ USB_DEVICE(0x0ccd, 0x0086), .driver_info = TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE },
+	{ USB_DEVICE(0x0ccd, 0x00A5), .driver_info = TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE },
+	{ USB_DEVICE(0x13d3, 0x3240), .driver_info = TM6010_BOARD_TWINHAN_TU501 },
+	{ USB_DEVICE(0x13d3, 0x3241), .driver_info = TM6010_BOARD_TWINHAN_TU501 },
+	{ USB_DEVICE(0x13d3, 0x3243), .driver_info = TM6010_BOARD_TWINHAN_TU501 },
+	{ USB_DEVICE(0x13d3, 0x3264), .driver_info = TM6010_BOARD_TWINHAN_TU501 },
 	{ },
 };
 
@@ -271,7 +295,9 @@  int tm6000_tuner_callback(void *ptr, int component, int command, int arg)
 		case 0:
 			/* newer tuner can faster reset */
 			switch (dev->model) {
+			case TM6010_BOARD_HAUPPAUGE_900H:
 			case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE:
+			case TM6010_BOARD_TWINHAN_TU501:
 				tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
 					       dev->tuner_reset_gpio, 0x01);
 				msleep(60);
@@ -328,11 +354,11 @@  int tm6000_cards_setup(struct tm6000_core *dev)
 	 */
 	switch (dev->model) {
 	case TM6010_BOARD_HAUPPAUGE_900H:
+	case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE:
+	case TM6010_BOARD_TWINHAN_TU501:
 		/* Turn xceive 3028 on */
 		tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6010_GPIO_3, 0x01);
-		msleep(11);
-		break;
-	case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE:
+		msleep(15);
 		/* Turn zarlink zl10353 on */
 		tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6010_GPIO_4, 0x00);
 		msleep(15);
@@ -445,6 +471,7 @@  static void tm6000_config_tuner (struct tm6000_core *dev)
 		switch(dev->model) {
 		case TM6010_BOARD_HAUPPAUGE_900H:
 		case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE:
+		case TM6010_BOARD_TWINHAN_TU501:
 			ctl.fname = "xc3028L-v36.fw";
 			break;
 		default: