[PATCH] BTTV support for Adlink RTV24 capture card

The bttv module currently lacks support for the Adlink RTV24 capture card.
The following patch adds support for the Adlink RTV24 video capture card to
the bttv module.

Cc: Gerd Knorr <kraxel@bytesex.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Peter Skipworth and committed by
Linus Torvalds
93b43f13 097b750e

+88
+87
drivers/media/video/bttv-cards.c
··· 51 51 static void osprey_eeprom(struct bttv *btv); 52 52 static void modtec_eeprom(struct bttv *btv); 53 53 static void init_PXC200(struct bttv *btv); 54 + static void init_RTV24(struct bttv *btv); 54 55 55 56 static void winview_audio(struct bttv *btv, struct video_audio *v, int set); 56 57 static void lt9415_audio(struct bttv *btv, struct video_audio *v, int set); ··· 2252 2251 .no_tda7432 = 1, 2253 2252 .no_tda9875 = 1, 2254 2253 .muxsel_hook = kodicom4400r_muxsel, 2254 + }, 2255 + { 2256 + /* ---- card 0x86---------------------------------- */ 2257 + /* Michael Henson <mhenson@clarityvi.com> */ 2258 + /* Adlink RTV24 with special unlock codes */ 2259 + .name = "Adlink RTV24", 2260 + .video_inputs = 4, 2261 + .audio_inputs = 1, 2262 + .tuner = 0, 2263 + .svhs = 2, 2264 + .muxsel = { 2, 3, 1, 0}, 2265 + .tuner_type = -1, 2266 + .pll = PLL_28, 2255 2267 }}; 2256 2268 2257 2269 static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards); ··· 2762 2748 case BTTV_KODICOM_4400R: 2763 2749 kodicom4400r_init(btv); 2764 2750 break; 2751 + case BTTV_ADLINK_RTV24: 2752 + init_RTV24(btv); 2753 + break; 2765 2754 } 2766 2755 2767 2756 /* pll configuration */ ··· 3320 3303 printk(KERN_INFO "PXC200 Initialised.\n"); 3321 3304 } 3322 3305 3306 + /* ----------------------------------------------------------------------- */ 3307 + /* 3308 + * The Adlink RTV-24 (aka Angelo) has some special initialisation to unlock 3309 + * it. This apparently involves the following procedure for each 878 chip: 3310 + * 3311 + * 1) write 0x00C3FEFF to the GPIO_OUT_EN register 3312 + * 3313 + * 2) write to GPIO_DATA 3314 + * - 0x0E 3315 + * - sleep 1ms 3316 + * - 0x10 + 0x0E 3317 + * - sleep 10ms 3318 + * - 0x0E 3319 + * read from GPIO_DATA into buf (uint_32) 3320 + * - if ( data>>18 & 0x01 != 0) || ( buf>>19 & 0x01 != 1 ) 3321 + * error. ERROR_CPLD_Check_Failed stop. 3322 + * 3323 + * 3) write to GPIO_DATA 3324 + * - write 0x4400 + 0x0E 3325 + * - sleep 10ms 3326 + * - write 0x4410 + 0x0E 3327 + * - sleep 1ms 3328 + * - write 0x0E 3329 + * read from GPIO_DATA into buf (uint_32) 3330 + * - if ( buf>>18 & 0x01 ) || ( buf>>19 && 0x01 != 0 ) 3331 + * error. ERROR_CPLD_Check_Failed. 3332 + */ 3333 + /* ----------------------------------------------------------------------- */ 3334 + void init_RTV24(struct bttv *btv) 3335 + { 3336 + u32 dataread; 3337 + const long watchdog_value = 0x0E; 3338 + 3339 + printk(KERN_INFO "bttv%d: Adlink RTV-24 initialisation in progress\n", 3340 + btv->c.nr); 3341 + 3342 + btwrite(0x00c3feff, BT848_GPIO_OUT_EN); 3343 + 3344 + btwrite(0 + watchdog_value, BT848_GPIO_DATA); 3345 + msleep(1); 3346 + btwrite(0x10 + watchdog_value, BT848_GPIO_DATA); 3347 + msleep( 10 ); 3348 + btwrite(0 + watchdog_value, BT848_GPIO_DATA); 3349 + 3350 + dataread = btread(BT848_GPIO_DATA); 3351 + 3352 + if (((dataread >> 18) & 0x01) != 0 || ((dataread >> 19) & 0x01) != 1) { 3353 + printk(KERN_INFO "bttv%d: Adlink RTV-24 initialisation(1) " 3354 + "ERROR_CPLD_Check_Failed (read %d)\n", 3355 + btv->c.nr, dataread); 3356 + } 3357 + 3358 + btwrite(0x4400 + watchdog_value, BT848_GPIO_DATA); 3359 + msleep(10); 3360 + btwrite(0x4410 + watchdog_value, BT848_GPIO_DATA); 3361 + msleep(1); 3362 + btwrite(watchdog_value, BT848_GPIO_DATA); 3363 + msleep(1); 3364 + dataread = btread(BT848_GPIO_DATA); 3365 + 3366 + if (((dataread >> 18) & 0x01) != 0 || ((dataread >> 19) & 0x01) != 0) { 3367 + printk(KERN_INFO "bttv%d: Adlink RTV-24 initialisation(2) " 3368 + "ERROR_CPLD_Check_Failed (read %d)\n", 3369 + btv->c.nr, dataread); 3370 + return; 3371 + } 3372 + 3373 + printk(KERN_INFO "bttv%d: Adlink RTV-24 initialisation complete.\n", 3374 + btv->c.nr); 3375 + } 3323 3376 3324 3377 /* ----------------------------------------------------------------------- */ 3325 3378 /* Miro Pro radio stuff -- the tea5757 is connected to some GPIO ports */
+1
drivers/media/video/bttv.h
··· 135 135 #define BTTV_DVICO_DVBT_LITE 0x80 136 136 #define BTTV_TIBET_CS16 0x83 137 137 #define BTTV_KODICOM_4400R 0x84 138 + #define BTTV_ADLINK_RTV24 0x86 138 139 139 140 /* i2c address list */ 140 141 #define I2C_TSA5522 0xc2