Commit 21615365 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

media: media/pci: set device_caps in struct video_device

Instead of filling in the struct v4l2_capability device_caps
field, fill in the struct video_device device_caps field.

That way the V4L2 core knows what the capabilities of the
video device are.

But this only really works if all drivers use this, so convert
all pci drivers in this patch.

Tested with cx88-blackbird and ivtv PVR-350.
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 374d62e7
...@@ -608,6 +608,15 @@ int saa7146_register_device(struct video_device *vfd, struct saa7146_dev *dev, ...@@ -608,6 +608,15 @@ int saa7146_register_device(struct video_device *vfd, struct saa7146_dev *dev,
for (i = 0; i < dev->ext_vv_data->num_stds; i++) for (i = 0; i < dev->ext_vv_data->num_stds; i++)
vfd->tvnorms |= dev->ext_vv_data->stds[i].id; vfd->tvnorms |= dev->ext_vv_data->stds[i].id;
strscpy(vfd->name, name, sizeof(vfd->name)); strscpy(vfd->name, name, sizeof(vfd->name));
vfd->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OVERLAY |
V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
vfd->device_caps |= dev->ext_vv_data->capabilities;
if (type == VFL_TYPE_GRABBER)
vfd->device_caps &=
~(V4L2_CAP_VBI_CAPTURE | V4L2_CAP_SLICED_VBI_OUTPUT);
else
vfd->device_caps &=
~(V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OVERLAY | V4L2_CAP_AUDIO);
video_set_drvdata(vfd, dev); video_set_drvdata(vfd, dev);
err = video_register_device(vfd, type, -1); err = video_register_device(vfd, type, -1);
......
...@@ -448,25 +448,15 @@ static int video_end(struct saa7146_fh *fh, struct file *file) ...@@ -448,25 +448,15 @@ static int video_end(struct saa7146_fh *fh, struct file *file)
static int vidioc_querycap(struct file *file, void *fh, struct v4l2_capability *cap) static int vidioc_querycap(struct file *file, void *fh, struct v4l2_capability *cap)
{ {
struct video_device *vdev = video_devdata(file);
struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev; struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev;
strscpy((char *)cap->driver, "saa7146 v4l2", sizeof(cap->driver)); strscpy((char *)cap->driver, "saa7146 v4l2", sizeof(cap->driver));
strscpy((char *)cap->card, dev->ext->name, sizeof(cap->card)); strscpy((char *)cap->card, dev->ext->name, sizeof(cap->card));
sprintf((char *)cap->bus_info, "PCI:%s", pci_name(dev->pci)); sprintf((char *)cap->bus_info, "PCI:%s", pci_name(dev->pci));
cap->device_caps = cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OVERLAY |
V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
V4L2_CAP_VIDEO_OVERLAY | V4L2_CAP_DEVICE_CAPS;
V4L2_CAP_READWRITE | cap->capabilities |= dev->ext_vv_data->capabilities;
V4L2_CAP_STREAMING;
cap->device_caps |= dev->ext_vv_data->capabilities;
cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
if (vdev->vfl_type == VFL_TYPE_GRABBER)
cap->device_caps &=
~(V4L2_CAP_VBI_CAPTURE | V4L2_CAP_SLICED_VBI_OUTPUT);
else
cap->device_caps &=
~(V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OVERLAY | V4L2_CAP_AUDIO);
return 0; return 0;
} }
......
...@@ -2453,7 +2453,6 @@ static int bttv_s_fmt_vid_overlay(struct file *file, void *priv, ...@@ -2453,7 +2453,6 @@ static int bttv_s_fmt_vid_overlay(struct file *file, void *priv,
static int bttv_querycap(struct file *file, void *priv, static int bttv_querycap(struct file *file, void *priv,
struct v4l2_capability *cap) struct v4l2_capability *cap)
{ {
struct video_device *vdev = video_devdata(file);
struct bttv_fh *fh = priv; struct bttv_fh *fh = priv;
struct bttv *btv = fh->btv; struct bttv *btv = fh->btv;
...@@ -2464,17 +2463,17 @@ static int bttv_querycap(struct file *file, void *priv, ...@@ -2464,17 +2463,17 @@ static int bttv_querycap(struct file *file, void *priv,
strscpy(cap->card, btv->video_dev.name, sizeof(cap->card)); strscpy(cap->card, btv->video_dev.name, sizeof(cap->card));
snprintf(cap->bus_info, sizeof(cap->bus_info), snprintf(cap->bus_info, sizeof(cap->bus_info),
"PCI:%s", pci_name(btv->c.pci)); "PCI:%s", pci_name(btv->c.pci));
cap->capabilities = cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING | V4L2_CAP_DEVICE_CAPS;
V4L2_CAP_READWRITE |
V4L2_CAP_STREAMING |
V4L2_CAP_DEVICE_CAPS;
if (no_overlay <= 0) if (no_overlay <= 0)
cap->capabilities |= V4L2_CAP_VIDEO_OVERLAY; cap->capabilities |= V4L2_CAP_VIDEO_OVERLAY;
if (video_is_registered(&btv->vbi_dev)) if (video_is_registered(&btv->vbi_dev))
cap->capabilities |= V4L2_CAP_VBI_CAPTURE; cap->capabilities |= V4L2_CAP_VBI_CAPTURE;
if (video_is_registered(&btv->radio_dev)) if (video_is_registered(&btv->radio_dev)) {
cap->capabilities |= V4L2_CAP_RADIO; cap->capabilities |= V4L2_CAP_RADIO;
if (btv->has_tea575x)
cap->capabilities |= V4L2_CAP_HW_FREQ_SEEK;
}
/* /*
* No need to lock here: those vars are initialized during board * No need to lock here: those vars are initialized during board
...@@ -2484,27 +2483,6 @@ static int bttv_querycap(struct file *file, void *priv, ...@@ -2484,27 +2483,6 @@ static int bttv_querycap(struct file *file, void *priv,
cap->capabilities |= V4L2_CAP_RDS_CAPTURE; cap->capabilities |= V4L2_CAP_RDS_CAPTURE;
if (btv->tuner_type != TUNER_ABSENT) if (btv->tuner_type != TUNER_ABSENT)
cap->capabilities |= V4L2_CAP_TUNER; cap->capabilities |= V4L2_CAP_TUNER;
if (vdev->vfl_type == VFL_TYPE_GRABBER)
cap->device_caps = cap->capabilities &
(V4L2_CAP_VIDEO_CAPTURE |
V4L2_CAP_READWRITE |
V4L2_CAP_STREAMING |
V4L2_CAP_VIDEO_OVERLAY |
V4L2_CAP_TUNER);
else if (vdev->vfl_type == VFL_TYPE_VBI)
cap->device_caps = cap->capabilities &
(V4L2_CAP_VBI_CAPTURE |
V4L2_CAP_READWRITE |
V4L2_CAP_STREAMING |
V4L2_CAP_TUNER);
else {
cap->device_caps = V4L2_CAP_RADIO | V4L2_CAP_TUNER;
if (btv->has_saa6588)
cap->device_caps |= V4L2_CAP_READWRITE |
V4L2_CAP_RDS_CAPTURE;
if (btv->has_tea575x)
cap->device_caps |= V4L2_CAP_HW_FREQ_SEEK;
}
return 0; return 0;
} }
...@@ -3939,6 +3917,12 @@ static int bttv_register_video(struct bttv *btv) ...@@ -3939,6 +3917,12 @@ static int bttv_register_video(struct bttv *btv)
/* video */ /* video */
vdev_init(btv, &btv->video_dev, &bttv_video_template, "video"); vdev_init(btv, &btv->video_dev, &bttv_video_template, "video");
btv->video_dev.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER |
V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
if (btv->tuner_type != TUNER_ABSENT)
btv->video_dev.device_caps |= V4L2_CAP_TUNER;
if (no_overlay <= 0)
btv->video_dev.device_caps |= V4L2_CAP_VIDEO_OVERLAY;
if (video_register_device(&btv->video_dev, VFL_TYPE_GRABBER, if (video_register_device(&btv->video_dev, VFL_TYPE_GRABBER,
video_nr[btv->c.nr]) < 0) video_nr[btv->c.nr]) < 0)
...@@ -3953,6 +3937,10 @@ static int bttv_register_video(struct bttv *btv) ...@@ -3953,6 +3937,10 @@ static int bttv_register_video(struct bttv *btv)
/* vbi */ /* vbi */
vdev_init(btv, &btv->vbi_dev, &bttv_video_template, "vbi"); vdev_init(btv, &btv->vbi_dev, &bttv_video_template, "vbi");
btv->vbi_dev.device_caps = V4L2_CAP_VBI_CAPTURE | V4L2_CAP_READWRITE |
V4L2_CAP_STREAMING | V4L2_CAP_TUNER;
if (btv->tuner_type != TUNER_ABSENT)
btv->vbi_dev.device_caps |= V4L2_CAP_TUNER;
if (video_register_device(&btv->vbi_dev, VFL_TYPE_VBI, if (video_register_device(&btv->vbi_dev, VFL_TYPE_VBI,
vbi_nr[btv->c.nr]) < 0) vbi_nr[btv->c.nr]) < 0)
...@@ -3964,6 +3952,12 @@ static int bttv_register_video(struct bttv *btv) ...@@ -3964,6 +3952,12 @@ static int bttv_register_video(struct bttv *btv)
return 0; return 0;
/* radio */ /* radio */
vdev_init(btv, &btv->radio_dev, &radio_template, "radio"); vdev_init(btv, &btv->radio_dev, &radio_template, "radio");
btv->radio_dev.device_caps = V4L2_CAP_RADIO | V4L2_CAP_TUNER;
if (btv->has_saa6588)
btv->radio_dev.device_caps |= V4L2_CAP_READWRITE |
V4L2_CAP_RDS_CAPTURE;
if (btv->has_tea575x)
btv->radio_dev.device_caps |= V4L2_CAP_HW_FREQ_SEEK;
btv->radio_dev.ctrl_handler = &btv->radio_ctrl_handler; btv->radio_dev.ctrl_handler = &btv->radio_ctrl_handler;
if (video_register_device(&btv->radio_dev, VFL_TYPE_RADIO, if (video_register_device(&btv->radio_dev, VFL_TYPE_RADIO,
radio_nr[btv->c.nr]) < 0) radio_nr[btv->c.nr]) < 0)
......
...@@ -483,13 +483,8 @@ static int cobalt_querycap(struct file *file, void *priv_fh, ...@@ -483,13 +483,8 @@ static int cobalt_querycap(struct file *file, void *priv_fh,
strscpy(vcap->card, "cobalt", sizeof(vcap->card)); strscpy(vcap->card, "cobalt", sizeof(vcap->card));
snprintf(vcap->bus_info, sizeof(vcap->bus_info), snprintf(vcap->bus_info, sizeof(vcap->bus_info),
"PCIe:%s", pci_name(cobalt->pci_dev)); "PCIe:%s", pci_name(cobalt->pci_dev));
vcap->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_READWRITE; vcap->capabilities = V4L2_CAP_STREAMING | V4L2_CAP_READWRITE |
if (s->is_output) V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_DEVICE_CAPS;
vcap->device_caps |= V4L2_CAP_VIDEO_OUTPUT;
else
vcap->device_caps |= V4L2_CAP_VIDEO_CAPTURE;
vcap->capabilities = vcap->device_caps | V4L2_CAP_DEVICE_CAPS |
V4L2_CAP_VIDEO_CAPTURE;
if (cobalt->have_hsma_tx) if (cobalt->have_hsma_tx)
vcap->capabilities |= V4L2_CAP_VIDEO_OUTPUT; vcap->capabilities |= V4L2_CAP_VIDEO_OUTPUT;
return 0; return 0;
...@@ -1274,6 +1269,11 @@ static int cobalt_node_register(struct cobalt *cobalt, int node) ...@@ -1274,6 +1269,11 @@ static int cobalt_node_register(struct cobalt *cobalt, int node)
q->lock = &s->lock; q->lock = &s->lock;
q->dev = &cobalt->pci_dev->dev; q->dev = &cobalt->pci_dev->dev;
vdev->queue = q; vdev->queue = q;
vdev->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_READWRITE;
if (s->is_output)
vdev->device_caps |= V4L2_CAP_VIDEO_OUTPUT;
else
vdev->device_caps |= V4L2_CAP_VIDEO_CAPTURE;
video_set_drvdata(vdev, s); video_set_drvdata(vdev, s);
ret = vb2_queue_init(q); ret = vb2_queue_init(q);
......
...@@ -385,16 +385,13 @@ static int cx18_querycap(struct file *file, void *fh, ...@@ -385,16 +385,13 @@ static int cx18_querycap(struct file *file, void *fh,
struct v4l2_capability *vcap) struct v4l2_capability *vcap)
{ {
struct cx18_open_id *id = fh2id(fh); struct cx18_open_id *id = fh2id(fh);
struct cx18_stream *s = video_drvdata(file);
struct cx18 *cx = id->cx; struct cx18 *cx = id->cx;
strscpy(vcap->driver, CX18_DRIVER_NAME, sizeof(vcap->driver)); strscpy(vcap->driver, CX18_DRIVER_NAME, sizeof(vcap->driver));
strscpy(vcap->card, cx->card_name, sizeof(vcap->card)); strscpy(vcap->card, cx->card_name, sizeof(vcap->card));
snprintf(vcap->bus_info, sizeof(vcap->bus_info), snprintf(vcap->bus_info, sizeof(vcap->bus_info),
"PCI:%s", pci_name(cx->pci_dev)); "PCI:%s", pci_name(cx->pci_dev));
vcap->capabilities = cx->v4l2_cap; /* capabilities */ vcap->capabilities = cx->v4l2_cap | V4L2_CAP_DEVICE_CAPS;
vcap->device_caps = s->v4l2_dev_caps; /* device capabilities */
vcap->capabilities |= V4L2_CAP_DEVICE_CAPS;
return 0; return 0;
} }
......
...@@ -411,6 +411,7 @@ static int cx18_reg_dev(struct cx18 *cx, int type) ...@@ -411,6 +411,7 @@ static int cx18_reg_dev(struct cx18 *cx, int type)
return 0; return 0;
num = s->video_dev.num; num = s->video_dev.num;
s->video_dev.device_caps = s->v4l2_dev_caps; /* device capabilities */
/* card number + user defined offset + device offset */ /* card number + user defined offset + device offset */
if (type != CX18_ENC_STREAM_TYPE_MPG) { if (type != CX18_ENC_STREAM_TYPE_MPG) {
struct cx18_stream *s_mpg = &cx->streams[CX18_ENC_STREAM_TYPE_MPG]; struct cx18_stream *s_mpg = &cx->streams[CX18_ENC_STREAM_TYPE_MPG];
......
...@@ -1324,12 +1324,11 @@ static int vidioc_querycap(struct file *file, void *priv, ...@@ -1324,12 +1324,11 @@ static int vidioc_querycap(struct file *file, void *priv,
strscpy(cap->card, cx23885_boards[tsport->dev->board].name, strscpy(cap->card, cx23885_boards[tsport->dev->board].name,
sizeof(cap->card)); sizeof(cap->card));
sprintf(cap->bus_info, "PCIe:%s", pci_name(dev->pci)); sprintf(cap->bus_info, "PCIe:%s", pci_name(dev->pci));
cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
V4L2_CAP_STREAMING; V4L2_CAP_STREAMING | V4L2_CAP_VBI_CAPTURE |
V4L2_CAP_AUDIO | V4L2_CAP_DEVICE_CAPS;
if (dev->tuner_type != TUNER_ABSENT) if (dev->tuner_type != TUNER_ABSENT)
cap->device_caps |= V4L2_CAP_TUNER; cap->capabilities |= V4L2_CAP_TUNER;
cap->capabilities = cap->device_caps | V4L2_CAP_VBI_CAPTURE |
V4L2_CAP_AUDIO | V4L2_CAP_DEVICE_CAPS;
return 0; return 0;
} }
...@@ -1542,6 +1541,10 @@ int cx23885_417_register(struct cx23885_dev *dev) ...@@ -1542,6 +1541,10 @@ int cx23885_417_register(struct cx23885_dev *dev)
video_set_drvdata(dev->v4l_device, dev); video_set_drvdata(dev->v4l_device, dev);
dev->v4l_device->lock = &dev->lock; dev->v4l_device->lock = &dev->lock;
dev->v4l_device->queue = q; dev->v4l_device->queue = q;
dev->v4l_device->device_caps = V4L2_CAP_VIDEO_CAPTURE |
V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
if (dev->tuner_type != TUNER_ABSENT)
dev->v4l_device->device_caps |= V4L2_CAP_TUNER;
err = video_register_device(dev->v4l_device, err = video_register_device(dev->v4l_device,
VFL_TYPE_GRABBER, -1); VFL_TYPE_GRABBER, -1);
if (err < 0) { if (err < 0) {
......
...@@ -627,21 +627,17 @@ static int vidioc_querycap(struct file *file, void *priv, ...@@ -627,21 +627,17 @@ static int vidioc_querycap(struct file *file, void *priv,
struct v4l2_capability *cap) struct v4l2_capability *cap)
{ {
struct cx23885_dev *dev = video_drvdata(file); struct cx23885_dev *dev = video_drvdata(file);
struct video_device *vdev = video_devdata(file);
strscpy(cap->driver, "cx23885", sizeof(cap->driver)); strscpy(cap->driver, "cx23885", sizeof(cap->driver));
strscpy(cap->card, cx23885_boards[dev->board].name, strscpy(cap->card, cx23885_boards[dev->board].name,
sizeof(cap->card)); sizeof(cap->card));
sprintf(cap->bus_info, "PCIe:%s", pci_name(dev->pci)); sprintf(cap->bus_info, "PCIe:%s", pci_name(dev->pci));
cap->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING | V4L2_CAP_AUDIO; cap->capabilities = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
V4L2_CAP_AUDIO | V4L2_CAP_VBI_CAPTURE |
V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VBI_CAPTURE |
V4L2_CAP_DEVICE_CAPS;
if (dev->tuner_type != TUNER_ABSENT) if (dev->tuner_type != TUNER_ABSENT)
cap->device_caps |= V4L2_CAP_TUNER; cap->capabilities |= V4L2_CAP_TUNER;
if (vdev->vfl_type == VFL_TYPE_VBI)
cap->device_caps |= V4L2_CAP_VBI_CAPTURE;
else
cap->device_caps |= V4L2_CAP_VIDEO_CAPTURE;
cap->capabilities = cap->device_caps | V4L2_CAP_VBI_CAPTURE |
V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_DEVICE_CAPS;
return 0; return 0;
} }
...@@ -1306,6 +1302,10 @@ int cx23885_video_register(struct cx23885_dev *dev) ...@@ -1306,6 +1302,10 @@ int cx23885_video_register(struct cx23885_dev *dev)
dev->video_dev = cx23885_vdev_init(dev, dev->pci, dev->video_dev = cx23885_vdev_init(dev, dev->pci,
&cx23885_video_template, "video"); &cx23885_video_template, "video");
dev->video_dev->queue = &dev->vb2_vidq; dev->video_dev->queue = &dev->vb2_vidq;
dev->video_dev->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
V4L2_CAP_AUDIO | V4L2_CAP_VIDEO_CAPTURE;
if (dev->tuner_type != TUNER_ABSENT)
dev->video_dev->device_caps |= V4L2_CAP_TUNER;
err = video_register_device(dev->video_dev, VFL_TYPE_GRABBER, err = video_register_device(dev->video_dev, VFL_TYPE_GRABBER,
video_nr[dev->nr]); video_nr[dev->nr]);
if (err < 0) { if (err < 0) {
...@@ -1320,6 +1320,10 @@ int cx23885_video_register(struct cx23885_dev *dev) ...@@ -1320,6 +1320,10 @@ int cx23885_video_register(struct cx23885_dev *dev)
dev->vbi_dev = cx23885_vdev_init(dev, dev->pci, dev->vbi_dev = cx23885_vdev_init(dev, dev->pci,
&cx23885_vbi_template, "vbi"); &cx23885_vbi_template, "vbi");
dev->vbi_dev->queue = &dev->vb2_vbiq; dev->vbi_dev->queue = &dev->vb2_vbiq;
dev->vbi_dev->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
V4L2_CAP_AUDIO | V4L2_CAP_VBI_CAPTURE;
if (dev->tuner_type != TUNER_ABSENT)
dev->vbi_dev->device_caps |= V4L2_CAP_TUNER;
err = video_register_device(dev->vbi_dev, VFL_TYPE_VBI, err = video_register_device(dev->vbi_dev, VFL_TYPE_VBI,
vbi_nr[dev->nr]); vbi_nr[dev->nr]);
if (err < 0) { if (err < 0) {
......
...@@ -426,18 +426,13 @@ static int cx25821_vidioc_querycap(struct file *file, void *priv, ...@@ -426,18 +426,13 @@ static int cx25821_vidioc_querycap(struct file *file, void *priv,
{ {
struct cx25821_channel *chan = video_drvdata(file); struct cx25821_channel *chan = video_drvdata(file);
struct cx25821_dev *dev = chan->dev; struct cx25821_dev *dev = chan->dev;
const u32 cap_input = V4L2_CAP_VIDEO_CAPTURE |
V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
const u32 cap_output = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_READWRITE;
strscpy(cap->driver, "cx25821", sizeof(cap->driver)); strscpy(cap->driver, "cx25821", sizeof(cap->driver));
strscpy(cap->card, cx25821_boards[dev->board].name, sizeof(cap->card)); strscpy(cap->card, cx25821_boards[dev->board].name, sizeof(cap->card));
sprintf(cap->bus_info, "PCIe:%s", pci_name(dev->pci)); sprintf(cap->bus_info, "PCIe:%s", pci_name(dev->pci));
if (chan->id >= VID_CHANNEL_NUM) cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUTPUT |
cap->device_caps = cap_output; V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
else V4L2_CAP_DEVICE_CAPS;
cap->device_caps = cap_input;
cap->capabilities = cap_input | cap_output | V4L2_CAP_DEVICE_CAPS;
return 0; return 0;
} }
...@@ -624,6 +619,8 @@ static const struct video_device cx25821_video_device = { ...@@ -624,6 +619,8 @@ static const struct video_device cx25821_video_device = {
.minor = -1, .minor = -1,
.ioctl_ops = &video_ioctl_ops, .ioctl_ops = &video_ioctl_ops,
.tvnorms = CX25821_NORMS, .tvnorms = CX25821_NORMS,
.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
V4L2_CAP_STREAMING,
}; };
static const struct v4l2_file_operations video_out_fops = { static const struct v4l2_file_operations video_out_fops = {
...@@ -657,6 +654,7 @@ static const struct video_device cx25821_video_out_device = { ...@@ -657,6 +654,7 @@ static const struct video_device cx25821_video_out_device = {
.minor = -1, .minor = -1,
.ioctl_ops = &video_out_ioctl_ops, .ioctl_ops = &video_out_ioctl_ops,
.tvnorms = CX25821_NORMS, .tvnorms = CX25821_NORMS,
.device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_READWRITE,
}; };
void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num) void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num)
......
...@@ -1136,6 +1136,10 @@ static int blackbird_register_video(struct cx8802_dev *dev) ...@@ -1136,6 +1136,10 @@ static int blackbird_register_video(struct cx8802_dev *dev)
dev->mpeg_dev.ctrl_handler = &dev->cxhdl.hdl; dev->mpeg_dev.ctrl_handler = &dev->cxhdl.hdl;
video_set_drvdata(&dev->mpeg_dev, dev); video_set_drvdata(&dev->mpeg_dev, dev);
dev->mpeg_dev.queue = &dev->vb2_mpegq; dev->mpeg_dev.queue = &dev->vb2_mpegq;
dev->mpeg_dev.device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
V4L2_CAP_VIDEO_CAPTURE;
if (dev->core->board.tuner_type != UNSET)
dev->mpeg_dev.device_caps |= V4L2_CAP_TUNER;
err = video_register_device(&dev->mpeg_dev, VFL_TYPE_GRABBER, -1); err = video_register_device(&dev->mpeg_dev, VFL_TYPE_GRABBER, -1);
if (err < 0) { if (err < 0) {
pr_info("can't register mpeg device\n"); pr_info("can't register mpeg device\n");
......
...@@ -800,27 +800,12 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, ...@@ -800,27 +800,12 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
int cx88_querycap(struct file *file, struct cx88_core *core, int cx88_querycap(struct file *file, struct cx88_core *core,
struct v4l2_capability *cap) struct v4l2_capability *cap)
{ {
struct video_device *vdev = video_devdata(file);
strscpy(cap->card, core->board.name, sizeof(cap->card)); strscpy(cap->card, core->board.name, sizeof(cap->card));
cap->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; cap->capabilities = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VBI_CAPTURE |
V4L2_CAP_DEVICE_CAPS;
if (core->board.tuner_type != UNSET) if (core->board.tuner_type != UNSET)
cap->device_caps |= V4L2_CAP_TUNER; cap->capabilities |= V4L2_CAP_TUNER;
switch (vdev->vfl_type) {
case VFL_TYPE_RADIO:
cap->device_caps = V4L2_CAP_RADIO | V4L2_CAP_TUNER;
break;
case VFL_TYPE_GRABBER:
cap->device_caps |= V4L2_CAP_VIDEO_CAPTURE;
break;
case VFL_TYPE_VBI:
cap->device_caps |= V4L2_CAP_VBI_CAPTURE;
break;
default:
return -EINVAL;
}
cap->capabilities = cap->device_caps | V4L2_CAP_VIDEO_CAPTURE |
V4L2_CAP_VBI_CAPTURE | V4L2_CAP_DEVICE_CAPS;
if (core->board.radio.type == CX88_RADIO) if (core->board.radio.type == CX88_RADIO)
cap->capabilities |= V4L2_CAP_RADIO; cap->capabilities |= V4L2_CAP_RADIO;
return 0; return 0;
...@@ -1473,6 +1458,10 @@ static int cx8800_initdev(struct pci_dev *pci_dev, ...@@ -1473,6 +1458,10 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
video_set_drvdata(&dev->video_dev, dev); video_set_drvdata(&dev->video_dev, dev);
dev->video_dev.ctrl_handler = &core->video_hdl; dev->video_dev.ctrl_handler = &core->video_hdl;
dev->video_dev.queue = &dev->vb2_vidq; dev->video_dev.queue = &dev->vb2_vidq;
dev->video_dev.device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
V4L2_CAP_VIDEO_CAPTURE;
if (core->board.tuner_type != UNSET)
dev->video_dev.device_caps |= V4L2_CAP_TUNER;
err = video_register_device(&dev->video_dev, VFL_TYPE_GRABBER, err = video_register_device(&dev->video_dev, VFL_TYPE_GRABBER,
video_nr[core->nr]); video_nr[core->nr]);
if (err < 0) { if (err < 0) {
...@@ -1486,6 +1475,10 @@ static int cx8800_initdev(struct pci_dev *pci_dev, ...@@ -1486,6 +1475,10 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
&cx8800_vbi_template, "vbi"); &cx8800_vbi_template, "vbi");
video_set_drvdata(&dev->vbi_dev, dev); video_set_drvdata(&dev->vbi_dev, dev);
dev->vbi_dev.queue = &dev->vb2_vbiq; dev->vbi_dev.queue = &dev->vb2_vbiq;
dev->vbi_dev.device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
V4L2_CAP_VBI_CAPTURE;
if (core->board.tuner_type != UNSET)
dev->vbi_dev.device_caps |= V4L2_CAP_TUNER;
err = video_register_device(&dev->vbi_dev, VFL_TYPE_VBI, err = video_register_device(&dev->vbi_dev, VFL_TYPE_VBI,
vbi_nr[core->nr]); vbi_nr[core->nr]);
if (err < 0) { if (err < 0) {
...@@ -1500,6 +1493,7 @@ static int cx8800_initdev(struct pci_dev *pci_dev, ...@@ -1500,6 +1493,7 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
&cx8800_radio_template, "radio"); &cx8800_radio_template, "radio");
video_set_drvdata(&dev->radio_dev, dev); video_set_drvdata(&dev->radio_dev, dev);
dev->radio_dev.ctrl_handler = &core->audio_hdl; dev->radio_dev.ctrl_handler = &core->audio_hdl;
dev->radio_dev.device_caps = V4L2_CAP_RADIO | V4L2_CAP_TUNER;
err = video_register_device(&dev->radio_dev, VFL_TYPE_RADIO, err = video_register_device(&dev->radio_dev, VFL_TYPE_RADIO,
radio_nr[core->nr]); radio_nr[core->nr]);
if (err < 0) { if (err < 0) {
......
...@@ -297,9 +297,6 @@ static int dt3155_querycap(struct file *filp, void *p, ...@@ -297,9 +297,6 @@ static int dt3155_querycap(struct file *filp, void *p,
strscpy(cap->driver, DT3155_NAME, sizeof(cap->driver)); strscpy(cap->driver, DT3155_NAME, sizeof(cap->driver));
strscpy(cap->card, DT3155_NAME " frame grabber", sizeof(cap->card)); strscpy(cap->card, DT3155_NAME " frame grabber", sizeof(cap->card));
sprintf(cap->bus_info, "PCI:%s", pci_name(pd->pdev)); sprintf(cap->bus_info, "PCI:%s", pci_name(pd->pdev));
cap->device_caps = V4L2_CAP_VIDEO_CAPTURE |
V4L2_CAP_STREAMING | V4L2_CAP_READWRITE;
cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
return 0; return 0;
} }
...@@ -490,6 +487,8 @@ static const struct video_device dt3155_vdev = { ...@@ -490,6 +487,8 @@ static const struct video_device dt3155_vdev = {
.minor = -1, .minor = -1,
.release = video_device_release_empty, .release = video_device_release_empty,
.tvnorms = V4L2_STD_ALL, .tvnorms = V4L2_STD_ALL,
.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING |
V4L2_CAP_READWRITE,
}; };
static int dt3155_probe(struct pci_dev *pdev, const struct pci_device_id *id) static int dt3155_probe(struct pci_dev *pdev, const struct pci_device_id *id)
......
...@@ -156,8 +156,7 @@ ...@@ -156,8 +156,7 @@
#define IVTV_CAP_ENCODER (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER | \ #define IVTV_CAP_ENCODER (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER | \
V4L2_CAP_AUDIO | V4L2_CAP_READWRITE | V4L2_CAP_VBI_CAPTURE | \ V4L2_CAP_AUDIO | V4L2_CAP_READWRITE | V4L2_CAP_VBI_CAPTURE | \
V4L2_CAP_SLICED_VBI_CAPTURE) V4L2_CAP_SLICED_VBI_CAPTURE)
#define IVTV_CAP_DECODER (V4L2_CAP_VIDEO_OUTPUT | \ #define IVTV_CAP_DECODER (V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_SLICED_VBI_OUTPUT)
V4L2_CAP_SLICED_VBI_OUTPUT | V4L2_CAP_VIDEO_OUTPUT_OVERLAY)
struct ivtv_card_video_input { struct ivtv_card_video_input {
u8 video_type; /* video input type */ u8 video_type; /* video input type */
......
...@@ -734,18 +734,11 @@ static int ivtv_querycap(struct file *file, void *fh, struct v4l2_capability *vc ...@@ -734,18 +734,11 @@ static int ivtv_querycap(struct file *file, void *fh, struct v4l2_capability *vc
{ {
struct ivtv_open_id *id = fh2id(file->private_data); struct ivtv_open_id *id = fh2id(file->private_data);
struct ivtv *itv = id->itv; struct ivtv *itv = id->itv;
struct ivtv_stream *s = &itv->streams[id->type];
strscpy(vcap->driver, IVTV_DRIVER_NAME, sizeof(vcap->driver)); strscpy(vcap->driver, IVTV_DRIVER_NAME, sizeof(vcap->driver));
strscpy(vcap->card, itv->card_name, sizeof(vcap->card)); strscpy(vcap->card, itv->card_name, sizeof(vcap->card));
snprintf(vcap->bus_info, sizeof(vcap->bus_info), "PCI:%s", pci_name(itv->pdev)); snprintf(vcap->bus_info, sizeof(vcap->bus_info), "PCI:%s", pci_name(itv->pdev));
vcap->capabilities = itv->v4l2_cap | V4L2_CAP_DEVICE_CAPS; vcap->capabilities = itv->v4l2_cap | V4L2_CAP_DEVICE_CAPS;
vcap->device_caps = s->caps;
if ((s->caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY) &&
!itv->osd_video_pbase) {
vcap->capabilities &= ~V4L2_CAP_VIDEO_OUTPUT_OVERLAY;
vcap->device_caps &= ~V4L2_CAP_VIDEO_OUTPUT_OVERLAY;
}
return 0; return 0;
} }
......
...@@ -139,8 +139,7 @@ static struct { ...@@ -139,8 +139,7 @@ static struct {
"decoder MPG", "decoder MPG",
VFL_TYPE_GRABBER, IVTV_V4L2_DEC_MPG_OFFSET, VFL_TYPE_GRABBER, IVTV_V4L2_DEC_MPG_OFFSET,
PCI_DMA_TODEVICE, 0, PCI_DMA_TODEVICE, 0,
V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE | V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE,
V4L2_CAP_VIDEO_OUTPUT_OVERLAY,
&ivtv_v4l2_dec_fops &ivtv_v4l2_dec_fops
}, },
{ /* IVTV_DEC_STREAM_TYPE_VBI */ { /* IVTV_DEC_STREAM_TYPE_VBI */
...@@ -161,8 +160,7 @@ static struct { ...@@ -161,8 +160,7 @@ static struct {
"decoder YUV", "decoder YUV",
VFL_TYPE_GRABBER, IVTV_V4L2_DEC_YUV_OFFSET, VFL_TYPE_GRABBER, IVTV_V4L2_DEC_YUV_OFFSET,
PCI_DMA_TODEVICE, 0, PCI_DMA_TODEVICE, 0,
V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE | V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE,
V4L2_CAP_VIDEO_OUTPUT_OVERLAY,
&ivtv_v4l2_dec_fops &ivtv_v4l2_dec_fops
} }
}; };
...@@ -301,6 +299,14 @@ static int ivtv_reg_dev(struct ivtv *itv, int type) ...@@ -301,6 +299,14 @@ static int ivtv_reg_dev(struct ivtv *itv, int type)
if (s_mpg->vdev.v4l2_dev) if (s_mpg->vdev.v4l2_dev)
num = s_mpg->vdev.num + ivtv_stream_info[type].num_offset; num = s_mpg->vdev.num + ivtv_stream_info[type].num_offset;
} }
s->vdev.device_caps = s->caps;
if (itv->osd_video_pbase) {
itv->streams[IVTV_DEC_STREAM_TYPE_YUV].vdev.device_caps |=
V4L2_CAP_VIDEO_OUTPUT_OVERLAY;
itv->streams[IVTV_DEC_STREAM_TYPE_MPG].vdev.device_caps |=
V4L2_CAP_VIDEO_OUTPUT_OVERLAY;
itv->v4l2_cap |= V4L2_CAP_VIDEO_OUTPUT_OVERLAY;
}
video_set_drvdata(&s->vdev, s); video_set_drvdata(&s->vdev, s);
/* Register device. First try the desired minor, then any free one. */ /* Register device. First try the desired minor, then any free one. */
......
...@@ -1220,6 +1220,11 @@ static int ivtvfb_init_card(struct ivtv *itv) ...@@ -1220,6 +1220,11 @@ static int ivtvfb_init_card(struct ivtv *itv)
/* Allocate DMA */ /* Allocate DMA */
ivtv_udma_alloc(itv); ivtv_udma_alloc(itv);
itv->streams[IVTV_DEC_STREAM_TYPE_YUV].vdev.device_caps |=
V4L2_CAP_VIDEO_OUTPUT_OVERLAY;
itv->streams[IVTV_DEC_STREAM_TYPE_MPG].vdev.device_caps |=
V4L2_CAP_VIDEO_OUTPUT_OVERLAY;
itv->v4l2_cap |= V4L2_CAP_VIDEO_OUTPUT_OVERLAY;
return 0; return 0;
} }
...@@ -1246,6 +1251,11 @@ static int ivtvfb_callback_cleanup(struct device *dev, void *p) ...@@ -1246,6 +1251,11 @@ static int ivtvfb_callback_cleanup(struct device *dev, void *p)
struct osd_info *oi = itv->osd_info; struct osd_info *oi = itv->osd_info;
if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) { if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) {
itv->streams[IVTV_DEC_STREAM_TYPE_YUV].vdev.device_caps &=
~V4L2_CAP_VIDEO_OUTPUT_OVERLAY;
itv->streams[IVTV_DEC_STREAM_TYPE_MPG].vdev.device_caps &=
~V4L2_CAP_VIDEO_OUTPUT_OVERLAY;
itv->v4l2_cap &= ~V4L2_CAP_VIDEO_OUTPUT_OVERLAY;
if (unregister_framebuffer(&itv->osd_info->ivtvfb_info)) { if (unregister_framebuffer(&itv->osd_info->ivtvfb_info)) {
IVTVFB_WARN("Framebuffer %d is in use, cannot unload\n", IVTVFB_WARN("Framebuffer %d is in use, cannot unload\n",
itv->instance); itv->instance);
......
...@@ -1013,11 +1013,6 @@ static int vidioc_querycap(struct file *file, void *fh, ...@@ -1013,11 +1013,6 @@ static int vidioc_querycap(struct file *file, void *fh,
strscpy(cap->driver, "meye", sizeof(cap->driver)); strscpy(cap->driver, "meye", sizeof(cap->driver));
strscpy(cap->card, "meye", sizeof(cap->card)); strscpy(cap->card, "meye", sizeof(cap->card));
sprintf(cap->bus_info, "PCI:%s", pci_name(meye.mchip_dev)); sprintf(cap->bus_info, "PCI:%s", pci_name(meye.mchip_dev));
cap->device_caps = V4L2_CAP_VIDEO_CAPTURE |
V4L2_CAP_STREAMING;
cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
return 0; return 0;
} }
...@@ -1529,6 +1524,7 @@ static const struct video_device meye_template = { ...@@ -1529,6 +1524,7 @@ static const struct video_device meye_template = {
.fops = &meye_fops, .fops = &meye_fops,
.ioctl_ops = &meye_ioctl_ops, .ioctl_ops = &meye_ioctl_ops,
.release = video_device_release_empty, .release = video_device_release_empty,
.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING,
}; };
static const struct v4l2_ctrl_ops meye_ctrl_ops = { static const struct v4l2_ctrl_ops meye_ctrl_ops = {
......
...@@ -1206,6 +1206,14 @@ static int saa7134_initdev(struct pci_dev *pci_dev, ...@@ -1206,6 +1206,14 @@ static int saa7134_initdev(struct pci_dev *pci_dev,
dev->video_dev->ctrl_handler = &dev->ctrl_handler; dev->video_dev->ctrl_handler = &dev->ctrl_handler;
dev->video_dev->lock = &dev->lock; dev->video_dev->lock = &dev->lock;
dev->video_dev->queue = &dev->video_vbq; dev->video_dev->queue = &dev->video_vbq;
dev->video_dev->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
V4L2_CAP_VIDEO_CAPTURE;
if (dev->tuner_type != TUNER_ABSENT && dev->tuner_type != UNSET)
dev->video_dev->device_caps |= V4L2_CAP_TUNER;
if (saa7134_no_overlay <= 0)
dev->video_dev->device_caps |= V4L2_CAP_VIDEO_OVERLAY;
err = video_register_device(dev->video_dev,VFL_TYPE_GRABBER, err = video_register_device(dev->video_dev,VFL_TYPE_GRABBER,
video_nr[dev->nr]); video_nr[dev->nr]);
if (err < 0) { if (err < 0) {
...@@ -1220,6 +1228,10 @@ static int saa7134_initdev(struct pci_dev *pci_dev, ...@@ -1220,6 +1228,10 @@ static int saa7134_initdev(struct pci_dev *pci_dev,
dev->vbi_dev->ctrl_handler = &dev->ctrl_handler; dev->vbi_dev->ctrl_handler = &dev->ctrl_handler;
dev->vbi_dev->lock = &dev->lock; dev->vbi_dev->lock = &dev->lock;
dev->vbi_dev->queue = &dev->vbi_vbq; dev->vbi_dev->queue = &dev->vbi_vbq;
dev->vbi_dev->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
V4L2_CAP_VBI_CAPTURE;
if (dev->tuner_type != TUNER_ABSENT && dev->tuner_type != UNSET)
dev->vbi_dev->device_caps |= V4L2_CAP_TUNER;
err = video_register_device(dev->vbi_dev,VFL_TYPE_VBI, err = video_register_device(dev->vbi_dev,VFL_TYPE_VBI,
vbi_nr[dev->nr]); vbi_nr[dev->nr]);
...@@ -1232,6 +1244,9 @@ static int saa7134_initdev(struct pci_dev *pci_dev, ...@@ -1232,6 +1244,9 @@ static int saa7134_initdev(struct pci_dev *pci_dev,
dev->radio_dev = vdev_init(dev,&saa7134_radio_template,"radio"); dev->radio_dev = vdev_init(dev,&saa7134_radio_template,"radio");
dev->radio_dev->ctrl_handler = &dev->radio_ctrl_handler; dev->radio_dev->ctrl_handler = &dev->radio_ctrl_handler;
dev->radio_dev->lock = &dev->lock; dev->radio_dev->lock = &dev->lock;
dev->radio_dev->device_caps = V4L2_CAP_RADIO | V4L2_CAP_TUNER;
if (dev->has_rds)
dev->radio_dev->device_caps |= V4L2_CAP_RDS_CAPTURE;
err = video_register_device(dev->radio_dev,VFL_TYPE_RADIO, err = video_register_device(dev->radio_dev,VFL_TYPE_RADIO,
radio_nr[dev->nr]); radio_nr[dev->nr]);
if (err < 0) if (err < 0)
......
...@@ -287,6 +287,10 @@ static int empress_init(struct saa7134_dev *dev) ...@@ -287,6 +287,10 @@ static int empress_init(struct saa7134_dev *dev)
if (err) if (err)
return err; return err;
dev->empress_dev->queue = q; dev->empress_dev->queue = q;
dev->empress_dev->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
V4L2_CAP_VIDEO_CAPTURE;
if (dev->tuner_type != TUNER_ABSENT && dev->tuner_type != UNSET)
dev->empress_dev->device_caps |= V4L2_CAP_TUNER;
video_set_drvdata(dev->empress_dev, dev); video_set_drvdata(dev->empress_dev, dev);
err = video_register_device(dev->empress_dev,VFL_TYPE_GRABBER, err = video_register_device(dev->empress_dev,VFL_TYPE_GRABBER,
......
...@@ -1489,50 +1489,20 @@ int saa7134_querycap(struct file *file, void *priv, ...@@ -1489,50 +1489,20 @@ int saa7134_querycap(struct file *file, void *priv,
struct v4l2_capability *cap) struct v4l2_capability *cap)
{ {
struct saa7134_dev *dev = video_drvdata(file); struct saa7134_dev *dev = video_drvdata(file);
struct video_device *vdev = video_devdata(file);
u32 radio_caps, video_caps, vbi_caps;
unsigned int tuner_type = dev->tuner_type;
strscpy(cap->driver, "saa7134", sizeof(cap->driver)); strscpy(cap->driver, "saa7134", sizeof(cap->driver));
strscpy(cap->card, saa7134_boards[dev->board].name, strscpy(cap->card, saa7134_boards[dev->board].name,
sizeof(cap->card)); sizeof(cap->card));
sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci)); sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci));
cap->capabilities = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
cap->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; V4L2_CAP_RADIO | V4L2_CAP_VIDEO_CAPTURE |
if ((tuner_type != TUNER_ABSENT) && (tuner_type != UNSET)) V4L2_CAP_VBI_CAPTURE | V4L2_CAP_DEVICE_CAPS;
cap->device_caps |= V4L2_CAP_TUNER; if (dev->tuner_type != TUNER_ABSENT && dev->tuner_type != UNSET)
cap->capabilities |= V4L2_CAP_TUNER;
radio_caps = V4L2_CAP_RADIO;
if (dev->has_rds) if (dev->has_rds)
radio_caps |= V4L2_CAP_RDS_CAPTURE; cap->capabilities |= V4L2_CAP_RDS_CAPTURE;
if (saa7134_no_overlay <= 0)
video_caps = V4L2_CAP_VIDEO_CAPTURE; cap->capabilities |= V4L2_CAP_VIDEO_OVERLAY;
if (saa7134_no_overlay <= 0 && !is_empress(file))
video_caps |= V4L2_CAP_VIDEO_OVERLAY;
vbi_caps = V4L2_CAP_VBI_CAPTURE;
switch (vdev->vfl_type) {
case VFL_TYPE_RADIO:
cap->device_caps |= radio_caps;
break;
case VFL_TYPE_GRABBER:
cap->device_caps |= video_caps;
break;
case VFL_TYPE_VBI:
cap->device_caps |= vbi_caps;
break;
default:
return -EINVAL;
}
cap->capabilities = radio_caps | video_caps | vbi_caps |
cap->device_caps | V4L2_CAP_DEVICE_CAPS;
if (vdev->vfl_type == VFL_TYPE_RADIO) {
cap->device_caps &= ~V4L2_CAP_STREAMING;
if (!dev->has_rds)
cap->device_caps &= ~V4L2_CAP_READWRITE;
}
return 0; return 0;
} }
......
...@@ -491,16 +491,9 @@ static int vidioc_querycap(struct file *file, void *priv, ...@@ -491,16 +491,9 @@ static int vidioc_querycap(struct file *file, void *priv,
strscpy(cap->card, saa7164_boards[dev->board].name, strscpy(cap->card, saa7164_boards[dev->board].name,
sizeof(cap->card)); sizeof(cap->card));
sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci)); sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci));
cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
cap->device_caps = V4L2_CAP_TUNER | V4L2_CAP_VBI_CAPTURE |
V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_DEVICE_CAPS;
V4L2_CAP_READWRITE |
V4L2_CAP_TUNER;
cap->capabilities = cap->device_caps |
V4L2_CAP_VBI_CAPTURE |
V4L2_CAP_DEVICE_CAPS;
return 0; return 0;
} }
...@@ -973,6 +966,8 @@ static struct video_device saa7164_mpeg_template = { ...@@ -973,6 +966,8 @@ static struct video_device saa7164_mpeg_template = {
.ioctl_ops = &mpeg_ioctl_ops, .ioctl_ops = &mpeg_ioctl_ops,
.minor = -1, .minor = -1,
.tvnorms = SAA7164_NORMS, .tvnorms = SAA7164_NORMS,
.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
V4L2_CAP_TUNER,
}; };
static struct video_device *saa7164_encoder_alloc( static struct video_device *saa7164_encoder_alloc(
......
...@@ -202,16 +202,9 @@ static int vidioc_querycap(struct file *file, void *priv, ...@@ -202,16 +202,9 @@ static int vidioc_querycap(struct file *file, void *priv,
strscpy(cap->card, saa7164_boards[dev->board].name, strscpy(cap->card, saa7164_boards[dev->board].name,
sizeof(cap->card)); sizeof(cap->card));
sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci)); sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci));
cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
cap->device_caps = V4L2_CAP_TUNER | V4L2_CAP_VBI_CAPTURE |
V4L2_CAP_VBI_CAPTURE | V4L2_CAP_DEVICE_CAPS;
V4L2_CAP_READWRITE |
V4L2_CAP_TUNER;
cap->capabilities = cap->device_caps |
V4L2_CAP_VIDEO_CAPTURE |
V4L2_CAP_DEVICE_CAPS;
return 0; return 0;
} }
...@@ -675,6 +668,8 @@ static struct video_device saa7164_vbi_template = { ...@@ -675,6 +668,8 @@ static struct video_device saa7164_vbi_template = {
.ioctl_ops = &vbi_ioctl_ops, .ioctl_ops = &vbi_ioctl_ops,
.minor = -1, .minor = -1,
.tvnorms = SAA7164_NORMS, .tvnorms = SAA7164_NORMS,
.device_caps = V4L2_CAP_VBI_CAPTURE | V4L2_CAP_READWRITE |
V4L2_CAP_TUNER,
}; };
static struct video_device *saa7164_vbi_alloc( static struct video_device *saa7164_vbi_alloc(
......
...@@ -771,9 +771,6 @@ static int solo_enc_querycap(struct file *file, void *priv, ...@@ -771,9 +771,6 @@ static int solo_enc_querycap(struct file *file, void *priv,
solo_enc->ch); solo_enc->ch);
snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s", snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s",
pci_name(solo_dev->pdev)); pci_name(solo_dev->pdev));
cap->device_caps = V4L2_CAP_VIDEO_CAPTURE |
V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
return 0; return 0;
} }
...@@ -1191,6 +1188,8 @@ static const struct video_device solo_enc_template = { ...@@ -1191,6 +1188,8 @@ static const struct video_device solo_enc_template = {
.minor = -1, .minor = -1,
.release = video_device_release, .release = video_device_release,
.tvnorms = V4L2_STD_NTSC_M | V4L2_STD_PAL, .tvnorms = V4L2_STD_NTSC_M | V4L2_STD_PAL,
.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
V4L2_CAP_STREAMING,
}; };
static const struct v4l2_ctrl_ops solo_ctrl_ops = { static const struct v4l2_ctrl_ops solo_ctrl_ops = {
......
...@@ -378,9 +378,6 @@ static int solo_querycap(struct file *file, void *priv, ...@@ -378,9 +378,6 @@ static int solo_querycap(struct file *file, void *priv,
strscpy(cap->card, "Softlogic 6x10", sizeof(cap->card)); strscpy(cap->card, "Softlogic 6x10", sizeof(cap->card));
snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s", snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s",
pci_name(solo_dev->pdev)); pci_name(solo_dev->pdev));
cap->device_caps = V4L2_CAP_VIDEO_CAPTURE |
V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
return 0; return 0;
} }
...@@ -628,6 +625,8 @@ static const struct video_device solo_v4l2_template = { ...@@ -628,6 +625,8 @@ static const struct video_device solo_v4l2_template = {
.minor = -1, .minor = -1,
.release = video_device_release, .release = video_device_release,
.tvnorms = V4L2_STD_NTSC_M | V4L2_STD_PAL, .tvnorms = V4L2_STD_NTSC_M | V4L2_STD_PAL,
.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
V4L2_CAP_STREAMING,
}; };
static const struct v4l2_ctrl_ops solo_ctrl_ops = { static const struct v4l2_ctrl_ops solo_ctrl_ops = {
......
...@@ -407,10 +407,6 @@ static int vidioc_querycap(struct file *file, void *priv, ...@@ -407,10 +407,6 @@ static int vidioc_querycap(struct file *file, void *priv,
strscpy(cap->card, KBUILD_MODNAME, sizeof(cap->card)); strscpy(cap->card, KBUILD_MODNAME, sizeof(cap->card));
snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s", snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s",
pci_name(vip->pdev)); pci_name(vip->pdev));
cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
V4L2_CAP_STREAMING;
cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
return 0; return 0;
} }
...@@ -759,6 +755,8 @@ static const struct video_device video_dev_template = { ...@@ -759,6 +755,8 @@ static const struct video_device video_dev_template = {
.fops = &vip_fops, .fops = &vip_fops,
.ioctl_ops = &vip_ioctl_ops, .ioctl_ops = &vip_ioctl_ops,
.tvnorms = V4L2_STD_ALL, .tvnorms = V4L2_STD_ALL,
.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
V4L2_CAP_STREAMING,
}; };
/** /**
......
...@@ -729,12 +729,6 @@ static int tw68_querycap(struct file *file, void *priv, ...@@ -729,12 +729,6 @@ static int tw68_querycap(struct file *file, void *priv,
strscpy(cap->card, "Techwell Capture Card", strscpy(cap->card, "Techwell Capture Card",
sizeof(cap->card)); sizeof(cap->card));
sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci)); sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci));
cap->device_caps =
V4L2_CAP_VIDEO_CAPTURE |
V4L2_CAP_READWRITE |
V4L2_CAP_STREAMING;
cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
return 0; return 0;
} }
...@@ -913,6 +907,8 @@ static const struct video_device tw68_video_template = { ...@@ -913,6 +907,8 @@ static const struct video_device tw68_video_template = {
.ioctl_ops = &video_ioctl_ops, .ioctl_ops = &video_ioctl_ops,
.release = video_device_release_empty, .release = video_device_release_empty,
.tvnorms = TW68_NORMS, .tvnorms = TW68_NORMS,
.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
V4L2_CAP_STREAMING,
}; };
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
......
...@@ -765,9 +765,6 @@ static int tw686x_querycap(struct file *file, void *priv, ...@@ -765,9 +765,6 @@ static int tw686x_querycap(struct file *file, void *priv,
strscpy(cap->card, dev->name, sizeof(cap->card)); strscpy(cap->card, dev->name, sizeof(cap->card));
snprintf(cap->bus_info, sizeof(cap->bus_info), snprintf(cap->bus_info, sizeof(cap->bus_info),
"PCI:%s", pci_name(dev->pci_dev)); "PCI:%s", pci_name(dev->pci_dev));
cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING |
V4L2_CAP_READWRITE;
cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
return 0; return 0;
} }
...@@ -1280,6 +1277,8 @@ int tw686x_video_init(struct tw686x_dev *dev) ...@@ -1280,6 +1277,8 @@ int tw686x_video_init(struct tw686x_dev *dev)
vdev->minor = -1; vdev->minor = -1;
vdev->lock = &vc->vb_mutex; vdev->lock = &vc->vb_mutex;
vdev->ctrl_handler = &vc->ctrl_handler; vdev->ctrl_handler = &vc->ctrl_handler;
vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE |
V4L2_CAP_STREAMING | V4L2_CAP_READWRITE;
vc->device = vdev; vc->device = vdev;
video_set_drvdata(vdev, vc); video_set_drvdata(vdev, vc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment