diff options
Diffstat (limited to 'drivers/media/video/bttv-driver.c')
-rw-r--r-- | drivers/media/video/bttv-driver.c | 379 |
1 files changed, 198 insertions, 181 deletions
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c index d538a994ff04..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 | ||
193 | const struct bttv_tvnorm bttv_tvnorms[] = { | 193 | const 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 | ||
853 | static void bt848_contrast(struct bttv *btv, int cont) | 853 | static 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 | ||
867 | static void bt848_sat(struct bttv *btv, int color) | 867 | static 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); |
@@ -964,7 +964,7 @@ i2c_vidiocschan(struct bttv *btv) | |||
964 | c.norm = btv->tvnorm; | 964 | c.norm = btv->tvnorm; |
965 | c.channel = btv->input; | 965 | c.channel = btv->input; |
966 | bttv_call_i2c_clients(btv,VIDIOCSCHAN,&c); | 966 | bttv_call_i2c_clients(btv,VIDIOCSCHAN,&c); |
967 | if (btv->c.type == BTTV_VOODOOTV_FM) | 967 | if (btv->c.type == BTTV_BOARD_VOODOOTV_FM) |
968 | bttv_tda9880_setnorm(btv,c.norm); | 968 | bttv_tda9880_setnorm(btv,c.norm); |
969 | } | 969 | } |
970 | 970 | ||
@@ -988,7 +988,7 @@ set_tvnorm(struct bttv *btv, unsigned int norm) | |||
988 | bt848A_set_timing(btv); | 988 | bt848A_set_timing(btv); |
989 | 989 | ||
990 | switch (btv->c.type) { | 990 | switch (btv->c.type) { |
991 | case BTTV_VOODOOTV_FM: | 991 | case BTTV_BOARD_VOODOOTV_FM: |
992 | bttv_tda9880_setnorm(btv,norm); | 992 | bttv_tda9880_setnorm(btv,norm); |
993 | break; | 993 | break; |
994 | } | 994 | } |
@@ -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 | ||
1400 | static int bttv_prepare_buffer(struct bttv *btv, struct bttv_buffer *buf, | 1400 | static 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[] = { | |||
1521 | static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) | 1521 | static 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); |
@@ -1851,6 +1851,11 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) | |||
1851 | up(&btv->lock); | 1851 | up(&btv->lock); |
1852 | return 0; | 1852 | return 0; |
1853 | } | 1853 | } |
1854 | case VIDIOC_LOG_STATUS: | ||
1855 | { | ||
1856 | bttv_call_i2c_clients(btv, VIDIOC_LOG_STATUS, 0); | ||
1857 | return 0; | ||
1858 | } | ||
1854 | 1859 | ||
1855 | default: | 1860 | default: |
1856 | return -ENOIOCTLCMD; | 1861 | return -ENOIOCTLCMD; |
@@ -2163,7 +2168,7 @@ static int bttv_s_fmt(struct bttv_fh *fh, struct bttv *btv, | |||
2163 | if (0 != retval) | 2168 | if (0 != retval) |
2164 | return retval; | 2169 | return retval; |
2165 | if (locked_btres(fh->btv, RESOURCE_VBI)) | 2170 | if (locked_btres(fh->btv, RESOURCE_VBI)) |
2166 | return -EBUSY; | 2171 | return -EBUSY; |
2167 | bttv_vbi_try_fmt(fh,f); | 2172 | bttv_vbi_try_fmt(fh,f); |
2168 | bttv_vbi_setlines(fh,btv,f->fmt.vbi.count[0]); | 2173 | bttv_vbi_setlines(fh,btv,f->fmt.vbi.count[0]); |
2169 | bttv_vbi_get_fmt(fh,f); | 2174 | bttv_vbi_get_fmt(fh,f); |
@@ -2201,9 +2206,9 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2201 | bttv_reinit_bt848(btv); | 2206 | bttv_reinit_bt848(btv); |
2202 | 2207 | ||
2203 | switch (cmd) { | 2208 | switch (cmd) { |
2204 | case VIDIOCSFREQ: | 2209 | case VIDIOCSFREQ: |
2205 | case VIDIOCSTUNER: | 2210 | case VIDIOCSTUNER: |
2206 | case VIDIOCSCHAN: | 2211 | case VIDIOCSCHAN: |
2207 | case VIDIOC_S_CTRL: | 2212 | case VIDIOC_S_CTRL: |
2208 | case VIDIOC_S_STD: | 2213 | case VIDIOC_S_STD: |
2209 | case VIDIOC_S_INPUT: | 2214 | case VIDIOC_S_INPUT: |
@@ -2219,10 +2224,10 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2219 | /* *** v4l1 *** ************************************************ */ | 2224 | /* *** v4l1 *** ************************************************ */ |
2220 | case VIDIOCGCAP: | 2225 | case VIDIOCGCAP: |
2221 | { | 2226 | { |
2222 | struct video_capability *cap = arg; | 2227 | struct video_capability *cap = arg; |
2223 | 2228 | ||
2224 | memset(cap,0,sizeof(*cap)); | 2229 | memset(cap,0,sizeof(*cap)); |
2225 | strcpy(cap->name,btv->video_dev->name); | 2230 | strcpy(cap->name,btv->video_dev->name); |
2226 | if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) { | 2231 | if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) { |
2227 | /* vbi */ | 2232 | /* vbi */ |
2228 | cap->type = VID_TYPE_TUNER|VID_TYPE_TELETEXT; | 2233 | cap->type = VID_TYPE_TUNER|VID_TYPE_TELETEXT; |
@@ -2242,7 +2247,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2242 | } | 2247 | } |
2243 | cap->channels = bttv_tvcards[btv->c.type].video_inputs; | 2248 | cap->channels = bttv_tvcards[btv->c.type].video_inputs; |
2244 | cap->audios = bttv_tvcards[btv->c.type].audio_inputs; | 2249 | cap->audios = bttv_tvcards[btv->c.type].audio_inputs; |
2245 | return 0; | 2250 | return 0; |
2246 | } | 2251 | } |
2247 | 2252 | ||
2248 | case VIDIOCGPICT: | 2253 | case VIDIOCGPICT: |
@@ -2291,7 +2296,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2291 | bt848_hue(btv,pic->hue); | 2296 | bt848_hue(btv,pic->hue); |
2292 | bt848_sat(btv,pic->colour); | 2297 | bt848_sat(btv,pic->colour); |
2293 | up(&fh->cap.lock); | 2298 | up(&fh->cap.lock); |
2294 | return 0; | 2299 | return 0; |
2295 | } | 2300 | } |
2296 | 2301 | ||
2297 | case VIDIOCGWIN: | 2302 | case VIDIOCGWIN: |
@@ -2352,8 +2357,8 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2352 | unsigned long end; | 2357 | unsigned long end; |
2353 | 2358 | ||
2354 | if(!capable(CAP_SYS_ADMIN) && | 2359 | if(!capable(CAP_SYS_ADMIN) && |
2355 | !capable(CAP_SYS_RAWIO)) | 2360 | !capable(CAP_SYS_RAWIO)) |
2356 | return -EPERM; | 2361 | return -EPERM; |
2357 | end = (unsigned long)fbuf->base + | 2362 | end = (unsigned long)fbuf->base + |
2358 | fbuf->height * fbuf->bytesperline; | 2363 | fbuf->height * fbuf->bytesperline; |
2359 | down(&fh->cap.lock); | 2364 | down(&fh->cap.lock); |
@@ -2427,7 +2432,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2427 | } | 2432 | } |
2428 | 2433 | ||
2429 | /* switch over */ | 2434 | /* switch over */ |
2430 | retval = bttv_switch_overlay(btv,fh,new); | 2435 | retval = bttv_switch_overlay(btv,fh,new); |
2431 | up(&fh->cap.lock); | 2436 | up(&fh->cap.lock); |
2432 | return retval; | 2437 | return retval; |
2433 | } | 2438 | } |
@@ -2566,13 +2571,13 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2566 | return 0; | 2571 | return 0; |
2567 | } | 2572 | } |
2568 | 2573 | ||
2569 | case BTTV_VERSION: | 2574 | case BTTV_VERSION: |
2570 | case VIDIOCGFREQ: | 2575 | case VIDIOCGFREQ: |
2571 | case VIDIOCSFREQ: | 2576 | case VIDIOCSFREQ: |
2572 | case VIDIOCGTUNER: | 2577 | case VIDIOCGTUNER: |
2573 | case VIDIOCSTUNER: | 2578 | case VIDIOCSTUNER: |
2574 | case VIDIOCGCHAN: | 2579 | case VIDIOCGCHAN: |
2575 | case VIDIOCSCHAN: | 2580 | case VIDIOCSCHAN: |
2576 | case VIDIOCGAUDIO: | 2581 | case VIDIOCGAUDIO: |
2577 | case VIDIOCSAUDIO: | 2582 | case VIDIOCSAUDIO: |
2578 | return bttv_common_ioctls(btv,cmd,arg); | 2583 | return bttv_common_ioctls(btv,cmd,arg); |
@@ -2584,8 +2589,8 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2584 | 2589 | ||
2585 | if (0 == v4l2) | 2590 | if (0 == v4l2) |
2586 | return -EINVAL; | 2591 | return -EINVAL; |
2587 | strcpy(cap->driver,"bttv"); | 2592 | strcpy(cap->driver,"bttv"); |
2588 | strlcpy(cap->card,btv->video_dev->name,sizeof(cap->card)); | 2593 | strlcpy(cap->card,btv->video_dev->name,sizeof(cap->card)); |
2589 | sprintf(cap->bus_info,"PCI:%s",pci_name(btv->c.pci)); | 2594 | sprintf(cap->bus_info,"PCI:%s",pci_name(btv->c.pci)); |
2590 | cap->version = BTTV_VERSION_CODE; | 2595 | cap->version = BTTV_VERSION_CODE; |
2591 | cap->capabilities = | 2596 | cap->capabilities = |
@@ -2856,6 +2861,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2856 | case VIDIOC_S_TUNER: | 2861 | case VIDIOC_S_TUNER: |
2857 | case VIDIOC_G_FREQUENCY: | 2862 | case VIDIOC_G_FREQUENCY: |
2858 | case VIDIOC_S_FREQUENCY: | 2863 | case VIDIOC_S_FREQUENCY: |
2864 | case VIDIOC_LOG_STATUS: | ||
2859 | return bttv_common_ioctls(btv,cmd,arg); | 2865 | return bttv_common_ioctls(btv,cmd,arg); |
2860 | 2866 | ||
2861 | default: | 2867 | default: |
@@ -3091,7 +3097,7 @@ static struct video_device bttv_video_template = | |||
3091 | { | 3097 | { |
3092 | .name = "UNSET", | 3098 | .name = "UNSET", |
3093 | .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER| | 3099 | .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER| |
3094 | VID_TYPE_CLIPPING|VID_TYPE_SCALES, | 3100 | VID_TYPE_CLIPPING|VID_TYPE_SCALES, |
3095 | .hardware = VID_HARDWARE_BT848, | 3101 | .hardware = VID_HARDWARE_BT848, |
3096 | .fops = &bttv_fops, | 3102 | .fops = &bttv_fops, |
3097 | .minor = -1, | 3103 | .minor = -1, |
@@ -3137,7 +3143,7 @@ static int radio_open(struct inode *inode, struct file *file) | |||
3137 | audio_mux(btv,AUDIO_RADIO); | 3143 | audio_mux(btv,AUDIO_RADIO); |
3138 | 3144 | ||
3139 | up(&btv->lock); | 3145 | up(&btv->lock); |
3140 | return 0; | 3146 | return 0; |
3141 | } | 3147 | } |
3142 | 3148 | ||
3143 | static int radio_release(struct inode *inode, struct file *file) | 3149 | static int radio_release(struct inode *inode, struct file *file) |
@@ -3160,34 +3166,34 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, | |||
3160 | switch (cmd) { | 3166 | switch (cmd) { |
3161 | case VIDIOCGCAP: | 3167 | case VIDIOCGCAP: |
3162 | { | 3168 | { |
3163 | struct video_capability *cap = arg; | 3169 | struct video_capability *cap = arg; |
3164 | 3170 | ||
3165 | memset(cap,0,sizeof(*cap)); | 3171 | memset(cap,0,sizeof(*cap)); |
3166 | strcpy(cap->name,btv->radio_dev->name); | 3172 | strcpy(cap->name,btv->radio_dev->name); |
3167 | cap->type = VID_TYPE_TUNER; | 3173 | cap->type = VID_TYPE_TUNER; |
3168 | cap->channels = 1; | 3174 | cap->channels = 1; |
3169 | cap->audios = 1; | 3175 | cap->audios = 1; |
3170 | return 0; | 3176 | return 0; |
3171 | } | 3177 | } |
3172 | 3178 | ||
3173 | case VIDIOCGTUNER: | 3179 | case VIDIOCGTUNER: |
3174 | { | 3180 | { |
3175 | struct video_tuner *v = arg; | 3181 | struct video_tuner *v = arg; |
3176 | 3182 | ||
3177 | if(v->tuner) | 3183 | if(v->tuner) |
3178 | return -EINVAL; | 3184 | return -EINVAL; |
3179 | memset(v,0,sizeof(*v)); | 3185 | memset(v,0,sizeof(*v)); |
3180 | strcpy(v->name, "Radio"); | 3186 | strcpy(v->name, "Radio"); |
3181 | bttv_call_i2c_clients(btv,cmd,v); | 3187 | bttv_call_i2c_clients(btv,cmd,v); |
3182 | return 0; | 3188 | return 0; |
3183 | } | 3189 | } |
3184 | case VIDIOCSTUNER: | 3190 | case VIDIOCSTUNER: |
3185 | /* nothing to do */ | 3191 | /* nothing to do */ |
3186 | return 0; | 3192 | return 0; |
3187 | 3193 | ||
3188 | case BTTV_VERSION: | 3194 | case BTTV_VERSION: |
3189 | case VIDIOCGFREQ: | 3195 | case VIDIOCGFREQ: |
3190 | case VIDIOCSFREQ: | 3196 | case VIDIOCSFREQ: |
3191 | case VIDIOCGAUDIO: | 3197 | case VIDIOCGAUDIO: |
3192 | case VIDIOCSAUDIO: | 3198 | case VIDIOCSAUDIO: |
3193 | return bttv_common_ioctls(btv,cmd,arg); | 3199 | return bttv_common_ioctls(btv,cmd,arg); |
@@ -3693,7 +3699,7 @@ static irqreturn_t bttv_irq(int irq, void *dev_id, struct pt_regs * regs) | |||
3693 | } | 3699 | } |
3694 | 3700 | ||
3695 | if (astat&BT848_INT_VSYNC) | 3701 | if (astat&BT848_INT_VSYNC) |
3696 | btv->field_count++; | 3702 | btv->field_count++; |
3697 | 3703 | ||
3698 | if (astat & BT848_INT_GPINT) { | 3704 | if (astat & BT848_INT_GPINT) { |
3699 | wake_up(&btv->gpioq); | 3705 | wake_up(&btv->gpioq); |
@@ -3705,13 +3711,13 @@ static irqreturn_t bttv_irq(int irq, void *dev_id, struct pt_regs * regs) | |||
3705 | wake_up(&btv->i2c_queue); | 3711 | wake_up(&btv->i2c_queue); |
3706 | } | 3712 | } |
3707 | 3713 | ||
3708 | if ((astat & BT848_INT_RISCI) && (stat & (4<<28))) | 3714 | if ((astat & BT848_INT_RISCI) && (stat & (4<<28))) |
3709 | bttv_irq_switch_vbi(btv); | 3715 | bttv_irq_switch_vbi(btv); |
3710 | 3716 | ||
3711 | if ((astat & BT848_INT_RISCI) && (stat & (2<<28))) | 3717 | if ((astat & BT848_INT_RISCI) && (stat & (2<<28))) |
3712 | bttv_irq_wakeup_top(btv); | 3718 | bttv_irq_wakeup_top(btv); |
3713 | 3719 | ||
3714 | if ((astat & BT848_INT_RISCI) && (stat & (1<<28))) | 3720 | if ((astat & BT848_INT_RISCI) && (stat & (1<<28))) |
3715 | bttv_irq_switch_video(btv); | 3721 | bttv_irq_switch_video(btv); |
3716 | 3722 | ||
3717 | if ((astat & BT848_INT_HLOCK) && btv->opt_automute) | 3723 | if ((astat & BT848_INT_HLOCK) && btv->opt_automute) |
@@ -3736,10 +3742,22 @@ static irqreturn_t bttv_irq(int irq, void *dev_id, struct pt_regs * regs) | |||
3736 | 3742 | ||
3737 | count++; | 3743 | count++; |
3738 | if (count > 4) { | 3744 | if (count > 4) { |
3739 | btwrite(0, BT848_INT_MASK); | 3745 | |
3740 | printk(KERN_ERR | 3746 | if (count > 8 || !(astat & BT848_INT_GPINT)) { |
3741 | "bttv%d: IRQ lockup, cleared int mask [", btv->c.nr); | 3747 | btwrite(0, BT848_INT_MASK); |
3748 | |||
3749 | printk(KERN_ERR | ||
3750 | "bttv%d: IRQ lockup, cleared int mask [", btv->c.nr); | ||
3751 | } else { | ||
3752 | printk(KERN_ERR | ||
3753 | "bttv%d: IRQ lockup, clearing GPINT from int mask [", btv->c.nr); | ||
3754 | |||
3755 | btwrite(btread(BT848_INT_MASK) & (-1 ^ BT848_INT_GPINT), | ||
3756 | BT848_INT_MASK); | ||
3757 | }; | ||
3758 | |||
3742 | bttv_print_irqbits(stat,astat); | 3759 | bttv_print_irqbits(stat,astat); |
3760 | |||
3743 | printk("]\n"); | 3761 | printk("]\n"); |
3744 | } | 3762 | } |
3745 | } | 3763 | } |
@@ -3808,7 +3826,7 @@ static int __devinit bttv_register_video(struct bttv *btv) | |||
3808 | 3826 | ||
3809 | /* video */ | 3827 | /* video */ |
3810 | btv->video_dev = vdev_init(btv, &bttv_video_template, "video"); | 3828 | btv->video_dev = vdev_init(btv, &bttv_video_template, "video"); |
3811 | if (NULL == btv->video_dev) | 3829 | if (NULL == btv->video_dev) |
3812 | goto err; | 3830 | goto err; |
3813 | 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) |
3814 | goto err; | 3832 | goto err; |
@@ -3818,18 +3836,18 @@ static int __devinit bttv_register_video(struct bttv *btv) | |||
3818 | 3836 | ||
3819 | /* vbi */ | 3837 | /* vbi */ |
3820 | btv->vbi_dev = vdev_init(btv, &bttv_vbi_template, "vbi"); | 3838 | btv->vbi_dev = vdev_init(btv, &bttv_vbi_template, "vbi"); |
3821 | if (NULL == btv->vbi_dev) | 3839 | if (NULL == btv->vbi_dev) |
3822 | goto err; | 3840 | goto err; |
3823 | 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) |
3824 | goto err; | 3842 | goto err; |
3825 | printk(KERN_INFO "bttv%d: registered device vbi%d\n", | 3843 | printk(KERN_INFO "bttv%d: registered device vbi%d\n", |
3826 | btv->c.nr,btv->vbi_dev->minor & 0x1f); | 3844 | btv->c.nr,btv->vbi_dev->minor & 0x1f); |
3827 | 3845 | ||
3828 | if (!btv->has_radio) | 3846 | if (!btv->has_radio) |
3829 | return 0; | 3847 | return 0; |
3830 | /* radio */ | 3848 | /* radio */ |
3831 | btv->radio_dev = vdev_init(btv, &radio_template, "radio"); | 3849 | btv->radio_dev = vdev_init(btv, &radio_template, "radio"); |
3832 | if (NULL == btv->radio_dev) | 3850 | if (NULL == btv->radio_dev) |
3833 | goto err; | 3851 | goto err; |
3834 | 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) |
3835 | goto err; | 3853 | goto err; |
@@ -3850,11 +3868,11 @@ static int __devinit bttv_register_video(struct bttv *btv) | |||
3850 | static void pci_set_command(struct pci_dev *dev) | 3868 | static void pci_set_command(struct pci_dev *dev) |
3851 | { | 3869 | { |
3852 | #if defined(__powerpc__) | 3870 | #if defined(__powerpc__) |
3853 | unsigned int cmd; | 3871 | unsigned int cmd; |
3854 | 3872 | ||
3855 | pci_read_config_dword(dev, PCI_COMMAND, &cmd); | 3873 | pci_read_config_dword(dev, PCI_COMMAND, &cmd); |
3856 | cmd = (cmd | PCI_COMMAND_MEMORY ); | 3874 | cmd = (cmd | PCI_COMMAND_MEMORY ); |
3857 | pci_write_config_dword(dev, PCI_COMMAND, cmd); | 3875 | pci_write_config_dword(dev, PCI_COMMAND, cmd); |
3858 | #endif | 3876 | #endif |
3859 | } | 3877 | } |
3860 | 3878 | ||
@@ -3868,63 +3886,62 @@ static int __devinit bttv_probe(struct pci_dev *dev, | |||
3868 | if (bttv_num == BTTV_MAX) | 3886 | if (bttv_num == BTTV_MAX) |
3869 | return -ENOMEM; | 3887 | return -ENOMEM; |
3870 | printk(KERN_INFO "bttv: Bt8xx card found (%d).\n", bttv_num); | 3888 | printk(KERN_INFO "bttv: Bt8xx card found (%d).\n", bttv_num); |
3871 | btv=&bttvs[bttv_num]; | 3889 | btv=&bttvs[bttv_num]; |
3872 | memset(btv,0,sizeof(*btv)); | 3890 | memset(btv,0,sizeof(*btv)); |
3873 | btv->c.nr = bttv_num; | 3891 | btv->c.nr = bttv_num; |
3874 | sprintf(btv->c.name,"bttv%d",btv->c.nr); | 3892 | sprintf(btv->c.name,"bttv%d",btv->c.nr); |
3875 | 3893 | ||
3876 | /* initialize structs / fill in defaults */ | 3894 | /* initialize structs / fill in defaults */ |
3877 | init_MUTEX(&btv->lock); | 3895 | init_MUTEX(&btv->lock); |
3878 | init_MUTEX(&btv->reslock); | 3896 | init_MUTEX(&btv->reslock); |
3879 | spin_lock_init(&btv->s_lock); | 3897 | spin_lock_init(&btv->s_lock); |
3880 | spin_lock_init(&btv->gpio_lock); | 3898 | spin_lock_init(&btv->gpio_lock); |
3881 | init_waitqueue_head(&btv->gpioq); | 3899 | init_waitqueue_head(&btv->gpioq); |
3882 | init_waitqueue_head(&btv->i2c_queue); | 3900 | init_waitqueue_head(&btv->i2c_queue); |
3883 | INIT_LIST_HEAD(&btv->c.subs); | 3901 | INIT_LIST_HEAD(&btv->c.subs); |
3884 | INIT_LIST_HEAD(&btv->capture); | 3902 | INIT_LIST_HEAD(&btv->capture); |
3885 | INIT_LIST_HEAD(&btv->vcapture); | 3903 | INIT_LIST_HEAD(&btv->vcapture); |
3886 | v4l2_prio_init(&btv->prio); | 3904 | v4l2_prio_init(&btv->prio); |
3887 | 3905 | ||
3888 | init_timer(&btv->timeout); | 3906 | init_timer(&btv->timeout); |
3889 | btv->timeout.function = bttv_irq_timeout; | 3907 | btv->timeout.function = bttv_irq_timeout; |
3890 | btv->timeout.data = (unsigned long)btv; | 3908 | btv->timeout.data = (unsigned long)btv; |
3891 | 3909 | ||
3892 | btv->i2c_rc = -1; | 3910 | btv->i2c_rc = -1; |
3893 | btv->tuner_type = UNSET; | 3911 | btv->tuner_type = UNSET; |
3894 | btv->pinnacle_id = UNSET; | 3912 | btv->pinnacle_id = UNSET; |
3895 | btv->new_input = UNSET; | 3913 | btv->new_input = UNSET; |
3896 | btv->gpioirq = 1; | ||
3897 | btv->has_radio=radio[btv->c.nr]; | 3914 | btv->has_radio=radio[btv->c.nr]; |
3898 | 3915 | ||
3899 | /* pci stuff (init, get irq/mmio, ... */ | 3916 | /* pci stuff (init, get irq/mmio, ... */ |
3900 | btv->c.pci = dev; | 3917 | btv->c.pci = dev; |
3901 | btv->id = dev->device; | 3918 | btv->id = dev->device; |
3902 | if (pci_enable_device(dev)) { | 3919 | if (pci_enable_device(dev)) { |
3903 | printk(KERN_WARNING "bttv%d: Can't enable device.\n", | 3920 | printk(KERN_WARNING "bttv%d: Can't enable device.\n", |
3904 | btv->c.nr); | 3921 | btv->c.nr); |
3905 | return -EIO; | 3922 | return -EIO; |
3906 | } | 3923 | } |
3907 | if (pci_set_dma_mask(dev, DMA_32BIT_MASK)) { | 3924 | if (pci_set_dma_mask(dev, DMA_32BIT_MASK)) { |
3908 | printk(KERN_WARNING "bttv%d: No suitable DMA available.\n", | 3925 | printk(KERN_WARNING "bttv%d: No suitable DMA available.\n", |
3909 | btv->c.nr); | 3926 | btv->c.nr); |
3910 | return -EIO; | 3927 | return -EIO; |
3911 | } | 3928 | } |
3912 | if (!request_mem_region(pci_resource_start(dev,0), | 3929 | if (!request_mem_region(pci_resource_start(dev,0), |
3913 | pci_resource_len(dev,0), | 3930 | pci_resource_len(dev,0), |
3914 | btv->c.name)) { | 3931 | btv->c.name)) { |
3915 | 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", |
3916 | btv->c.nr, pci_resource_start(dev,0)); | 3933 | btv->c.nr, pci_resource_start(dev,0)); |
3917 | return -EBUSY; | 3934 | return -EBUSY; |
3918 | } | 3935 | } |
3919 | pci_set_master(dev); | 3936 | pci_set_master(dev); |
3920 | pci_set_command(dev); | 3937 | pci_set_command(dev); |
3921 | pci_set_drvdata(dev,btv); | 3938 | pci_set_drvdata(dev,btv); |
3922 | 3939 | ||
3923 | pci_read_config_byte(dev, PCI_CLASS_REVISION, &btv->revision); | 3940 | pci_read_config_byte(dev, PCI_CLASS_REVISION, &btv->revision); |
3924 | pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat); | 3941 | pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat); |
3925 | printk(KERN_INFO "bttv%d: Bt%d (rev %d) at %s, ", | 3942 | printk(KERN_INFO "bttv%d: Bt%d (rev %d) at %s, ", |
3926 | bttv_num,btv->id, btv->revision, pci_name(dev)); | 3943 | bttv_num,btv->id, btv->revision, pci_name(dev)); |
3927 | printk("irq: %d, latency: %d, mmio: 0x%lx\n", | 3944 | printk("irq: %d, latency: %d, mmio: 0x%lx\n", |
3928 | btv->c.pci->irq, lat, pci_resource_start(dev,0)); | 3945 | btv->c.pci->irq, lat, pci_resource_start(dev,0)); |
3929 | schedule(); | 3946 | schedule(); |
3930 | 3947 | ||
@@ -3935,23 +3952,23 @@ static int __devinit bttv_probe(struct pci_dev *dev, | |||
3935 | goto fail1; | 3952 | goto fail1; |
3936 | } | 3953 | } |
3937 | 3954 | ||
3938 | /* identify card */ | 3955 | /* identify card */ |
3939 | bttv_idcard(btv); | 3956 | bttv_idcard(btv); |
3940 | 3957 | ||
3941 | /* disable irqs, register irq handler */ | 3958 | /* disable irqs, register irq handler */ |
3942 | btwrite(0, BT848_INT_MASK); | 3959 | btwrite(0, BT848_INT_MASK); |
3943 | result = request_irq(btv->c.pci->irq, bttv_irq, | 3960 | result = request_irq(btv->c.pci->irq, bttv_irq, |
3944 | SA_SHIRQ | SA_INTERRUPT,btv->c.name,(void *)btv); | 3961 | SA_SHIRQ | SA_INTERRUPT,btv->c.name,(void *)btv); |
3945 | if (result < 0) { | 3962 | if (result < 0) { |
3946 | printk(KERN_ERR "bttv%d: can't get IRQ %d\n", | 3963 | printk(KERN_ERR "bttv%d: can't get IRQ %d\n", |
3947 | bttv_num,btv->c.pci->irq); | 3964 | bttv_num,btv->c.pci->irq); |
3948 | goto fail1; | 3965 | goto fail1; |
3949 | } | 3966 | } |
3950 | 3967 | ||
3951 | if (0 != bttv_handle_chipset(btv)) { | 3968 | if (0 != bttv_handle_chipset(btv)) { |
3952 | result = -EIO; | 3969 | result = -EIO; |
3953 | goto fail2; | 3970 | goto fail2; |
3954 | } | 3971 | } |
3955 | 3972 | ||
3956 | /* init options from insmod args */ | 3973 | /* init options from insmod args */ |
3957 | btv->opt_combfilter = combfilter; | 3974 | btv->opt_combfilter = combfilter; |
@@ -3977,29 +3994,29 @@ static int __devinit bttv_probe(struct pci_dev *dev, | |||
3977 | btv->input = 0; | 3994 | btv->input = 0; |
3978 | 3995 | ||
3979 | /* initialize hardware */ | 3996 | /* initialize hardware */ |
3980 | if (bttv_gpio) | 3997 | if (bttv_gpio) |
3981 | bttv_gpio_tracking(btv,"pre-init"); | 3998 | bttv_gpio_tracking(btv,"pre-init"); |
3982 | 3999 | ||
3983 | bttv_risc_init_main(btv); | 4000 | bttv_risc_init_main(btv); |
3984 | init_bt848(btv); | 4001 | init_bt848(btv); |
3985 | 4002 | ||
3986 | /* gpio */ | 4003 | /* gpio */ |
3987 | btwrite(0x00, BT848_GPIO_REG_INP); | 4004 | btwrite(0x00, BT848_GPIO_REG_INP); |
3988 | btwrite(0x00, BT848_GPIO_OUT_EN); | 4005 | btwrite(0x00, BT848_GPIO_OUT_EN); |
3989 | if (bttv_verbose) | 4006 | if (bttv_verbose) |
3990 | bttv_gpio_tracking(btv,"init"); | 4007 | bttv_gpio_tracking(btv,"init"); |
3991 | 4008 | ||
3992 | /* needs to be done before i2c is registered */ | 4009 | /* needs to be done before i2c is registered */ |
3993 | bttv_init_card1(btv); | 4010 | bttv_init_card1(btv); |
3994 | 4011 | ||
3995 | /* register i2c + gpio */ | 4012 | /* register i2c + gpio */ |
3996 | init_bttv_i2c(btv); | 4013 | init_bttv_i2c(btv); |
3997 | 4014 | ||
3998 | /* some card-specific stuff (needs working i2c) */ | 4015 | /* some card-specific stuff (needs working i2c) */ |
3999 | bttv_init_card2(btv); | 4016 | bttv_init_card2(btv); |
4000 | init_irqreg(btv); | 4017 | init_irqreg(btv); |
4001 | 4018 | ||
4002 | /* register video4linux + input */ | 4019 | /* register video4linux + input */ |
4003 | if (!bttv_tvcards[btv->c.type].no_video) { | 4020 | if (!bttv_tvcards[btv->c.type].no_video) { |
4004 | bttv_register_video(btv); | 4021 | bttv_register_video(btv); |
4005 | bt848_bright(btv,32768); | 4022 | bt848_bright(btv,32768); |
@@ -4018,10 +4035,10 @@ static int __devinit bttv_probe(struct pci_dev *dev, | |||
4018 | 4035 | ||
4019 | /* everything is fine */ | 4036 | /* everything is fine */ |
4020 | bttv_num++; | 4037 | bttv_num++; |
4021 | return 0; | 4038 | return 0; |
4022 | 4039 | ||
4023 | fail2: | 4040 | fail2: |
4024 | free_irq(btv->c.pci->irq,btv); | 4041 | free_irq(btv->c.pci->irq,btv); |
4025 | 4042 | ||
4026 | fail1: | 4043 | fail1: |
4027 | if (btv->bt848_mmio) | 4044 | if (btv->bt848_mmio) |
@@ -4034,12 +4051,12 @@ static int __devinit bttv_probe(struct pci_dev *dev, | |||
4034 | 4051 | ||
4035 | static void __devexit bttv_remove(struct pci_dev *pci_dev) | 4052 | static void __devexit bttv_remove(struct pci_dev *pci_dev) |
4036 | { | 4053 | { |
4037 | struct bttv *btv = pci_get_drvdata(pci_dev); | 4054 | struct bttv *btv = pci_get_drvdata(pci_dev); |
4038 | 4055 | ||
4039 | if (bttv_verbose) | 4056 | if (bttv_verbose) |
4040 | printk("bttv%d: unloading\n",btv->c.nr); | 4057 | printk("bttv%d: unloading\n",btv->c.nr); |
4041 | 4058 | ||
4042 | /* shutdown everything (DMA+IRQs) */ | 4059 | /* shutdown everything (DMA+IRQs) */ |
4043 | btand(~15, BT848_GPIO_DMA_CTL); | 4060 | btand(~15, BT848_GPIO_DMA_CTL); |
4044 | btwrite(0, BT848_INT_MASK); | 4061 | btwrite(0, BT848_INT_MASK); |
4045 | btwrite(~0x0, BT848_INT_STAT); | 4062 | btwrite(~0x0, BT848_INT_STAT); |
@@ -4052,7 +4069,7 @@ static void __devexit bttv_remove(struct pci_dev *pci_dev) | |||
4052 | wake_up(&btv->gpioq); | 4069 | wake_up(&btv->gpioq); |
4053 | bttv_sub_del_devices(&btv->c); | 4070 | bttv_sub_del_devices(&btv->c); |
4054 | 4071 | ||
4055 | /* unregister i2c_bus + input */ | 4072 | /* unregister i2c_bus + input */ |
4056 | fini_bttv_i2c(btv); | 4073 | fini_bttv_i2c(btv); |
4057 | 4074 | ||
4058 | /* unregister video4linux */ | 4075 | /* unregister video4linux */ |
@@ -4062,18 +4079,18 @@ static void __devexit bttv_remove(struct pci_dev *pci_dev) | |||
4062 | btcx_riscmem_free(btv->c.pci,&btv->main); | 4079 | btcx_riscmem_free(btv->c.pci,&btv->main); |
4063 | 4080 | ||
4064 | /* free ressources */ | 4081 | /* free ressources */ |
4065 | free_irq(btv->c.pci->irq,btv); | 4082 | free_irq(btv->c.pci->irq,btv); |
4066 | iounmap(btv->bt848_mmio); | 4083 | iounmap(btv->bt848_mmio); |
4067 | release_mem_region(pci_resource_start(btv->c.pci,0), | 4084 | release_mem_region(pci_resource_start(btv->c.pci,0), |
4068 | pci_resource_len(btv->c.pci,0)); | 4085 | pci_resource_len(btv->c.pci,0)); |
4069 | 4086 | ||
4070 | pci_set_drvdata(pci_dev, NULL); | 4087 | pci_set_drvdata(pci_dev, NULL); |
4071 | return; | 4088 | return; |
4072 | } | 4089 | } |
4073 | 4090 | ||
4074 | static int bttv_suspend(struct pci_dev *pci_dev, pm_message_t state) | 4091 | static int bttv_suspend(struct pci_dev *pci_dev, pm_message_t state) |
4075 | { | 4092 | { |
4076 | struct bttv *btv = pci_get_drvdata(pci_dev); | 4093 | struct bttv *btv = pci_get_drvdata(pci_dev); |
4077 | struct bttv_buffer_set idle; | 4094 | struct bttv_buffer_set idle; |
4078 | unsigned long flags; | 4095 | unsigned long flags; |
4079 | 4096 | ||
@@ -4108,7 +4125,7 @@ static int bttv_suspend(struct pci_dev *pci_dev, pm_message_t state) | |||
4108 | 4125 | ||
4109 | static int bttv_resume(struct pci_dev *pci_dev) | 4126 | static int bttv_resume(struct pci_dev *pci_dev) |
4110 | { | 4127 | { |
4111 | struct bttv *btv = pci_get_drvdata(pci_dev); | 4128 | struct bttv *btv = pci_get_drvdata(pci_dev); |
4112 | unsigned long flags; | 4129 | unsigned long flags; |
4113 | int err; | 4130 | int err; |
4114 | 4131 | ||
@@ -4153,24 +4170,24 @@ static int bttv_resume(struct pci_dev *pci_dev) | |||
4153 | } | 4170 | } |
4154 | 4171 | ||
4155 | static struct pci_device_id bttv_pci_tbl[] = { | 4172 | static struct pci_device_id bttv_pci_tbl[] = { |
4156 | {PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT848, | 4173 | {PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT848, |
4157 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 4174 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
4158 | {PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT849, | 4175 | {PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT849, |
4159 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 4176 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
4160 | {PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT878, | 4177 | {PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT878, |
4161 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 4178 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
4162 | {PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT879, | 4179 | {PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT879, |
4163 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 4180 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
4164 | {0,} | 4181 | {0,} |
4165 | }; | 4182 | }; |
4166 | 4183 | ||
4167 | MODULE_DEVICE_TABLE(pci, bttv_pci_tbl); | 4184 | MODULE_DEVICE_TABLE(pci, bttv_pci_tbl); |
4168 | 4185 | ||
4169 | static struct pci_driver bttv_pci_driver = { | 4186 | static struct pci_driver bttv_pci_driver = { |
4170 | .name = "bttv", | 4187 | .name = "bttv", |
4171 | .id_table = bttv_pci_tbl, | 4188 | .id_table = bttv_pci_tbl, |
4172 | .probe = bttv_probe, | 4189 | .probe = bttv_probe, |
4173 | .remove = __devexit_p(bttv_remove), | 4190 | .remove = __devexit_p(bttv_remove), |
4174 | .suspend = bttv_suspend, | 4191 | .suspend = bttv_suspend, |
4175 | .resume = bttv_resume, | 4192 | .resume = bttv_resume, |
4176 | }; | 4193 | }; |