public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* Add Terratec Grabster support to tm6000
@ 2011-01-04 19:12 Holger Nelson
  2011-01-04 20:07 ` Stefan Ringel
  0 siblings, 1 reply; 4+ messages in thread
From: Holger Nelson @ 2011-01-04 19:12 UTC (permalink / raw)
  To: Linux Media Mailing List

Hi,

the following patch adds support for a Terratec Grabster AV MX150 (and 
maybe other devices in the Grabster series). This device is an analog 
frame grabber device using a tm5600. This device doesn't have a tuner, so 
I changed the code to skip the tuner reset if neither has_tuner nor 
has_dvb is set.

Holger

diff -urpN --exclude='*~' linux-2.6.37-rc8/drivers/staging/tm6000/tm6000-cards.c linux-lts-backport-natty-2.6.37/drivers/staging/tm6000/tm6000-cards.c
--- linux-2.6.37-rc8/drivers/staging/tm6000/tm6000-cards.c	2010-12-29 02:05:48.000000000 +0100
+++ linux-lts-backport-natty-2.6.37/drivers/staging/tm6000/tm6000-cards.c	2011-01-04 10:46:40.582497722 +0100
@@ -50,6 +50,7 @@
  #define TM6010_BOARD_BEHOLD_VOYAGER		11
  #define TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE	12
  #define TM6010_BOARD_TWINHAN_TU501		13
+#define TM5600_BOARD_TERRATEC_GRABSTER		14

  #define TM6000_MAXBOARDS        16
  static unsigned int card[]     = {[0 ... (TM6000_MAXBOARDS - 1)] = UNSET };
@@ -303,6 +304,19 @@ struct tm6000_board tm6000_boards[] = {
  			.dvb_led	= TM6010_GPIO_5,
  			.ir		= TM6010_GPIO_0,
  		},
+	},
+	[TM5600_BOARD_TERRATEC_GRABSTER] = {
+		.name         = "Terratec Grabster Series",
+		.type         = TM5600,
+		.caps = {
+			.has_tuner	= 0,
+			.has_dvb	= 0,
+			.has_zl10353	= 0,
+			.has_eeprom	= 0,
+			.has_remote	= 0,
+		},
+		.gpio = {
+		},
  	}
  };

@@ -325,6 +339,7 @@ struct usb_device_id tm6000_id_table[] =
  	{ 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 },
+	{ USB_DEVICE(0x0ccd, 0x0079), .driver_info = TM5600_BOARD_TERRATEC_GRABSTER },
  	{ },
  };

@@ -505,33 +520,35 @@ int tm6000_cards_setup(struct tm6000_cor
  	 * reset, just add the code at the board-specific part
  	 */

-	if (dev->gpio.tuner_reset) {
-		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 tuner reset\n", rc);
-				return rc;
-			}
+	if (dev->caps.has_tuner||dev->caps.has_dvb) {
+		if (dev->gpio.tuner_reset) {
+			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 tuner 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 tuner reset\n", rc);
-				return rc;
-			}
-			msleep(10);
+				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 tuner reset\n", rc);
+					return rc;
+				}
+				msleep(10);

-			if (!i) {
-				rc = tm6000_get_reg32(dev, REQ_40_GET_VERSION, 0, 0);
-				if (rc >= 0)
-					printk(KERN_DEBUG "board=0x%08x\n", rc);
+				if (!i) {
+					rc = tm6000_get_reg32(dev, REQ_40_GET_VERSION, 0, 0);
+					if (rc >= 0)
+						printk(KERN_DEBUG "board=0x%08x\n", rc);
+				}
  			}
+		} else {
+			printk(KERN_ERR "Tuner reset is not configured\n");
+			return -1;
  		}
-	} else {
-		printk(KERN_ERR "Tuner reset is not configured\n");
-		return -1;
  	}

  	msleep(50);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Add Terratec Grabster support to tm6000
  2011-01-04 19:12 Add Terratec Grabster support to tm6000 Holger Nelson
@ 2011-01-04 20:07 ` Stefan Ringel
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Ringel @ 2011-01-04 20:07 UTC (permalink / raw)
  To: Holger Nelson; +Cc: Linux Media Mailing List


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 
Am 04.01.2011 20:12, schrieb Holger Nelson:
> Hi,
>
> the following patch adds support for a Terratec Grabster AV MX150
> (and maybe other devices in the Grabster series). This device is an
> analog frame grabber device using a tm5600. This device doesn't have
> a tuner, so I changed the code to skip the tuner reset if neither
> has_tuner nor has_dvb is set.
it skip, if you has no tuner gpio defined. You does'nt need more. Work
the driver with input select (tv (conposite0), composite, s-vhs)?
>
> Holger
>
> diff -urpN --exclude='*~'
> linux-2.6.37-rc8/drivers/staging/tm6000/tm6000-cards.c
> linux-lts-backport-natty-2.6.37/drivers/staging/tm6000/tm6000-cards.c
> --- linux-2.6.37-rc8/drivers/staging/tm6000/tm6000-cards.c
> 2010-12-29 02:05:48.000000000 +0100
> +++
> linux-lts-backport-natty-2.6.37/drivers/staging/tm6000/tm6000-cards.c
> 2011-01-04 10:46:40.582497722 +0100
please use the lastest development kernel from
git://linuxtv.org/media_tree.git (http://linuxtv.org/git/media_tree.git).
> @@ -50,6 +50,7 @@
> #define TM6010_BOARD_BEHOLD_VOYAGER 11
> #define TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE 12
> #define TM6010_BOARD_TWINHAN_TU501 13
> +#define TM5600_BOARD_TERRATEC_GRABSTER 14
>
> #define TM6000_MAXBOARDS 16
> static unsigned int card[] = {[0 ... (TM6000_MAXBOARDS - 1)] =
> UNSET };
> @@ -303,6 +304,19 @@ struct tm6000_board tm6000_boards[] = {
> .dvb_led = TM6010_GPIO_5,
> .ir = TM6010_GPIO_0,
> },
> + },
> + [TM5600_BOARD_TERRATEC_GRABSTER] = {
> + .name = "Terratec Grabster Series",
> + .type = TM5600,
> + .caps = {
> + .has_tuner = 0,
> + .has_dvb = 0,
> + .has_zl10353 = 0,
> + .has_eeprom = 0,
> + .has_remote = 0,
> + },
> + .gpio = {
> + },
> }
> };
>
> @@ -325,6 +339,7 @@ struct usb_device_id tm6000_id_table[] =
> { 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 },
> + { USB_DEVICE(0x0ccd, 0x0079), .driver_info =
> TM5600_BOARD_TERRATEC_GRABSTER },
> { },
> };
>
> @@ -505,33 +520,35 @@ int tm6000_cards_setup(struct tm6000_cor
> * reset, just add the code at the board-specific part
> */
>
> - if (dev->gpio.tuner_reset) {
> - 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 tuner reset\n", rc);
> - return rc;
> - }
> + if (dev->caps.has_tuner||dev->caps.has_dvb) {
this is bad, if you mean skip tuner reset. We use the line "if
(dev->gpio.tuner_reset)" to check the true tuner reset gpio - if no
gpio set, it skip reset - , and you has no defined a tuner gpio, so it
skip alone.
Why you added then this line?
> + if (dev->gpio.tuner_reset) {
> + 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 tuner 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 tuner reset\n", rc);
> - return rc;
> - }
> - msleep(10);
> + 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 tuner reset\n",
> rc);
> + return rc;
> + }
> + msleep(10);
>
> - if (!i) {
> - rc = tm6000_get_reg32(dev, REQ_40_GET_VERSION, 0, 0);
> - if (rc >= 0)
> - printk(KERN_DEBUG "board=0x%08x\n", rc);
> + if (!i) {
> + rc = tm6000_get_reg32(dev, REQ_40_GET_VERSION,
> 0, 0);
> + if (rc >= 0)
> + printk(KERN_DEBUG "board=0x%08x\n", rc);
> + }
> }
> + } else {
> + printk(KERN_ERR "Tuner reset is not configured\n");
> + return -1;
> }
> - } else {
> - printk(KERN_ERR "Tuner reset is not configured\n");
> - return -1;
> }
>
> msleep(50);
> --
> 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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
iQEcBAEBAgAGBQJNI34QAAoJEAWtPFjxMvFGZwEH/R51EPEp2a/+DC34YkW+ywk6
aF6dJQLSq97hcvm2l6u7P7ku6XNAHqK/uqxXmM7trlyoK9RA1v4GWJV/aod+WmHo
jDocoiYG3ZWANco9aqdcutMCiVFlSKZRk2PsiJQwS+LAOabQGGe3pe6EIPQDmO5h
6TaVVLpzOyvGOHxYAy6PMI4ahJzkeJi1YORFN1a43UzV2GrViroT+BDWDKJk9QPk
Mg2diBj29gR0dwPTusqU0I6mwCqwV13incRlROMiKV1WIkaX1XW64qD0FKfMkSZA
edAljweR/S8ktqYGVrBFPvLUmFaX5zTruSgbRvskAKNO5CZO8isihSEJk9zEEbw=
=Z6bs
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Add Terratec Grabster support to tm6000
@ 2011-01-05 17:58 Holger Nelson
  2011-01-31 15:01 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 4+ messages in thread
From: Holger Nelson @ 2011-01-05 17:58 UTC (permalink / raw)
  To: Stefan Ringel; +Cc: Linux Media Mailing List

On Tue, 4 Jan 2011, Stefan Ringel wrote:

> Am 04.01.2011 20:12, schrieb Holger Nelson:
>> Hi,
>> the following patch adds support for a Terratec Grabster AV MX150 (and 
>> maybe other devices in the Grabster series). This device is an analog 
>> frame grabber device using a tm5600. This device doesn't have a tuner, 
>> so I changed the code to skip the tuner reset if neither has_tuner nor 
>> has_dvb is set.
> it skip, if you has no tuner gpio defined. You does'nt need more. Work 
> the driver with input select (tv (conposite0), composite, s-vhs)?

Yes tuner reset is skipped, but in the else-branch, the code also 
complains that tuner reset is not configured and returns -1, which makes 
tm6000_init_dev exit before v4l2_device_register is called. Switching 
inputs does not work, but at least I can use the composite input, if I 
use the tv-input.

Below is a new version of the patch.

Holger

diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c
index 5a7946c..0f4154f 100644
--- a/drivers/staging/tm6000/tm6000-cards.c
+++ b/drivers/staging/tm6000/tm6000-cards.c
@@ -50,6 +50,7 @@
  #define TM6010_BOARD_BEHOLD_VOYAGER		11
  #define TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE	12
  #define TM6010_BOARD_TWINHAN_TU501		13
