]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/video/bt8xx/bttv-cards.c
bt8xx: treat firmware data as const
[linux-2.6-omap-h63xx.git] / drivers / media / video / bt8xx / bttv-cards.c
index 78e5e29748acdf516fcb2c5c514786c3f52f39e4..1c56ae92ce7482c68cb6445031458a71332906b9 100644 (file)
@@ -34,6 +34,7 @@
 #include <linux/firmware.h>
 #include <net/checksum.h>
 
+#include <asm/unaligned.h>
 #include <asm/io.h>
 
 #include "bttvp.h"
@@ -71,6 +72,8 @@ static void kodicom4400r_init(struct bttv *btv);
 static void sigmaSLC_muxsel(struct bttv *btv, unsigned int input);
 static void sigmaSQ_muxsel(struct bttv *btv, unsigned int input);
 
+static void geovision_muxsel(struct bttv *btv, unsigned int input);
+
 static int terratec_active_radio_upgrade(struct bttv *btv);
 static int tea5757_read(struct bttv *btv);
 static int tea5757_write(struct bttv *btv, int value);
@@ -301,6 +304,7 @@ static struct CARD {
        { 0xd50018ac, BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE,    "DViCO FusionHDTV 5 Lite" },
        { 0x00261822, BTTV_BOARD_TWINHAN_DST,   "DNTV Live! Mini "},
        { 0xd200dbc0, BTTV_BOARD_DVICO_FUSIONHDTV_2,    "DViCO FusionHDTV 2" },
+       { 0x763c008a, BTTV_BOARD_GEOVISION_GV600,       "GeoVision GV-600" },
 
        { 0, -1, NULL }
 };
