From tawi@gruft.de  Mon Jun 16 13:17:41 2003
Return-Path: <tawi@gruft.de>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 5348937B401
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 16 Jun 2003 13:17:41 -0700 (PDT)
Received: from obh.snafu.de (obh.snafu.de [213.73.92.34])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 4890F43FA3
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 16 Jun 2003 13:17:40 -0700 (PDT)
	(envelope-from tawi@gruft.de)
Received: from tawi by obh.snafu.de with local (Exim 3.36 #1)
	id 19S0Q6-0003dv-00
	for FreeBSD-gnats-submit@freebsd.org; Mon, 16 Jun 2003 22:17:38 +0200
Message-Id: <E19S0Q6-0003dv-00@obh.snafu.de>
Date: Mon, 16 Jun 2003 22:17:38 +0200
From: Tanja Wittke <tawi@gruft.de>
Reply-To: Tanja Wittke <tawi@gruft.de>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: adding Terratec TValue to bktr driver
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         53383
>Category:       kern
>Synopsis:       [bktr] [patch] adding Terratec TValue to bktr driver
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jun 16 13:20:01 PDT 2003
>Closed-Date:    Sun Nov 13 13:28:29 GMT 2005
>Last-Modified:  Sun Nov 13 13:28:29 GMT 2005
>Originator:     Tanja Wittke
>Release:        FreeBSD 4.8-PRERELEASE i386
>Organization:
private
>Environment:
System: FreeBSD strolch.ob-home.lan 4.8-STABLE FreeBSD 4.8-STABLE #20: Mon Jun 16 21:12:17 CEST 2003     root@strolch.ob-home.lan:/usr/obj/usr/src/sys/STROLCH  i386

>Description:
When using the Terratec TValue Card widely used in Germany there is no sound
and the wrong tuner is detected on the card. Adding the audio mux values,
gpio mask and detection of the card fixes this.

>How-To-Repeat:
Simply use a Terratec TValue card with the bktr driver...

>Fix:

Applied you find a diff for the bktr_card.[ch] files which fixes the behaviour
for that card.

NOTE: I implemented this for only one specific model of the card (according
to the PCI device ID). There are several other device IDs which seem to use
the same values according to the SOlaris/Linux driver. These IDs are:

0x1117
0x1118 (which is implemented with my patch)
0x1119
0x111a
(and maybe others)

SNIP HERE


diff -c sys/dev/bktr.old/bktr_card.c sys/dev/bktr/bktr_card.c
*** sys/dev/bktr.old/bktr_card.c	Sat Feb  8 03:04:57 2003
--- sys/dev/bktr/bktr_card.c	Mon Jun 16 22:03:01 2003
***************
*** 355,360 ****
--- 355,373 ----
  	   { 0x10000, 0, 0x10000, 0, 1 },	/* audio MUX values */
  	   0x10f00 },				/* GPIO mask */
  
+         {  CARD_TERRATVALUE,                    /* the card id */
+           "TerraTec TValue",                    /* the 'name' */
+            NULL,                                /* the tuner */
+            0,                                   /* the tuner i2c address */
+            0,                                   /* dbx is optional */
+            0,
+ 	   0,
+            0,                                   /* EEProm type */
+            0,                                   /* EEProm size */
+ 	   /* Tuner, Extern, Intern, Mute, Enabled */
+ 	   { 0x500, 0x900, 0x300, 0x900, 1 },	/* audio MUX values */
+ 	   0xffff00 },				/* GPIO mask */
+ 
  };
  
  struct bt848_card_sig bt848_card_signature[1]= {
***************
*** 546,551 ****
--- 559,565 ----
  #define PCI_VENDOR_AVERMEDIA	0x1461
  #define PCI_VENDOR_STB		0x10B4
  #define PCI_VENDOR_ASKEY	0x144F
+ #define PCI_VENDOR_TERRATEC	0x153B
  #endif
  /* Following not confirmed with http://members.hyperlink.net.au/~chart,
     so not added to NetBSD's pcidevs */
***************
*** 556,561 ****
--- 570,576 ----
  #define PCI_VENDOR_IODATA	0x10fc
  
  #define MODEL_IODATA_GV_BCTV3_PCI	0x4020
+ #define MODEL_TERRATVALUE1118	0x1118
  
  void
  probeCard( bktr_ptr_t bktr, int verbose, int unit )
***************
*** 697,702 ****
--- 712,725 ----
  		    goto checkTuner;
  		}
  
