Commit e8c26f45 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] au0828: convert to the control framework

Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: default avatarDevin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent a2cf96f9
...@@ -143,6 +143,7 @@ static void au0828_usb_disconnect(struct usb_interface *interface) ...@@ -143,6 +143,7 @@ static void au0828_usb_disconnect(struct usb_interface *interface)
au0828_i2c_unregister(dev); au0828_i2c_unregister(dev);
#ifdef CONFIG_VIDEO_AU0828_V4L2 #ifdef CONFIG_VIDEO_AU0828_V4L2
v4l2_ctrl_handler_free(&dev->v4l2_ctrl_hdl);
v4l2_device_unregister(&dev->v4l2_dev); v4l2_device_unregister(&dev->v4l2_dev);
#endif #endif
...@@ -205,12 +206,22 @@ static int au0828_usb_probe(struct usb_interface *interface, ...@@ -205,12 +206,22 @@ static int au0828_usb_probe(struct usb_interface *interface,
/* Create the v4l2_device */ /* Create the v4l2_device */
retval = v4l2_device_register(&interface->dev, &dev->v4l2_dev); retval = v4l2_device_register(&interface->dev, &dev->v4l2_dev);
if (retval) { if (retval) {
printk(KERN_ERR "%s() v4l2_device_register failed\n", pr_err("%s() v4l2_device_register failed\n",
__func__); __func__);
mutex_unlock(&dev->lock); mutex_unlock(&dev->lock);
kfree(dev); kfree(dev);
return -EIO; return retval;
} }
/* This control handler will inherit the controls from au8522 */
retval = v4l2_ctrl_handler_init(&dev->v4l2_ctrl_hdl, 4);
if (retval) {
pr_err("%s() v4l2_ctrl_handler_init failed\n",
__func__);
mutex_unlock(&dev->lock);
kfree(dev);
return retval;
}
dev->v4l2_dev.ctrl_handler = &dev->v4l2_ctrl_hdl;
#endif #endif
/* Power Up the bridge */ /* Power Up the bridge */
......
...@@ -1226,18 +1226,6 @@ static int au0828_set_format(struct au0828_dev *dev, unsigned int cmd, ...@@ -1226,18 +1226,6 @@ static int au0828_set_format(struct au0828_dev *dev, unsigned int cmd,
} }
static int vidioc_queryctrl(struct file *file, void *priv,
struct v4l2_queryctrl *qc)
{
struct au0828_fh *fh = priv;
struct au0828_dev *dev = fh->dev;
v4l2_device_call_all(&dev->v4l2_dev, 0, core, queryctrl, qc);
if (qc->type)
return 0;
else
return -EINVAL;
}
static int vidioc_querycap(struct file *file, void *priv, static int vidioc_querycap(struct file *file, void *priv,
struct v4l2_capability *cap) struct v4l2_capability *cap)
{ {
...@@ -1495,26 +1483,6 @@ static int vidioc_s_audio(struct file *file, void *priv, const struct v4l2_audio ...@@ -1495,26 +1483,6 @@ static int vidioc_s_audio(struct file *file, void *priv, const struct v4l2_audio
return 0; return 0;
} }
static int vidioc_g_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl)
{
struct au0828_fh *fh = priv;
struct au0828_dev *dev = fh->dev;
v4l2_device_call_all(&dev->v4l2_dev, 0, core, g_ctrl, ctrl);
return 0;
}
static int vidioc_s_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl)
{
struct au0828_fh *fh = priv;
struct au0828_dev *dev = fh->dev;
v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_ctrl, ctrl);
return 0;
}
static int vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t) static int vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t)
{ {
struct au0828_fh *fh = priv; struct au0828_fh *fh = priv;
...@@ -1905,9 +1873,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { ...@@ -1905,9 +1873,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
.vidioc_enum_input = vidioc_enum_input, .vidioc_enum_input = vidioc_enum_input,
.vidioc_g_input = vidioc_g_input, .vidioc_g_input = vidioc_g_input,
.vidioc_s_input = vidioc_s_input, .vidioc_s_input = vidioc_s_input,
.vidioc_queryctrl = vidioc_queryctrl,
.vidioc_g_ctrl = vidioc_g_ctrl,
.vidioc_s_ctrl = vidioc_s_ctrl,
.vidioc_streamon = vidioc_streamon, .vidioc_streamon = vidioc_streamon,
.vidioc_streamoff = vidioc_streamoff, .vidioc_streamoff = vidioc_streamoff,
.vidioc_g_tuner = vidioc_g_tuner, .vidioc_g_tuner = vidioc_g_tuner,
...@@ -2013,13 +1978,13 @@ int au0828_analog_register(struct au0828_dev *dev, ...@@ -2013,13 +1978,13 @@ int au0828_analog_register(struct au0828_dev *dev,
/* Fill the video capture device struct */ /* Fill the video capture device struct */
*dev->vdev = au0828_video_template; *dev->vdev = au0828_video_template;
dev->vdev->parent = &dev->usbdev->dev; dev->vdev->v4l2_dev = &dev->v4l2_dev;
dev->vdev->lock = &dev->lock; dev->vdev->lock = &dev->lock;
strcpy(dev->vdev->name, "au0828a video"); strcpy(dev->vdev->name, "au0828a video");
/* Setup the VBI device */ /* Setup the VBI device */
*dev->vbi_dev = au0828_video_template; *dev->vbi_dev = au0828_video_template;
dev->vbi_dev->parent = &dev->usbdev->dev; dev->vbi_dev->v4l2_dev = &dev->v4l2_dev;
dev->vbi_dev->lock = &dev->lock; dev->vbi_dev->lock = &dev->lock;
strcpy(dev->vbi_dev->name, "au0828a vbi"); strcpy(dev->vbi_dev->name, "au0828a vbi");
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/videodev2.h> #include <linux/videodev2.h>
#include <media/videobuf-vmalloc.h> #include <media/videobuf-vmalloc.h>
#include <media/v4l2-device.h> #include <media/v4l2-device.h>
#include <media/v4l2-ctrls.h>
/* DVB */ /* DVB */
#include "demux.h" #include "demux.h"
...@@ -202,6 +203,7 @@ struct au0828_dev { ...@@ -202,6 +203,7 @@ struct au0828_dev {
#ifdef CONFIG_VIDEO_AU0828_V4L2 #ifdef CONFIG_VIDEO_AU0828_V4L2
/* Analog */ /* Analog */
struct v4l2_device v4l2_dev; struct v4l2_device v4l2_dev;
struct v4l2_ctrl_handler v4l2_ctrl_hdl;
#endif #endif
int users; int users;
unsigned int resources; /* resources in use */ unsigned int resources; /* resources in use */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment