Update the bktr driver to match the current state of FreeBSD-current,
authorSimon Schubert <corecode@dragonflybsd.org>
Sat, 12 Mar 2005 11:35:27 +0000 (11:35 +0000)
committerSimon Schubert <corecode@dragonflybsd.org>
Sat, 12 Mar 2005 11:35:27 +0000 (11:35 +0000)
apart from changes that are purely to suit FreeBSD changes. It adds support
for three new cards (including the MT2032 tuner) and has some long -> uint32_t
changes that (according to the commit log) make it work on AMD64.

Obtained-from: FreeBSD
Submitted-by: Steve O'Hara-Smith <steve at sohara.org>
sys/dev/video/bktr/bktr_card.c
sys/dev/video/bktr/bktr_card.h
sys/dev/video/bktr/bktr_core.c
sys/dev/video/bktr/bktr_mem.c
sys/dev/video/bktr/bktr_tuner.c
sys/dev/video/bktr/bktr_tuner.h
sys/dev/video/bktr/msp34xx.c

index 062294e..347caf8 100644 (file)
@@ -30,8 +30,8 @@
  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/bktr/bktr_card.c,v 1.23 2003/12/08 07:59:18 obrien Exp $
- * $DragonFly: src/sys/dev/video/bktr/bktr_card.c,v 1.7 2004/09/20 04:10:44 dillon Exp $
+ * $FreeBSD: src/sys/dev/bktr/bktr_card.c,v 1.32 2005/02/10 22:38:51 julian Exp $
+ * $DragonFly: src/sys/dev/video/bktr/bktr_card.c,v 1.8 2005/03/12 11:35:27 corecode Exp $
  */
 
 /*
@@ -346,6 +346,42 @@ static const struct CARDTYPE cards[] = {
           { 0x500, 0, 0x300, 0x900, 0x900 },   /* audio MUX values */
           0x10f00 },                           /* GPIO mask */
 
