aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/pci/saa7134/saa7134-video.c
diff options
context:
space:
mode:
authorOndrej Zary <linux@rainbow-software.org>2013-02-01 18:01:14 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-04-14 17:52:39 -0400
commitc3b3e0c5fd5ccacecf454d60c8fdc5caa96ba862 (patch)
tree9f33f7dbcd2b5b1fdbccd0cee046b682d9d2674c /drivers/media/pci/saa7134/saa7134-video.c
parentd67492585d8308a22a841956f1e629ef3b7d0315 (diff)
[media] saa7134: v4l2-compliance: implement V4L2_CAP_DEVICE_CAPS
Make saa7134 driver more V4L2 compliant: implement V4L2_CAP_DEVICE_CAPS support and fix all capabilities problems reported by v4l2-compliance. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/pci/saa7134/saa7134-video.c')
-rw-r--r--drivers/media/pci/saa7134/saa7134-video.c58
1 files changed, 34 insertions, 24 deletions
diff --git a/drivers/media/pci/saa7134/saa7134-video.c b/drivers/media/pci/saa7134/saa7134-video.c
index 1363e97ccda4..88e84c31c7d7 100644
--- a/drivers/media/pci/saa7134/saa7134-video.c
+++ b/drivers/media/pci/saa7134/saa7134-video.c
@@ -1805,6 +1805,8 @@ static int saa7134_querycap(struct file *file, void *priv,
1805{ 1805{
1806 struct saa7134_fh *fh = priv; 1806 struct saa7134_fh *fh = priv;
1807 struct saa7134_dev *dev = fh->dev; 1807 struct saa7134_dev *dev = fh->dev;
1808 struct video_device *vdev = video_devdata(file);
1809 u32 radio_caps, video_caps, vbi_caps;
1808 1810
1809 unsigned int tuner_type = dev->tuner_type; 1811 unsigned int tuner_type = dev->tuner_type;
1810 1812
@@ -1812,19 +1814,40 @@ static int saa7134_querycap(struct file *file, void *priv,
1812 strlcpy(cap->card, saa7134_boards[dev->board].name, 1814 strlcpy(cap->card, saa7134_boards[dev->board].name,
1813 sizeof(cap->card)); 1815 sizeof(cap->card));
1814 sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci)); 1816 sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci));
1815 cap->capabilities = 1817
1816 V4L2_CAP_VIDEO_CAPTURE | 1818 cap->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
1817 V4L2_CAP_VBI_CAPTURE | 1819 if ((tuner_type != TUNER_ABSENT) && (tuner_type != UNSET))
1818 V4L2_CAP_READWRITE | 1820 cap->device_caps |= V4L2_CAP_TUNER;
1819 V4L2_CAP_STREAMING | 1821
1820 V4L2_CAP_TUNER; 1822 radio_caps = V4L2_CAP_RADIO;
1821 if (dev->has_rds) 1823 if (dev->has_rds)
1822 cap->capabilities |= V4L2_CAP_RDS_CAPTURE; 1824 radio_caps |= V4L2_CAP_RDS_CAPTURE;
1825
1826 video_caps = V4L2_CAP_VIDEO_CAPTURE;
1823 if (saa7134_no_overlay <= 0) 1827 if (saa7134_no_overlay <= 0)
1824 cap->capabilities |= V4L2_CAP_VIDEO_OVERLAY; 1828 video_caps |= V4L2_CAP_VIDEO_OVERLAY;
1829
1830 vbi_caps = V4L2_CAP_VBI_CAPTURE;
1831
1832 switch (vdev->vfl_type) {
1833 case VFL_TYPE_RADIO:
1834 cap->device_caps |= radio_caps;
1835 break;
1836 case VFL_TYPE_GRABBER:
1837 cap->device_caps |= video_caps;
1838 break;
1839 case VFL_TYPE_VBI:
1840 cap->device_caps |= vbi_caps;
1841 break;
1842 }
1843 cap->capabilities = radio_caps | video_caps | vbi_caps |
1844 cap->device_caps | V4L2_CAP_DEVICE_CAPS;
1845 if (vdev->vfl_type == VFL_TYPE_RADIO) {
1846 cap->device_caps &= ~V4L2_CAP_STREAMING;
1847 if (!dev->has_rds)
1848 cap->device_caps &= ~V4L2_CAP_READWRITE;
1849 }
1825 1850
1826 if ((tuner_type == TUNER_ABSENT) || (tuner_type == UNSET))
1827 cap->capabilities &= ~V4L2_CAP_TUNER;
1828 return 0; 1851 return 0;
1829} 1852}
1830 1853
@@ -2312,19 +2335,6 @@ static int vidioc_s_register (struct file *file, void *priv,
2312} 2335}
2313#endif 2336#endif
2314 2337
2315static int radio_querycap(struct file *file, void *priv,
2316 struct v4l2_capability *cap)
2317{
2318 struct saa7134_fh *fh = file->private_data;
2319 struct saa7134_dev *dev = fh->dev;
2320
2321 strcpy(cap->driver, "saa7134");
2322 strlcpy(cap->card, saa7134_boards[dev->board].name, sizeof(cap->card));
2323 sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci));
2324 cap->capabilities = V4L2_CAP_TUNER;
2325 return 0;
2326}
2327
2328static int radio_g_tuner(struct file *file, void *priv, 2338static int radio_g_tuner(struct file *file, void *priv,
2329 struct v4l2_tuner *t) 2339 struct v4l2_tuner *t)
2330{ 2340{
@@ -2486,7 +2496,7 @@ static const struct v4l2_file_operations radio_fops = {
2486}; 2496};
2487 2497
2488static const struct v4l2_ioctl_ops radio_ioctl_ops = { 2498static const struct v4l2_ioctl_ops radio_ioctl_ops = {
2489 .vidioc_querycap = radio_querycap, 2499 .vidioc_querycap = saa7134_querycap,
2490 .vidioc_g_tuner = radio_g_tuner, 2500 .vidioc_g_tuner = radio_g_tuner,
2491 .vidioc_enum_input = radio_enum_input, 2501 .vidioc_enum_input = radio_enum_input,
2492 .vidioc_g_audio = radio_g_audio, 2502 .vidioc_g_audio = radio_g_audio,