Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Oct 2002 08:37:08 +0900 (JST)
From:      MOROHOSHI Akihiko <moro@remus.dti.ne.jp>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   i386/43879: [PATCH] bktr: add IO-DATA GV-BCTV3/PCI card support
Message-ID:  <200210092337.g99Nb8hh002736@chocolat.a-bao-a-que.kyagroup.com>

next in thread | raw e-mail | index | archive | help

>Number:         43879
>Category:       i386
>Synopsis:       [PATCH] bktr: add IO-DATA GV-BCTV3/PCI card support
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 09 16:40:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     MOROHOSHI Akihiko
>Release:        FreeBSD 4.7-RC i386
>Organization:
>Environment:
System: FreeBSD chocolat.a-bao-a-que.kyagroup.com 4.7-RC FreeBSD 4.7-RC #0: Mon Sep 30 10:43:41 JST 2002 moro@chocolat.a-bao-a-que.kyagroup.com:/home/obj/home/src/sys/CHOCOLAT i386


	
>Description:
a patch to add IO-DATA GV-BCTV3/PCI TV-tuner card support to bktr.
It is against 4.7-RC.

Changes are:

 * add BCTV3/PCI entry.
 * rename functions bctv_* to bctv2_* and macros BCTV_* to BCTV2_*
   for coexistance of BCTV2 and BCTV3.
 * rename CARD_IO_GV to CARD_TO_BCTV2.
 * add auto recognition of BCTV3/PCI.
>How-To-Repeat:
	
>Fix:
diff -urN -x *.orig bktr.orig/bktr_audio.c bktr/bktr_audio.c
--- bktr.orig/bktr_audio.c	Wed Nov  1 18:36:14 2000
+++ bktr/bktr_audio.c	Wed Oct  9 09:36:08 2002
@@ -85,13 +85,11 @@
 #endif
 
 /*
- * Prototypes for the GV_BCTV specific functions.
+ * Prototypes for the GV_BCTV2 specific functions.
  */
-void    set_bctv_audio( bktr_ptr_t bktr );
-void    bctv_gpio_write( bktr_ptr_t bktr, int port, int val );
-/*int   bctv_gpio_read( bktr_ptr_t bktr, int port );*/ /* Not used */
-
-
+void    set_bctv2_audio( bktr_ptr_t bktr );
+void    bctv2_gpio_write( bktr_ptr_t bktr, int port, int val );
+/*int   bctv2_gpio_read( bktr_ptr_t bktr, int port );*/ /* Not used */
 
 /*
  * init_audio_devices
@@ -171,8 +169,8 @@
 	 * audio source. The I/O_GV card has a more advanced multiplexer
 	 * and requires special handling.
 	 */
-        if ( bktr->bt848_card == CARD_IO_GV ) {
-                set_bctv_audio( bktr );
+        if ( bktr->bt848_card == CARD_IO_BCTV2 ) {
+                set_bctv2_audio( bktr );
                 return( 0 );
 	}
 
@@ -315,87 +313,87 @@
 }
 
 /*
- * CARD_GV_BCTV specific functions.
+ * CARD_GV_BCTV2 specific functions.
  */
 
-#define BCTV_AUDIO_MAIN              0x10    /* main audio program */
-#define BCTV_AUDIO_SUB               0x20    /* sub audio program */
-#define BCTV_AUDIO_BOTH              0x30    /* main(L) + sub(R) program */
-
-#define BCTV_GPIO_REG0          1
-#define BCTV_GPIO_REG1          3
-
-#define BCTV_GR0_AUDIO_MODE     3
-#define BCTV_GR0_AUDIO_MAIN     0       /* main program */
-#define BCTV_GR0_AUDIO_SUB      3       /* sub program */
-#define BCTV_GR0_AUDIO_BOTH     1       /* main(L) + sub(R) */
-#define BCTV_GR0_AUDIO_MUTE     4       /* audio mute */
-#define BCTV_GR0_AUDIO_MONO     8       /* force mono */
+#define BCTV2_AUDIO_MAIN              0x10    /* main audio program */
+#define BCTV2_AUDIO_SUB               0x20    /* sub audio program */
+#define BCTV2_AUDIO_BOTH              0x30    /* main(L) + sub(R) program */
+
+#define BCTV2_GPIO_REG0          1
+#define BCTV2_GPIO_REG1          3
+
+#define BCTV2_GR0_AUDIO_MODE     3
+#define BCTV2_GR0_AUDIO_MAIN     0       /* main program */
+#define BCTV2_GR0_AUDIO_SUB      3       /* sub program */
+#define BCTV2_GR0_AUDIO_BOTH     1       /* main(L) + sub(R) */
+#define BCTV2_GR0_AUDIO_MUTE     4       /* audio mute */
+#define BCTV2_GR0_AUDIO_MONO     8       /* force mono */
 
 void
