diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2013-01-29 10:32:20 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-05 12:25:57 -0500 |
commit | 530e01e782c97076c58b6e474d31cc61caa4a9dd (patch) | |
tree | 984541078ede0628301e9c2c9d8acfeb01122c6f /drivers/media/usb/cx231xx/cx231xx-video.c | |
parent | fddd14c8f6ca2bb9bfdad1874c172002bc537527 (diff) |
[media] cx231xx: clean up radio support
Radio should not use video or audio inputs.
In addition, fix a bug in radio_g_tuner where s_tuner was called in the tuner
subdev instead of g_tuner.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/usb/cx231xx/cx231xx-video.c')
-rw-r--r-- | drivers/media/usb/cx231xx/cx231xx-video.c | 79 |
1 files changed, 18 insertions, 61 deletions
diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c index 1b29158bbbe2..2cd31129de86 100644 --- a/drivers/media/usb/cx231xx/cx231xx-video.c +++ b/drivers/media/usb/cx231xx/cx231xx-video.c | |||
@@ -1875,20 +1875,24 @@ static int vidioc_querycap(struct file *file, void *priv, | |||
1875 | strlcpy(cap->card, cx231xx_boards[dev->model].name, sizeof(cap->card)); | 1875 | strlcpy(cap->card, cx231xx_boards[dev->model].name, sizeof(cap->card)); |
1876 | usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info)); | 1876 | usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info)); |
1877 | 1877 | ||
1878 | cap->device_caps = | 1878 | if (vdev->vfl_type == VFL_TYPE_RADIO) |
1879 | V4L2_CAP_AUDIO | | 1879 | cap->device_caps = V4L2_CAP_RADIO; |
1880 | V4L2_CAP_READWRITE | | 1880 | else { |
1881 | V4L2_CAP_STREAMING; | 1881 | cap->device_caps = V4L2_CAP_AUDIO | V4L2_CAP_READWRITE | |
1882 | 1882 | V4L2_CAP_STREAMING; | |
1883 | if (vdev->vfl_type == VFL_TYPE_VBI) | 1883 | if (vdev->vfl_type == VFL_TYPE_VBI) |
1884 | cap->device_caps |= V4L2_CAP_VBI_CAPTURE; | 1884 | cap->device_caps |= V4L2_CAP_VBI_CAPTURE; |
1885 | else | 1885 | else |
1886 | cap->device_caps |= V4L2_CAP_VIDEO_CAPTURE; | 1886 | cap->device_caps |= V4L2_CAP_VIDEO_CAPTURE; |
1887 | } | ||
1887 | if (dev->tuner_type != TUNER_ABSENT) | 1888 | if (dev->tuner_type != TUNER_ABSENT) |
1888 | cap->device_caps |= V4L2_CAP_TUNER; | 1889 | cap->device_caps |= V4L2_CAP_TUNER; |
1889 | cap->capabilities = cap->device_caps | | 1890 | cap->capabilities = cap->device_caps | |
1890 | V4L2_CAP_VBI_CAPTURE | V4L2_CAP_VIDEO_CAPTURE | | 1891 | V4L2_CAP_VBI_CAPTURE | V4L2_CAP_VIDEO_CAPTURE | |
1891 | V4L2_CAP_DEVICE_CAPS; | 1892 | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE | |
1893 | V4L2_CAP_STREAMING | V4L2_CAP_DEVICE_CAPS; | ||
1894 | if (dev->radio_dev) | ||
1895 | cap->capabilities |= V4L2_CAP_RADIO; | ||
1892 | 1896 | ||
1893 | return 0; | 1897 | return 0; |
1894 | } | 1898 | } |
@@ -2055,53 +2059,19 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b) | |||
2055 | /* RADIO ESPECIFIC IOCTLS */ | 2059 | /* RADIO ESPECIFIC IOCTLS */ |
2056 | /* ----------------------------------------------------------- */ | 2060 | /* ----------------------------------------------------------- */ |
2057 | 2061 | ||
2058 | static int radio_querycap(struct file *file, void *priv, | ||
2059 | struct v4l2_capability *cap) | ||
2060 | { | ||
2061 | struct cx231xx *dev = ((struct cx231xx_fh *)priv)->dev; | ||
2062 | |||
2063 | strlcpy(cap->driver, "cx231xx", sizeof(cap->driver)); | ||
2064 | strlcpy(cap->card, cx231xx_boards[dev->model].name, sizeof(cap->card)); | ||
2065 | usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info)); | ||
2066 | |||
2067 | cap->capabilities = V4L2_CAP_TUNER; | ||
2068 | return 0; | ||
2069 | } | ||
2070 | |||
2071 | static int radio_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t) | 2062 | static int radio_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t) |
2072 | { | 2063 | { |
2073 | struct cx231xx *dev = ((struct cx231xx_fh *)priv)->dev; | 2064 | struct cx231xx *dev = ((struct cx231xx_fh *)priv)->dev; |
2074 | 2065 | ||
2075 | if (unlikely(t->index > 0)) | 2066 | if (t->index) |
2076 | return -EINVAL; | 2067 | return -EINVAL; |
2077 | 2068 | ||
2078 | strcpy(t->name, "Radio"); | 2069 | strcpy(t->name, "Radio"); |
2079 | t->type = V4L2_TUNER_RADIO; | ||
2080 | |||
2081 | call_all(dev, tuner, s_tuner, t); | ||
2082 | |||
2083 | return 0; | ||
2084 | } | ||
2085 | 2070 | ||
2086 | static int radio_enum_input(struct file *file, void *priv, struct v4l2_input *i) | 2071 | call_all(dev, tuner, g_tuner, t); |
2087 | { | ||
2088 | if (i->index != 0) | ||
2089 | return -EINVAL; | ||
2090 | strcpy(i->name, "Radio"); | ||
2091 | i->type = V4L2_INPUT_TYPE_TUNER; | ||
2092 | |||
2093 | return 0; | ||
2094 | } | ||
2095 | |||
2096 | static int radio_g_audio(struct file *file, void *priv, struct v4l2_audio *a) | ||
2097 | { | ||
2098 | if (unlikely(a->index)) | ||
2099 | return -EINVAL; | ||
2100 | 2072 | ||
2101 | strcpy(a->name, "Radio"); | ||
2102 | return 0; | 2073 | return 0; |
2103 | } | 2074 | } |
2104 | |||
2105 | static int radio_s_tuner(struct file *file, void *priv, struct v4l2_tuner *t) | 2075 | static int radio_s_tuner(struct file *file, void *priv, struct v4l2_tuner *t) |
2106 | { | 2076 | { |
2107 | struct cx231xx *dev = ((struct cx231xx_fh *)priv)->dev; | 2077 | struct cx231xx *dev = ((struct cx231xx_fh *)priv)->dev; |
@@ -2114,16 +2084,6 @@ static int radio_s_tuner(struct file *file, void *priv, struct v4l2_tuner *t) | |||
2114 | return 0; | 2084 | return 0; |
2115 | } | 2085 | } |
2116 | 2086 | ||
2117 | static int radio_s_audio(struct file *file, void *fh, const struct v4l2_audio *a) | ||
2118 | { | ||
2119 | return 0; | ||
2120 | } | ||
2121 | |||
2122 | static int radio_s_input(struct file *file, void *fh, unsigned int i) | ||
2123 | { | ||
2124 | return 0; | ||
2125 | } | ||
2126 | |||
2127 | static int radio_queryctrl(struct file *file, void *priv, | 2087 | static int radio_queryctrl(struct file *file, void *priv, |
2128 | struct v4l2_queryctrl *c) | 2088 | struct v4l2_queryctrl *c) |
2129 | { | 2089 | { |
@@ -2552,18 +2512,15 @@ static const struct v4l2_file_operations radio_fops = { | |||
2552 | }; | 2512 | }; |
2553 | 2513 | ||
2554 | static const struct v4l2_ioctl_ops radio_ioctl_ops = { | 2514 | static const struct v4l2_ioctl_ops radio_ioctl_ops = { |
2555 | .vidioc_querycap = radio_querycap, | 2515 | .vidioc_querycap = vidioc_querycap, |
2556 | .vidioc_g_tuner = radio_g_tuner, | 2516 | .vidioc_g_tuner = radio_g_tuner, |
2557 | .vidioc_enum_input = radio_enum_input, | ||
2558 | .vidioc_g_audio = radio_g_audio, | ||
2559 | .vidioc_s_tuner = radio_s_tuner, | 2517 | .vidioc_s_tuner = radio_s_tuner, |
2560 | .vidioc_s_audio = radio_s_audio, | ||
2561 | .vidioc_s_input = radio_s_input, | ||
2562 | .vidioc_queryctrl = radio_queryctrl, | 2518 | .vidioc_queryctrl = radio_queryctrl, |
2563 | .vidioc_g_ctrl = vidioc_g_ctrl, | 2519 | .vidioc_g_ctrl = vidioc_g_ctrl, |
2564 | .vidioc_s_ctrl = vidioc_s_ctrl, | 2520 | .vidioc_s_ctrl = vidioc_s_ctrl, |
2565 | .vidioc_g_frequency = vidioc_g_frequency, | 2521 | .vidioc_g_frequency = vidioc_g_frequency, |
2566 | .vidioc_s_frequency = vidioc_s_frequency, | 2522 | .vidioc_s_frequency = vidioc_s_frequency, |
2523 | .vidioc_g_chip_ident = vidioc_g_chip_ident, | ||
2567 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 2524 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
2568 | .vidioc_g_register = vidioc_g_register, | 2525 | .vidioc_g_register = vidioc_g_register, |
2569 | .vidioc_s_register = vidioc_s_register, | 2526 | .vidioc_s_register = vidioc_s_register, |