@@ -414,7 +418,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner_type     = UNSET,
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
-               .audio_hook     = avermedia_tvphone_audio,
+               .audio_mode_gpio= avermedia_tvphone_audio,
                .has_remote     = 1,
        },
        [BTTV_BOARD_MATRIX_VISION] = {
@@ -526,7 +530,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner_type     = TUNER_PHILIPS_PAL,
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
-               .audio_hook     = avermedia_tv_stereo_audio,
+               .audio_mode_gpio= avermedia_tv_stereo_audio,
                .no_gpioirq     = 1,
        },
        [BTTV_BOARD_VHX] = {
@@ -576,6 +580,8 @@ struct tvcard bttv_tvcards[] = {
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = UNSET,
+               .tuner_addr     = ADDR_UNSET,
+               .radio_addr     = ADDR_UNSET,
        },
        [BTTV_BOARD_WINVIEW_601] = {
                .name           = "Leadtek WinView 601",
@@ -591,7 +597,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner_type     = UNSET,
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
-               .audio_hook     = winview_audio,
+               .volume_gpio    = winview_volume,
                .has_radio      = 1,
        },
        [BTTV_BOARD_AVEC_INTERCAP] = {
@@ -715,7 +721,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner_type     = TUNER_PHILIPS_PAL,
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
-               .audio_hook     = terratv_audio,
+               .audio_mode_gpio= terratv_audio,
        },
        [BTTV_BOARD_HAUPPAUG_WCAM] = {
                .name           = "Hauppauge WinCam newer (bt878)",
@@ -763,7 +769,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner_type     = TUNER_PHILIPS_PAL,
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
-               .audio_hook     = terratv_audio,
+               .audio_mode_gpio= terratv_audio,
                /* GPIO wiring:
                External 20 pin connector (for Active Radio Upgrade board)
                gpio00: i2c-sda
@@ -902,7 +908,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner_type     = TUNER_PHILIPS_PAL, /* default for now, gpio reads BFFF06 for Pal bg+dk */
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
-               .audio_hook     = winfast2000_audio,
+               .audio_mode_gpio= winfast2000_audio,
                .has_remote     = 1,
        },
        [BTTV_BOARD_CHRONOS_VS2] = {
@@ -1022,7 +1028,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
                .has_radio      = 1,
-               .audio_hook     = avermedia_tvphone_audio,
+               .audio_mode_gpio= avermedia_tvphone_audio,
        },
        [BTTV_BOARD_PV951] = {
                .name           = "ProVideo PV951", /* pic16c54 */
@@ -1154,7 +1160,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner_type     = TUNER_ALPS_TSHC6_NTSC,
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
-               .audio_hook     = gvbctv3pci_audio,
+               .audio_mode_gpio= gvbctv3pci_audio,
        },
        [BTTV_BOARD_PXELVWPLTVPAK] = {
                .name           = "Prolink PV-BT878P+4E / PixelView PlayTV PAK / Lenco MXTV-9578 CP",
@@ -1459,7 +1465,7 @@ struct tvcard bttv_tvcards[] = {
                                /* -dk-???: set mute=0x1800 for tda9874h daughterboard */
                .gpiomux        = { 0x0000,0x0800,0x1000,0x1000 },
                .gpiomute       = 0x1800,
-               .audio_hook     = fv2000s_audio,
+               .audio_mode_gpio= fv2000s_audio,
                .no_msp34xx     = 1,
                .no_tda9875     = 1,
                .needs_tvaudio  = 1,
@@ -1500,7 +1506,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner_type     = TUNER_SHARP_2U5JF5540_NTSC,
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
-               .audio_hook     = gvbctv3pci_audio,
+               .audio_mode_gpio= gvbctv3pci_audio,
        },
 
        /* ---- card 0x44 ---------------------------------- */
@@ -1619,7 +1625,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner_type     = TUNER_PHILIPS_PAL,
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
-               .audio_hook     = pvbt878p9b_audio, /* Note: not all cards have stereo */
+               .audio_mode_gpio= pvbt878p9b_audio, /* Note: not all cards have stereo */
                .has_radio      = 1,  /* Note: not all cards have radio */
                .has_remote     = 1,
                /* GPIO wiring:
@@ -1697,7 +1703,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner_type     = TUNER_PHILIPS_NTSC,
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
-               .audio_hook     = windvr_audio,
+               .audio_mode_gpio= windvr_audio,
        },
        [BTTV_BOARD_GRANDTEC_MULTI] = {
                .name           = "GrandTec Multi Capture Card (Bt878)",
@@ -1794,7 +1800,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner_type     = TUNER_PHILIPS_NTSC_M,
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
-               .audio_hook     = gvbctv5pci_audio,
+               .audio_mode_gpio= gvbctv5pci_audio,
                .has_radio      = 1,
        },
        [BTTV_BOARD_OSPREY1x0] = {
@@ -2093,7 +2099,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner_type     = TUNER_PHILIPS_NTSC,
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
-               .audio_hook     = adtvk503_audio,
+               .audio_mode_gpio= adtvk503_audio,
        },
 
                /* ---- card 0x64 ---------------------------------- */
@@ -2322,7 +2328,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .muxsel         = { 2, 3, 1, 0 },
-               .tuner_type     = TUNER_PHILIPS_ATSC,
+               .tuner_type     = TUNER_PHILIPS_FCV1236D,
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
                .has_dvb        = 1,
@@ -2961,7 +2967,7 @@ struct tvcard bttv_tvcards[] = {
        [BTTV_BOARD_DVICO_FUSIONHDTV_2] = {
                .name           = "DViCO FusionHDTV 2",
                .tuner          = 0,
-               .tuner_type     = TUNER_PHILIPS_ATSC, /* FCV1236D */
+               .tuner_type     = TUNER_PHILIPS_FCV1236D,
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
                .video_inputs   = 3,
@@ -2992,6 +2998,45 @@ struct tvcard bttv_tvcards[] = {
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
        },
+       [BTTV_BOARD_GEOVISION_GV600] = {
+               /* emhn@usb.ve */
+               .name             = "Geovision GV-600",
+               .video_inputs     = 16,
+               .audio_inputs     = 0,
+               .tuner            = UNSET,
+               .svhs             = UNSET,
+               .gpiomask         = 0x0,
+               .muxsel           = { 2, 2, 2, 2, 2, 2, 2, 2,
+                                     2, 2, 2, 2, 2, 2, 2, 2 },
+               .muxsel_hook      = geovision_muxsel,
+               .gpiomux          = { 0 },
+               .no_msp34xx       = 1,
+               .pll              = PLL_28,
+               .tuner_type       = UNSET,
+               .tuner_addr       = ADDR_UNSET,
+               .radio_addr       = ADDR_UNSET,
+       },
+       [BTTV_BOARD_KOZUMI_KTV_01C] = {
+               /* Mauro Lacy <mauro@lacy.com.ar>
+                * Based on MagicTV and Conceptronic CONTVFMi */
+
+               .name           = "Kozumi KTV-01C",
+               .video_inputs   = 3,
+               .audio_inputs   = 1,
+               .tuner          = 0,
+               .svhs           = 2,
+               .gpiomask       = 0x008007,
+               .muxsel         = { 2, 3, 1, 1 },
+               .gpiomux        = { 0, 1, 2, 2 }, /* CONTVFMi */
+               .gpiomute       = 3, /* CONTVFMi */
+               .needs_tvaudio  = 0,
+               .tuner_type     = TUNER_PHILIPS_FM1216ME_MK3, /* TCL MK3 */
+               .tuner_addr     = ADDR_UNSET,
+               .radio_addr     = ADDR_UNSET,
+               .pll            = PLL_28,
+               .has_radio      = 1,
+               .has_remote     = 1,
+       },
 };
 
 static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards);
@@ -3160,8 +3205,8 @@ static void flyvideo_gpio(struct bttv *btv)
        /* LR90 Audio Routing is done by 2 hef4052, so Audio_Mask has 4 bits: 0x001c80
         * LR26/LR50 only has 1 hef4052, Audio_Mask 0x000c00
         * Audio options: from tuner, from tda9821/tda9821(mono,stereo,sap), from tda9874, ext., mute */
-       if(has_tda9820_tda9821) btv->audio_hook = lt9415_audio;
-       /* todo: if(has_tda9874) btv->audio_hook = fv2000s_audio; */
+       if(has_tda9820_tda9821) btv->audio_mode_gpio = lt9415_audio;
+       /* todo: if(has_tda9874) btv->audio_mode_gpio = fv2000s_audio; */
 }
 
 static int miro_tunermap[] = { 0,6,2,3,   4,5,6,0,  3,0,4,5,  5,2,16,1,
@@ -3331,6 +3376,13 @@ static void sigmaSLC_muxsel(struct bttv *btv, unsigned int input)
        gpio_bits( 3<<9, inmux<<9 );
 }
 
+static void geovision_muxsel(struct bttv *btv, unsigned int input)
+{
+       unsigned int inmux = input % 16;
+       gpio_inout(0xf, 0xf);
+       gpio_bits(0xf, inmux);
+}
+
 /* ----------------------------------------------------------------------- */
 
 static void bttv_reset_audio(struct bttv *btv)
@@ -3581,8 +3633,10 @@ void __devinit bttv_init_card2(struct bttv *btv)
                btv->has_remote=1;
        if (!bttv_tvcards[btv->c.type].no_gpioirq)
                btv->gpioirq=1;
-       if (bttv_tvcards[btv->c.type].audio_hook)
-               btv->audio_hook=bttv_tvcards[btv->c.type].audio_hook;
+       if (bttv_tvcards[btv->c.type].volume_gpio)
+               btv->volume_gpio=bttv_tvcards[btv->c.type].volume_gpio;
+       if (bttv_tvcards[btv->c.type].audio_mode_gpio)
+               btv->audio_mode_gpio=bttv_tvcards[btv->c.type].audio_mode_gpio;
 
        if (bttv_tvcards[btv->c.type].digital_mode == DIGITAL_MODE_CAMERA) {
                /* detect Bt832 chip for quartzsight digital camera */
@@ -3714,7 +3768,8 @@ static int terratec_active_radio_upgrade(struct bttv *btv)
 #define BTTV_ALT_DCLK          0x100000
 #define BTTV_ALT_NCONFIG       0x800000
 
-static int __devinit pvr_altera_load(struct bttv *btv, u8 *micro, u32 microlen)
+static int __devinit pvr_altera_load(struct bttv *btv, const u8 *micro,
+                                    u32 microlen)
 {
        u32 n;
        u8 bits;
@@ -3805,7 +3860,7 @@ static void __devinit osprey_eeprom(struct bttv *btv, const u8 ee[256])
                ee += i;
 
                /* found a valid descriptor */
-               type = be16_to_cpup((u16*)(ee+4));
+               type = get_unaligned_be16((__be16 *)(ee+4));
 
                switch(type) {
                /* 848 based */
@@ -3865,7 +3920,7 @@ static void __devinit osprey_eeprom(struct bttv *btv, const u8 ee[256])
                               btv->c.nr, type);
                        break;
                }
-               serial = be32_to_cpup((u32*)(ee+6));
+               serial = get_unaligned_be32((__be32 *)(ee+6));
        }
 
        printk(KERN_INFO "bttv%d: osprey eeprom: card=%d '%s' serial=%u\n",
@@ -4342,7 +4397,7 @@ static void rv605_muxsel(struct bttv *btv, unsigned int input)
        gpio_bits(0x200,0x000);
        mdelay(1);
 
-       /* create a new conection */
+       /* create a new connection */
        gpio_bits(0x480,0x080);
        gpio_bits(0x480,0x480);
        mdelay(1);