-set_bctv_audio( bktr_ptr_t bktr )
+set_bctv2_audio( bktr_ptr_t bktr )
 {
         int data;
 
         switch (bktr->audio_mux_select) {
         case 1:         /* external */
         case 2:         /* internal */
-                bctv_gpio_write(bktr, BCTV_GPIO_REG1, 0);
+                bctv2_gpio_write(bktr, BCTV2_GPIO_REG1, 0);
                 break;
         default:        /* tuner */
-                bctv_gpio_write(bktr, BCTV_GPIO_REG1, 1);
+                bctv2_gpio_write(bktr, BCTV2_GPIO_REG1, 1);
                 break;
         }
 /*      switch (bktr->audio_sap_select) { */
-        switch (BCTV_AUDIO_BOTH) {
-        case BCTV_AUDIO_SUB:
-                data = BCTV_GR0_AUDIO_SUB;
+        switch (BCTV2_AUDIO_BOTH) {
+        case BCTV2_AUDIO_SUB:
+                data = BCTV2_GR0_AUDIO_SUB;
                 break;
-        case BCTV_AUDIO_BOTH:
-                data = BCTV_GR0_AUDIO_BOTH;
+        case BCTV2_AUDIO_BOTH:
+                data = BCTV2_GR0_AUDIO_BOTH;
                 break;
-        case BCTV_AUDIO_MAIN:
+        case BCTV2_AUDIO_MAIN:
         default:
-                data = BCTV_GR0_AUDIO_MAIN;
+                data = BCTV2_GR0_AUDIO_MAIN;
                 break;
         }
         if (bktr->audio_mute_state == TRUE)
-                data |= BCTV_GR0_AUDIO_MUTE;
+                data |= BCTV2_GR0_AUDIO_MUTE;
 
-        bctv_gpio_write(bktr, BCTV_GPIO_REG0, data);
+        bctv2_gpio_write(bktr, BCTV2_GPIO_REG0, data);
 
         return;
 }
 
 /* gpio_data bit assignment */
-#define BCTV_GPIO_ADDR_MASK     0x000300
-#define BCTV_GPIO_WE            0x000400
-#define BCTV_GPIO_OE            0x000800
-#define BCTV_GPIO_VAL_MASK      0x00f000
-
-#define BCTV_GPIO_PORT_MASK     3
-#define BCTV_GPIO_ADDR_SHIFT    8
-#define BCTV_GPIO_VAL_SHIFT     12
+#define BCTV2_GPIO_ADDR_MASK     0x000300
+#define BCTV2_GPIO_WE            0x000400
+#define BCTV2_GPIO_OE            0x000800
+#define BCTV2_GPIO_VAL_MASK      0x00f000
+
+#define BCTV2_GPIO_PORT_MASK     3
+#define BCTV2_GPIO_ADDR_SHIFT    8
+#define BCTV2_GPIO_VAL_SHIFT     12
 
 /* gpio_out_en value for read/write */
-#define BCTV_GPIO_OUT_RMASK     0x000f00
-#define BCTV_GPIO_OUT_WMASK     0x00ff00
+#define BCTV2_GPIO_OUT_RMASK     0x000f00
+#define BCTV2_GPIO_OUT_WMASK     0x00ff00
 
-#define BCTV_BITS       100
+#define BCTV2_BITS       100
 
 void
-bctv_gpio_write( bktr_ptr_t bktr, int port, int val )
+bctv2_gpio_write( bktr_ptr_t bktr, int port, int val )
 {
         u_long data, outbits;
 
-        port &= BCTV_GPIO_PORT_MASK;
+        port &= BCTV2_GPIO_PORT_MASK;
         switch (port) {
         case 1:
         case 3:
-                data = ((val << BCTV_GPIO_VAL_SHIFT) & BCTV_GPIO_VAL_MASK) |
-                       ((port << BCTV_GPIO_ADDR_SHIFT) & BCTV_GPIO_ADDR_MASK) |
-                       BCTV_GPIO_WE | BCTV_GPIO_OE;
-                outbits = BCTV_GPIO_OUT_WMASK;
+                data = ((val << BCTV2_GPIO_VAL_SHIFT) & BCTV2_GPIO_VAL_MASK) |
+                       ((port << BCTV2_GPIO_ADDR_SHIFT) & BCTV2_GPIO_ADDR_MASK) |
+                       BCTV2_GPIO_WE | BCTV2_GPIO_OE;
+                outbits = BCTV2_GPIO_OUT_WMASK;
                 break;
         default:
                 return;
@@ -403,28 +401,28 @@
         OUTL(bktr, BKTR_GPIO_OUT_EN, 0);
         OUTL(bktr, BKTR_GPIO_DATA, data);
         OUTL(bktr, BKTR_GPIO_OUT_EN, outbits);
-        DELAY(BCTV_BITS);
-        OUTL(bktr, BKTR_GPIO_DATA, data & ~BCTV_GPIO_WE);
-        DELAY(BCTV_BITS);
+        DELAY(BCTV2_BITS);
+        OUTL(bktr, BKTR_GPIO_DATA, data & ~BCTV2_GPIO_WE);
+        DELAY(BCTV2_BITS);
         OUTL(bktr, BKTR_GPIO_DATA, data);
-        DELAY(BCTV_BITS);
+        DELAY(BCTV2_BITS);
         OUTL(bktr, BKTR_GPIO_DATA, ~0);
         OUTL(bktr, BKTR_GPIO_OUT_EN, 0);
 }
 
 /* Not yet used
 int
-bctv_gpio_read( bktr_ptr_t bktr, int port )
+bctv2_gpio_read( bktr_ptr_t bktr, int port )
 {
         u_long data, outbits, ret;
 
-        port &= BCTV_GPIO_PORT_MASK;
+        port &= BCTV2_GPIO_PORT_MASK;
         switch (port) {
         case 1:
         case 3:
-                data = ((port << BCTV_GPIO_ADDR_SHIFT) & BCTV_GPIO_ADDR_MASK) |
-                       BCTV_GPIO_WE | BCTV_GPIO_OE;
-                outbits = BCTV_GPIO_OUT_RMASK;
+                data = ((port << BCTV2_GPIO_ADDR_SHIFT) & BCTV2_GPIO_ADDR_MASK) |
+                       BCTV2_GPIO_WE | BCTV2_GPIO_OE;
+                outbits = BCTV2_GPIO_OUT_RMASK;
                 break;
         default:
                 return( -1 );
@@ -432,16 +430,16 @@
         OUTL(bktr, BKTR_GPIO_OUT_EN, 0);
         OUTL(bktr, BKTR_GPIO_DATA, data);
         OUTL(bktr, BKTR_GPIO_OUT_EN, outbits);
-        DELAY(BCTV_BITS);
-        OUTL(bktr, BKTR_GPIO_DATA, data & ~BCTV_GPIO_OE);
-        DELAY(BCTV_BITS);
+        DELAY(BCTV2_BITS);
+        OUTL(bktr, BKTR_GPIO_DATA, data & ~BCTV2_GPIO_OE);
+        DELAY(BCTV2_BITS);
         ret = INL(bktr, BKTR_GPIO_DATA);
-        DELAY(BCTV_BITS);
+        DELAY(BCTV2_BITS);
         OUTL(bktr, BKTR_GPIO_DATA, data);
-        DELAY(BCTV_BITS);
+        DELAY(BCTV2_BITS);
         OUTL(bktr, BKTR_GPIO_DATA, ~0);
         OUTL(bktr, BKTR_GPIO_OUT_EN, 0);
-        return( (ret & BCTV_GPIO_VAL_MASK) >> BCTV_GPIO_VAL_SHIFT );
+        return( (ret & BCTV2_GPIO_VAL_MASK) >> BCTV2_GPIO_VAL_SHIFT );
 }
 */
 
diff -urN -x *.orig bktr.orig/bktr_card.c bktr/bktr_card.c
--- bktr.orig/bktr_card.c	Wed Nov  1 18:36:14 2000
+++ bktr/bktr_card.c	Wed Oct  9 09:38:50 2002
@@ -245,7 +245,7 @@
            { 0x01, 0x02, 0x01, 0x00, 1 },	/* audio MUX values */
 	   0x0f },				/* GPIO mask */
 
-        {  CARD_IO_GV,                          /* the card id */
+        {  CARD_IO_BCTV2,                       /* the card id */
           "I/O DATA GV-BCTV2/PCI",              /* the 'name' */
            NULL,                                /* the tuner */
            0,                                   /* the tuner i2c address */
@@ -342,11 +342,24 @@
            { 0x20000, 0x00000, 0x30000, 0x40000, 1 }, /* audio MUX values*/
            0x70000 },                           /* GPIO mask */
 
+        {  CARD_IO_BCTV3,                       /* the card id */
+          "I/O DATA GV-BCTV3/PCI",              /* 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 */
+	   { 0x10000, 0, 0x10000, 0, 1 },	/* audio MUX values */
+	   0x10f00 },				/* GPIO mask */
+
 };
 
 struct bt848_card_sig bt848_card_signature[1]= {
   /* IMS TURBO TV : card 5 */
-    {  5,9, {00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 02, 00, 00, 00}}
+    {  5,9, {00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 02, 00, 00, 00, 00}}
 
 
 };
@@ -540,7 +553,9 @@
 #define PCI_VENDOR_FLYVIDEO	0x1851
 #define PCI_VENDOR_FLYVIDEO_2	0x1852
 #define PCI_VENDOR_PINNACLE_ALT	0xBD11
+#define PCI_VENDOR_IODATA	0x10fc
 
+#define MODEL_IODATA_GV_BCTV3_PCI	0x4020
 
 void
 probeCard( bktr_ptr_t bktr, int verbose, int unit )
@@ -674,6 +689,14 @@
                     goto checkTuner;
                 }
 