+ 		if (subsystem_vendor_id == PCI_VENDOR_TERRATEC &&
+                     subsystem_id == MODEL_TERRATVALUE1118 ) {
+ 		    bktr->card = cards[ (card = CARD_TERRATVALUE) ];
+ 		    bktr->card.eepromAddr = eeprom_i2c_address;
+ 		    bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
+ 		    goto checkTuner;
+ 		}
+ 
                  /* Vendor is unknown. We will use the standard probe code */
  		/* which may not give best results */
                  printf("%s: Warning - card vendor 0x%04x (model 0x%04x) unknown.\n",
***************
*** 1111,1116 ****
--- 1134,1144 ----
  
  	case CARD_IO_BCTV3:
  	    select_tuner( bktr, ALPS_TSCH5 ); /* ALPS_TSCH6, in fact. */
+ 	    goto checkDBX;
+ 	    break;
+ 
+ 	case CARD_TERRATVALUE:
+ 	    select_tuner( bktr, PHILIPS_PAL); /* Phlips PAL tuner */
  	    goto checkDBX;
  	    break;
  
diff -c sys/dev/bktr.old/bktr_card.h sys/dev/bktr/bktr_card.h
*** sys/dev/bktr.old/bktr_card.h	Sat Feb  8 03:04:57 2003
--- sys/dev/bktr/bktr_card.h	Mon Jun 16 22:03:01 2003
***************
*** 77,83 ****
  #define CARD_LEADTEK		15
  #define CARD_TERRATVPLUS	16
  #define CARD_IO_BCTV3		17
! #define Bt848_MAX_CARD		18
  
  #define CARD_IO_GV		CARD_IO_BCTV2
  
--- 77,84 ----
  #define CARD_LEADTEK		15
  #define CARD_TERRATVPLUS	16
  #define CARD_IO_BCTV3		17
! #define CARD_TERRATVALUE	18
! #define Bt848_MAX_CARD		19
  
  #define CARD_IO_GV		CARD_IO_BCTV2
  

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->roger 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Tue Aug 31 00:05:39 GMT 2004 
Responsible-Changed-Why:  
Over to bktr maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=53383 
Responsible-Changed-From-To: roger->freebsd-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Nov 4 08:21:40 GMT 2004 
Responsible-Changed-Why:  
Assignee is currently away from doing FreeBSD work at the moment, so 
at his request, return this one to the pool. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=53383 

From: Simon Barner <barner@FreeBSD.org>
To: bug-followup@FreeBSD.org, tawi@gruft.de
Cc:  
Subject: Re: kern/53383 : [bktr] [patch] adding Terratec TValue to bktr driver
Date: Sat, 12 Nov 2005 13:23:47 +0100

 Here is an updated version of the patch (against RELENG_6), which also
 detecteds TerraTValue cards with subid 0x1134:
 
 diff -ruN sys/dev/bktr.orig/bktr_card.c sys/dev/bktr/bktr_card.c
 --- sys/dev/bktr.orig/bktr_card.c	Sat Nov 12 12:19:40 2005
 +++ sys/dev/bktr/bktr_card.c	Sat Nov 12 12:29:01 2005
 @@ -391,6 +391,18 @@
  	    { 0x20000, 0x80000, 0, 0xa8000, 1 },        /* audio MUX values */
  	    0xAA0000 },                         /* GPIO mask */
  
 +	{  CARD_TERRATVALUE,                    /* the card id */
 +	   "TerraTec TValue",                    /* the 'name' */
 +	   NULL,                                /* the tuner */
 +	   0,                                   /* the tuner i2c address */
 +	   0,                                   /* dbx is optional */
 +           0,
 +	   0,
 +	   0,                                   /* EEProm type */
 +           0,                                   /* EEProm size */
 +           /* Tuner, Extern, Intern, Mute, Enabled */
 +	   { 0x500, 0x900, 0x300, 0x900, 1 },	/* audio MUX values */
 +	   0xffff00 },				/* GPIO mask */
  };
  
  struct bt848_card_sig bt848_card_signature[1]= {
 @@ -582,6 +594,7 @@
  #define PCI_VENDOR_AVERMEDIA	0x1461
  #define PCI_VENDOR_STB		0x10B4
  #define PCI_VENDOR_ASKEY	0x144F
 +#define PCI_VENDOR_TERRATEC	0x153B
  #endif
  /* Following not confirmed with http://members.hyperlink.net.au/~chart,
     so not added to NetBSD's pcidevs */
 @@ -595,6 +608,8 @@
  #define PCI_VENDOR_PINNACLE_NEW	0x11BD
  
  #define MODEL_IODATA_GV_BCTV3_PCI	0x4020
 +#define MODEL_TERRATVALUE_1118		0x1118
 +#define MODEL_TERRATVALUE_1134		0x1134
  
  void
  probeCard( bktr_ptr_t bktr, int verbose, int unit )
 @@ -739,6 +754,15 @@
  		    goto checkTuner;
  		}
  
 +		if ((subsystem_vendor_id == PCI_VENDOR_TERRATEC) &&
 +		    (subsystem_id == MODEL_TERRATVALUE_1134 ||
 +		    subsystem_id == MODEL_TERRATVALUE_1118)) {
 +		    bktr->card = cards[ (card = CARD_TERRATVALUE) ];
 +		    bktr->card.eepromAddr = eeprom_i2c_address;
 +		    bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
 +		    goto checkTuner;
 +		}
 +
  		/* Vendor is unknown. We will use the standard probe code */
  		/* which may not give best results */
  		printf("%s: Warning - card vendor 0x%04x (model 0x%04x) unknown.\n",
 @@ -1162,6 +1186,11 @@
  
  	case CARD_IO_BCTV3:
  	    select_tuner( bktr, ALPS_TSCH5 ); /* ALPS_TSCH6, in fact. */
 +	    goto checkDBX;
 +	    break;
 +
 +	case CARD_TERRATVALUE:
 +	    select_tuner( bktr, PHILIPS_PAL); /* Phlips PAL tuner */
  	    goto checkDBX;
  	    break;
  
 diff -ruN sys/dev/bktr.orig/bktr_card.h sys/dev/bktr/bktr_card.h
 --- sys/dev/bktr.orig/bktr_card.h	Sat Nov 12 12:19:40 2005
 +++ sys/dev/bktr/bktr_card.h	Sat Nov 12 12:21:01 2005
 @@ -80,8 +80,9 @@
  #define	CARD_AOPEN_VA1000	18
  #define CARD_PINNACLE_PCTV_RAVE	19
  #define CARD_PIXELVIEW_PLAYTV_PAK	20
 -#define Bt848_MAX_CARD		21
 -
 +#define CARD_TERRATVALUE	21
 +#define Bt848_MAX_CARD		22
 + 
  #define CARD_IO_GV		CARD_IO_BCTV2
  
  int	signCard( bktr_ptr_t bktr, int offset, int count, u_char* sig );
State-Changed-From-To: open->closed 
State-Changed-By: netchild 
State-Changed-When: Sun Nov 13 13:28:16 GMT 2005 
State-Changed-Why:  
Committed. Thank you. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=53383 
>Unformatted:
