diff options
Diffstat (limited to 'drivers/media/video/bt8xx/bttv-driver.c')
-rw-r--r-- | drivers/media/video/bt8xx/bttv-driver.c | 58 |
1 files changed, 26 insertions, 32 deletions
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 0ea559a7fe59..85bf31ab8789 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/kdev_t.h> | 45 | #include <linux/kdev_t.h> |
46 | #include "bttvp.h" | 46 | #include "bttvp.h" |
47 | #include <media/v4l2-common.h> | 47 | #include <media/v4l2-common.h> |
48 | #include <media/v4l2-ioctl.h> | ||
48 | #include <media/tvaudio.h> | 49 | #include <media/tvaudio.h> |
49 | #include <media/msp3400.h> | 50 | #include <media/msp3400.h> |
50 | 51 | ||
@@ -163,8 +164,8 @@ MODULE_LICENSE("GPL"); | |||
163 | static ssize_t show_card(struct device *cd, | 164 | static ssize_t show_card(struct device *cd, |
164 | struct device_attribute *attr, char *buf) | 165 | struct device_attribute *attr, char *buf) |
165 | { | 166 | { |
166 | struct video_device *vfd = container_of(cd, struct video_device, class_dev); | 167 | struct video_device *vfd = container_of(cd, struct video_device, dev); |
167 | struct bttv *btv = dev_get_drvdata(vfd->dev); | 168 | struct bttv *btv = dev_get_drvdata(vfd->parent); |
168 | return sprintf(buf, "%d\n", btv ? btv->c.type : UNSET); | 169 | return sprintf(buf, "%d\n", btv ? btv->c.type : UNSET); |
169 | } | 170 | } |
170 | static DEVICE_ATTR(card, S_IRUGO, show_card, NULL); | 171 | static DEVICE_ATTR(card, S_IRUGO, show_card, NULL); |
@@ -3357,10 +3358,7 @@ static const struct file_operations bttv_fops = | |||
3357 | .poll = bttv_poll, | 3358 | .poll = bttv_poll, |
3358 | }; | 3359 | }; |
3359 | 3360 | ||
3360 | static struct video_device bttv_video_template = | 3361 | static const struct v4l2_ioctl_ops bttv_ioctl_ops = { |
3361 | { | ||
3362 | .fops = &bttv_fops, | ||
3363 | .minor = -1, | ||
3364 | .vidioc_querycap = bttv_querycap, | 3362 | .vidioc_querycap = bttv_querycap, |
3365 | .vidioc_enum_fmt_vid_cap = bttv_enum_fmt_vid_cap, | 3363 | .vidioc_enum_fmt_vid_cap = bttv_enum_fmt_vid_cap, |
3366 | .vidioc_g_fmt_vid_cap = bttv_g_fmt_vid_cap, | 3364 | .vidioc_g_fmt_vid_cap = bttv_g_fmt_vid_cap, |
@@ -3411,8 +3409,14 @@ static struct video_device bttv_video_template = | |||
3411 | .vidioc_g_register = bttv_g_register, | 3409 | .vidioc_g_register = bttv_g_register, |
3412 | .vidioc_s_register = bttv_s_register, | 3410 | .vidioc_s_register = bttv_s_register, |
3413 | #endif | 3411 | #endif |
3414 | .tvnorms = BTTV_NORMS, | 3412 | }; |
3415 | .current_norm = V4L2_STD_PAL, | 3413 | |
3414 | static struct video_device bttv_video_template = { | ||
3415 | .fops = &bttv_fops, | ||
3416 | .minor = -1, | ||
3417 | .ioctl_ops = &bttv_ioctl_ops, | ||
3418 | .tvnorms = BTTV_NORMS, | ||
3419 | .current_norm = V4L2_STD_PAL, | ||
3416 | }; | 3420 | }; |
3417 | 3421 | ||
3418 | /* ----------------------------------------------------------------------- */ | 3422 | /* ----------------------------------------------------------------------- */ |
@@ -3635,10 +3639,7 @@ static const struct file_operations radio_fops = | |||
3635 | .poll = radio_poll, | 3639 | .poll = radio_poll, |
3636 | }; | 3640 | }; |
3637 | 3641 | ||
3638 | static struct video_device radio_template = | 3642 | static const struct v4l2_ioctl_ops radio_ioctl_ops = { |
3639 | { | ||
3640 | .fops = &radio_fops, | ||
3641 | .minor = -1, | ||
3642 | .vidioc_querycap = radio_querycap, | 3643 | .vidioc_querycap = radio_querycap, |
3643 | .vidioc_g_tuner = radio_g_tuner, | 3644 | .vidioc_g_tuner = radio_g_tuner, |
3644 | .vidioc_enum_input = radio_enum_input, | 3645 | .vidioc_enum_input = radio_enum_input, |
@@ -3655,6 +3656,12 @@ static struct video_device radio_template = | |||
3655 | .vidioc_s_frequency = bttv_s_frequency, | 3656 | .vidioc_s_frequency = bttv_s_frequency, |
3656 | }; | 3657 | }; |
3657 | 3658 | ||
3659 | static struct video_device radio_template = { | ||
3660 | .fops = &radio_fops, | ||
3661 | .minor = -1, | ||
3662 | .ioctl_ops = &radio_ioctl_ops, | ||
3663 | }; | ||
3664 | |||
3658 | /* ----------------------------------------------------------------------- */ | 3665 | /* ----------------------------------------------------------------------- */ |
3659 | /* some debug code */ | 3666 | /* some debug code */ |
3660 | 3667 | ||
@@ -4175,8 +4182,7 @@ static irqreturn_t bttv_irq(int irq, void *dev_id) | |||
4175 | 4182 | ||
4176 | static struct video_device *vdev_init(struct bttv *btv, | 4183 | static struct video_device *vdev_init(struct bttv *btv, |
4177 | const struct video_device *template, | 4184 | const struct video_device *template, |
4178 | const char *type_name, | 4185 | const char *type_name) |
4179 | const int type) | ||
4180 | { | 4186 | { |
4181 | struct video_device *vfd; | 4187 | struct video_device *vfd; |
4182 | 4188 | ||
@@ -4185,9 +4191,8 @@ static struct video_device *vdev_init(struct bttv *btv, | |||
4185 | return NULL; | 4191 | return NULL; |
4186 | *vfd = *template; | 4192 | *vfd = *template; |
4187 | vfd->minor = -1; | 4193 | vfd->minor = -1; |
4188 | vfd->dev = &btv->c.pci->dev; | 4194 | vfd->parent = &btv->c.pci->dev; |
4189 | vfd->release = video_device_release; | 4195 | vfd->release = video_device_release; |
4190 | vfd->type = type; | ||
4191 | vfd->debug = bttv_debug; | 4196 | vfd->debug = bttv_debug; |
4192 | snprintf(vfd->name, sizeof(vfd->name), "BT%d%s %s (%s)", | 4197 | snprintf(vfd->name, sizeof(vfd->name), "BT%d%s %s (%s)", |
4193 | btv->id, (btv->id==848 && btv->revision==0x12) ? "A" : "", | 4198 | btv->id, (btv->id==848 && btv->revision==0x12) ? "A" : "", |
@@ -4223,20 +4228,11 @@ static void bttv_unregister_video(struct bttv *btv) | |||
4223 | /* register video4linux devices */ | 4228 | /* register video4linux devices */ |
4224 | static int __devinit bttv_register_video(struct bttv *btv) | 4229 | static int __devinit bttv_register_video(struct bttv *btv) |
4225 | { | 4230 | { |
4226 | int video_type = VID_TYPE_CAPTURE | | 4231 | if (no_overlay > 0) |
4227 | VID_TYPE_TUNER | | ||
4228 | VID_TYPE_CLIPPING| | ||
4229 | VID_TYPE_SCALES; | ||
4230 | |||
4231 | if (no_overlay <= 0) { | ||
4232 | bttv_video_template.type |= VID_TYPE_OVERLAY; | ||
4233 | } else { | ||
4234 | printk("bttv: Overlay support disabled.\n"); | 4232 | printk("bttv: Overlay support disabled.\n"); |
4235 | } | ||
4236 | 4233 | ||
4237 | /* video */ | 4234 | /* video */ |
4238 | btv->video_dev = vdev_init(btv, &bttv_video_template, | 4235 | btv->video_dev = vdev_init(btv, &bttv_video_template, "video"); |
4239 | "video", video_type); | ||
4240 | 4236 | ||
4241 | if (NULL == btv->video_dev) | 4237 | if (NULL == btv->video_dev) |
4242 | goto err; | 4238 | goto err; |
@@ -4244,7 +4240,7 @@ static int __devinit bttv_register_video(struct bttv *btv) | |||
4244 | goto err; | 4240 | goto err; |
4245 | printk(KERN_INFO "bttv%d: registered device video%d\n", | 4241 | printk(KERN_INFO "bttv%d: registered device video%d\n", |
4246 | btv->c.nr,btv->video_dev->minor & 0x1f); | 4242 | btv->c.nr,btv->video_dev->minor & 0x1f); |
4247 | if (device_create_file(&btv->video_dev->class_dev, | 4243 | if (device_create_file(&btv->video_dev->dev, |
4248 | &dev_attr_card)<0) { | 4244 | &dev_attr_card)<0) { |
4249 | printk(KERN_ERR "bttv%d: device_create_file 'card' " | 4245 | printk(KERN_ERR "bttv%d: device_create_file 'card' " |
4250 | "failed\n", btv->c.nr); | 4246 | "failed\n", btv->c.nr); |
@@ -4252,8 +4248,7 @@ static int __devinit bttv_register_video(struct bttv *btv) | |||
4252 | } | 4248 | } |
4253 | 4249 | ||
4254 | /* vbi */ | 4250 | /* vbi */ |
4255 | btv->vbi_dev = vdev_init(btv, &bttv_video_template, | 4251 | btv->vbi_dev = vdev_init(btv, &bttv_video_template, "vbi"); |
4256 | "vbi", VID_TYPE_TUNER | VID_TYPE_TELETEXT); | ||
4257 | 4252 | ||
4258 | if (NULL == btv->vbi_dev) | 4253 | if (NULL == btv->vbi_dev) |
4259 | goto err; | 4254 | goto err; |
@@ -4265,8 +4260,7 @@ static int __devinit bttv_register_video(struct bttv *btv) | |||
4265 | if (!btv->has_radio) | 4260 | if (!btv->has_radio) |
4266 | return 0; | 4261 | return 0; |
4267 | /* radio */ | 4262 | /* radio */ |
4268 | btv->radio_dev = vdev_init(btv, &radio_template, | 4263 | btv->radio_dev = vdev_init(btv, &radio_template, "radio"); |
4269 | "radio", VID_TYPE_TUNER); | ||
4270 | if (NULL == btv->radio_dev) | 4264 | if (NULL == btv->radio_dev) |
4271 | goto err; | 4265 | goto err; |
4272 | if (video_register_device(btv->radio_dev, VFL_TYPE_RADIO,radio_nr)<0) | 4266 | if (video_register_device(btv->radio_dev, VFL_TYPE_RADIO,radio_nr)<0) |