+       {  CARD_AOPEN_VA1000,                   /* the card id */
+         "AOpen VA1000",                       /* the 'name' */
+          NULL,                                /* the tuner */
+          0,                                   /* the tuner i2c address */
+          0,                                   /* dbx is optional */
+          0,
+          0,
+          0,                                   /* EEProm unknown */
+          0,                                   /* size unknown */
+          { 0x02, 0x00, 0x00, 0x00, 1 },       /* audio MUX values */
+          0x18e0 },                            /* GPIO mask */
+
+       {  CARD_PINNACLE_PCTV_RAVE,             /* the card id */
+         "Pinnacle PCTV Rave",                 /* the 'name' */
+          NULL,                                /* the tuner */
+          0,                                   /* the tuner i2c address */
+          0,                                   /* dbx unknown */
+          0,
+          0,
+          0,                                   /* EEProm unknown */
+          0,                                   /* size unknown */
+          { 0x02, 0x01, 0x00, 0x0a, 1 },       /* audio MUX values */
+          0x03000F },                          /* GPIO mask */
+
+        {  CARD_PIXELVIEW_PLAYTV_PAK,       /* the card id */
+           "PixelView PlayTV Pak",              /* the 'name' */
+            NULL,                               /* the tuner */
+            0,                                  /* the tuner i2c address */
+            0,                                  /* dbx is optional */
+            0,
+            0,
+            PFC8582_WADDR,                      /* EEProm type */
+            (u_char)(256 / EEPROMBLOCKSIZE),    /* 256 bytes */
+            { 0x20000, 0x80000, 0, 0xa8000, 1 },        /* audio MUX values */
+            0xAA0000 },                         /* GPIO mask */
+
 };
 
 struct bt848_card_sig bt848_card_signature[1]= {
@@ -540,8 +576,9 @@ static int locate_eeprom_address( bktr_ptr_t bktr) {
 #define PCI_VENDOR_LEADTEK_ALT_3       0x107d
 #define PCI_VENDOR_FLYVIDEO    0x1851
 #define PCI_VENDOR_FLYVIDEO_2  0x1852
-#define PCI_VENDOR_PINNACLE_ALT        0xBD11
 #define PCI_VENDOR_IODATA      0x10fc
+#define PCI_VENDOR_PINNACLE_ALT        0xBD11  /* They got their own ID backwards? */
+#define PCI_VENDOR_PINNACLE_NEW        0x11BD
 
 #define MODEL_IODATA_GV_BCTV3_PCI      0x4020
 
@@ -672,7 +709,8 @@ probeCard( bktr_ptr_t bktr, int verbose, int unit )
                     goto checkTuner;
                 }
 
-               if (subsystem_vendor_id == PCI_VENDOR_PINNACLE_ALT) {
+               if (subsystem_vendor_id == PCI_VENDOR_PINNACLE_ALT ||
+                   subsystem_vendor_id == PCI_VENDOR_PINNACLE_NEW) {
                     bktr->card = cards[ (card = CARD_MIRO) ];
                    bktr->card.eepromAddr = eeprom_i2c_address;
                    bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
@@ -825,6 +863,12 @@ checkEEPROM:
 
 checkTuner:
 
+       if (card == CARD_MIRO && mt2032_init(bktr) == 0) {
+               bktr->card = cards[ (card = CARD_PINNACLE_PCTV_RAVE) ];
+               select_tuner( bktr, TUNER_MT2032 );
+               goto checkDBX;
+       }
+
        /* look for a tuner */
        tuner_i2c_address = locate_tuner_address( bktr );
        if ( tuner_i2c_address == -1 ) {
index e86e191..841749e 100644 (file)
@@ -1,5 +1,5 @@
-/* $FreeBSD: src/sys/dev/bktr/bktr_card.h,v 1.6 2003/02/02 17:46:00 orion Exp $ */
-/* $DragonFly: src/sys/dev/video/bktr/bktr_card.h,v 1.3 2004/05/15 17:54:12 joerg Exp $ */
+/* $FreeBSD: src/sys/dev/bktr/bktr_card.h,v 1.11 2005/01/06 01:42:31 imp Exp */
+/* $DragonFly: src/sys/dev/video/bktr/bktr_card.h,v 1.4 2005/03/12 11:35:27 corecode Exp $ */
 
 /*
  * This is part of the Driver for Video Capture Cards (Frame grabbers)
 #define CARD_TERRATVPLUS       16
 #define CARD_IO_BCTV3          17
 #define CARD_TERRATEC_TVALUE   18
-#define Bt848_MAX_CARD         19
+#define CARD_AOPEN_VA1000       19
+#define CARD_PINNACLE_PCTV_RAVE 20
+#define CARD_PIXELVIEW_PLAYTV_PAK 21
+#define Bt848_MAX_CARD         22
 
 #define CARD_IO_GV             CARD_IO_BCTV2
 
index 3841501..e3e43f0 100644 (file)
@@ -61,8 +61,8 @@
  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/bktr/bktr_core.c,v 1.133 2003/12/08 07:59:18 obrien Exp $
- * $DragonFly: src/sys/dev/video/bktr/bktr_core.c,v 1.13 2004/05/15 17:54:12 joerg Exp $
+ * $FreeBSD: src/sys/dev/bktr/bktr_core.c,v 1.138 2005/01/09 17:42:03 cognet Exp
+ * $DragonFly: src/sys/dev/video/bktr/bktr_core.c,v 1.14 2005/03/12 11:35:27 corecode Exp $
  */
 
 /*
@@ -348,7 +348,7 @@ static void build_dma_prog( bktr_ptr_t bktr, char i_flag );
 
 static bool_t   getline(bktr_reg_t *, int);
 static bool_t   notclipped(bktr_reg_t * , int , int);     
-static bool_t   split(bktr_reg_t *, volatile u_long **, int, u_long, int, 
+static bool_t   split(bktr_reg_t *, volatile uint32_t **, int, u_long, int, 
                      volatile u_char ** , int  );
 
 static void    start_capture( bktr_ptr_t bktr, unsigned type );
@@ -2552,7 +2552,7 @@ static bool_t getline(bktr_reg_t *bktr, int x ) {
     return FALSE;
 }
     
-static bool_t split(bktr_reg_t * bktr, volatile u_long **dma_prog, int width ,
+static bool_t split(bktr_reg_t * bktr, volatile uint32_t **dma_prog, int width ,
                    u_long operation, int pixel_width,
                    volatile u_char ** target_buffer, int cols ) {
 
@@ -2642,11 +2642,11 @@ static void
 rgb_vbi_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace )
 {
        int                     i;
-       volatile u_long         target_buffer, buffer, target,width;
-       volatile u_long         pitch;
-       volatile u_long         *dma_prog;      /* DMA prog is an array of 
+       volatile uint32_t       target_buffer, buffer, target,width;
+       volatile uint32_t       pitch;
+       volatile uint32_t       *dma_prog;      /* DMA prog is an array of 
                                                32 bit RISC instructions */
-       volatile u_long         *loop_point;
+       volatile uint32_t       *loop_point;
         struct meteor_pixfmt_internal *pf_int = &pixfmt_table[ bktr->pixfmt ];
        u_int                   Bpp = pf_int->public.Bpp;
        unsigned int            vbisamples;     /* VBI samples per line */
@@ -2682,7 +2682,7 @@ rgb_vbi_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace )
        }
        bktr->capcontrol = 3 << 2 |  3;
 
-       dma_prog = (u_long *) bktr->dma_prog;
+       dma_prog = (uint32_t *) bktr->dma_prog;
 
        /* Construct Write */
 
@@ -2724,19 +2724,19 @@ rgb_vbi_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace )
                for (i = 0; i < (rows/interlace); i++) {
                    target = target_buffer;
                    if ( notclipped(bktr, i, width)) {
-                       split(bktr, (volatile u_long **) &dma_prog,
+                       split(bktr, (volatile uint32_t **) &dma_prog,
                              bktr->y2 - bktr->y, OP_WRITE,
                              Bpp, (volatile u_char **)(uintptr_t)&target,  cols);
        
                    } else {
                        while(getline(bktr, i)) {
                            if (bktr->y != bktr->y2 ) {
-                               split(bktr, (volatile u_long **) &dma_prog,
+                               split(bktr, (volatile uint32_t **) &dma_prog,
                                      bktr->y2 - bktr->y, OP_WRITE,
                                      Bpp, (volatile u_char **)(uintptr_t)&target, cols);
                            }
                            if (bktr->yclip != bktr->yclip2 ) {
-                               split(bktr,(volatile u_long **) &dma_prog,
+                               split(bktr,(volatile uint32_t **) &dma_prog,
                                      bktr->yclip2 - bktr->yclip,
                                      OP_SKIP,
                                      Bpp, (volatile u_char **)(uintptr_t)&target,  cols);
@@ -2781,19 +2781,19 @@ rgb_vbi_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace )
                for (i = 0; i < (rows/interlace); i++) {
                    target = target_buffer;
                    if ( notclipped(bktr, i, width)) {
-                       split(bktr, (volatile u_long **) &dma_prog,
+                       split(bktr, (volatile uint32_t **) &dma_prog,
                              bktr->y2 - bktr->y, OP_WRITE,
                              Bpp, (volatile u_char **)(uintptr_t)&target,  cols);
                    } else {
                        while(getline(bktr, i)) {
                            if (bktr->y != bktr->y2 ) {
-                               split(bktr, (volatile u_long **) &dma_prog,
+                               split(bktr, (volatile uint32_t **) &dma_prog,
                                      bktr->y2 - bktr->y, OP_WRITE,
                                      Bpp, (volatile u_char **)(uintptr_t)&target,
                                      cols);
                            }   
                            if (bktr->yclip != bktr->yclip2 ) {
-                               split(bktr, (volatile u_long **) &dma_prog,
+                               split(bktr, (volatile uint32_t **) &dma_prog,
                                      bktr->yclip2 - bktr->yclip, OP_SKIP,
                                      Bpp, (volatile u_char **)(uintptr_t) &target,  cols);
                            }   
@@ -2824,9 +2824,9 @@ static void
 rgb_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace )
 {
        int                     i;
-       volatile u_long         target_buffer, buffer, target,width;
-       volatile u_long         pitch;
-       volatile  u_long        *dma_prog;
+       volatile uint32_t               target_buffer, buffer, target,width;
+       volatile uint32_t       pitch;
+       volatile  uint32_t      *dma_prog;
         struct meteor_pixfmt_internal *pf_int = &pixfmt_table[ bktr->pixfmt ];
        u_int                   Bpp = pf_int->public.Bpp;
 
@@ -2854,16 +2854,16 @@ rgb_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace )
        }
        bktr->capcontrol = 3 << 2 |  3;
 
-       dma_prog = (u_long *) bktr->dma_prog;
+       dma_prog = (uint32_t *) bktr->dma_prog;
 
        /* Construct Write */
 
        if (bktr->video.addr) {
-               target_buffer = (u_long) bktr->video.addr;
+               target_buffer = (uint32_t) bktr->video.addr;
                pitch = bktr->video.width;
        }
        else {
-               target_buffer = (u_long) vtophys(bktr->bigbuf);
+               target_buffer = (uint32_t) vtophys(bktr->bigbuf);
                pitch = cols*Bpp;
        }
 
@@ -2878,19 +2878,19 @@ rgb_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace )
        for (i = 0; i < (rows/interlace); i++) {
            target = target_buffer;
            if ( notclipped(bktr, i, width)) {
-               split(bktr, (volatile u_long **) &dma_prog,
+               split(bktr, (volatile uint32_t **) &dma_prog,
                      bktr->y2 - bktr->y, OP_WRITE,
                      Bpp, (volatile u_char **)(uintptr_t)&target,  cols);
 
            } else {
                while(getline(bktr, i)) {
                    if (bktr->y != bktr->y2 ) {
-                       split(bktr, (volatile u_long **) &dma_prog,
+                       split(bktr, (volatile uint32_t **) &dma_prog,
                              bktr->y2 - bktr->y, OP_WRITE,
                              Bpp, (volatile u_char **)(uintptr_t)&target, cols);
                    }
                    if (bktr->yclip != bktr->yclip2 ) {
-                       split(bktr,(volatile u_long **) &dma_prog,
+                       split(bktr,(volatile uint32_t **) &dma_prog,
                              bktr->yclip2 - bktr->yclip,
                              OP_SKIP,
                              Bpp, (volatile u_char **)(uintptr_t)&target,  cols);
@@ -2910,7 +2910,7 @@ rgb_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace )
                *dma_prog++ = 0;  /* NULL WORD */
 
                *dma_prog++ = OP_JUMP;
-               *dma_prog++ = (u_long ) vtophys(bktr->dma_prog);
+               *dma_prog++ = (uint32_t ) vtophys(bktr->dma_prog);
                return;
 
        case 2:
@@ -2919,7 +2919,7 @@ rgb_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace )
                *dma_prog++ = 0;  /* NULL WORD */
 
                *dma_prog++ = OP_JUMP;
-               *dma_prog++ = (u_long ) vtophys(bktr->dma_prog);
+               *dma_prog++ = (uint32_t ) vtophys(bktr->dma_prog);
                return;
 
        case 3:
@@ -2927,7 +2927,7 @@ rgb_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace )
                *dma_prog++ = OP_SYNC | BKTR_GEN_IRQ | BKTR_RESYNC | BKTR_VRO;
                *dma_prog++ = 0;  /* NULL WORD */
                *dma_prog++ = OP_JUMP; ;
-               *dma_prog = (u_long ) vtophys(bktr->odd_dma_prog);
+               *dma_prog = (uint32_t ) vtophys(bktr->odd_dma_prog);
                break;
        }
 
@@ -2935,7 +2935,7 @@ rgb_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace )
 
                target_buffer = buffer + pitch; 
 
-               dma_prog = (u_long *) bktr->odd_dma_prog;
+               dma_prog = (uint32_t *) bktr->odd_dma_prog;
 
                /* sync vre IRQ bit */
                *dma_prog++ = OP_SYNC | BKTR_RESYNC | BKTR_FM1;
@@ -2944,19 +2944,19 @@ rgb_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace )
                for (i = 0; i < (rows/interlace); i++) {
                    target = target_buffer;
                    if ( notclipped(bktr, i, width)) {
-                       split(bktr, (volatile u_long **) &dma_prog,
+                       split(bktr, (volatile uint32_t **) &dma_prog,
                              bktr->y2 - bktr->y, OP_WRITE,
                              Bpp, (volatile u_char **)(uintptr_t)&target,  cols);
                    } else {
                        while(getline(bktr, i)) {
                            if (bktr->y != bktr->y2 ) {
-                               split(bktr, (volatile u_long **) &dma_prog,
+                               split(bktr, (volatile uint32_t **) &dma_prog,
                                      bktr->y2 - bktr->y, OP_WRITE,
                                      Bpp, (volatile u_char **)(uintptr_t)&target,
                                      cols);
                            }   
                            if (bktr->yclip != bktr->yclip2 ) {
-                               split(bktr, (volatile u_long **) &dma_prog,
+                               split(bktr, (volatile uint32_t **) &dma_prog,
                                      bktr->yclip2 - bktr->yclip, OP_SKIP,
                                      Bpp, (volatile u_char **)(uintptr_t)&target,  cols);
                            }   
@@ -2974,7 +2974,7 @@ rgb_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace )
        *dma_prog++ = OP_SYNC | BKTR_GEN_IRQ | BKTR_RESYNC | BKTR_VRE;
        *dma_prog++ = 0;  /* NULL WORD */
        *dma_prog++ = OP_JUMP ;
-       *dma_prog++ = (u_long ) vtophys(bktr->dma_prog) ;
+       *dma_prog++ = (uint32_t ) vtophys(bktr->dma_prog) ;
        *dma_prog++ = 0;  /* NULL WORD */
 }
 
@@ -2989,8 +2989,8 @@ yuvpack_prog( bktr_ptr_t bktr, char i_flag,
        int                     i;
        volatile unsigned int   inst;
        volatile unsigned int   inst3;
-       volatile u_long         target_buffer, buffer;
-       volatile  u_long        *dma_prog;
+       volatile uint32_t       target_buffer, buffer;
+       volatile  uint32_t      *dma_prog;
         struct meteor_pixfmt_internal *pf_int = &pixfmt_table[ bktr->pixfmt ];
        int                     b;
 
@@ -3005,7 +3005,7 @@ yuvpack_prog( bktr_ptr_t bktr, char i_flag,
        bktr->capcontrol =   1 << 6 | 1 << 4 | 1 << 2 | 3;
        bktr->capcontrol = 3 << 2 |  3;
 
-       dma_prog = (u_long *) bktr->dma_prog;
+       dma_prog = (uint32_t *) bktr->dma_prog;
 
        /* Construct Write */
     
@@ -3015,9 +3015,9 @@ yuvpack_prog( bktr_ptr_t bktr, char i_flag,
        inst3 = OP_WRITE | OP_EOL | (cols);
 
        if (bktr->video.addr)
-               target_buffer = (u_long) bktr->video.addr;
+               target_buffer = (uint32_t) bktr->video.addr;
        else
-               target_buffer = (u_long) vtophys(bktr->bigbuf);
+               target_buffer = (uint32_t) vtophys(bktr->bigbuf);
 
        buffer = target_buffer;
 
@@ -3043,7 +3043,7 @@ yuvpack_prog( bktr_ptr_t bktr, char i_flag,
                *dma_prog++ = 0;  /* NULL WORD */
 
                *dma_prog++ = OP_JUMP;
-               *dma_prog++ = (u_long ) vtophys(bktr->dma_prog);
+               *dma_prog++ = (uint32_t) vtophys(bktr->dma_prog);
                return;
 
        case 2:
@@ -3051,7 +3051,7 @@ yuvpack_prog( bktr_ptr_t bktr, char i_flag,
                *dma_prog++ = OP_SYNC  | BKTR_GEN_IRQ | BKTR_VRO;
                *dma_prog++ = 0;  /* NULL WORD */
                *dma_prog++ = OP_JUMP;
-               *dma_prog++ = (u_long ) vtophys(bktr->dma_prog);
+               *dma_prog++ = (uint32_t) vtophys(bktr->dma_prog);
                return;
 
        case 3:
@@ -3059,15 +3059,15 @@ yuvpack_prog( bktr_ptr_t bktr, char i_flag,
                *dma_prog++ = OP_SYNC | BKTR_GEN_IRQ | BKTR_RESYNC | BKTR_VRO;
                *dma_prog++ = 0;  /* NULL WORD */
                *dma_prog++ = OP_JUMP  ;
-               *dma_prog = (u_long ) vtophys(bktr->odd_dma_prog);
+               *dma_prog = (uint32_t) vtophys(bktr->odd_dma_prog);
                break;
        }
 
        if (interlace == 2) {
 
-               target_buffer =  (u_long) buffer + cols*2;
+               target_buffer =  (uint32_t) buffer + cols*2;
 
-               dma_prog = (u_long * ) bktr->odd_dma_prog;
+               dma_prog = (uint32_t *) bktr->odd_dma_prog;
 
                /* sync vre */
                *dma_prog++ = OP_SYNC | BKTR_RESYNC | BKTR_FM1;
@@ -3086,10 +3086,10 @@ yuvpack_prog( bktr_ptr_t bktr, char i_flag,
        *dma_prog++ = OP_SYNC   |  BKTR_GEN_IRQ  | BKTR_RESYNC |  BKTR_VRE;
        *dma_prog++ = 0;  /* NULL WORD */
        *dma_prog++ = OP_JUMP ;
-       *dma_prog++ = (u_long ) vtophys(bktr->dma_prog);
+       *dma_prog++ = (uint32_t) vtophys(bktr->dma_prog);
 
        *dma_prog++ = OP_JUMP;
-       *dma_prog++ = (u_long ) vtophys(bktr->dma_prog);
+       *dma_prog++ = (uint32_t) vtophys(bktr->dma_prog);
        *dma_prog++ = 0;  /* NULL WORD */
 }
 
@@ -3103,13 +3103,13 @@ yuv422_prog( bktr_ptr_t bktr, char i_flag,
 
        int                     i;
        volatile unsigned int   inst;
-       volatile u_long         target_buffer, t1, buffer;
-       volatile u_long         *dma_prog;
+       volatile uint32_t       target_buffer, t1, buffer;
+       volatile uint32_t       *dma_prog;
         struct meteor_pixfmt_internal *pf_int = &pixfmt_table[ bktr->pixfmt ];
 
        OUTB(bktr, BKTR_COLOR_FMT, pf_int->color_fmt);
 
-       dma_prog = (u_long *) bktr->dma_prog;
+       dma_prog = (uint32_t*) bktr->dma_prog;
 
        bktr->capcontrol =   1 << 6 | 1 << 4 |  3;
 
@@ -3133,9 +3133,9 @@ yuv422_prog( bktr_ptr_t bktr, char i_flag,
        /* Construct Write */
        inst  = OP_WRITE123  | OP_SOL | OP_EOL |  (cols); 
        if (bktr->video.addr)
-               target_buffer = (u_long) bktr->video.addr;
+               target_buffer = (uint32_t) bktr->video.addr;
        else
-               target_buffer = (u_long) vtophys(bktr->bigbuf);
+               target_buffer = (uint32_t) vtophys(bktr->bigbuf);
     
        buffer = target_buffer;
 
@@ -3160,7 +3160,7 @@ yuv422_prog( bktr_ptr_t bktr, char i_flag,
                *dma_prog++ = 0;  /* NULL WORD */
 
                *dma_prog++ = OP_JUMP ;
-               *dma_prog++ = (u_long ) vtophys(bktr->dma_prog);
+               *dma_prog++ = (uint32_t) vtophys(bktr->dma_prog);
                return;
 
        case 2:
@@ -3168,7 +3168,7 @@ yuv422_prog( bktr_ptr_t bktr, char i_flag,
                *dma_prog++ = 0;  /* NULL WORD */
 
                *dma_prog++ = OP_JUMP;
-               *dma_prog++ = (u_long ) vtophys(bktr->dma_prog);
+               *dma_prog++ = (uint32_t) vtophys(bktr->dma_prog);
                return;
 
        case 3:
@@ -3176,15 +3176,15 @@ yuv422_prog( bktr_ptr_t bktr, char i_flag,
                *dma_prog++ = 0;  /* NULL WORD */
 
                *dma_prog++ = OP_JUMP  ;
-               *dma_prog = (u_long ) vtophys(bktr->odd_dma_prog);
+               *dma_prog = (uint32_t) vtophys(bktr->odd_dma_prog);
                break;
        }
 
        if (interlace == 2) {
 
-               dma_prog = (u_long * ) bktr->odd_dma_prog;
+               dma_prog = (uint32_t *) bktr->odd_dma_prog;
 
-               target_buffer  = (u_long) buffer + cols;
+               target_buffer  = (uint32_t) buffer + cols;
                t1 = buffer + cols/2;
                *dma_prog++ = OP_SYNC   |   1 << 15 | BKTR_FM3; 
                *dma_prog++ = 0;  /* NULL WORD */
@@ -3202,7 +3202,7 @@ yuv422_prog( bktr_ptr_t bktr, char i_flag,
        *dma_prog++ = OP_SYNC  | 1 << 24 | 1 << 15 |   BKTR_VRE; 
        *dma_prog++ = 0;  /* NULL WORD */
        *dma_prog++ = OP_JUMP ;
-       *dma_prog++ = (u_long ) vtophys(bktr->dma_prog) ;
+       *dma_prog++ = (uint32_t) vtophys(bktr->dma_prog) ;
        *dma_prog++ = 0;  /* NULL WORD */
 }
 
@@ -3217,13 +3217,13 @@ yuv12_prog( bktr_ptr_t bktr, char i_flag,
        int                     i;
        volatile unsigned int   inst;
        volatile unsigned int   inst1;
-       volatile u_long         target_buffer, t1, buffer;
-       volatile u_long         *dma_prog;
+       volatile uint32_t       target_buffer, t1, buffer;
+       volatile uint32_t       *dma_prog;
         struct meteor_pixfmt_internal *pf_int = &pixfmt_table[ bktr->pixfmt ];
 
        OUTB(bktr, BKTR_COLOR_FMT, pf_int->color_fmt);
 
-       dma_prog = (u_long *) bktr->dma_prog;
+       dma_prog = (uint32_t *) bktr->dma_prog;
 
        bktr->capcontrol =   1 << 6 | 1 << 4 |  3;
 
@@ -3234,9 +3234,9 @@ yuv12_prog( bktr_ptr_t bktr, char i_flag,
        inst  = OP_WRITE123  | OP_SOL | OP_EOL |  (cols); 
        inst1  = OP_WRITES123  | OP_SOL | OP_EOL |  (cols); 
        if (bktr->video.addr)
-               target_buffer = (u_long) bktr->video.addr;
+               target_buffer = (uint32_t) bktr->video.addr;
        else
-               target_buffer = (u_long) vtophys(bktr->bigbuf);
+               target_buffer = (uint32_t) vtophys(bktr->bigbuf);
      
        buffer = target_buffer;
        t1 = buffer;
@@ -3264,7 +3264,7 @@ yuv12_prog( bktr_ptr_t bktr, char i_flag,
                *dma_prog++ = 0;  /* NULL WORD */
 
                *dma_prog++ = OP_JUMP;
-               *dma_prog++ = (u_long ) vtophys(bktr->dma_prog);
+               *dma_prog++ = (uint32_t) vtophys(bktr->dma_prog);
                return;
 
        case 2:
@@ -3272,22 +3272,22 @@ yuv12_prog( bktr_ptr_t bktr, char i_flag,
                *dma_prog++ = 0;  /* NULL WORD */
 
                *dma_prog++ = OP_JUMP;
-               *dma_prog++ = (u_long ) vtophys(bktr->dma_prog);
+               *dma_prog++ = (uint32_t) vtophys(bktr->dma_prog);
                return;
  
        case 3:
                *dma_prog++ = OP_SYNC |  1 << 24 | 1 << 15 | BKTR_VRO;
                *dma_prog++ = 0;  /* NULL WORD */
                *dma_prog++ = OP_JUMP ;
-               *dma_prog = (u_long ) vtophys(bktr->odd_dma_prog);
+               *dma_prog = (uint32_t) vtophys(bktr->odd_dma_prog);
                break;
        }
 
        if (interlace == 2) {
 
-               dma_prog = (u_long * ) bktr->odd_dma_prog;
+               dma_prog = (uint32_t *) bktr->odd_dma_prog;
 
-               target_buffer  = (u_long) buffer + cols;
+               target_buffer  = (uint32_t) buffer + cols;
                t1 = buffer + cols/2;
                *dma_prog++ = OP_SYNC   | 1 << 15 | BKTR_FM3; 
                *dma_prog++ = 0;  /* NULL WORD */
@@ -3312,7 +3312,7 @@ yuv12_prog( bktr_ptr_t bktr, char i_flag,
        *dma_prog++ = OP_SYNC |  1 << 24 | 1 << 15 | BKTR_VRE;
        *dma_prog++ = 0;  /* NULL WORD */
        *dma_prog++ = OP_JUMP;
-       *dma_prog++ = (u_long ) vtophys(bktr->dma_prog);
+       *dma_prog++ = (uint32_t) vtophys(bktr->dma_prog);
        *dma_prog++ = 0;  /* NULL WORD */
 }
   
@@ -3768,7 +3768,7 @@ i2cRead( bktr_ptr_t bktr, int addr )
        return ((int)((unsigned char)result));
 }
 
-#define IICBUS(bktr) ((bktr)->i2c_sc.iicbus)
+#define IICBUS(bktr) ((bktr)->i2c_sc.iicbb)
 
 /* The MSP34xx and DPL35xx Audio chip require i2c bus writes of up */
 /* to 5 bytes which the bt848 automated i2c bus controller cannot handle */
index 3defaba..5a1f636 100644 (file)
@@ -1,5 +1,5 @@
-/* $FreeBSD: src/sys/dev/bktr/bktr_mem.c,v 1.7 2003/08/24 17:46:02 obrien Exp $ */
-/* $DragonFly: src/sys/dev/video/bktr/bktr_mem.c,v 1.5 2004/05/15 17:54:12 joerg Exp $ */
+/* $FreeBSD: src/sys/dev/bktr/bktr_mem.c,v 1.13 2005/01/27 01:40:12 imp Exp */
+/* $DragonFly: src/sys/dev/video/bktr/bktr_mem.c,v 1.6 2005/03/12 11:35:27 corecode Exp $ */
 
 /*
  * This is prt of the Driver for Video Capture Cards (Frame grabbers)
@@ -105,8 +105,8 @@ void
 bktr_store_address(int unit, int type, vm_offset_t addr) {
 
        if ((unit < 0) || (unit >= BKTR_MEM_MAX_DEVICES)) {
-               printf("bktr_mem: Unit number %d invalid for memory type %d, address 0x%x\n"
-                      ,unit,type,addr);
+               printf("bktr_mem: Unit number %d invalid for memory type %d, address %p\n"
+                      ,unit,type,(void *)addr);
                return;
        }
 
@@ -126,8 +126,8 @@ bktr_store_address(int unit, int type, vm_offset_t addr) {
                case BKTR_MEM_BUF:          memory_list[unit].buf = addr;
                                            memory_list[unit].addresses_stored = 1;
                                            break;
-               default:                    printf("bktr_mem: Invalid memory type %d for bktr%d, address 0x%xn",
-                                                  type,unit,addr);
+               default:                    printf("bktr_mem: Invalid memory type %d for bktr%d, address %p\n",
+                                                  type,unit,(void *)addr);
                                            break;
        }
 }
index 8383a2d..7923329 100644 (file)
@@ -30,8 +30,8 @@
  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/bktr/bktr_tuner.c,v 1.12 2003/12/08 07:59:18 obrien Exp $
- * $DragonFly: src/sys/dev/video/bktr/bktr_tuner.c,v 1.6 2004/05/15 17:54:13 joerg Exp $
+ * $FreeBSD: src/sys/dev/bktr/bktr_tuner.c,v 1.18 2005/01/23 07:13:09 julian Exp
+ * $DragonFly: src/sys/dev/video/bktr/bktr_tuner.c,v 1.7 2005/03/12 11:35:27 corecode Exp $
  */
 
 
 #define TSBH1_FCONTROL         0xce
 
 
+static void mt2032_set_tv_freq(bktr_ptr_t bktr, unsigned int freq);
+
+
 static const struct TUNER tuners[] = {
 /* XXX FIXME: fill in the band-switch crosspoints */
        /* NO_TUNER */
@@ -257,7 +260,17 @@ static const struct TUNER tuners[] = {
              TSBH1_FCONTROL,
              0x00 },
            { 0x00, 0x00 },                      /* band-switch crosspoints */
-           { 0x01, 0x02, 0x08, 0x00 } }         /* the band-switch values */
+           { 0x01, 0x02, 0x08, 0x00 } },         /* the band-switch values */
+
+       /* MT2032 Microtune */
+       { "MT2032",                             /* the 'name' */
+          TTYPE_PAL,                   /* input type */
+          { TSA552x_SCONTROL,                  /* control byte for Tuner PLL */
+            TSA552x_SCONTROL,
+            TSA552x_SCONTROL,
+            0x00 },
+          { 0x00, 0x00 },                      /* band-switch crosspoints */
+          { 0xa0, 0x90, 0x30, 0x00 } },        /* the band-switch values */
 };
 
 
@@ -768,6 +781,10 @@ tv_freq( bktr_ptr_t bktr, int frequency, int type )
        if ( tuner == NULL )
                return( -1 );
 
+       if (tuner == &tuners[TUNER_MT2032]) {
+               mt2032_set_tv_freq(bktr, frequency);
+               return 0;
+       }
        if (type == TV_FREQUENCY) {
                /*
                 * select the band based on frequency
@@ -955,6 +972,8 @@ do_afc( bktr_ptr_t bktr, int addr, int frequency )
  * Get the Tuner status and signal strength
  */
 int     get_tuner_status( bktr_ptr_t bktr ) {
+       if (bktr->card.tuner == &tuners[TUNER_MT2032])
+               return 0;
        return i2cRead( bktr, bktr->card.tuner_pllAddr + 1 );
 }
 
@@ -994,3 +1013,384 @@ tuner_getchnlset(struct bktr_chnlset *chnlset)
        chnlset->max_channel=freqTable[chnlset->index].ptr[0];
        return( 0 );
 }
+
+
+
+
+#define        TDA9887_ADDR    0x86
+
+static int
+TDA9887_init(bktr_ptr_t bktr, int output2_enable)
+{
+       u_char addr = TDA9887_ADDR;
+
+       i2cWrite(bktr, addr, 0, output2_enable ? 0x50 : 0xd0);
+       i2cWrite(bktr, addr, 1, 0x6e); /* takeover point / de-emphasis */
+
+       /* PAL BG: 0x09  PAL I: 0x0a  NTSC: 0x04 */
+#ifdef MT2032_NTSC
+       i2cWrite(bktr, addr, 2, 0x04);
+#else
+       i2cWrite(bktr, addr, 2, 0x09);
+#endif
+       return 0;
+}
+
+
+
+#define MT2032_OPTIMIZE_VCO     1
+
+/* holds the value of XOGC register after init */
+static int      MT2032_XOGC = 4;
+
+/* card.tuner_pllAddr not set during init */
+#define        MT2032_ADDR             0xc0
+
+#ifndef MT2032_ADDR
+#define        MT2032_ADDR             (bktr->card.tuner_pllAddr)
+#endif
+
+static int 
+_MT2032_GetRegister(bktr_ptr_t bktr, u_char regNum)
+{
+       int             ch;
+
+       if (i2cWrite(bktr, MT2032_ADDR, regNum, -1) == -1) {
+               if (bootverbose)
+                       printf("%s: MT2032 write failed (i2c addr %#x)\n",
+                               bktr_name(bktr), MT2032_ADDR);
+               return -1;
+       }
+       if ((ch = i2cRead(bktr, MT2032_ADDR + 1)) == -1) {
+               if (bootverbose)
+                       printf("%s: MT2032 get register %d failed\n",
+                               bktr_name(bktr), regNum);
+               return -1;
+       }
+       return ch;
+}
+
+static void 
+_MT2032_SetRegister(bktr_ptr_t bktr, u_char regNum, u_char data)
+{
+       i2cWrite(bktr, MT2032_ADDR, regNum, data);
+}
+
+#define        MT2032_GetRegister(r)           _MT2032_GetRegister(bktr,r)
+#define        MT2032_SetRegister(r,d)         _MT2032_SetRegister(bktr,r,d)
+
+
+int 
+mt2032_init(bktr_ptr_t bktr)
+{
+       u_char            rdbuf[22];
+       int             xogc, xok = 0;
+       int             i;
+       int             x;
+
+       TDA9887_init(bktr, 0);
+
+       for (i = 0; i < 21; i++) {
+               if ((x = MT2032_GetRegister(i)) == -1)
+                       break;
+               rdbuf[i] = x;
+       }
+       if (i < 21)
+               return -1;
+
+       printf("%s: MT2032: Companycode=%02x%02x Part=%02x Revision=%02x\n",
+               bktr_name(bktr),
+               rdbuf[0x11], rdbuf[0x12], rdbuf[0x13], rdbuf[0x14]);
+       if (rdbuf[0x13] != 4) {
+               printf("%s: MT2032 not found or unknown type\n", bktr_name(bktr));
+               return -1;
+       }
+
+       /* Initialize Registers per spec. */
+       MT2032_SetRegister(2, 0xff);
+       MT2032_SetRegister(3, 0x0f);
+       MT2032_SetRegister(4, 0x1f);
+       MT2032_SetRegister(6, 0xe4);
+       MT2032_SetRegister(7, 0x8f);
+       MT2032_SetRegister(8, 0xc3);
+       MT2032_SetRegister(9, 0x4e);
+       MT2032_SetRegister(10, 0xec);
+       MT2032_SetRegister(13, 0x32);
+
+       /* Adjust XOGC (register 7), wait for XOK */
+       xogc = 7;
+       do {
+               DELAY(10000);
+               xok = MT2032_GetRegister(0x0e) & 0x01;
+               if (xok == 1) {
+                       break;
+               }
+               xogc--;
+               if (xogc == 3) {
+                       xogc = 4;       /* min. 4 per spec */
+                       break;
+               }
+               MT2032_SetRegister(7, 0x88 + xogc);
+       } while (xok != 1);
+
+       TDA9887_init(bktr, 1);
+
+       MT2032_XOGC = xogc;
+
+       return 0;
+}
+
+static int 
+MT2032_SpurCheck(int f1, int f2, int spectrum_from, int spectrum_to)
+{
+       int             n1 = 1, n2, f;
+
+       f1 = f1 / 1000;         /* scale to kHz to avoid 32bit overflows */
+       f2 = f2 / 1000;
+       spectrum_from /= 1000;
+       spectrum_to /= 1000;
+
+       do {
+               n2 = -n1;
+               f = n1 * (f1 - f2);
+               do {
+                       n2--;
+                       f = f - f2;
+                       if ((f > spectrum_from) && (f < spectrum_to)) {
+                               return 1;
+                       }
+               } while ((f > (f2 - spectrum_to)) || (n2 > -5));
+               n1++;
+       } while (n1 < 5);
+
+       return 0;
+}
+
+static int
+MT2032_ComputeFreq(
+                  int rfin,
+                  int if1,
+                  int if2,
+                  int spectrum_from,
+                  int spectrum_to,
+                  unsigned char *buf,
+                  int *ret_sel,
+                  int xogc
+)
+{                              /* all in Hz */
+       int             fref, lo1, lo1n, lo1a, s, sel;
+       int             lo1freq, desired_lo1, desired_lo2, lo2, lo2n, lo2a,
+                       lo2num, lo2freq;
+       int             nLO1adjust;
+
+       fref = 5250 * 1000;     /* 5.25MHz */
+
+       /* per spec 2.3.1 */
+       desired_lo1 = rfin + if1;
+       lo1 = (2 * (desired_lo1 / 1000) + (fref / 1000)) / (2 * fref / 1000);
+       lo1freq = lo1 * fref;
+       desired_lo2 = lo1freq - rfin - if2;
+
+       /* per spec 2.3.2 */
+       for (nLO1adjust = 1; nLO1adjust < 3; nLO1adjust++) {
+               if (!MT2032_SpurCheck(lo1freq, desired_lo2, spectrum_from, spectrum_to)) {
+                       break;
+               }
+               if (lo1freq < desired_lo1) {
+                       lo1 += nLO1adjust;
+               } else {
+                       lo1 -= nLO1adjust;
+               }
+
+               lo1freq = lo1 * fref;
+               desired_lo2 = lo1freq - rfin - if2;
+       }
+
+       /* per spec 2.3.3 */
+       s = lo1freq / 1000 / 1000;
+
+       if (MT2032_OPTIMIZE_VCO) {
+               if (s > 1890) {
+                       sel = 0;
+               } else if (s > 1720) {
+                       sel = 1;
+               } else if (s > 1530) {
+                       sel = 2;
+               } else if (s > 1370) {
+                       sel = 3;
+               } else {
+                       sel = 4;/* >1090 */
+               }
+       } else {
+               if (s > 1790) {
+                       sel = 0;/* <1958 */
+               } else if (s > 1617) {
+                       sel = 1;
+               } else if (s > 1449) {
+                       sel = 2;
+               } else if (s > 1291) {
+                       sel = 3;
+               } else {
+                       sel = 4;/* >1090 */
+               }
+       }
+
+       *ret_sel = sel;
+
+       /* per spec 2.3.4 */
+       lo1n = lo1 / 8;
+       lo1a = lo1 - (lo1n * 8);
+       lo2 = desired_lo2 / fref;
+       lo2n = lo2 / 8;
+       lo2a = lo2 - (lo2n * 8);
+       /* scale to fit in 32bit arith */
+       lo2num = ((desired_lo2 / 1000) % (fref / 1000)) * 3780 / (fref / 1000);
+       lo2freq = (lo2a + 8 * lo2n) * fref + lo2num * (fref / 1000) / 3780 * 1000;
+
+       if (lo1a < 0 || lo1a > 7 || lo1n < 17 || lo1n > 48 || lo2a < 0 ||
+           lo2a > 7 || lo2n < 17 || lo2n > 30) {
+               printf("MT2032: parameter out of range\n");
+               return -1;
+       }
+       /* set up MT2032 register map for transfer over i2c */
+       buf[0] = lo1n - 1;
+       buf[1] = lo1a | (sel << 4);
+       buf[2] = 0x86;          /* LOGC */
+       buf[3] = 0x0f;          /* reserved */
+       buf[4] = 0x1f;
+       buf[5] = (lo2n - 1) | (lo2a << 5);
+       if (rfin < 400 * 1000 * 1000) {
+               buf[6] = 0xe4;
+       } else {
+               buf[6] = 0xf4;  /* set PKEN per rev 1.2 */
+       }
+
+       buf[7] = 8 + xogc;
+       buf[8] = 0xc3;          /* reserved */
+       buf[9] = 0x4e;          /* reserved */
+       buf[10] = 0xec;         /* reserved */
+       buf[11] = (lo2num & 0xff);
+       buf[12] = (lo2num >> 8) | 0x80; /* Lo2RST */
+
+       return 0;
+}
+
+static int 
+MT2032_CheckLOLock(bktr_ptr_t bktr)
+{
+       int             t, lock = 0;
+       for (t = 0; t < 10; t++) {
+               lock = MT2032_GetRegister(0x0e) & 0x06;
+               if (lock == 6) {
+                       break;
+               }
+               DELAY(1000);
+       }
+       return lock;
+}
+
+static int 
+MT2032_OptimizeVCO(bktr_ptr_t bktr, int sel, int lock)
+{
+       int             tad1, lo1a;
+
+       tad1 = MT2032_GetRegister(0x0f) & 0x07;
+
+       if (tad1 == 0) {
+               return lock;
+       }
+       if (tad1 == 1) {
+               return lock;
+       }
+       if (tad1 == 2) {
+               if (sel == 0) {
+                       return lock;
+               } else {
+                       sel--;
+               }
+       } else {
+               if (sel < 4) {
+                       sel++;
+               } else {
+                       return lock;
+               }
+       }
+       lo1a = MT2032_GetRegister(0x01) & 0x07;
+       MT2032_SetRegister(0x01, lo1a | (sel << 4));
+       lock = MT2032_CheckLOLock(bktr);
+       return lock;
+}
+
+static int
+MT2032_SetIFFreq(bktr_ptr_t bktr, int rfin, int if1, int if2, int from, int to)
+{
+       u_char          buf[21];
+       int             lint_try, sel, lock = 0;
+
+       if (MT2032_ComputeFreq(rfin, if1, if2, from, to, &buf[0], &sel, MT2032_XOGC) == -1)
+               return -1;
+
+       TDA9887_init(bktr, 0);
+
+       /* send only the relevant registers per Rev. 1.2 */
+       MT2032_SetRegister(0, buf[0x00]);
+       MT2032_SetRegister(1, buf[0x01]);
+       MT2032_SetRegister(2, buf[0x02]);
+
+       MT2032_SetRegister(5, buf[0x05]);
+       MT2032_SetRegister(6, buf[0x06]);
+       MT2032_SetRegister(7, buf[0x07]);
+
+       MT2032_SetRegister(11, buf[0x0B]);
+       MT2032_SetRegister(12, buf[0x0C]);
+
+       /* wait for PLLs to lock (per manual), retry LINT if not. */
+       for (lint_try = 0; lint_try < 2; lint_try++) {
+               lock = MT2032_CheckLOLock(bktr);
+
+               if (MT2032_OPTIMIZE_VCO) {
+                       lock = MT2032_OptimizeVCO(bktr, sel, lock);
+               }
+               if (lock == 6) {
+                       break;
+               }
+               /* set LINT to re-init PLLs */
+               MT2032_SetRegister(7, 0x80 + 8 + MT2032_XOGC);
+               DELAY(10000);
+               MT2032_SetRegister(7, 8 + MT2032_XOGC);
+       }
+       if (lock != 6)
+               printf("%s: PLL didn't lock\n", bktr_name(bktr));
+
+       MT2032_SetRegister(2, 0x20);
+
+       TDA9887_init(bktr, 1);
+       return 0;
+}
+
+static void
+mt2032_set_tv_freq(bktr_ptr_t bktr, unsigned int freq)
+{
+       int if2,from,to;
+       int stat, tad;
+
+#ifdef MT2032_NTSC
+       from=40750*1000;
+       to=46750*1000;
+       if2=45750*1000;
+#else
+       from=32900*1000;
+       to=39900*1000;
+       if2=38900*1000;
+#endif
+
+       if (MT2032_SetIFFreq(bktr, freq*62500 /* freq*1000*1000/16 */,
+                       1090*1000*1000, if2, from, to) == 0) {
+               bktr->tuner.frequency = freq;
+               stat = MT2032_GetRegister(0x0e);
+               tad = MT2032_GetRegister(0x0f);
+               if (bootverbose)
+                       printf("%s: frequency set to %d, st = %#x, tad = %#x\n",
+                               bktr_name(bktr), freq*62500, stat, tad);
+       }
+}
index 3eb451e..babc07d 100644 (file)
@@ -1,5 +1,5 @@
-/* $FreeBSD: src/sys/dev/bktr/bktr_tuner.h,v 1.1 1999/09/26 22:06:20 roger Exp $ */
-/* $DragonFly: src/sys/dev/video/bktr/bktr_tuner.h,v 1.3 2004/05/15 17:54:13 joerg Exp $ */
+/* $FreeBSD: src/sys/dev/bktr/bktr_tuner.h,v 1.6 2005/01/23 07:13:09 julian Exp */
+/* $DragonFly: src/sys/dev/video/bktr/bktr_tuner.h,v 1.4 2005/03/12 11:35:27 corecode Exp $ */
 
 /*
  * This is part of the Driver for Video Capture Cards (Frame grabbers)
 #define PHILIPS_FR1236_SECAM    11   /* These have FM radio support */
 #define ALPS_TSCH5              12
 #define ALPS_TSBH1              13
-#define Bt848_MAX_TUNER         14
+#define TUNER_MT2032            14
+#define Bt848_MAX_TUNER         15
 
 /* experimental code for Automatic Frequency Control */ 
 #define TUNER_AFC
 
+int mt2032_init(bktr_ptr_t bktr);                                              
+
 /*
  * Fill in the tuner entries in the bktr_softc based on the selected tuner
  * type (from the list of tuners above)
index 570fe1f..385e5a6 100644 (file)
@@ -23,8 +23,8 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/bktr/msp34xx.c,v 1.3 2003/12/12 21:18:04 rwatson Exp $
- * $DragonFly: src/sys/dev/video/bktr/msp34xx.c,v 1.2 2004/06/01 17:12:15 joerg Exp $
+ * $FreeBSD: src/sys/dev/bktr/msp34xx.c,v 1.5 2004/12/16 23:19:57 julian Exp
+ * $DragonFly: src/sys/dev/video/bktr/msp34xx.c,v 1.3 2005/03/12 11:35:27 corecode Exp $
  */
 
 /*
 #include <sys/kthread.h>
 #include <sys/malloc.h>
 
+#ifdef BKTR_USE_FREEBSD_SMBUS
+#include <sys/bus.h>                   /* required by bktr_reg.h */
+#endif
+
 #include <machine/bus.h>               /* required by bktr_reg.h */
 
 #include <dev/video/meteor/ioctl_meteor.h>