aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/usb/au0828
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2013-02-15 06:55:41 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-03-25 14:10:22 -0400
commite8c26f45b1f7e57ecf297903158823ecaa32c513 (patch)
tree11ad059a08756f1d31e125cedcde0f8c4e832fb4 /drivers/media/usb/au0828
parenta2cf96f929d54cb2c8041358053656bf76be2c34 (diff)
[media] au0828: convert to the control framework
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reviewed-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/usb/au0828')
-rw-r--r--drivers/media/usb/au0828/au0828-core.c15
-rw-r--r--drivers/media/usb/au0828/au0828-video.c39
-rw-r--r--drivers/media/usb/au0828/au0828.h2
3 files changed, 17 insertions, 39 deletions
diff --git a/drivers/media/usb/au0828/au0828-core.c b/drivers/media/usb/au0828/au0828-core.c
index 1e6f40ef1c6b..ffd3bcba9c10 100644
--- a/drivers/media/usb/au0828/au0828-core.c
+++ b/drivers/media/usb/au0828/au0828-core.c
@@ -143,6 +143,7 @@ static void au0828_usb_disconnect(struct usb_interface *interface)
143 au0828_i2c_unregister(dev); 143 au0828_i2c_unregister(dev);
144 144
145#ifdef CONFIG_VIDEO_AU0828_V4L2 145#ifdef CONFIG_VIDEO_AU0828_V4L2
146 v4l2_ctrl_handler_free(&dev->v4l2_ctrl_hdl);
146 v4l2_device_unregister(&dev->v4l2_dev); 147 v4l2_device_unregister(&dev->v4l2_dev);
147#endif 148#endif
148 149
@@ -205,12 +206,22 @@ static int au0828_usb_probe(struct usb_interface *interface,
205 /* Create the v4l2_device */ 206 /* Create the v4l2_device */
206 retval = v4l2_device_register(&interface->dev, &dev->v4l2_dev); 207 retval = v4l2_device_register(&interface->dev, &dev->v4l2_dev);
207 if (retval) { 208 if (retval) {
208 printk(KERN_ERR "%s() v4l2_device_register failed\n", 209 pr_err("%s() v4l2_device_register failed\n",
209 __func__); 210 __func__);
210 mutex_unlock(&dev->lock); 211 mutex_unlock(&dev->lock);
211 kfree(dev); 212 kfree(dev);
212 return -EIO; 213 return retval;
213 } 214 }
215 /* This control handler will inherit the controls from au8522 */
216 retval = v4l2_ctrl_handler_init(&dev->v4l2_ctrl_hdl, 4);
217 if (retval) {
218 pr_err("%s() v4l2_ctrl_handler_init failed\n",
219 __func__);
220 mutex_unlock(&dev->lock);
221 kfree(dev);
222 return retval;
223 }
224 dev->v4l2_dev.ctrl_handler = &dev->v4l2_ctrl_hdl;
214#endif 225#endif
215 226
216 /* Power Up the bridge */ 227 /* Power Up the bridge */
diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c
index 28071ff756e2..afb600f9daa6 100644
--- a/drivers/media/usb/au0828/au0828-video.c
+++ b/drivers/media/usb/au0828/au0828-video.c
@@ -1226,18 +1226,6 @@ static int au0828_set_format(struct au0828_dev *dev, unsigned int cmd,
1226} 1226}
1227 1227
1228 1228
1229static int vidioc_queryctrl(struct file *file, void *priv,
1230 struct v4l2_queryctrl *qc)
1231{
1232 struct au0828_fh *fh = priv;
1233 struct au0828_dev *dev = fh->dev;
1234 v4l2_device_call_all(&dev->v4l2_dev, 0, core, queryctrl, qc);
1235 if (qc->type)
1236 return 0;
1237 else
1238 return -EINVAL;
1239}
1240
1241static int vidioc_querycap(struct file *file, void *priv, 1229static int vidioc_querycap(struct file *file, void *priv,
1242 struct v4l2_capability *cap) 1230 struct v4l2_capability *cap)
1243{ 1231{
@@ -1495,26 +1483,6 @@ static int vidioc_s_audio(struct file *file, void *priv, const struct v4l2_audio
1495 return 0; 1483 return 0;
1496} 1484}
1497 1485
1498static int vidioc_g_ctrl(struct file *file, void *priv,
1499 struct v4l2_control *ctrl)
1500{
1501 struct au0828_fh *fh = priv;
1502 struct au0828_dev *dev = fh->dev;
1503
1504 v4l2_device_call_all(&dev->v4l2_dev, 0, core, g_ctrl, ctrl);
1505 return 0;
1506
1507}
1508
1509static int vidioc_s_ctrl(struct file *file, void *priv,
1510 struct v4l2_control *ctrl)
1511{
1512 struct au0828_fh *fh = priv;
1513 struct au0828_dev *dev = fh->dev;
1514 v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_ctrl, ctrl);
1515 return 0;
1516}
1517
1518static int vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t) 1486static int vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t)
1519{ 1487{
1520 struct au0828_fh *fh = priv; 1488 struct au0828_fh *fh = priv;
@@ -1905,9 +1873,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
1905 .vidioc_enum_input = vidioc_enum_input, 1873 .vidioc_enum_input = vidioc_enum_input,
1906 .vidioc_g_input = vidioc_g_input, 1874 .vidioc_g_input = vidioc_g_input,
1907 .vidioc_s_input = vidioc_s_input, 1875 .vidioc_s_input = vidioc_s_input,
1908 .vidioc_queryctrl = vidioc_queryctrl,
1909 .vidioc_g_ctrl = vidioc_g_ctrl,
1910 .vidioc_s_ctrl = vidioc_s_ctrl,
1911 .vidioc_streamon = vidioc_streamon, 1876 .vidioc_streamon = vidioc_streamon,
1912 .vidioc_streamoff = vidioc_streamoff, 1877 .vidioc_streamoff = vidioc_streamoff,
1913 .vidioc_g_tuner = vidioc_g_tuner, 1878 .vidioc_g_tuner = vidioc_g_tuner,
@@ -2013,13 +1978,13 @@ int au0828_analog_register(struct au0828_dev *dev,
2013 1978
2014 /* Fill the video capture device struct */ 1979 /* Fill the video capture device struct */
2015 *dev->vdev = au0828_video_template; 1980 *dev->vdev = au0828_video_template;
2016 dev->vdev->parent = &dev->usbdev->dev; 1981 dev->vdev->v4l2_dev = &dev->v4l2_dev;
2017 dev->vdev->lock = &dev->lock; 1982 dev->vdev->lock = &dev->lock;
2018 strcpy(dev->vdev->name, "au0828a video"); 1983 strcpy(dev->vdev->name, "au0828a video");
2019 1984
2020 /* Setup the VBI device */ 1985 /* Setup the VBI device */
2021 *dev->vbi_dev = au0828_video_template; 1986 *dev->vbi_dev = au0828_video_template;
2022 dev->vbi_dev->parent = &dev->usbdev->dev; 1987 dev->vbi_dev->v4l2_dev = &dev->v4l2_dev;
2023 dev->vbi_dev->lock = &dev->lock; 1988 dev->vbi_dev->lock = &dev->lock;
2024 strcpy(dev->vbi_dev->name, "au0828a vbi"); 1989 strcpy(dev->vbi_dev->name, "au0828a vbi");
2025 1990
diff --git a/drivers/media/usb/au0828/au0828.h b/drivers/media/usb/au0828/au0828.h
index e579ff69ca4a..803af10f5130 100644
--- a/drivers/media/usb/au0828/au0828.h
+++ b/drivers/media/usb/au0828/au0828.h
@@ -28,6 +28,7 @@
28#include <linux/videodev2.h> 28#include <linux/videodev2.h>
29#include <media/videobuf-vmalloc.h> 29#include <media/videobuf-vmalloc.h>
30#include <media/v4l2-device.h> 30#include <media/v4l2-device.h>
31#include <media/v4l2-ctrls.h>
31 32
32/* DVB */ 33/* DVB */
33#include "demux.h" 34#include "demux.h"
@@ -202,6 +203,7 @@ struct au0828_dev {
202#ifdef CONFIG_VIDEO_AU0828_V4L2 203#ifdef CONFIG_VIDEO_AU0828_V4L2
203 /* Analog */ 204 /* Analog */
204 struct v4l2_device v4l2_dev; 205 struct v4l2_device v4l2_dev;
206 struct v4l2_ctrl_handler v4l2_ctrl_hdl;
205#endif 207#endif
206 int users; 208 int users;
207 unsigned int resources; /* resources in use */ 209 unsigned int resources; /* resources in use */