diff options
Diffstat (limited to 'drivers/media/video/bt8xx/bttv-driver.c')
-rw-r--r-- | drivers/media/video/bt8xx/bttv-driver.c | 66 |
1 files changed, 38 insertions, 28 deletions
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 933eaef41ead..5858bf5ff41c 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -76,9 +76,9 @@ static unsigned int gbuffers = 8; | |||
76 | static unsigned int gbufsize = 0x208000; | 76 | static unsigned int gbufsize = 0x208000; |
77 | static unsigned int reset_crop = 1; | 77 | static unsigned int reset_crop = 1; |
78 | 78 | ||
79 | static int video_nr = -1; | 79 | static int video_nr[BTTV_MAX] = { [0 ... (BTTV_MAX-1)] = -1 }; |
80 | static int radio_nr = -1; | 80 | static int radio_nr[BTTV_MAX] = { [0 ... (BTTV_MAX-1)] = -1 }; |
81 | static int vbi_nr = -1; | 81 | static int vbi_nr[BTTV_MAX] = { [0 ... (BTTV_MAX-1)] = -1 }; |
82 | static int debug_latency; | 82 | static int debug_latency; |
83 | 83 | ||
84 | static unsigned int fdsr; | 84 | static unsigned int fdsr; |
@@ -108,9 +108,6 @@ module_param(irq_debug, int, 0644); | |||
108 | module_param(debug_latency, int, 0644); | 108 | module_param(debug_latency, int, 0644); |
109 | 109 | ||
110 | module_param(fdsr, int, 0444); | 110 | module_param(fdsr, int, 0444); |
111 | module_param(video_nr, int, 0444); | ||
112 | module_param(radio_nr, int, 0444); | ||
113 | module_param(vbi_nr, int, 0444); | ||
114 | module_param(gbuffers, int, 0444); | 111 | module_param(gbuffers, int, 0444); |
115 | module_param(gbufsize, int, 0444); | 112 | module_param(gbufsize, int, 0444); |
116 | module_param(reset_crop, int, 0444); | 113 | module_param(reset_crop, int, 0444); |
@@ -130,7 +127,10 @@ module_param(uv_ratio, int, 0444); | |||
130 | module_param(full_luma_range, int, 0444); | 127 | module_param(full_luma_range, int, 0444); |
131 | module_param(coring, int, 0444); | 128 | module_param(coring, int, 0444); |
132 | 129 | ||
133 | module_param_array(radio, int, NULL, 0444); | 130 | module_param_array(radio, int, NULL, 0444); |
131 | module_param_array(video_nr, int, NULL, 0444); | ||
132 | module_param_array(radio_nr, int, NULL, 0444); | ||
133 | module_param_array(vbi_nr, int, NULL, 0444); | ||
134 | 134 | ||
135 | MODULE_PARM_DESC(radio,"The TV card supports radio, default is 0 (no)"); | 135 | MODULE_PARM_DESC(radio,"The TV card supports radio, default is 0 (no)"); |
136 | MODULE_PARM_DESC(bigendian,"byte order of the framebuffer, default is native endian"); | 136 | MODULE_PARM_DESC(bigendian,"byte order of the framebuffer, default is native endian"); |
@@ -152,6 +152,9 @@ MODULE_PARM_DESC(irq_iswitch,"switch inputs in irq handler"); | |||
152 | MODULE_PARM_DESC(uv_ratio,"ratio between u and v gains, default is 50"); | 152 | MODULE_PARM_DESC(uv_ratio,"ratio between u and v gains, default is 50"); |
153 | MODULE_PARM_DESC(full_luma_range,"use the full luma range, default is 0 (no)"); | 153 | MODULE_PARM_DESC(full_luma_range,"use the full luma range, default is 0 (no)"); |
154 | MODULE_PARM_DESC(coring,"set the luma coring level, default is 0 (no)"); | 154 | MODULE_PARM_DESC(coring,"set the luma coring level, default is 0 (no)"); |
155 | MODULE_PARM_DESC(video_nr, "video device numbers"); | ||
156 | MODULE_PARM_DESC(vbi_nr, "vbi device numbers"); | ||
157 | MODULE_PARM_DESC(radio_nr, "radio device numbers"); | ||
155 | 158 | ||
156 | MODULE_DESCRIPTION("bttv - v4l/v4l2 driver module for bt848/878 based cards"); | 159 | MODULE_DESCRIPTION("bttv - v4l/v4l2 driver module for bt848/878 based cards"); |
157 | MODULE_AUTHOR("Ralph Metzler & Marcus Metzler & Gerd Knorr"); | 160 | MODULE_AUTHOR("Ralph Metzler & Marcus Metzler & Gerd Knorr"); |
@@ -1367,7 +1370,7 @@ static void init_irqreg(struct bttv *btv) | |||
1367 | (btv->gpioirq ? BT848_INT_GPINT : 0) | | 1370 | (btv->gpioirq ? BT848_INT_GPINT : 0) | |
1368 | BT848_INT_SCERR | | 1371 | BT848_INT_SCERR | |
1369 | (fdsr ? BT848_INT_FDSR : 0) | | 1372 | (fdsr ? BT848_INT_FDSR : 0) | |
1370 | BT848_INT_RISCI|BT848_INT_OCERR|BT848_INT_VPRES| | 1373 | BT848_INT_RISCI | BT848_INT_OCERR | |
1371 | BT848_INT_FMTCHG|BT848_INT_HLOCK| | 1374 | BT848_INT_FMTCHG|BT848_INT_HLOCK| |
1372 | BT848_INT_I2CDONE, | 1375 | BT848_INT_I2CDONE, |
1373 | BT848_INT_MASK); | 1376 | BT848_INT_MASK); |
@@ -2661,18 +2664,6 @@ static int bttv_querycap(struct file *file, void *priv, | |||
2661 | return 0; | 2664 | return 0; |
2662 | } | 2665 | } |
2663 | 2666 | ||
2664 | static int bttv_enum_fmt_vbi_cap(struct file *file, void *priv, | ||
2665 | struct v4l2_fmtdesc *f) | ||
2666 | { | ||
2667 | if (0 != f->index) | ||
2668 | return -EINVAL; | ||
2669 | |||
2670 | f->pixelformat = V4L2_PIX_FMT_GREY; | ||
2671 | strcpy(f->description, "vbi data"); | ||
2672 | |||
2673 | return 0; | ||
2674 | } | ||
2675 | |||
2676 | static int bttv_enum_fmt_cap_ovr(struct v4l2_fmtdesc *f) | 2667 | static int bttv_enum_fmt_cap_ovr(struct v4l2_fmtdesc *f) |
2677 | { | 2668 | { |
2678 | int index = -1, i; | 2669 | int index = -1, i; |
@@ -3227,6 +3218,7 @@ static int bttv_open(struct inode *inode, struct file *file) | |||
3227 | 3218 | ||
3228 | dprintk(KERN_DEBUG "bttv: open minor=%d\n",minor); | 3219 | dprintk(KERN_DEBUG "bttv: open minor=%d\n",minor); |
3229 | 3220 | ||
3221 | lock_kernel(); | ||
3230 | for (i = 0; i < bttv_num; i++) { | 3222 | for (i = 0; i < bttv_num; i++) { |
3231 | if (bttvs[i].video_dev && | 3223 | if (bttvs[i].video_dev && |
3232 | bttvs[i].video_dev->minor == minor) { | 3224 | bttvs[i].video_dev->minor == minor) { |
@@ -3241,16 +3233,20 @@ static int bttv_open(struct inode *inode, struct file *file) | |||
3241 | break; | 3233 | break; |
3242 | } | 3234 | } |
3243 | } | 3235 | } |
3244 | if (NULL == btv) | 3236 | if (NULL == btv) { |
3237 | unlock_kernel(); | ||
3245 | return -ENODEV; | 3238 | return -ENODEV; |
3239 | } | ||
3246 | 3240 | ||
3247 | dprintk(KERN_DEBUG "bttv%d: open called (type=%s)\n", | 3241 | dprintk(KERN_DEBUG "bttv%d: open called (type=%s)\n", |
3248 | btv->c.nr,v4l2_type_names[type]); | 3242 | btv->c.nr,v4l2_type_names[type]); |
3249 | 3243 | ||
3250 | /* allocate per filehandle data */ | 3244 | /* allocate per filehandle data */ |
3251 | fh = kmalloc(sizeof(*fh),GFP_KERNEL); | 3245 | fh = kmalloc(sizeof(*fh),GFP_KERNEL); |
3252 | if (NULL == fh) | 3246 | if (NULL == fh) { |
3247 | unlock_kernel(); | ||
3253 | return -ENOMEM; | 3248 | return -ENOMEM; |
3249 | } | ||
3254 | file->private_data = fh; | 3250 | file->private_data = fh; |
3255 | *fh = btv->init; | 3251 | *fh = btv->init; |
3256 | fh->type = type; | 3252 | fh->type = type; |
@@ -3270,6 +3266,7 @@ static int bttv_open(struct inode *inode, struct file *file) | |||
3270 | sizeof(struct bttv_buffer), | 3266 | sizeof(struct bttv_buffer), |
3271 | fh); | 3267 | fh); |
3272 | set_tvnorm(btv,btv->tvnorm); | 3268 | set_tvnorm(btv,btv->tvnorm); |
3269 | set_input(btv, btv->input, btv->tvnorm); | ||
3273 | 3270 | ||
3274 | btv->users++; | 3271 | btv->users++; |
3275 | 3272 | ||
@@ -3290,6 +3287,7 @@ static int bttv_open(struct inode *inode, struct file *file) | |||
3290 | bttv_vbi_fmt_reset(&fh->vbi_fmt, btv->tvnorm); | 3287 | bttv_vbi_fmt_reset(&fh->vbi_fmt, btv->tvnorm); |
3291 | 3288 | ||
3292 | bttv_field_count(btv); | 3289 | bttv_field_count(btv); |
3290 | unlock_kernel(); | ||
3293 | return 0; | 3291 | return 0; |
3294 | } | 3292 | } |
3295 | 3293 | ||
@@ -3330,6 +3328,10 @@ static int bttv_release(struct inode *inode, struct file *file) | |||
3330 | 3328 | ||
3331 | btv->users--; | 3329 | btv->users--; |
3332 | bttv_field_count(btv); | 3330 | bttv_field_count(btv); |
3331 | |||
3332 | if (!btv->users) | ||
3333 | audio_mute(btv, 1); | ||
3334 | |||
3333 | return 0; | 3335 | return 0; |
3334 | } | 3336 | } |
3335 | 3337 | ||
@@ -3367,7 +3369,6 @@ static const struct v4l2_ioctl_ops bttv_ioctl_ops = { | |||
3367 | .vidioc_g_fmt_vid_overlay = bttv_g_fmt_vid_overlay, | 3369 | .vidioc_g_fmt_vid_overlay = bttv_g_fmt_vid_overlay, |
3368 | .vidioc_try_fmt_vid_overlay = bttv_try_fmt_vid_overlay, | 3370 | .vidioc_try_fmt_vid_overlay = bttv_try_fmt_vid_overlay, |
3369 | .vidioc_s_fmt_vid_overlay = bttv_s_fmt_vid_overlay, | 3371 | .vidioc_s_fmt_vid_overlay = bttv_s_fmt_vid_overlay, |
3370 | .vidioc_enum_fmt_vbi_cap = bttv_enum_fmt_vbi_cap, | ||
3371 | .vidioc_g_fmt_vbi_cap = bttv_g_fmt_vbi_cap, | 3372 | .vidioc_g_fmt_vbi_cap = bttv_g_fmt_vbi_cap, |
3372 | .vidioc_try_fmt_vbi_cap = bttv_try_fmt_vbi_cap, | 3373 | .vidioc_try_fmt_vbi_cap = bttv_try_fmt_vbi_cap, |
3373 | .vidioc_s_fmt_vbi_cap = bttv_s_fmt_vbi_cap, | 3374 | .vidioc_s_fmt_vbi_cap = bttv_s_fmt_vbi_cap, |
@@ -3430,21 +3431,26 @@ static int radio_open(struct inode *inode, struct file *file) | |||
3430 | 3431 | ||
3431 | dprintk("bttv: open minor=%d\n",minor); | 3432 | dprintk("bttv: open minor=%d\n",minor); |
3432 | 3433 | ||
3434 | lock_kernel(); | ||
3433 | for (i = 0; i < bttv_num; i++) { | 3435 | for (i = 0; i < bttv_num; i++) { |
3434 | if (bttvs[i].radio_dev && bttvs[i].radio_dev->minor == minor) { | 3436 | if (bttvs[i].radio_dev && bttvs[i].radio_dev->minor == minor) { |
3435 | btv = &bttvs[i]; | 3437 | btv = &bttvs[i]; |
3436 | break; | 3438 | break; |
3437 | } | 3439 | } |
3438 | } | 3440 | } |
3439 | if (NULL == btv) | 3441 | if (NULL == btv) { |
3442 | unlock_kernel(); | ||
3440 | return -ENODEV; | 3443 | return -ENODEV; |
3444 | } | ||
3441 | 3445 | ||
3442 | dprintk("bttv%d: open called (radio)\n",btv->c.nr); | 3446 | dprintk("bttv%d: open called (radio)\n",btv->c.nr); |
3443 | 3447 | ||
3444 | /* allocate per filehandle data */ | 3448 | /* allocate per filehandle data */ |
3445 | fh = kmalloc(sizeof(*fh), GFP_KERNEL); | 3449 | fh = kmalloc(sizeof(*fh), GFP_KERNEL); |
3446 | if (NULL == fh) | 3450 | if (NULL == fh) { |
3451 | unlock_kernel(); | ||
3447 | return -ENOMEM; | 3452 | return -ENOMEM; |
3453 | } | ||
3448 | file->private_data = fh; | 3454 | file->private_data = fh; |
3449 | *fh = btv->init; | 3455 | *fh = btv->init; |
3450 | v4l2_prio_open(&btv->prio, &fh->prio); | 3456 | v4l2_prio_open(&btv->prio, &fh->prio); |
@@ -3457,6 +3463,7 @@ static int radio_open(struct inode *inode, struct file *file) | |||
3457 | audio_input(btv,TVAUDIO_INPUT_RADIO); | 3463 | audio_input(btv,TVAUDIO_INPUT_RADIO); |
3458 | 3464 | ||
3459 | mutex_unlock(&btv->lock); | 3465 | mutex_unlock(&btv->lock); |
3466 | unlock_kernel(); | ||
3460 | return 0; | 3467 | return 0; |
3461 | } | 3468 | } |
3462 | 3469 | ||
@@ -4235,7 +4242,8 @@ static int __devinit bttv_register_video(struct bttv *btv) | |||
4235 | 4242 | ||
4236 | if (NULL == btv->video_dev) | 4243 | if (NULL == btv->video_dev) |
4237 | goto err; | 4244 | goto err; |
4238 | if (video_register_device(btv->video_dev,VFL_TYPE_GRABBER,video_nr)<0) | 4245 | if (video_register_device(btv->video_dev, VFL_TYPE_GRABBER, |
4246 | video_nr[btv->c.nr]) < 0) | ||
4239 | goto err; | 4247 | goto err; |
4240 | printk(KERN_INFO "bttv%d: registered device video%d\n", | 4248 | printk(KERN_INFO "bttv%d: registered device video%d\n", |
4241 | btv->c.nr,btv->video_dev->minor & 0x1f); | 4249 | btv->c.nr,btv->video_dev->minor & 0x1f); |
@@ -4251,7 +4259,8 @@ static int __devinit bttv_register_video(struct bttv *btv) | |||
4251 | 4259 | ||
4252 | if (NULL == btv->vbi_dev) | 4260 | if (NULL == btv->vbi_dev) |
4253 | goto err; | 4261 | goto err; |
4254 | if (video_register_device(btv->vbi_dev,VFL_TYPE_VBI,vbi_nr)<0) | 4262 | if (video_register_device(btv->vbi_dev, VFL_TYPE_VBI, |
4263 | vbi_nr[btv->c.nr]) < 0) | ||
4255 | goto err; | 4264 | goto err; |
4256 | printk(KERN_INFO "bttv%d: registered device vbi%d\n", | 4265 | printk(KERN_INFO "bttv%d: registered device vbi%d\n", |
4257 | btv->c.nr,btv->vbi_dev->minor & 0x1f); | 4266 | btv->c.nr,btv->vbi_dev->minor & 0x1f); |
@@ -4262,7 +4271,8 @@ static int __devinit bttv_register_video(struct bttv *btv) | |||
4262 | btv->radio_dev = vdev_init(btv, &radio_template, "radio"); | 4271 | btv->radio_dev = vdev_init(btv, &radio_template, "radio"); |
4263 | if (NULL == btv->radio_dev) | 4272 | if (NULL == btv->radio_dev) |
4264 | goto err; | 4273 | goto err; |
4265 | if (video_register_device(btv->radio_dev, VFL_TYPE_RADIO,radio_nr)<0) | 4274 | if (video_register_device(btv->radio_dev, VFL_TYPE_RADIO, |
4275 | radio_nr[btv->c.nr]) < 0) | ||
4266 | goto err; | 4276 | goto err; |
4267 | printk(KERN_INFO "bttv%d: registered device radio%d\n", | 4277 | printk(KERN_INFO "bttv%d: registered device radio%d\n", |
4268 | btv->c.nr,btv->radio_dev->minor & 0x1f); | 4278 | btv->c.nr,btv->radio_dev->minor & 0x1f); |