aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/bttv-driver.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@brturbo.com.br>2005-11-09 00:37:43 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-09 10:56:20 -0500
commit4ac97914c6c35f6bf132071c718e034d0846b9f5 (patch)
tree98c7eb827bb8ba99730ed89d32703a30448fd813 /drivers/media/video/bttv-driver.c
parenta8900fc242406f25f315190a6d650f1d54617c2f (diff)
[PATCH] v4l: 800: whitespace cleanups
- Whitespace Cleanups. Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/video/bttv-driver.c')
-rw-r--r--drivers/media/video/bttv-driver.c342
1 files changed, 171 insertions, 171 deletions
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c
index f8307407e320..0005741d5514 100644
--- a/drivers/media/video/bttv-driver.c
+++ b/drivers/media/video/bttv-driver.c
@@ -3,7 +3,7 @@
3 bttv - Bt848 frame grabber driver 3 bttv - Bt848 frame grabber driver
4 4
5 Copyright (C) 1996,97,98 Ralph Metzler <rjkm@thp.uni-koeln.de> 5 Copyright (C) 1996,97,98 Ralph Metzler <rjkm@thp.uni-koeln.de>
6 & Marcus Metzler <mocm@thp.uni-koeln.de> 6 & Marcus Metzler <mocm@thp.uni-koeln.de>
7 (c) 1999-2002 Gerd Knorr <kraxel@bytesex.org> 7 (c) 1999-2002 Gerd Knorr <kraxel@bytesex.org>
8 8
9 some v4l2 code lines are taken from Justin's bttv2 driver which is 9 some v4l2 code lines are taken from Justin's bttv2 driver which is
@@ -192,8 +192,8 @@ static u8 SRAM_Table[][60] =
192 192
193const struct bttv_tvnorm bttv_tvnorms[] = { 193const struct bttv_tvnorm bttv_tvnorms[] = {
194 /* PAL-BDGHI */ 194 /* PAL-BDGHI */
195 /* max. active video is actually 922, but 924 is divisible by 4 and 3! */ 195 /* max. active video is actually 922, but 924 is divisible by 4 and 3! */
196 /* actually, max active PAL with HSCALE=0 is 948, NTSC is 768 - nil */ 196 /* actually, max active PAL with HSCALE=0 is 948, NTSC is 768 - nil */
197 { 197 {
198 .v4l2_id = V4L2_STD_PAL, 198 .v4l2_id = V4L2_STD_PAL,
199 .name = "PAL", 199 .name = "PAL",
@@ -806,9 +806,9 @@ static void bt848A_set_timing(struct bttv *btv)
806 btv->c.nr,table_idx); 806 btv->c.nr,table_idx);
807 807
808 /* timing change...reset timing generator address */ 808 /* timing change...reset timing generator address */
809 btwrite(0x00, BT848_TGCTRL); 809 btwrite(0x00, BT848_TGCTRL);
810 btwrite(0x02, BT848_TGCTRL); 810 btwrite(0x02, BT848_TGCTRL);
811 btwrite(0x00, BT848_TGCTRL); 811 btwrite(0x00, BT848_TGCTRL);
812 812
813 len=SRAM_Table[table_idx][0]; 813 len=SRAM_Table[table_idx][0];
814 for(i = 1; i <= len; i++) 814 for(i = 1; i <= len; i++)
@@ -847,7 +847,7 @@ static void bt848_hue(struct bttv *btv, int hue)
847 847
848 /* -128 to 127 */ 848 /* -128 to 127 */
849 value = (hue >> 8) - 128; 849 value = (hue >> 8) - 128;
850 btwrite(value & 0xff, BT848_HUE); 850 btwrite(value & 0xff, BT848_HUE);
851} 851}
852 852
853static void bt848_contrast(struct bttv *btv, int cont) 853static void bt848_contrast(struct bttv *btv, int cont)
@@ -859,9 +859,9 @@ static void bt848_contrast(struct bttv *btv, int cont)
859 /* 0-511 */ 859 /* 0-511 */
860 value = (cont >> 7); 860 value = (cont >> 7);
861 hibit = (value >> 6) & 4; 861 hibit = (value >> 6) & 4;
862 btwrite(value & 0xff, BT848_CONTRAST_LO); 862 btwrite(value & 0xff, BT848_CONTRAST_LO);
863 btaor(hibit, ~4, BT848_E_CONTROL); 863 btaor(hibit, ~4, BT848_E_CONTROL);
864 btaor(hibit, ~4, BT848_O_CONTROL); 864 btaor(hibit, ~4, BT848_O_CONTROL);
865} 865}
866 866
867static void bt848_sat(struct bttv *btv, int color) 867static void bt848_sat(struct bttv *btv, int color)
@@ -873,12 +873,12 @@ static void bt848_sat(struct bttv *btv, int color)
873 /* 0-511 for the color */ 873 /* 0-511 for the color */
874 val_u = ((color * btv->opt_uv_ratio) / 50) >> 7; 874 val_u = ((color * btv->opt_uv_ratio) / 50) >> 7;
875 val_v = (((color * (100 - btv->opt_uv_ratio) / 50) >>7)*180L)/254; 875 val_v = (((color * (100 - btv->opt_uv_ratio) / 50) >>7)*180L)/254;
876 hibits = (val_u >> 7) & 2; 876 hibits = (val_u >> 7) & 2;
877 hibits |= (val_v >> 8) & 1; 877 hibits |= (val_v >> 8) & 1;
878 btwrite(val_u & 0xff, BT848_SAT_U_LO); 878 btwrite(val_u & 0xff, BT848_SAT_U_LO);
879 btwrite(val_v & 0xff, BT848_SAT_V_LO); 879 btwrite(val_v & 0xff, BT848_SAT_V_LO);
880 btaor(hibits, ~3, BT848_E_CONTROL); 880 btaor(hibits, ~3, BT848_E_CONTROL);
881 btaor(hibits, ~3, BT848_O_CONTROL); 881 btaor(hibits, ~3, BT848_O_CONTROL);
882} 882}
883 883
884/* ----------------------------------------------------------------------- */ 884/* ----------------------------------------------------------------------- */
@@ -891,7 +891,7 @@ video_mux(struct bttv *btv, unsigned int input)
891 if (input >= bttv_tvcards[btv->c.type].video_inputs) 891 if (input >= bttv_tvcards[btv->c.type].video_inputs)
892 return -EINVAL; 892 return -EINVAL;
893 893
894 /* needed by RemoteVideo MX */ 894 /* needed by RemoteVideo MX */
895 mask2 = bttv_tvcards[btv->c.type].gpiomask2; 895 mask2 = bttv_tvcards[btv->c.type].gpiomask2;
896 if (mask2) 896 if (mask2)
897 gpio_inout(mask2,mask2); 897 gpio_inout(mask2,mask2);
@@ -1055,22 +1055,22 @@ static void init_bt848(struct bttv *btv)
1055 btwrite(BT848_COLOR_CTL_GAMMA, BT848_COLOR_CTL); 1055 btwrite(BT848_COLOR_CTL_GAMMA, BT848_COLOR_CTL);
1056 btwrite(BT848_IFORM_XTAUTO | BT848_IFORM_AUTO, BT848_IFORM); 1056 btwrite(BT848_IFORM_XTAUTO | BT848_IFORM_AUTO, BT848_IFORM);
1057 1057
1058 /* set planar and packed mode trigger points and */ 1058 /* set planar and packed mode trigger points and */
1059 /* set rising edge of inverted GPINTR pin as irq trigger */ 1059 /* set rising edge of inverted GPINTR pin as irq trigger */
1060 btwrite(BT848_GPIO_DMA_CTL_PKTP_32| 1060 btwrite(BT848_GPIO_DMA_CTL_PKTP_32|
1061 BT848_GPIO_DMA_CTL_PLTP1_16| 1061 BT848_GPIO_DMA_CTL_PLTP1_16|
1062 BT848_GPIO_DMA_CTL_PLTP23_16| 1062 BT848_GPIO_DMA_CTL_PLTP23_16|
1063 BT848_GPIO_DMA_CTL_GPINTC| 1063 BT848_GPIO_DMA_CTL_GPINTC|
1064 BT848_GPIO_DMA_CTL_GPINTI, 1064 BT848_GPIO_DMA_CTL_GPINTI,
1065 BT848_GPIO_DMA_CTL); 1065 BT848_GPIO_DMA_CTL);
1066 1066
1067 val = btv->opt_chroma_agc ? BT848_SCLOOP_CAGC : 0; 1067 val = btv->opt_chroma_agc ? BT848_SCLOOP_CAGC : 0;
1068 btwrite(val, BT848_E_SCLOOP); 1068 btwrite(val, BT848_E_SCLOOP);
1069 btwrite(val, BT848_O_SCLOOP); 1069 btwrite(val, BT848_O_SCLOOP);
1070 1070
1071 btwrite(0x20, BT848_E_VSCALE_HI); 1071 btwrite(0x20, BT848_E_VSCALE_HI);
1072 btwrite(0x20, BT848_O_VSCALE_HI); 1072 btwrite(0x20, BT848_O_VSCALE_HI);
1073 btwrite(BT848_ADC_RESERVED | (btv->opt_adc_crush ? BT848_ADC_CRUSH : 0), 1073 btwrite(BT848_ADC_RESERVED | (btv->opt_adc_crush ? BT848_ADC_CRUSH : 0),
1074 BT848_ADC); 1074 BT848_ADC);
1075 1075
1076 btwrite(whitecrush_upper, BT848_WC_UP); 1076 btwrite(whitecrush_upper, BT848_WC_UP);
@@ -1089,7 +1089,7 @@ static void init_bt848(struct bttv *btv)
1089 bt848_contrast(btv, btv->contrast); 1089 bt848_contrast(btv, btv->contrast);
1090 bt848_sat(btv, btv->saturation); 1090 bt848_sat(btv, btv->saturation);
1091 1091
1092 /* interrupt */ 1092 /* interrupt */
1093 init_irqreg(btv); 1093 init_irqreg(btv);
1094} 1094}
1095 1095
@@ -1105,7 +1105,7 @@ static void bttv_reinit_bt848(struct bttv *btv)
1105 spin_unlock_irqrestore(&btv->s_lock,flags); 1105 spin_unlock_irqrestore(&btv->s_lock,flags);
1106 1106
1107 init_bt848(btv); 1107 init_bt848(btv);
1108 btv->pll.pll_current = -1; 1108 btv->pll.pll_current = -1;
1109 set_input(btv,btv->input); 1109 set_input(btv,btv->input);
1110} 1110}
1111 1111
@@ -1398,7 +1398,7 @@ bttv_switch_overlay(struct bttv *btv, struct bttv_fh *fh,
1398/* video4linux (1) interface */ 1398/* video4linux (1) interface */
1399 1399
1400static int bttv_prepare_buffer(struct bttv *btv, struct bttv_buffer *buf, 1400static int bttv_prepare_buffer(struct bttv *btv, struct bttv_buffer *buf,
1401 const struct bttv_format *fmt, 1401 const struct bttv_format *fmt,
1402 unsigned int width, unsigned int height, 1402 unsigned int width, unsigned int height,
1403 enum v4l2_field field) 1403 enum v4l2_field field)
1404{ 1404{
@@ -1521,8 +1521,8 @@ static const char *v4l1_ioctls[] = {
1521static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) 1521static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1522{ 1522{
1523 switch (cmd) { 1523 switch (cmd) {
1524 case BTTV_VERSION: 1524 case BTTV_VERSION:
1525 return BTTV_VERSION_CODE; 1525 return BTTV_VERSION_CODE;
1526 1526
1527 /* *** v4l1 *** ************************************************ */ 1527 /* *** v4l1 *** ************************************************ */
1528 case VIDIOCGFREQ: 1528 case VIDIOCGFREQ:
@@ -1576,32 +1576,32 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1576 return 0; 1576 return 0;
1577 } 1577 }
1578 1578
1579 case VIDIOCGCHAN: 1579 case VIDIOCGCHAN:
1580 { 1580 {
1581 struct video_channel *v = arg; 1581 struct video_channel *v = arg;
1582 unsigned int channel = v->channel; 1582 unsigned int channel = v->channel;
1583 1583
1584 if (channel >= bttv_tvcards[btv->c.type].video_inputs) 1584 if (channel >= bttv_tvcards[btv->c.type].video_inputs)
1585 return -EINVAL; 1585 return -EINVAL;
1586 v->tuners=0; 1586 v->tuners=0;
1587 v->flags = VIDEO_VC_AUDIO; 1587 v->flags = VIDEO_VC_AUDIO;
1588 v->type = VIDEO_TYPE_CAMERA; 1588 v->type = VIDEO_TYPE_CAMERA;
1589 v->norm = btv->tvnorm; 1589 v->norm = btv->tvnorm;
1590 if (channel == bttv_tvcards[btv->c.type].tuner) { 1590 if (channel == bttv_tvcards[btv->c.type].tuner) {
1591 strcpy(v->name,"Television"); 1591 strcpy(v->name,"Television");
1592 v->flags|=VIDEO_VC_TUNER; 1592 v->flags|=VIDEO_VC_TUNER;
1593 v->type=VIDEO_TYPE_TV; 1593 v->type=VIDEO_TYPE_TV;
1594 v->tuners=1; 1594 v->tuners=1;
1595 } else if (channel == btv->svhs) { 1595 } else if (channel == btv->svhs) {
1596 strcpy(v->name,"S-Video"); 1596 strcpy(v->name,"S-Video");
1597 } else { 1597 } else {
1598 sprintf(v->name,"Composite%d",channel); 1598 sprintf(v->name,"Composite%d",channel);
1599 } 1599 }
1600 return 0; 1600 return 0;
1601 } 1601 }
1602 case VIDIOCSCHAN: 1602 case VIDIOCSCHAN:
1603 { 1603 {
1604 struct video_channel *v = arg; 1604 struct video_channel *v = arg;
1605 unsigned int channel = v->channel; 1605 unsigned int channel = v->channel;
1606 1606
1607 if (channel >= bttv_tvcards[btv->c.type].video_inputs) 1607 if (channel >= bttv_tvcards[btv->c.type].video_inputs)
@@ -1623,7 +1623,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1623 return 0; 1623 return 0;
1624 } 1624 }
1625 1625
1626 case VIDIOCGAUDIO: 1626 case VIDIOCGAUDIO:
1627 { 1627 {
1628 struct video_audio *v = arg; 1628 struct video_audio *v = arg;
1629 1629
@@ -1728,7 +1728,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1728 } else if (i->index == btv->svhs) { 1728 } else if (i->index == btv->svhs) {
1729 sprintf(i->name, "S-Video"); 1729 sprintf(i->name, "S-Video");
1730 } else { 1730 } else {
1731 sprintf(i->name,"Composite%d",i->index); 1731 sprintf(i->name,"Composite%d",i->index);
1732 } 1732 }
1733 if (i->index == btv->input) { 1733 if (i->index == btv->input) {
1734 __u32 dstatus = btread(BT848_DSTATUS); 1734 __u32 dstatus = btread(BT848_DSTATUS);
@@ -2168,7 +2168,7 @@ static int bttv_s_fmt(struct bttv_fh *fh, struct bttv *btv,
2168 if (0 != retval) 2168 if (0 != retval)
2169 return retval; 2169 return retval;
2170 if (locked_btres(fh->btv, RESOURCE_VBI)) 2170 if (locked_btres(fh->btv, RESOURCE_VBI))
2171 return -EBUSY; 2171 return -EBUSY;
2172 bttv_vbi_try_fmt(fh,f); 2172 bttv_vbi_try_fmt(fh,f);
2173 bttv_vbi_setlines(fh,btv,f->fmt.vbi.count[0]); 2173 bttv_vbi_setlines(fh,btv,f->fmt.vbi.count[0]);
2174 bttv_vbi_get_fmt(fh,f); 2174 bttv_vbi_get_fmt(fh,f);
@@ -2206,9 +2206,9 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
2206 bttv_reinit_bt848(btv); 2206 bttv_reinit_bt848(btv);
2207 2207
2208 switch (cmd) { 2208 switch (cmd) {
2209 case VIDIOCSFREQ: 2209 case VIDIOCSFREQ:
2210 case VIDIOCSTUNER: 2210 case VIDIOCSTUNER:
2211 case VIDIOCSCHAN: 2211 case VIDIOCSCHAN:
2212 case VIDIOC_S_CTRL: 2212 case VIDIOC_S_CTRL:
2213 case VIDIOC_S_STD: 2213 case VIDIOC_S_STD:
2214 case VIDIOC_S_INPUT: 2214 case VIDIOC_S_INPUT:
@@ -2224,10 +2224,10 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
2224 /* *** v4l1 *** ************************************************ */ 2224 /* *** v4l1 *** ************************************************ */
2225 case VIDIOCGCAP: 2225 case VIDIOCGCAP:
2226 { 2226 {
2227 struct video_capability *cap = arg; 2227 struct video_capability *cap = arg;
2228 2228
2229 memset(cap,0,sizeof(*cap)); 2229 memset(cap,0,sizeof(*cap));
2230 strcpy(cap->name,btv->video_dev->name); 2230 strcpy(cap->name,btv->video_dev->name);
2231 if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) { 2231 if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) {
2232 /* vbi */ 2232 /* vbi */
2233 cap->type = VID_TYPE_TUNER|VID_TYPE_TELETEXT; 2233 cap->type = VID_TYPE_TUNER|VID_TYPE_TELETEXT;
@@ -2247,7 +2247,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
2247 } 2247 }
2248 cap->channels = bttv_tvcards[btv->c.type].video_inputs; 2248 cap->channels = bttv_tvcards[btv->c.type].video_inputs;
2249 cap->audios = bttv_tvcards[btv->c.type].audio_inputs; 2249 cap->audios = bttv_tvcards[btv->c.type].audio_inputs;
2250 return 0; 2250 return 0;
2251 } 2251 }
2252 2252
2253 case VIDIOCGPICT: 2253 case VIDIOCGPICT:
@@ -2296,7 +2296,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
2296 bt848_hue(btv,pic->hue); 2296 bt848_hue(btv,pic->hue);
2297 bt848_sat(btv,pic->colour); 2297 bt848_sat(btv,pic->colour);
2298 up(&fh->cap.lock); 2298 up(&fh->cap.lock);
2299 return 0; 2299 return 0;
2300 } 2300 }
2301 2301
2302 case VIDIOCGWIN: 2302 case VIDIOCGWIN:
@@ -2357,8 +2357,8 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
2357 unsigned long end; 2357 unsigned long end;
2358 2358
2359 if(!capable(CAP_SYS_ADMIN) && 2359 if(!capable(CAP_SYS_ADMIN) &&
2360 !capable(CAP_SYS_RAWIO)) 2360 !capable(CAP_SYS_RAWIO))
2361 return -EPERM; 2361 return -EPERM;
2362 end = (unsigned long)fbuf->base + 2362 end = (unsigned long)fbuf->base +
2363 fbuf->height * fbuf->bytesperline; 2363 fbuf->height * fbuf->bytesperline;
2364 down(&fh->cap.lock); 2364 down(&fh->cap.lock);
@@ -2432,7 +2432,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
2432 } 2432 }
2433 2433
2434 /* switch over */ 2434 /* switch over */
2435 retval = bttv_switch_overlay(btv,fh,new); 2435 retval = bttv_switch_overlay(btv,fh,new);
2436 up(&fh->cap.lock); 2436 up(&fh->cap.lock);
2437 return retval; 2437 return retval;
2438 } 2438 }
@@ -2571,13 +2571,13 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
2571 return 0; 2571 return 0;
2572 } 2572 }
2573 2573
2574 case BTTV_VERSION: 2574 case BTTV_VERSION:
2575 case VIDIOCGFREQ: 2575 case VIDIOCGFREQ:
2576 case VIDIOCSFREQ: 2576 case VIDIOCSFREQ:
2577 case VIDIOCGTUNER: 2577 case VIDIOCGTUNER:
2578 case VIDIOCSTUNER: 2578 case VIDIOCSTUNER:
2579 case VIDIOCGCHAN: 2579 case VIDIOCGCHAN:
2580 case VIDIOCSCHAN: 2580 case VIDIOCSCHAN:
2581 case VIDIOCGAUDIO: 2581 case VIDIOCGAUDIO:
2582 case VIDIOCSAUDIO: 2582 case VIDIOCSAUDIO:
2583 return bttv_common_ioctls(btv,cmd,arg); 2583 return bttv_common_ioctls(btv,cmd,arg);
@@ -2589,8 +2589,8 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
2589 2589
2590 if (0 == v4l2) 2590 if (0 == v4l2)
2591 return -EINVAL; 2591 return -EINVAL;
2592 strcpy(cap->driver,"bttv"); 2592 strcpy(cap->driver,"bttv");
2593 strlcpy(cap->card,btv->video_dev->name,sizeof(cap->card)); 2593 strlcpy(cap->card,btv->video_dev->name,sizeof(cap->card));
2594 sprintf(cap->bus_info,"PCI:%s",pci_name(btv->c.pci)); 2594 sprintf(cap->bus_info,"PCI:%s",pci_name(btv->c.pci));
2595 cap->version = BTTV_VERSION_CODE; 2595 cap->version = BTTV_VERSION_CODE;
2596 cap->capabilities = 2596 cap->capabilities =
@@ -3097,7 +3097,7 @@ static struct video_device bttv_video_template =
3097{ 3097{
3098 .name = "UNSET", 3098 .name = "UNSET",
3099 .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER| 3099 .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER|
3100 VID_TYPE_CLIPPING|VID_TYPE_SCALES, 3100 VID_TYPE_CLIPPING|VID_TYPE_SCALES,
3101 .hardware = VID_HARDWARE_BT848, 3101 .hardware = VID_HARDWARE_BT848,
3102 .fops = &bttv_fops, 3102 .fops = &bttv_fops,
3103 .minor = -1, 3103 .minor = -1,
@@ -3143,7 +3143,7 @@ static int radio_open(struct inode *inode, struct file *file)
3143 audio_mux(btv,AUDIO_RADIO); 3143 audio_mux(btv,AUDIO_RADIO);
3144 3144
3145 up(&btv->lock); 3145 up(&btv->lock);
3146 return 0; 3146 return 0;
3147} 3147}
3148 3148
3149static int radio_release(struct inode *inode, struct file *file) 3149static int radio_release(struct inode *inode, struct file *file)
@@ -3166,34 +3166,34 @@ static int radio_do_ioctl(struct inode *inode, struct file *file,
3166 switch (cmd) { 3166 switch (cmd) {
3167 case VIDIOCGCAP: 3167 case VIDIOCGCAP:
3168 { 3168 {
3169 struct video_capability *cap = arg; 3169 struct video_capability *cap = arg;
3170 3170
3171 memset(cap,0,sizeof(*cap)); 3171 memset(cap,0,sizeof(*cap));
3172 strcpy(cap->name,btv->radio_dev->name); 3172 strcpy(cap->name,btv->radio_dev->name);
3173 cap->type = VID_TYPE_TUNER; 3173 cap->type = VID_TYPE_TUNER;
3174 cap->channels = 1; 3174 cap->channels = 1;
3175 cap->audios = 1; 3175 cap->audios = 1;
3176 return 0; 3176 return 0;
3177 } 3177 }
3178 3178
3179 case VIDIOCGTUNER: 3179 case VIDIOCGTUNER:
3180 { 3180 {
3181 struct video_tuner *v = arg; 3181 struct video_tuner *v = arg;
3182 3182
3183 if(v->tuner) 3183 if(v->tuner)
3184 return -EINVAL; 3184 return -EINVAL;
3185 memset(v,0,sizeof(*v)); 3185 memset(v,0,sizeof(*v));
3186 strcpy(v->name, "Radio"); 3186 strcpy(v->name, "Radio");
3187 bttv_call_i2c_clients(btv,cmd,v); 3187 bttv_call_i2c_clients(btv,cmd,v);
3188 return 0; 3188 return 0;
3189 } 3189 }
3190 case VIDIOCSTUNER: 3190 case VIDIOCSTUNER:
3191 /* nothing to do */ 3191 /* nothing to do */
3192 return 0; 3192 return 0;
3193 3193
3194 case BTTV_VERSION: 3194 case BTTV_VERSION:
3195 case VIDIOCGFREQ: 3195 case VIDIOCGFREQ:
3196 case VIDIOCSFREQ: 3196 case VIDIOCSFREQ:
3197 case VIDIOCGAUDIO: 3197 case VIDIOCGAUDIO:
3198 case VIDIOCSAUDIO: 3198 case VIDIOCSAUDIO:
3199 return bttv_common_ioctls(btv,cmd,arg); 3199 return bttv_common_ioctls(btv,cmd,arg);
@@ -3699,7 +3699,7 @@ static irqreturn_t bttv_irq(int irq, void *dev_id, struct pt_regs * regs)
3699 } 3699 }
3700 3700
3701 if (astat&BT848_INT_VSYNC) 3701 if (astat&BT848_INT_VSYNC)
3702 btv->field_count++; 3702 btv->field_count++;
3703 3703
3704 if (astat & BT848_INT_GPINT) { 3704 if (astat & BT848_INT_GPINT) {
3705 wake_up(&btv->gpioq); 3705 wake_up(&btv->gpioq);
@@ -3711,13 +3711,13 @@ static irqreturn_t bttv_irq(int irq, void *dev_id, struct pt_regs * regs)
3711 wake_up(&btv->i2c_queue); 3711 wake_up(&btv->i2c_queue);
3712 } 3712 }
3713 3713
3714 if ((astat & BT848_INT_RISCI) && (stat & (4<<28))) 3714 if ((astat & BT848_INT_RISCI) && (stat & (4<<28)))
3715 bttv_irq_switch_vbi(btv); 3715 bttv_irq_switch_vbi(btv);
3716 3716
3717 if ((astat & BT848_INT_RISCI) && (stat & (2<<28))) 3717 if ((astat & BT848_INT_RISCI) && (stat & (2<<28)))
3718 bttv_irq_wakeup_top(btv); 3718 bttv_irq_wakeup_top(btv);
3719 3719
3720 if ((astat & BT848_INT_RISCI) && (stat & (1<<28))) 3720 if ((astat & BT848_INT_RISCI) && (stat & (1<<28)))
3721 bttv_irq_switch_video(btv); 3721 bttv_irq_switch_video(btv);
3722 3722
3723 if ((astat & BT848_INT_HLOCK) && btv->opt_automute) 3723 if ((astat & BT848_INT_HLOCK) && btv->opt_automute)
@@ -3744,7 +3744,7 @@ static irqreturn_t bttv_irq(int irq, void *dev_id, struct pt_regs * regs)
3744 if (count > 4) { 3744 if (count > 4) {
3745 3745
3746 if (count > 8 || !(astat & BT848_INT_GPINT)) { 3746 if (count > 8 || !(astat & BT848_INT_GPINT)) {
3747 btwrite(0, BT848_INT_MASK); 3747 btwrite(0, BT848_INT_MASK);
3748 3748
3749 printk(KERN_ERR 3749 printk(KERN_ERR
3750 "bttv%d: IRQ lockup, cleared int mask [", btv->c.nr); 3750 "bttv%d: IRQ lockup, cleared int mask [", btv->c.nr);
@@ -3826,7 +3826,7 @@ static int __devinit bttv_register_video(struct bttv *btv)
3826 3826
3827 /* video */ 3827 /* video */
3828 btv->video_dev = vdev_init(btv, &bttv_video_template, "video"); 3828 btv->video_dev = vdev_init(btv, &bttv_video_template, "video");
3829 if (NULL == btv->video_dev) 3829 if (NULL == btv->video_dev)
3830 goto err; 3830 goto err;
3831 if (video_register_device(btv->video_dev,VFL_TYPE_GRABBER,video_nr)<0) 3831 if (video_register_device(btv->video_dev,VFL_TYPE_GRABBER,video_nr)<0)
3832 goto err; 3832 goto err;
@@ -3836,18 +3836,18 @@ static int __devinit bttv_register_video(struct bttv *btv)
3836 3836
3837 /* vbi */ 3837 /* vbi */
3838 btv->vbi_dev = vdev_init(btv, &bttv_vbi_template, "vbi"); 3838 btv->vbi_dev = vdev_init(btv, &bttv_vbi_template, "vbi");
3839 if (NULL == btv->vbi_dev) 3839 if (NULL == btv->vbi_dev)
3840 goto err; 3840 goto err;
3841 if (video_register_device(btv->vbi_dev,VFL_TYPE_VBI,vbi_nr)<0) 3841 if (video_register_device(btv->vbi_dev,VFL_TYPE_VBI,vbi_nr)<0)
3842 goto err; 3842 goto err;
3843 printk(KERN_INFO "bttv%d: registered device vbi%d\n", 3843 printk(KERN_INFO "bttv%d: registered device vbi%d\n",
3844 btv->c.nr,btv->vbi_dev->minor & 0x1f); 3844 btv->c.nr,btv->vbi_dev->minor & 0x1f);
3845 3845
3846 if (!btv->has_radio) 3846 if (!btv->has_radio)
3847 return 0; 3847 return 0;
3848 /* radio */ 3848 /* radio */
3849 btv->radio_dev = vdev_init(btv, &radio_template, "radio"); 3849 btv->radio_dev = vdev_init(btv, &radio_template, "radio");
3850 if (NULL == btv->radio_dev) 3850 if (NULL == btv->radio_dev)
3851 goto err; 3851 goto err;
3852 if (video_register_device(btv->radio_dev, VFL_TYPE_RADIO,radio_nr)<0) 3852 if (video_register_device(btv->radio_dev, VFL_TYPE_RADIO,radio_nr)<0)
3853 goto err; 3853 goto err;
@@ -3868,11 +3868,11 @@ static int __devinit bttv_register_video(struct bttv *btv)
3868static void pci_set_command(struct pci_dev *dev) 3868static void pci_set_command(struct pci_dev *dev)
3869{ 3869{
3870#if defined(__powerpc__) 3870#if defined(__powerpc__)
3871 unsigned int cmd; 3871 unsigned int cmd;
3872 3872
3873 pci_read_config_dword(dev, PCI_COMMAND, &cmd); 3873 pci_read_config_dword(dev, PCI_COMMAND, &cmd);
3874 cmd = (cmd | PCI_COMMAND_MEMORY ); 3874 cmd = (cmd | PCI_COMMAND_MEMORY );
3875 pci_write_config_dword(dev, PCI_COMMAND, cmd); 3875 pci_write_config_dword(dev, PCI_COMMAND, cmd);
3876#endif 3876#endif
3877} 3877}
3878 3878
@@ -3886,21 +3886,21 @@ static int __devinit bttv_probe(struct pci_dev *dev,
3886 if (bttv_num == BTTV_MAX) 3886 if (bttv_num == BTTV_MAX)
3887 return -ENOMEM; 3887 return -ENOMEM;
3888 printk(KERN_INFO "bttv: Bt8xx card found (%d).\n", bttv_num); 3888 printk(KERN_INFO "bttv: Bt8xx card found (%d).\n", bttv_num);
3889 btv=&bttvs[bttv_num]; 3889 btv=&bttvs[bttv_num];
3890 memset(btv,0,sizeof(*btv)); 3890 memset(btv,0,sizeof(*btv));
3891 btv->c.nr = bttv_num; 3891 btv->c.nr = bttv_num;
3892 sprintf(btv->c.name,"bttv%d",btv->c.nr); 3892 sprintf(btv->c.name,"bttv%d",btv->c.nr);
3893 3893
3894 /* initialize structs / fill in defaults */ 3894 /* initialize structs / fill in defaults */
3895 init_MUTEX(&btv->lock); 3895 init_MUTEX(&btv->lock);
3896 init_MUTEX(&btv->reslock); 3896 init_MUTEX(&btv->reslock);
3897 spin_lock_init(&btv->s_lock); 3897 spin_lock_init(&btv->s_lock);
3898 spin_lock_init(&btv->gpio_lock); 3898 spin_lock_init(&btv->gpio_lock);
3899 init_waitqueue_head(&btv->gpioq); 3899 init_waitqueue_head(&btv->gpioq);
3900 init_waitqueue_head(&btv->i2c_queue); 3900 init_waitqueue_head(&btv->i2c_queue);
3901 INIT_LIST_HEAD(&btv->c.subs); 3901 INIT_LIST_HEAD(&btv->c.subs);
3902 INIT_LIST_HEAD(&btv->capture); 3902 INIT_LIST_HEAD(&btv->capture);
3903 INIT_LIST_HEAD(&btv->vcapture); 3903 INIT_LIST_HEAD(&btv->vcapture);
3904 v4l2_prio_init(&btv->prio); 3904 v4l2_prio_init(&btv->prio);
3905 3905
3906 init_timer(&btv->timeout); 3906 init_timer(&btv->timeout);
@@ -3921,27 +3921,27 @@ static int __devinit bttv_probe(struct pci_dev *dev,
3921 btv->c.nr); 3921 btv->c.nr);
3922 return -EIO; 3922 return -EIO;
3923 } 3923 }
3924 if (pci_set_dma_mask(dev, DMA_32BIT_MASK)) { 3924 if (pci_set_dma_mask(dev, DMA_32BIT_MASK)) {
3925 printk(KERN_WARNING "bttv%d: No suitable DMA available.\n", 3925 printk(KERN_WARNING "bttv%d: No suitable DMA available.\n",
3926 btv->c.nr); 3926 btv->c.nr);
3927 return -EIO; 3927 return -EIO;
3928 } 3928 }
3929 if (!request_mem_region(pci_resource_start(dev,0), 3929 if (!request_mem_region(pci_resource_start(dev,0),
3930 pci_resource_len(dev,0), 3930 pci_resource_len(dev,0),
3931 btv->c.name)) { 3931 btv->c.name)) {
3932 printk(KERN_WARNING "bttv%d: can't request iomem (0x%lx).\n", 3932 printk(KERN_WARNING "bttv%d: can't request iomem (0x%lx).\n",
3933 btv->c.nr, pci_resource_start(dev,0)); 3933 btv->c.nr, pci_resource_start(dev,0));
3934 return -EBUSY; 3934 return -EBUSY;
3935 } 3935 }
3936 pci_set_master(dev); 3936 pci_set_master(dev);
3937 pci_set_command(dev); 3937 pci_set_command(dev);
3938 pci_set_drvdata(dev,btv); 3938 pci_set_drvdata(dev,btv);
3939 3939
3940 pci_read_config_byte(dev, PCI_CLASS_REVISION, &btv->revision); 3940 pci_read_config_byte(dev, PCI_CLASS_REVISION, &btv->revision);
3941 pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat); 3941 pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat);
3942 printk(KERN_INFO "bttv%d: Bt%d (rev %d) at %s, ", 3942 printk(KERN_INFO "bttv%d: Bt%d (rev %d) at %s, ",
3943 bttv_num,btv->id, btv->revision, pci_name(dev)); 3943 bttv_num,btv->id, btv->revision, pci_name(dev));
3944 printk("irq: %d, latency: %d, mmio: 0x%lx\n", 3944 printk("irq: %d, latency: %d, mmio: 0x%lx\n",
3945 btv->c.pci->irq, lat, pci_resource_start(dev,0)); 3945 btv->c.pci->irq, lat, pci_resource_start(dev,0));
3946 schedule(); 3946 schedule();
3947 3947
@@ -3952,23 +3952,23 @@ static int __devinit bttv_probe(struct pci_dev *dev,
3952 goto fail1; 3952 goto fail1;
3953 } 3953 }
3954 3954
3955 /* identify card */ 3955 /* identify card */
3956 bttv_idcard(btv); 3956 bttv_idcard(btv);
3957 3957
3958 /* disable irqs, register irq handler */ 3958 /* disable irqs, register irq handler */
3959 btwrite(0, BT848_INT_MASK); 3959 btwrite(0, BT848_INT_MASK);
3960 result = request_irq(btv->c.pci->irq, bttv_irq, 3960 result = request_irq(btv->c.pci->irq, bttv_irq,
3961 SA_SHIRQ | SA_INTERRUPT,btv->c.name,(void *)btv); 3961 SA_SHIRQ | SA_INTERRUPT,btv->c.name,(void *)btv);
3962 if (result < 0) { 3962 if (result < 0) {
3963 printk(KERN_ERR "bttv%d: can't get IRQ %d\n", 3963 printk(KERN_ERR "bttv%d: can't get IRQ %d\n",
3964 bttv_num,btv->c.pci->irq); 3964 bttv_num,btv->c.pci->irq);
3965 goto fail1; 3965 goto fail1;
3966 } 3966 }
3967 3967
3968 if (0 != bttv_handle_chipset(btv)) { 3968 if (0 != bttv_handle_chipset(btv)) {
3969 result = -EIO; 3969 result = -EIO;
3970 goto fail2; 3970 goto fail2;
3971 } 3971 }
3972 3972
3973 /* init options from insmod args */ 3973 /* init options from insmod args */
3974 btv->opt_combfilter = combfilter; 3974 btv->opt_combfilter = combfilter;
@@ -3994,29 +3994,29 @@ static int __devinit bttv_probe(struct pci_dev *dev,
3994 btv->input = 0; 3994 btv->input = 0;
3995 3995
3996 /* initialize hardware */ 3996 /* initialize hardware */
3997 if (bttv_gpio) 3997 if (bttv_gpio)
3998 bttv_gpio_tracking(btv,"pre-init"); 3998 bttv_gpio_tracking(btv,"pre-init");
3999 3999
4000 bttv_risc_init_main(btv); 4000 bttv_risc_init_main(btv);
4001 init_bt848(btv); 4001 init_bt848(btv);
4002 4002
4003 /* gpio */ 4003 /* gpio */
4004 btwrite(0x00, BT848_GPIO_REG_INP); 4004 btwrite(0x00, BT848_GPIO_REG_INP);
4005 btwrite(0x00, BT848_GPIO_OUT_EN); 4005 btwrite(0x00, BT848_GPIO_OUT_EN);
4006 if (bttv_verbose) 4006 if (bttv_verbose)
4007 bttv_gpio_tracking(btv,"init"); 4007 bttv_gpio_tracking(btv,"init");
4008 4008
4009 /* needs to be done before i2c is registered */ 4009 /* needs to be done before i2c is registered */
4010 bttv_init_card1(btv); 4010 bttv_init_card1(btv);
4011 4011
4012 /* register i2c + gpio */ 4012 /* register i2c + gpio */
4013 init_bttv_i2c(btv); 4013 init_bttv_i2c(btv);
4014 4014
4015 /* some card-specific stuff (needs working i2c) */ 4015 /* some card-specific stuff (needs working i2c) */
4016 bttv_init_card2(btv); 4016 bttv_init_card2(btv);
4017 init_irqreg(btv); 4017 init_irqreg(btv);
4018 4018
4019 /* register video4linux + input */ 4019 /* register video4linux + input */
4020 if (!bttv_tvcards[btv->c.type].no_video) { 4020 if (!bttv_tvcards[btv->c.type].no_video) {
4021 bttv_register_video(btv); 4021 bttv_register_video(btv);
4022 bt848_bright(btv,32768); 4022 bt848_bright(btv,32768);
@@ -4035,10 +4035,10 @@ static int __devinit bttv_probe(struct pci_dev *dev,
4035 4035
4036 /* everything is fine */ 4036 /* everything is fine */
4037 bttv_num++; 4037 bttv_num++;
4038 return 0; 4038 return 0;
4039 4039
4040 fail2: 4040 fail2:
4041 free_irq(btv->c.pci->irq,btv); 4041 free_irq(btv->c.pci->irq,btv);
4042 4042
4043 fail1: 4043 fail1:
4044 if (btv->bt848_mmio) 4044 if (btv->bt848_mmio)
@@ -4051,12 +4051,12 @@ static int __devinit bttv_probe(struct pci_dev *dev,
4051 4051
4052static void __devexit bttv_remove(struct pci_dev *pci_dev) 4052static void __devexit bttv_remove(struct pci_dev *pci_dev)
4053{ 4053{
4054 struct bttv *btv = pci_get_drvdata(pci_dev); 4054 struct bttv *btv = pci_get_drvdata(pci_dev);
4055 4055
4056 if (bttv_verbose) 4056 if (bttv_verbose)
4057 printk("bttv%d: unloading\n",btv->c.nr); 4057 printk("bttv%d: unloading\n",btv->c.nr);
4058 4058
4059 /* shutdown everything (DMA+IRQs) */ 4059 /* shutdown everything (DMA+IRQs) */
4060 btand(~15, BT848_GPIO_DMA_CTL); 4060 btand(~15, BT848_GPIO_DMA_CTL);
4061 btwrite(0, BT848_INT_MASK); 4061 btwrite(0, BT848_INT_MASK);
4062 btwrite(~0x0, BT848_INT_STAT); 4062 btwrite(~0x0, BT848_INT_STAT);
@@ -4069,7 +4069,7 @@ static void __devexit bttv_remove(struct pci_dev *pci_dev)
4069 wake_up(&btv->gpioq); 4069 wake_up(&btv->gpioq);
4070 bttv_sub_del_devices(&btv->c); 4070 bttv_sub_del_devices(&btv->c);
4071 4071
4072 /* unregister i2c_bus + input */ 4072 /* unregister i2c_bus + input */
4073 fini_bttv_i2c(btv); 4073 fini_bttv_i2c(btv);
4074 4074
4075 /* unregister video4linux */ 4075 /* unregister video4linux */
@@ -4079,18 +4079,18 @@ static void __devexit bttv_remove(struct pci_dev *pci_dev)
4079 btcx_riscmem_free(btv->c.pci,&btv->main); 4079 btcx_riscmem_free(btv->c.pci,&btv->main);
4080 4080
4081 /* free ressources */ 4081 /* free ressources */
4082 free_irq(btv->c.pci->irq,btv); 4082 free_irq(btv->c.pci->irq,btv);
4083 iounmap(btv->bt848_mmio); 4083 iounmap(btv->bt848_mmio);
4084 release_mem_region(pci_resource_start(btv->c.pci,0), 4084 release_mem_region(pci_resource_start(btv->c.pci,0),
4085 pci_resource_len(btv->c.pci,0)); 4085 pci_resource_len(btv->c.pci,0));
4086 4086
4087 pci_set_drvdata(pci_dev, NULL); 4087 pci_set_drvdata(pci_dev, NULL);
4088 return; 4088 return;
4089} 4089}
4090 4090
4091static int bttv_suspend(struct pci_dev *pci_dev, pm_message_t state) 4091static int bttv_suspend(struct pci_dev *pci_dev, pm_message_t state)
4092{ 4092{
4093 struct bttv *btv = pci_get_drvdata(pci_dev); 4093 struct bttv *btv = pci_get_drvdata(pci_dev);
4094 struct bttv_buffer_set idle; 4094 struct bttv_buffer_set idle;
4095 unsigned long flags; 4095 unsigned long flags;
4096 4096
@@ -4125,7 +4125,7 @@ static int bttv_suspend(struct pci_dev *pci_dev, pm_message_t state)
4125 4125
4126static int bttv_resume(struct pci_dev *pci_dev) 4126static int bttv_resume(struct pci_dev *pci_dev)
4127{ 4127{
4128 struct bttv *btv = pci_get_drvdata(pci_dev); 4128 struct bttv *btv = pci_get_drvdata(pci_dev);
4129 unsigned long flags; 4129 unsigned long flags;
4130 int err; 4130 int err;
4131 4131
@@ -4170,24 +4170,24 @@ static int bttv_resume(struct pci_dev *pci_dev)
4170} 4170}
4171 4171
4172static struct pci_device_id bttv_pci_tbl[] = { 4172static struct pci_device_id bttv_pci_tbl[] = {
4173 {PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT848, 4173 {PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT848,
4174 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 4174 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
4175 {PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT849, 4175 {PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT849,
4176 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 4176 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
4177 {PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT878, 4177 {PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT878,
4178 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 4178 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
4179 {PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT879, 4179 {PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT879,
4180 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 4180 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
4181 {0,} 4181 {0,}
4182}; 4182};
4183 4183
4184MODULE_DEVICE_TABLE(pci, bttv_pci_tbl); 4184MODULE_DEVICE_TABLE(pci, bttv_pci_tbl);
4185 4185
4186static struct pci_driver bttv_pci_driver = { 4186static struct pci_driver bttv_pci_driver = {
4187 .name = "bttv", 4187 .name = "bttv",
4188 .id_table = bttv_pci_tbl, 4188 .id_table = bttv_pci_tbl,
4189 .probe = bttv_probe, 4189 .probe = bttv_probe,
4190 .remove = __devexit_p(bttv_remove), 4190 .remove = __devexit_p(bttv_remove),
4191 .suspend = bttv_suspend, 4191 .suspend = bttv_suspend,
4192 .resume = bttv_resume, 4192 .resume = bttv_resume,
4193}; 4193};