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

[media] cx23885: convert to the control framework

This is part 1, converting the uncompressed video/vbi nodes to use
the control framework.

The next patch converts the compressed video node as well.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 24a8f7b5
...@@ -1313,22 +1313,6 @@ static int vidioc_s_frequency(struct file *file, void *priv, ...@@ -1313,22 +1313,6 @@ static int vidioc_s_frequency(struct file *file, void *priv,
return cx23885_set_frequency(file, priv, f); return cx23885_set_frequency(file, priv, f);
} }
static int vidioc_g_ctrl(struct file *file, void *priv,
struct v4l2_control *ctl)
{
struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev;
return cx23885_get_control(dev, ctl);
}
static int vidioc_s_ctrl(struct file *file, void *priv,
struct v4l2_control *ctl)
{
struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev;
return cx23885_set_control(dev, ctl);
}
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)
{ {
...@@ -1672,8 +1656,6 @@ static const struct v4l2_ioctl_ops mpeg_ioctl_ops = { ...@@ -1672,8 +1656,6 @@ static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
.vidioc_s_tuner = vidioc_s_tuner, .vidioc_s_tuner = vidioc_s_tuner,
.vidioc_g_frequency = vidioc_g_frequency, .vidioc_g_frequency = vidioc_g_frequency,
.vidioc_s_frequency = vidioc_s_frequency, .vidioc_s_frequency = vidioc_s_frequency,
.vidioc_s_ctrl = vidioc_s_ctrl,
.vidioc_g_ctrl = vidioc_g_ctrl,
.vidioc_querycap = vidioc_querycap, .vidioc_querycap = vidioc_querycap,
.vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
.vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap,
...@@ -1689,8 +1671,6 @@ static const struct v4l2_ioctl_ops mpeg_ioctl_ops = { ...@@ -1689,8 +1671,6 @@ static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
.vidioc_s_ext_ctrls = vidioc_s_ext_ctrls, .vidioc_s_ext_ctrls = vidioc_s_ext_ctrls,
.vidioc_try_ext_ctrls = vidioc_try_ext_ctrls, .vidioc_try_ext_ctrls = vidioc_try_ext_ctrls,
.vidioc_log_status = vidioc_log_status, .vidioc_log_status = vidioc_log_status,
.vidioc_querymenu = vidioc_querymenu,
.vidioc_queryctrl = vidioc_queryctrl,
#ifdef CONFIG_VIDEO_ADV_DEBUG #ifdef CONFIG_VIDEO_ADV_DEBUG
.vidioc_g_chip_info = cx23885_g_chip_info, .vidioc_g_chip_info = cx23885_g_chip_info,
.vidioc_g_register = cx23885_g_register, .vidioc_g_register = cx23885_g_register,
......
...@@ -2087,6 +2087,7 @@ static int cx23885_initdev(struct pci_dev *pci_dev, ...@@ -2087,6 +2087,7 @@ static int cx23885_initdev(struct pci_dev *pci_dev,
const struct pci_device_id *pci_id) const struct pci_device_id *pci_id)
{ {
struct cx23885_dev *dev; struct cx23885_dev *dev;
struct v4l2_ctrl_handler *hdl;
int err; int err;
dev = kzalloc(sizeof(*dev), GFP_KERNEL); dev = kzalloc(sizeof(*dev), GFP_KERNEL);
...@@ -2097,6 +2098,14 @@ static int cx23885_initdev(struct pci_dev *pci_dev, ...@@ -2097,6 +2098,14 @@ static int cx23885_initdev(struct pci_dev *pci_dev,
if (err < 0) if (err < 0)
goto fail_free; goto fail_free;
hdl = &dev->ctrl_handler;
v4l2_ctrl_handler_init(hdl, 6);
if (hdl->error) {
err = hdl->error;
goto fail_ctrl;
}
dev->v4l2_dev.ctrl_handler = hdl;
/* Prepare to handle notifications from subdevices */ /* Prepare to handle notifications from subdevices */
cx23885_v4l2_dev_notify_init(dev); cx23885_v4l2_dev_notify_init(dev);
...@@ -2104,12 +2113,12 @@ static int cx23885_initdev(struct pci_dev *pci_dev, ...@@ -2104,12 +2113,12 @@ static int cx23885_initdev(struct pci_dev *pci_dev,
dev->pci = pci_dev; dev->pci = pci_dev;
if (pci_enable_device(pci_dev)) { if (pci_enable_device(pci_dev)) {
err = -EIO; err = -EIO;
goto fail_unreg; goto fail_ctrl;
} }
if (cx23885_dev_setup(dev) < 0) { if (cx23885_dev_setup(dev) < 0) {
err = -EINVAL; err = -EINVAL;
goto fail_unreg; goto fail_ctrl;
} }
/* print pci info */ /* print pci info */
...@@ -2157,7 +2166,8 @@ static int cx23885_initdev(struct pci_dev *pci_dev, ...@@ -2157,7 +2166,8 @@ static int cx23885_initdev(struct pci_dev *pci_dev,
fail_irq: fail_irq:
cx23885_dev_unregister(dev); cx23885_dev_unregister(dev);
fail_unreg: fail_ctrl:
v4l2_ctrl_handler_free(hdl);
v4l2_device_unregister(&dev->v4l2_dev); v4l2_device_unregister(&dev->v4l2_dev);
fail_free: fail_free:
kfree(dev); kfree(dev);
...@@ -2180,6 +2190,7 @@ static void cx23885_finidev(struct pci_dev *pci_dev) ...@@ -2180,6 +2190,7 @@ static void cx23885_finidev(struct pci_dev *pci_dev)
free_irq(pci_dev->irq, dev); free_irq(pci_dev->irq, dev);
cx23885_dev_unregister(dev); cx23885_dev_unregister(dev);
v4l2_ctrl_handler_free(&dev->ctrl_handler);
v4l2_device_unregister(v4l2_dev); v4l2_device_unregister(v4l2_dev);
kfree(dev); kfree(dev);
} }
......
This diff is collapsed.
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <media/v4l2-device.h> #include <media/v4l2-device.h>
#include <media/v4l2-fh.h> #include <media/v4l2-fh.h>
#include <media/v4l2-ctrls.h>
#include <media/tuner.h> #include <media/tuner.h>
#include <media/tveeprom.h> #include <media/tveeprom.h>
#include <media/videobuf-dma-sg.h> #include <media/videobuf-dma-sg.h>
...@@ -132,14 +133,6 @@ struct cx23885_fmt { ...@@ -132,14 +133,6 @@ struct cx23885_fmt {
u32 cxformat; u32 cxformat;
}; };
struct cx23885_ctrl {
struct v4l2_queryctrl v;
u32 off;
u32 reg;
u32 mask;
u32 shift;
};
struct cx23885_tvnorm { struct cx23885_tvnorm {
char *name; char *name;
v4l2_std_id id; v4l2_std_id id;
...@@ -370,6 +363,7 @@ struct cx23885_audio_dev { ...@@ -370,6 +363,7 @@ struct cx23885_audio_dev {
struct cx23885_dev { struct cx23885_dev {
atomic_t refcount; atomic_t refcount;
struct v4l2_device v4l2_dev; struct v4l2_device v4l2_dev;
struct v4l2_ctrl_handler ctrl_handler;
/* pci stuff */ /* pci stuff */
struct pci_dev *pci; struct pci_dev *pci;
...@@ -597,8 +591,6 @@ int cx23885_enum_input(struct cx23885_dev *dev, struct v4l2_input *i); ...@@ -597,8 +591,6 @@ int cx23885_enum_input(struct cx23885_dev *dev, struct v4l2_input *i);
int cx23885_set_input(struct file *file, void *priv, unsigned int i); int cx23885_set_input(struct file *file, void *priv, unsigned int i);
int cx23885_get_input(struct file *file, void *priv, unsigned int *i); int cx23885_get_input(struct file *file, void *priv, unsigned int *i);
int cx23885_set_frequency(struct file *file, void *priv, const struct v4l2_frequency *f); int cx23885_set_frequency(struct file *file, void *priv, const struct v4l2_frequency *f);
int cx23885_set_control(struct cx23885_dev *dev, struct v4l2_control *ctl);
int cx23885_get_control(struct cx23885_dev *dev, struct v4l2_control *ctl);
int cx23885_set_tvnorm(struct cx23885_dev *dev, v4l2_std_id norm); int cx23885_set_tvnorm(struct cx23885_dev *dev, v4l2_std_id norm);
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
......
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