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

[media] davinci/vpfe_capture: convert to the control framework

Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Acked-by: default avatarLad, Prabhakar <prabhakar.lad@ti.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 20a005a6
...@@ -1107,6 +1107,7 @@ static int vpfe_g_input(struct file *file, void *priv, unsigned int *index) ...@@ -1107,6 +1107,7 @@ static int vpfe_g_input(struct file *file, void *priv, unsigned int *index)
static int vpfe_s_input(struct file *file, void *priv, unsigned int index) static int vpfe_s_input(struct file *file, void *priv, unsigned int index)
{ {
struct vpfe_device *vpfe_dev = video_drvdata(file); struct vpfe_device *vpfe_dev = video_drvdata(file);
struct v4l2_subdev *sd;
struct vpfe_subdev_info *sdinfo; struct vpfe_subdev_info *sdinfo;
int subdev_index, inp_index; int subdev_index, inp_index;
struct vpfe_route *route; struct vpfe_route *route;
...@@ -1138,14 +1139,15 @@ static int vpfe_s_input(struct file *file, void *priv, unsigned int index) ...@@ -1138,14 +1139,15 @@ static int vpfe_s_input(struct file *file, void *priv, unsigned int index)
} }
sdinfo = &vpfe_dev->cfg->sub_devs[subdev_index]; sdinfo = &vpfe_dev->cfg->sub_devs[subdev_index];
sd = vpfe_dev->sd[subdev_index];
route = &sdinfo->routes[inp_index]; route = &sdinfo->routes[inp_index];
if (route && sdinfo->can_route) { if (route && sdinfo->can_route) {
input = route->input; input = route->input;
output = route->output; output = route->output;
} }
ret = v4l2_device_call_until_err(&vpfe_dev->v4l2_dev, sdinfo->grp_id, if (sd)
video, s_routing, input, output, 0); ret = v4l2_subdev_call(sd, video, s_routing, input, output, 0);
if (ret) { if (ret) {
v4l2_err(&vpfe_dev->v4l2_dev, v4l2_err(&vpfe_dev->v4l2_dev,
...@@ -1154,6 +1156,8 @@ static int vpfe_s_input(struct file *file, void *priv, unsigned int index) ...@@ -1154,6 +1156,8 @@ static int vpfe_s_input(struct file *file, void *priv, unsigned int index)
goto unlock_out; goto unlock_out;
} }
vpfe_dev->current_subdev = sdinfo; vpfe_dev->current_subdev = sdinfo;
if (sd)
vpfe_dev->v4l2_dev.ctrl_handler = sd->ctrl_handler;
vpfe_dev->current_input = index; vpfe_dev->current_input = index;
vpfe_dev->std_index = 0; vpfe_dev->std_index = 0;
...@@ -1439,41 +1443,6 @@ static int vpfe_dqbuf(struct file *file, void *priv, ...@@ -1439,41 +1443,6 @@ static int vpfe_dqbuf(struct file *file, void *priv,
buf, file->f_flags & O_NONBLOCK); buf, file->f_flags & O_NONBLOCK);
} }
static int vpfe_queryctrl(struct file *file, void *priv,
struct v4l2_queryctrl *qctrl)
{
struct vpfe_device *vpfe_dev = video_drvdata(file);
struct vpfe_subdev_info *sdinfo;
sdinfo = vpfe_dev->current_subdev;
return v4l2_device_call_until_err(&vpfe_dev->v4l2_dev, sdinfo->grp_id,
core, queryctrl, qctrl);
}
static int vpfe_g_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl)
{
struct vpfe_device *vpfe_dev = video_drvdata(file);
struct vpfe_subdev_info *sdinfo;
sdinfo = vpfe_dev->current_subdev;
return v4l2_device_call_until_err(&vpfe_dev->v4l2_dev, sdinfo->grp_id,
core, g_ctrl, ctrl);
}
static int vpfe_s_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl)
{
struct vpfe_device *vpfe_dev = video_drvdata(file);
struct vpfe_subdev_info *sdinfo;
sdinfo = vpfe_dev->current_subdev;
return v4l2_device_call_until_err(&vpfe_dev->v4l2_dev, sdinfo->grp_id,
core, s_ctrl, ctrl);
}
/* /*
* vpfe_calculate_offsets : This function calculates buffers offset * vpfe_calculate_offsets : This function calculates buffers offset
* for top and bottom field * for top and bottom field
...@@ -1781,9 +1750,6 @@ static const struct v4l2_ioctl_ops vpfe_ioctl_ops = { ...@@ -1781,9 +1750,6 @@ static const struct v4l2_ioctl_ops vpfe_ioctl_ops = {
.vidioc_querystd = vpfe_querystd, .vidioc_querystd = vpfe_querystd,
.vidioc_s_std = vpfe_s_std, .vidioc_s_std = vpfe_s_std,
.vidioc_g_std = vpfe_g_std, .vidioc_g_std = vpfe_g_std,
.vidioc_queryctrl = vpfe_queryctrl,
.vidioc_g_ctrl = vpfe_g_ctrl,
.vidioc_s_ctrl = vpfe_s_ctrl,
.vidioc_reqbufs = vpfe_reqbufs, .vidioc_reqbufs = vpfe_reqbufs,
.vidioc_querybuf = vpfe_querybuf, .vidioc_querybuf = vpfe_querybuf,
.vidioc_qbuf = vpfe_qbuf, .vidioc_qbuf = vpfe_qbuf,
...@@ -2007,6 +1973,7 @@ static int vpfe_probe(struct platform_device *pdev) ...@@ -2007,6 +1973,7 @@ static int vpfe_probe(struct platform_device *pdev)
/* set first sub device as current one */ /* set first sub device as current one */
vpfe_dev->current_subdev = &vpfe_cfg->sub_devs[0]; vpfe_dev->current_subdev = &vpfe_cfg->sub_devs[0];
vpfe_dev->v4l2_dev.ctrl_handler = vpfe_dev->sd[0]->ctrl_handler;
/* We have at least one sub device to work with */ /* We have at least one sub device to work with */
mutex_unlock(&ccdc_lock); mutex_unlock(&ccdc_lock);
......
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