+#define TM5600_BOARD_TERRATEC_GRABSTER		14

  #define TM6000_MAXBOARDS        16
  static unsigned int card[]     = {[0 ... (TM6000_MAXBOARDS - 1)] = UNSET };
@@ -303,6 +304,19 @@ struct tm6000_board tm6000_boards[] = {
  			.dvb_led	= TM6010_GPIO_5,
  			.ir		= TM6010_GPIO_0,
  		},
+	},
+	[TM5600_BOARD_TERRATEC_GRABSTER] = {
+		.name         = "Terratec Grabster AV 150/250 MX",
+		.type         = TM5600,
+		.caps = {
+			.has_tuner	= 0,
+			.has_dvb	= 0,
+			.has_zl10353	= 0,
+			.has_eeprom	= 0,
+			.has_remote	= 0,
+		},
+		.gpio = {
+		},
  	}
  };

@@ -325,6 +339,7 @@ struct usb_device_id tm6000_id_table[] = {
  	{ 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 },
+	{ USB_DEVICE(0x0ccd, 0x0079), .driver_info = TM5600_BOARD_TERRATEC_GRABSTER },
  	{ },
  };

@@ -447,6 +462,8 @@ int tm6000_cards_setup(struct tm6000_core *dev)
  	 * the board-specific session.
  	 */
  	switch (dev->model) {
+	case TM5600_BOARD_TERRATEC_GRABSTER:
+		return 0;
  	case TM6010_BOARD_HAUPPAUGE_900H:
  	case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE:
  	case TM6010_BOARD_TWINHAN_TU501:

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: Add Terratec Grabster support to tm6000
  2011-01-05 17:58 Holger Nelson
@ 2011-01-31 15:01 ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 4+ messages in thread
From: Mauro Carvalho Chehab @ 2011-01-31 15:01 UTC (permalink / raw)
  To: Holger Nelson; +Cc: Stefan Ringel, Linux Media Mailing List

Em 05-01-2011 15:58, Holger Nelson escreveu:
> On Tue, 4 Jan 2011, Stefan Ringel wrote:
> 
>> Am 04.01.2011 20:12, schrieb Holger Nelson:
>>> Hi,
>>> the following patch adds support for a Terratec Grabster AV MX150 (and maybe other devices in the Grabster series). This device is an analog frame grabber device using a tm5600. This device doesn't have a tuner, so I changed the code to skip the tuner reset if neither has_tuner nor has_dvb is set.
>> it skip, if you has no tuner gpio defined. You does'nt need more. Work the driver with input select (tv (conposite0), composite, s-vhs)?
> 
> Yes tuner reset is skipped, but in the else-branch, the code also complains that tuner reset is not configured and returns -1, which makes tm6000_init_dev exit before v4l2_device_register is called. Switching inputs does not work, but at least I can use the composite input, if I use the tv-input.
> 
> Below is a new version of the patch.
> 
> Holger

Please send your Signed-off-by: line. Btw, the patch doesn't apply
as-is over the latest development tree. Could you please rebase it
against it? you should use branch "staging/for_v2.6.39" of the git
tree at:
	http://git.linuxtv.org/media_tree.git

> 
> diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c
> index 5a7946c..0f4154f 100644
> --- a/drivers/staging/tm6000/tm6000-cards.c
> +++ b/drivers/staging/tm6000/tm6000-cards.c
> @@ -50,6 +50,7 @@
>  #define TM6010_BOARD_BEHOLD_VOYAGER        11
>  #define TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE    12
>  #define TM6010_BOARD_TWINHAN_TU501        13
> +#define TM5600_BOARD_TERRATEC_GRABSTER        14
> 
>  #define TM6000_MAXBOARDS        16
>  static unsigned int card[]     = {[0 ... (TM6000_MAXBOARDS - 1)] = UNSET };
> @@ -303,6 +304,19 @@ struct tm6000_board tm6000_boards[] = {
>              .dvb_led    = TM6010_GPIO_5,
>              .ir        = TM6010_GPIO_0,
>          },
> +    },
> +    [TM5600_BOARD_TERRATEC_GRABSTER] = {
> +        .name         = "Terratec Grabster AV 150/250 MX",
> +        .type         = TM5600,
> +        .caps = {
> +            .has_tuner    = 0,
> +            .has_dvb    = 0,
> +            .has_zl10353    = 0,
> +            .has_eeprom    = 0,
> +            .has_remote    = 0,
> +        },
> +        .gpio = {
> +        },
>      }
>  };
> 
> @@ -325,6 +339,7 @@ struct usb_device_id tm6000_id_table[] = {
>      { 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 },
> +    { USB_DEVICE(0x0ccd, 0x0079), .driver_info = TM5600_BOARD_TERRATEC_GRABSTER },
>      { },
>  };
> 
> @@ -447,6 +462,8 @@ int tm6000_cards_setup(struct tm6000_core *dev)
>       * the board-specific session.
>       */
>      switch (dev->model) {
> +    case TM5600_BOARD_TERRATEC_GRABSTER:
> +        return 0;
>      case TM6010_BOARD_HAUPPAUGE_900H:
>      case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE:
>      case TM6010_BOARD_TWINHAN_TU501:
> -- 
> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-01-31 15:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-04 19:12 Add Terratec Grabster support to tm6000 Holger Nelson
2011-01-04 20:07 ` Stefan Ringel
  -- strict thread matches above, loose matches on Subject: below --
2011-01-05 17:58 Holger Nelson
2011-01-31 15:01 ` Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox