[PATCH] bttv update

This patch synchronizes current bttv support on V4L with linux kernel and
adds support to Adlink RTV24 card.

It is asked that *every* patch to V4L stuff to be first submitted to
video4linux-list@redhat.com.

From: "J.A. Magallon" <jamagallon@able.es>

struct bttv defined after usage.

Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: Peter Skipworth <pskipworth@clarityvi.com>
Signed-off-by: Nickolay V Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Mauro Carvalho Chehab and committed by Linus Torvalds 2d03e289 3c1d0185

+62 -51
+54 -43
drivers/media/video/bttv-cards.c
··· 1 1 /* 2 - $Id: bttv-cards.c,v 1.47 2005/02/22 14:06:32 kraxel Exp $ 2 + $Id: bttv-cards.c,v 1.49 2005/06/10 17:20:24 mchehab Exp $ 3 3 4 4 bttv-cards.c 5 5 ··· 2254 2254 .muxsel_hook = kodicom4400r_muxsel, 2255 2255 }, 2256 2256 { 2257 - /* ---- card 0x86---------------------------------- */ 2258 - /* Michael Henson <mhenson@clarityvi.com> */ 2259 - /* Adlink RTV24 with special unlock codes */ 2260 - .name = "Adlink RTV24", 2261 - .video_inputs = 4, 2262 - .audio_inputs = 1, 2263 - .tuner = 0, 2264 - .svhs = 2, 2265 - .muxsel = { 2, 3, 1, 0}, 2266 - .tuner_type = -1, 2267 - .pll = PLL_28, 2257 + /* ---- card 0x85---------------------------------- */ 2258 + /* Michael Henson <mhenson@clarityvi.com> */ 2259 + /* Adlink RTV24 with special unlock codes */ 2260 + .name = "Adlink RTV24", 2261 + .video_inputs = 4, 2262 + .audio_inputs = 1, 2263 + .tuner = 0, 2264 + .svhs = 2, 2265 + .muxsel = { 2, 3, 1, 0}, 2266 + .tuner_type = -1, 2267 + .pll = PLL_28, 2268 + 2268 2269 }}; 2269 2270 2270 2271 static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards); ··· 2651 2650 case BTTV_AVDVBT_771: 2652 2651 btv->use_i2c_hw = 1; 2653 2652 break; 2653 + case BTTV_ADLINK_RTV24: 2654 + init_RTV24( btv ); 2655 + break; 2656 + 2654 2657 } 2655 2658 if (!bttv_tvcards[btv->c.type].has_dvb) 2656 2659 bttv_reset_audio(btv); ··· 2767 2762 case BTTV_KODICOM_4400R: 2768 2763 kodicom4400r_init(btv); 2769 2764 break; 2770 - case BTTV_ADLINK_RTV24: 2771 - init_RTV24(btv); 2772 - break; 2773 2765 } 2774 2766 2775 2767 /* pll configuration */ ··· 2802 2800 } 2803 2801 } 2804 2802 btv->pll.pll_current = -1; 2803 + 2804 + bttv_reset_audio(btv); 2805 2805 2806 2806 /* tuner configuration (from card list / autodetect / insmod option) */ 2807 2807 if (UNSET != bttv_tvcards[btv->c.type].tuner_type) ··· 3324 3320 printk(KERN_INFO "PXC200 Initialised.\n"); 3325 3321 } 3326 3322 3323 + 3324 + 3327 3325 /* ----------------------------------------------------------------------- */ 3328 3326 /* 3329 3327 * The Adlink RTV-24 (aka Angelo) has some special initialisation to unlock ··· 3354 3348 * error. ERROR_CPLD_Check_Failed. 3355 3349 */ 3356 3350 /* ----------------------------------------------------------------------- */ 3357 - void init_RTV24(struct bttv *btv) 3351 + void 3352 + init_RTV24 (struct bttv *btv) 3358 3353 { 3359 - u32 dataread; 3360 - const long watchdog_value = 0x0E; 3354 + uint32_t dataRead = 0; 3355 + long watchdog_value = 0x0E; 3361 3356 3362 - printk(KERN_INFO "bttv%d: Adlink RTV-24 initialisation in progress\n", 3357 + printk (KERN_INFO 3358 + "bttv%d: Adlink RTV-24 initialisation in progress ...\n", 3363 3359 btv->c.nr); 3364 3360 3365 - btwrite(0x00c3feff, BT848_GPIO_OUT_EN); 3361 + btwrite (0x00c3feff, BT848_GPIO_OUT_EN); 3366 3362 3367 - btwrite(0 + watchdog_value, BT848_GPIO_DATA); 3368 - msleep(1); 3369 - btwrite(0x10 + watchdog_value, BT848_GPIO_DATA); 3370 - msleep( 10 ); 3371 - btwrite(0 + watchdog_value, BT848_GPIO_DATA); 3363 + btwrite (0 + watchdog_value, BT848_GPIO_DATA); 3364 + msleep (1); 3365 + btwrite (0x10 + watchdog_value, BT848_GPIO_DATA); 3366 + msleep (10); 3367 + btwrite (0 + watchdog_value, BT848_GPIO_DATA); 3372 3368 3373 - dataread = btread(BT848_GPIO_DATA); 3369 + dataRead = btread (BT848_GPIO_DATA); 3374 3370 3375 - if (((dataread >> 18) & 0x01) != 0 || ((dataread >> 19) & 0x01) != 1) { 3376 - printk(KERN_INFO "bttv%d: Adlink RTV-24 initialisation(1) " 3377 - "ERROR_CPLD_Check_Failed (read %d)\n", 3378 - btv->c.nr, dataread); 3371 + if ((((dataRead >> 18) & 0x01) != 0) || (((dataRead >> 19) & 0x01) != 1)) { 3372 + printk (KERN_INFO 3373 + "bttv%d: Adlink RTV-24 initialisation(1) ERROR_CPLD_Check_Failed (read %d)\n", 3374 + btv->c.nr, dataRead); 3379 3375 } 3380 3376 3381 - btwrite(0x4400 + watchdog_value, BT848_GPIO_DATA); 3382 - msleep(10); 3383 - btwrite(0x4410 + watchdog_value, BT848_GPIO_DATA); 3384 - msleep(1); 3385 - btwrite(watchdog_value, BT848_GPIO_DATA); 3386 - msleep(1); 3387 - dataread = btread(BT848_GPIO_DATA); 3377 + btwrite (0x4400 + watchdog_value, BT848_GPIO_DATA); 3378 + msleep (10); 3379 + btwrite (0x4410 + watchdog_value, BT848_GPIO_DATA); 3380 + msleep (1); 3381 + btwrite (watchdog_value, BT848_GPIO_DATA); 3382 + msleep (1); 3383 + dataRead = btread (BT848_GPIO_DATA); 3388 3384 3389 - if (((dataread >> 18) & 0x01) != 0 || ((dataread >> 19) & 0x01) != 0) { 3390 - printk(KERN_INFO "bttv%d: Adlink RTV-24 initialisation(2) " 3391 - "ERROR_CPLD_Check_Failed (read %d)\n", 3392 - btv->c.nr, dataread); 3385 + if ((((dataRead >> 18) & 0x01) != 0) || (((dataRead >> 19) & 0x01) != 0)) { 3386 + printk (KERN_INFO 3387 + "bttv%d: Adlink RTV-24 initialisation(2) ERROR_CPLD_Check_Failed (read %d)\n", 3388 + btv->c.nr, dataRead); 3389 + 3393 3390 return; 3394 3391 } 3395 3392 3396 - printk(KERN_INFO "bttv%d: Adlink RTV-24 initialisation complete.\n", 3397 - btv->c.nr); 3393 + printk (KERN_INFO 3394 + "bttv%d: Adlink RTV-24 initialisation complete.\n", btv->c.nr); 3398 3395 } 3396 + 3397 + 3399 3398 3400 3399 /* ----------------------------------------------------------------------- */ 3401 3400 /* Miro Pro radio stuff -- the tea5757 is connected to some GPIO ports */
+1 -1
drivers/media/video/bttv-driver.c
··· 1 1 /* 2 - $Id: bttv-driver.c,v 1.37 2005/02/21 13:57:59 kraxel Exp $ 2 + $Id: bttv-driver.c,v 1.38 2005/06/10 17:20:24 mchehab Exp $ 3 3 4 4 bttv - Bt848 frame grabber driver 5 5
+1 -1
drivers/media/video/bttv-i2c.c
··· 1 1 /* 2 - $Id: bttv-i2c.c,v 1.18 2005/02/16 12:14:10 kraxel Exp $ 2 + $Id: bttv-i2c.c,v 1.21 2005/06/10 17:20:24 mchehab Exp $ 3 3 4 4 bttv-i2c.c -- all the i2c code is here 5 5
+2 -2
drivers/media/video/bttv.h
··· 1 1 /* 2 - * $Id: bttv.h,v 1.17 2005/02/22 14:06:32 kraxel Exp $ 2 + * $Id: bttv.h,v 1.18 2005/05/24 23:41:42 nsh Exp $ 3 3 * 4 4 * bttv - Bt848 frame grabber driver 5 5 * ··· 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 + #define BTTV_ADLINK_RTV24 0x85 139 139 140 140 /* i2c address list */ 141 141 #define I2C_TSA5522 0xc2
+4 -4
drivers/media/video/bttvp.h
··· 226 226 #define dprintk if (bttv_debug >= 1) printk 227 227 #define d2printk if (bttv_debug >= 2) printk 228 228 229 - /* our devices */ 230 - #define BTTV_MAX 16 231 - extern unsigned int bttv_num; 232 - 233 229 #define BTTV_MAX_FBUF 0x208000 234 230 #define VBIBUF_SIZE (2048*VBI_MAXLINES*2) 235 231 #define BTTV_TIMEOUT (HZ/2) /* 0.5 seconds */ ··· 371 375 unsigned int users; 372 376 struct bttv_fh init; 373 377 }; 378 + 379 + /* our devices */ 380 + #define BTTV_MAX 16 381 + extern unsigned int bttv_num; 374 382 extern struct bttv bttvs[BTTV_MAX]; 375 383 376 384 /* private ioctls */