aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/pci/cx88
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2019-06-17 05:36:16 -0400
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-06-24 14:57:12 -0400
commit2161536516edcc0be31109eb1284939119e7ba6d (patch)
tree2117cbdb255958f4a531a736b1781498e103937e /drivers/media/pci/cx88
parent374d62e7aa50f66c1a4316be9221df4d0f38addd (diff)
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: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/pci/cx88')
-rw-r--r--drivers/media/pci/cx88/cx88-blackbird.c4
-rw-r--r--drivers/media/pci/cx88/cx88-video.c32
2 files changed, 17 insertions, 19 deletions
diff --git a/drivers/media/pci/cx88/cx88-blackbird.c b/drivers/media/pci/cx88/cx88-blackbird.c
index 64dd8b6cf808..200d68827073 100644
--- a/drivers/media/pci/cx88/cx88-blackbird.c
+++ b/drivers/media/pci/cx88/cx88-blackbird.c
@@ -1136,6 +1136,10 @@ static int blackbird_register_video(struct cx8802_dev *dev)
1136 dev->mpeg_dev.ctrl_handler = &dev->cxhdl.hdl; 1136 dev->mpeg_dev.ctrl_handler = &dev->cxhdl.hdl;
1137 video_set_drvdata(&dev->mpeg_dev, dev); 1137 video_set_drvdata(&dev->mpeg_dev, dev);
1138 dev->mpeg_dev.queue = &dev->vb2_mpegq; 1138 dev->mpeg_dev.queue = &dev->vb2_mpegq;
1139 dev->mpeg_dev.device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
1140 V4L2_CAP_VIDEO_CAPTURE;
1141 if (dev->core->board.tuner_type != UNSET)
1142 dev->mpeg_dev.device_caps |= V4L2_CAP_TUNER;
1139 err = video_register_device(&dev->mpeg_dev, VFL_TYPE_GRABBER, -1); 1143 err = video_register_device(&dev->mpeg_dev, VFL_TYPE_GRABBER, -1);
1140 if (err < 0) { 1144 if (err < 0) {
1141 pr_info("can't register mpeg device\n"); 1145 pr_info("can't register mpeg device\n");
diff --git a/drivers/media/pci/cx88/cx88-video.c b/drivers/media/pci/cx88/cx88-video.c
index 5256ad7ead38..e59a74514c7c 100644
--- a/drivers/media/pci/cx88/cx88-video.c
+++ b/drivers/media/pci/cx88/cx88-video.c
@@ -800,27 +800,12 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
800int cx88_querycap(struct file *file, struct cx88_core *core, 800int cx88_querycap(struct file *file, struct cx88_core *core,
801 struct v4l2_capability *cap) 801 struct v4l2_capability *cap)
802{ 802{
803 struct video_device *vdev = video_devdata(file);
804
805 strscpy(cap->card, core->board.name, sizeof(cap->card)); 803 strscpy(cap->card, core->board.name, sizeof(cap->card));
806 cap->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; 804 cap->capabilities = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
805 V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VBI_CAPTURE |
806 V4L2_CAP_DEVICE_CAPS;
807 if (core->board.tuner_type != UNSET) 807 if (core->board.tuner_type != UNSET)
808 cap->device_caps |= V4L2_CAP_TUNER; 808 cap->capabilities |= V4L2_CAP_TUNER;
809 switch (vdev->vfl_type) {
810 case VFL_TYPE_RADIO:
811 cap->device_caps = V4L2_CAP_RADIO | V4L2_CAP_TUNER;
812 break;
813 case VFL_TYPE_GRABBER:
814 cap->device_caps |= V4L2_CAP_VIDEO_CAPTURE;
815 break;
816 case VFL_TYPE_VBI:
817 cap->device_caps |= V4L2_CAP_VBI_CAPTURE;
818 break;
819 default:
820 return -EINVAL;
821 }
822 cap->capabilities = cap->device_caps | V4L2_CAP_VIDEO_CAPTURE |
823 V4L2_CAP_VBI_CAPTURE | V4L2_CAP_DEVICE_CAPS;
824 if (core->board.radio.type == CX88_RADIO) 809 if (core->board.radio.type == CX88_RADIO)
825 cap->capabilities |= V4L2_CAP_RADIO; 810 cap->capabilities |= V4L2_CAP_RADIO;
826 return 0; 811 return 0;
@@ -1473,6 +1458,10 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
1473 video_set_drvdata(&dev->video_dev, dev); 1458 video_set_drvdata(&dev->video_dev, dev);
1474 dev->video_dev.ctrl_handler = &core->video_hdl; 1459 dev->video_dev.ctrl_handler = &core->video_hdl;
1475 dev->video_dev.queue = &dev->vb2_vidq; 1460 dev->video_dev.queue = &dev->vb2_vidq;
1461 dev->video_dev.device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
1462 V4L2_CAP_VIDEO_CAPTURE;
1463 if (core->board.tuner_type != UNSET)
1464 dev->video_dev.device_caps |= V4L2_CAP_TUNER;
1476 err = video_register_device(&dev->video_dev, VFL_TYPE_GRABBER, 1465 err = video_register_device(&dev->video_dev, VFL_TYPE_GRABBER,
1477 video_nr[core->nr]); 1466 video_nr[core->nr]);
1478 if (err < 0) { 1467 if (err < 0) {
@@ -1486,6 +1475,10 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
1486 &cx8800_vbi_template, "vbi"); 1475 &cx8800_vbi_template, "vbi");
1487 video_set_drvdata(&dev->vbi_dev, dev); 1476 video_set_drvdata(&dev->vbi_dev, dev);
1488 dev->vbi_dev.queue = &dev->vb2_vbiq; 1477 dev->vbi_dev.queue = &dev->vb2_vbiq;
1478 dev->vbi_dev.device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
1479 V4L2_CAP_VBI_CAPTURE;
1480 if (core->board.tuner_type != UNSET)
1481 dev->vbi_dev.device_caps |= V4L2_CAP_TUNER;
1489 err = video_register_device(&dev->vbi_dev, VFL_TYPE_VBI, 1482 err = video_register_device(&dev->vbi_dev, VFL_TYPE_VBI,
1490 vbi_nr[core->nr]); 1483 vbi_nr[core->nr]);
1491 if (err < 0) { 1484 if (err < 0) {
@@ -1500,6 +1493,7 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
1500 &cx8800_radio_template, "radio"); 1493 &cx8800_radio_template, "radio");
1501 video_set_drvdata(&dev->radio_dev, dev); 1494 video_set_drvdata(&dev->radio_dev, dev);
1502 dev->radio_dev.ctrl_handler = &core->audio_hdl; 1495 dev->radio_dev.ctrl_handler = &core->audio_hdl;
1496 dev->radio_dev.device_caps = V4L2_CAP_RADIO | V4L2_CAP_TUNER;
1503 err = video_register_device(&dev->radio_dev, VFL_TYPE_RADIO, 1497 err = video_register_device(&dev->radio_dev, VFL_TYPE_RADIO,
1504 radio_nr[core->nr]); 1498 radio_nr[core->nr]);
1505 if (err < 0) { 1499 if (err < 0) {