diff mbox

[REVIEW,07/11] davinci/vpfe_capture: convert to the control framework.

Message ID 28ffb525c2da963653402db5550c89f1878050e5.1362387265.git.hans.verkuil@cisco.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Hans Verkuil March 4, 2013, 9:05 a.m. UTC
From: Hans Verkuil <hans.verkuil@cisco.com>

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 drivers/media/platform/davinci/vpfe_capture.c |   47 ++++---------------------
 1 file changed, 7 insertions(+), 40 deletions(-)

Comments

Prabhakar March 4, 2013, 9:22 a.m. UTC | #1
Hi Hans,

On Mon, Mar 4, 2013 at 2:35 PM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
> From: Hans Verkuil <hans.verkuil@cisco.com>
>
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>

Acked-by: Lad, Prabhakar <prabhakar.lad@ti.com>

Regards,
--Prabhakar Lad

> ---
>  drivers/media/platform/davinci/vpfe_capture.c |   47 ++++---------------------
>  1 file changed, 7 insertions(+), 40 deletions(-)
>
> diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c
> index 28d019d..70facc0 100644
> --- a/drivers/media/platform/davinci/vpfe_capture.c
> +++ b/drivers/media/platform/davinci/vpfe_capture.c
> @@ -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)
>  {
>         struct vpfe_device *vpfe_dev = video_drvdata(file);
> +       struct v4l2_subdev *sd;
>         struct vpfe_subdev_info *sdinfo;
>         int subdev_index, inp_index;
>         struct vpfe_route *route;
> @@ -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];
> +       sd = vpfe_dev->sd[subdev_index];
>         route = &sdinfo->routes[inp_index];
>         if (route && sdinfo->can_route) {
>                 input = route->input;
>                 output = route->output;
>         }
>
> -       ret = v4l2_device_call_until_err(&vpfe_dev->v4l2_dev, sdinfo->grp_id,
> -                                        video, s_routing, input, output, 0);
> +       if (sd)
> +               ret = v4l2_subdev_call(sd, video, s_routing, input, output, 0);
>
>         if (ret) {
>                 v4l2_err(&vpfe_dev->v4l2_dev,
> @@ -1154,6 +1156,8 @@ static int vpfe_s_input(struct file *file, void *priv, unsigned int index)
>                 goto unlock_out;
>         }
>         vpfe_dev->current_subdev = sdinfo;
> +       if (sd)
> +               vpfe_dev->v4l2_dev.ctrl_handler = sd->ctrl_handler;
>         vpfe_dev->current_input = index;
>         vpfe_dev->std_index = 0;
>
> @@ -1439,41 +1443,6 @@ static int vpfe_dqbuf(struct file *file, void *priv,
>                                       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
>   * for top and bottom field
> @@ -1781,9 +1750,6 @@ static const struct v4l2_ioctl_ops vpfe_ioctl_ops = {
>         .vidioc_querystd         = vpfe_querystd,
>         .vidioc_s_std            = vpfe_s_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_querybuf         = vpfe_querybuf,
>         .vidioc_qbuf             = vpfe_qbuf,
> @@ -2007,6 +1973,7 @@ static int vpfe_probe(struct platform_device *pdev)
>
>         /* set first sub device as current one */
>         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 */
>         mutex_unlock(&ccdc_lock);
> --
> 1.7.10.4
>
diff mbox

Patch

diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c
index 28d019d..70facc0 100644
--- a/drivers/media/platform/davinci/vpfe_capture.c
+++ b/drivers/media/platform/davinci/vpfe_capture.c
@@ -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)
 {
 	struct vpfe_device *vpfe_dev = video_drvdata(file);
+	struct v4l2_subdev *sd;
 	struct vpfe_subdev_info *sdinfo;
 	int subdev_index, inp_index;
 	struct vpfe_route *route;
@@ -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];
+	sd = vpfe_dev->sd[subdev_index];
 	route = &sdinfo->routes[inp_index];
 	if (route && sdinfo->can_route) {
 		input = route->input;
 		output = route->output;
 	}
 
-	ret = v4l2_device_call_until_err(&vpfe_dev->v4l2_dev, sdinfo->grp_id,
-					 video, s_routing, input, output, 0);
+	if (sd)
+		ret = v4l2_subdev_call(sd, video, s_routing, input, output, 0);
 
 	if (ret) {
 		v4l2_err(&vpfe_dev->v4l2_dev,
@@ -1154,6 +1156,8 @@  static int vpfe_s_input(struct file *file, void *priv, unsigned int index)
 		goto unlock_out;
 	}
 	vpfe_dev->current_subdev = sdinfo;
+	if (sd)
+		vpfe_dev->v4l2_dev.ctrl_handler = sd->ctrl_handler;
 	vpfe_dev->current_input = index;
 	vpfe_dev->std_index = 0;
 
@@ -1439,41 +1443,6 @@  static int vpfe_dqbuf(struct file *file, void *priv,
 				      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
  * for top and bottom field
@@ -1781,9 +1750,6 @@  static const struct v4l2_ioctl_ops vpfe_ioctl_ops = {
 	.vidioc_querystd	 = vpfe_querystd,
 	.vidioc_s_std		 = vpfe_s_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_querybuf	 = vpfe_querybuf,
 	.vidioc_qbuf		 = vpfe_qbuf,
@@ -2007,6 +1973,7 @@  static int vpfe_probe(struct platform_device *pdev)
 
 	/* set first sub device as current one */
 	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 */
 	mutex_unlock(&ccdc_lock);