+		if (subsystem_vendor_id == 0x10fc &&
+		    subsystem_id == 0x4020) {
+		    bktr->card = cards[ (card = CARD_IO_BCTV3) ];
+		    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",
@@ -1083,6 +1106,11 @@
 	    select_tuner( bktr, PHILIPS_FR1236_NTSC );
 #endif
             goto checkDBX;
+	    break;
+
+	case CARD_IO_BCTV3:
+	    select_tuner( bktr, ALPS_TSCH5 ); /* ALPS_TSCH6, in fact. */
+	    goto checkDBX;
 	    break;
 
 	} /* end switch(card) */
diff -urN -x *.orig bktr.orig/bktr_card.h bktr/bktr_card.h
--- bktr.orig/bktr_card.h	Mon Sep 11 16:59:57 2000
+++ bktr/bktr_card.h	Sat Oct  5 18:32:02 2002
@@ -68,7 +68,7 @@
 #define CARD_AVER_MEDIA		6
 #define CARD_OSPREY		7
 #define CARD_NEC_PK		8
-#define CARD_IO_GV		9
+#define CARD_IO_BCTV2		9
 #define CARD_FLYVIDEO		10
 #define CARD_ZOLTRIX		11
 #define CARD_KISS		12
@@ -76,7 +76,8 @@
 #define CARD_ASKEY_DYNALINK_MAGIC_TVIEW	14
 #define CARD_LEADTEK		15
 #define CARD_TERRATVPLUS	16
-#define Bt848_MAX_CARD		17
+#define CARD_IO_BCTV3		17
+#define Bt848_MAX_CARD		18
 
 
 int	signCard( bktr_ptr_t bktr, int offset, int count, u_char* sig );

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210092337.g99Nb8hh002736>