aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2012-05-09 15:23:07 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-07-06 17:07:01 -0400
commit902e197dcc36138e1f40f4435b7de8893ffc6c15 (patch)
treea10f85448ff1837a230a0bdd33bd7839fe25d292 /drivers
parent4a77a8361fe79b78b741640b484a97c8d47e307f (diff)
[media] cx88: fix querycap
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c12
-rw-r--r--drivers/media/video/cx88/cx88-video.c90
-rw-r--r--drivers/media/video/cx88/cx88.h2
3 files changed, 36 insertions, 68 deletions
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index ed7b2aa1ed83..cbacdf634fd8 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -722,21 +722,15 @@ static int vidioc_querymenu (struct file *file, void *priv,
722 cx2341x_ctrl_get_menu(&dev->params, qmenu->id)); 722 cx2341x_ctrl_get_menu(&dev->params, qmenu->id));
723} 723}
724 724
725static int vidioc_querycap (struct file *file, void *priv, 725static int vidioc_querycap(struct file *file, void *priv,
726 struct v4l2_capability *cap) 726 struct v4l2_capability *cap)
727{ 727{
728 struct cx8802_dev *dev = ((struct cx8802_fh *)priv)->dev; 728 struct cx8802_dev *dev = ((struct cx8802_fh *)priv)->dev;
729 struct cx88_core *core = dev->core; 729 struct cx88_core *core = dev->core;
730 730
731 strcpy(cap->driver, "cx88_blackbird"); 731 strcpy(cap->driver, "cx88_blackbird");
732 strlcpy(cap->card, core->board.name, sizeof(cap->card)); 732 sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci));
733 sprintf(cap->bus_info,"PCI:%s",pci_name(dev->pci)); 733 cx88_querycap(file, core, cap);
734 cap->capabilities =
735 V4L2_CAP_VIDEO_CAPTURE |
736 V4L2_CAP_READWRITE |
737 V4L2_CAP_STREAMING;
738 if (UNSET != core->board.tuner_type)
739 cap->capabilities |= V4L2_CAP_TUNER;
740 return 0; 734 return 0;
741} 735}
742 736
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 921c56d115d6..5d9973680614 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -1195,22 +1195,42 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
1195 return 0; 1195 return 0;
1196} 1196}
1197 1197
1198static int vidioc_querycap (struct file *file, void *priv, 1198void cx88_querycap(struct file *file, struct cx88_core *core,
1199 struct v4l2_capability *cap)
1200{
1201 struct video_device *vdev = video_devdata(file);
1202
1203 strlcpy(cap->card, core->board.name, sizeof(cap->card));
1204 cap->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
1205 if (UNSET != core->board.tuner_type)
1206 cap->device_caps |= V4L2_CAP_TUNER;
1207 switch (vdev->vfl_type) {
1208 case VFL_TYPE_RADIO:
1209 cap->device_caps = V4L2_CAP_RADIO | V4L2_CAP_TUNER;
1210 break;
1211 case VFL_TYPE_GRABBER:
1212 cap->device_caps |= V4L2_CAP_VIDEO_CAPTURE;
1213 break;
1214 case VFL_TYPE_VBI:
1215 cap->device_caps |= V4L2_CAP_VBI_CAPTURE;
1216 break;
1217 }
1218 cap->capabilities = cap->device_caps | V4L2_CAP_VIDEO_CAPTURE |
1219 V4L2_CAP_VBI_CAPTURE | V4L2_CAP_DEVICE_CAPS;
1220 if (core->board.radio.type == CX88_RADIO)
1221 cap->capabilities |= V4L2_CAP_RADIO;
1222}
1223EXPORT_SYMBOL(cx88_querycap);
1224
1225static int vidioc_querycap(struct file *file, void *priv,
1199 struct v4l2_capability *cap) 1226 struct v4l2_capability *cap)
1200{ 1227{
1201 struct cx8800_dev *dev = ((struct cx8800_fh *)priv)->dev; 1228 struct cx8800_dev *dev = ((struct cx8800_fh *)priv)->dev;
1202 struct cx88_core *core = dev->core; 1229 struct cx88_core *core = dev->core;
1203 1230
1204 strcpy(cap->driver, "cx8800"); 1231 strcpy(cap->driver, "cx8800");
1205 strlcpy(cap->card, core->board.name, sizeof(cap->card)); 1232 sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci));
1206 sprintf(cap->bus_info,"PCI:%s",pci_name(dev->pci)); 1233 cx88_querycap(file, core, cap);
1207 cap->capabilities =
1208 V4L2_CAP_VIDEO_CAPTURE |
1209 V4L2_CAP_READWRITE |
1210 V4L2_CAP_STREAMING |
1211 V4L2_CAP_VBI_CAPTURE;
1212 if (UNSET != core->board.tuner_type)
1213 cap->capabilities |= V4L2_CAP_TUNER;
1214 return 0; 1234 return 0;
1215} 1235}
1216 1236
@@ -1513,19 +1533,6 @@ static int vidioc_s_register (struct file *file, void *fh,
1513/* RADIO ESPECIFIC IOCTLS */ 1533/* RADIO ESPECIFIC IOCTLS */
1514/* ----------------------------------------------------------- */ 1534/* ----------------------------------------------------------- */
1515 1535
1516static int radio_querycap (struct file *file, void *priv,
1517 struct v4l2_capability *cap)
1518{
1519 struct cx8800_dev *dev = ((struct cx8800_fh *)priv)->dev;
1520 struct cx88_core *core = dev->core;
1521
1522 strcpy(cap->driver, "cx8800");
1523 strlcpy(cap->card, core->board.name, sizeof(cap->card));
1524 sprintf(cap->bus_info,"PCI:%s", pci_name(dev->pci));
1525 cap->capabilities = V4L2_CAP_TUNER;
1526 return 0;
1527}
1528
1529static int radio_g_tuner (struct file *file, void *priv, 1536static int radio_g_tuner (struct file *file, void *priv,
1530 struct v4l2_tuner *t) 1537 struct v4l2_tuner *t)
1531{ 1538{
@@ -1541,26 +1548,6 @@ static int radio_g_tuner (struct file *file, void *priv,
1541 return 0; 1548 return 0;
1542} 1549}
1543 1550
1544static int radio_enum_input (struct file *file, void *priv,
1545 struct v4l2_input *i)
1546{
1547 if (i->index != 0)
1548 return -EINVAL;
1549 strcpy(i->name,"Radio");
1550 i->type = V4L2_INPUT_TYPE_TUNER;
1551
1552 return 0;
1553}
1554
1555static int radio_g_audio (struct file *file, void *priv, struct v4l2_audio *a)
1556{
1557 if (unlikely(a->index))
1558 return -EINVAL;
1559
1560 strcpy(a->name,"Radio");
1561 return 0;
1562}
1563
1564/* FIXME: Should add a standard for radio */ 1551/* FIXME: Should add a standard for radio */
1565 1552
1566static int radio_s_tuner (struct file *file, void *priv, 1553static int radio_s_tuner (struct file *file, void *priv,
@@ -1576,17 +1563,6 @@ static int radio_s_tuner (struct file *file, void *priv,
1576 return 0; 1563 return 0;
1577} 1564}
1578 1565
1579static int radio_s_audio (struct file *file, void *fh,
1580 struct v4l2_audio *a)
1581{
1582 return 0;
1583}
1584
1585static int radio_s_input (struct file *file, void *fh, unsigned int i)
1586{
1587 return 0;
1588}
1589
1590static int radio_queryctrl (struct file *file, void *priv, 1566static int radio_queryctrl (struct file *file, void *priv,
1591 struct v4l2_queryctrl *c) 1567 struct v4l2_queryctrl *c)
1592{ 1568{
@@ -1797,13 +1773,9 @@ static const struct v4l2_file_operations radio_fops =
1797}; 1773};
1798 1774
1799static const struct v4l2_ioctl_ops radio_ioctl_ops = { 1775static const struct v4l2_ioctl_ops radio_ioctl_ops = {
1800 .vidioc_querycap = radio_querycap, 1776 .vidioc_querycap = vidioc_querycap,
1801 .vidioc_g_tuner = radio_g_tuner, 1777 .vidioc_g_tuner = radio_g_tuner,
1802 .vidioc_enum_input = radio_enum_input,
1803 .vidioc_g_audio = radio_g_audio,
1804 .vidioc_s_tuner = radio_s_tuner, 1778 .vidioc_s_tuner = radio_s_tuner,
1805 .vidioc_s_audio = radio_s_audio,
1806 .vidioc_s_input = radio_s_input,
1807 .vidioc_queryctrl = radio_queryctrl, 1779 .vidioc_queryctrl = radio_queryctrl,
1808 .vidioc_g_ctrl = vidioc_g_ctrl, 1780 .vidioc_g_ctrl = vidioc_g_ctrl,
1809 .vidioc_s_ctrl = vidioc_s_ctrl, 1781 .vidioc_s_ctrl = vidioc_s_ctrl,
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index c9659def2a78..8e9820cf454e 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -730,3 +730,5 @@ int cx88_set_freq (struct cx88_core *core,struct v4l2_frequency *f);
730int cx88_get_control(struct cx88_core *core, struct v4l2_control *ctl); 730int cx88_get_control(struct cx88_core *core, struct v4l2_control *ctl);
731int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl); 731int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl);
732int cx88_video_mux(struct cx88_core *core, unsigned int input); 732int cx88_video_mux(struct cx88_core *core, unsigned int input);
733void cx88_querycap(struct file *file, struct cx88_core *core,
734 struct v4l2_capability *cap);