From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>
Cc: linux-media@vger.kernel.org, ulrich.hecht@gmail.com,
hverkuil@xs4all.nl, linux-renesas-soc@vger.kernel.org,
"Ulrich Hecht" <ulrich.hecht+renesas@gmail.com>,
"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Subject: Re: [PATCH 3/8] media: rcar-vin: add DV timings support
Date: Thu, 16 Jun 2016 18:05:14 +0300 [thread overview]
Message-ID: <1536149.DWb34yPSHI@avalon> (raw)
In-Reply-To: <1464203409-1279-4-git-send-email-niklas.soderlund@ragnatech.se>
Hello Niklas,
Thank you for the patch.
On Wednesday 25 May 2016 21:10:04 Niklas S�derlund wrote:
> From: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
>
> Adds ioctls DV_TIMINGS_CAP, ENUM_DV_TIMINGS, G_DV_TIMINGS, S_DV_TIMINGS,
> and QUERY_DV_TIMINGS.
>
> Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
> Signed-off-by: Niklas S�derlund <niklas.soderlund+renesas@ragnatech.se>
> ---
> drivers/media/platform/rcar-vin/rcar-v4l2.c | 82 ++++++++++++++++++++++++++
> 1 file changed, 82 insertions(+)
>
> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 3788f8a..10a5c10 100644
> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> @@ -400,6 +400,10 @@ static int rvin_enum_input(struct file *file, void
> *priv,
>
> i->type = V4L2_INPUT_TYPE_CAMERA;
> i->std = vin->vdev.tvnorms;
> +
> + if (v4l2_subdev_has_op(sd, pad, dv_timings_cap))
> + i->capabilities = V4L2_IN_CAP_DV_TIMINGS;
> +
> strlcpy(i->name, "Camera", sizeof(i->name));
>
> return 0;
> @@ -478,6 +482,78 @@ static int rvin_subscribe_event(struct v4l2_fh *fh,
> return v4l2_ctrl_subscribe_event(fh, sub);
> }
>
> +static int rvin_enum_dv_timings(struct file *file, void *priv_fh,
> + struct v4l2_enum_dv_timings *timings)
> +{
> + struct rvin_dev *vin = video_drvdata(file);
> + struct v4l2_subdev *sd = vin_to_source(vin);
> + int pad, ret;
pad can't be negative, you can make it an unsigned int.
unsigned int pad = timings->pad;
int ret;
timings->pad = vin->src_pad_idx;
> +
> + pad = timings->pad;
> + timings->pad = vin->src_pad_idx;
> +
> + ret = v4l2_subdev_call(sd, pad, enum_dv_timings, timings);
> +
> + timings->pad = pad;
> +
> + return ret;
> +}
> +
> +static int rvin_s_dv_timings(struct file *file, void *priv_fh,
> + struct v4l2_dv_timings *timings)
> +{
> + struct rvin_dev *vin = video_drvdata(file);
> + struct v4l2_subdev *sd = vin_to_source(vin);
> + int err;
The driver uses ret instead of err, let's keep it that way.
> +
> + err = v4l2_subdev_call(sd,
> + video, s_dv_timings, timings);
No need for a line break.
> + if (!err) {
I'd write this
if (ret)
return ret;
(with a return 0; at the end of the function) to lower the indentation level
of the code below.
> + vin->source.width = timings->bt.width;
> + vin->source.height = timings->bt.height;
> + vin->format.width = timings->bt.width;
> + vin->format.height = timings->bt.height;
> + }
> + return err;
> +}
> +
> +static int rvin_g_dv_timings(struct file *file, void *priv_fh,
> + struct v4l2_dv_timings *timings)
> +{
> + struct rvin_dev *vin = video_drvdata(file);
> + struct v4l2_subdev *sd = vin_to_source(vin);
> +
> + return v4l2_subdev_call(sd,
> + video, g_dv_timings, timings);
No need for a line break.
> +}
> +
> +static int rvin_query_dv_timings(struct file *file, void *priv_fh,
> + struct v4l2_dv_timings *timings)
> +{
> + struct rvin_dev *vin = video_drvdata(file);
> + struct v4l2_subdev *sd = vin_to_source(vin);
> +
> + return v4l2_subdev_call(sd,
> + video, query_dv_timings, timings);
No need for a line break.
> +}
> +
> +static int rvin_dv_timings_cap(struct file *file, void *priv_fh,
> + struct v4l2_dv_timings_cap *cap)
> +{
> + struct rvin_dev *vin = video_drvdata(file);
> + struct v4l2_subdev *sd = vin_to_source(vin);
> + int pad, ret;
Same comment as above about pad not being negative.
> +
> + pad = cap->pad;
> + cap->pad = vin->src_pad_idx;
> +
> + ret = v4l2_subdev_call(sd, pad, dv_timings_cap, cap);
> +
> + cap->pad = pad;
> +
> + return ret;
> +}
> +
> static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
> .vidioc_querycap = rvin_querycap,
> .vidioc_try_fmt_vid_cap = rvin_try_fmt_vid_cap,
> @@ -494,6 +570,12 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
> .vidioc_g_input = rvin_g_input,
> .vidioc_s_input = rvin_s_input,
>
> + .vidioc_dv_timings_cap = rvin_dv_timings_cap,
> + .vidioc_enum_dv_timings = rvin_enum_dv_timings,
> + .vidioc_g_dv_timings = rvin_g_dv_timings,
> + .vidioc_s_dv_timings = rvin_s_dv_timings,
> + .vidioc_query_dv_timings = rvin_query_dv_timings,
> +
> .vidioc_querystd = rvin_querystd,
> .vidioc_g_std = rvin_g_std,
> .vidioc_s_std = rvin_s_std,
--
Regards,
Laurent Pinchart
WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>
Cc: linux-media@vger.kernel.org, ulrich.hecht@gmail.com,
hverkuil@xs4all.nl, linux-renesas-soc@vger.kernel.org,
"Ulrich Hecht" <ulrich.hecht+renesas@gmail.com>,
"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Subject: Re: [PATCH 3/8] media: rcar-vin: add DV timings support
Date: Thu, 16 Jun 2016 18:05:14 +0300 [thread overview]
Message-ID: <1536149.DWb34yPSHI@avalon> (raw)
In-Reply-To: <1464203409-1279-4-git-send-email-niklas.soderlund@ragnatech.se>
Hello Niklas,
Thank you for the patch.
On Wednesday 25 May 2016 21:10:04 Niklas Söderlund wrote:
> From: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
>
> Adds ioctls DV_TIMINGS_CAP, ENUM_DV_TIMINGS, G_DV_TIMINGS, S_DV_TIMINGS,
> and QUERY_DV_TIMINGS.
>
> Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> ---
> drivers/media/platform/rcar-vin/rcar-v4l2.c | 82 ++++++++++++++++++++++++++
> 1 file changed, 82 insertions(+)
>
> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 3788f8a..10a5c10 100644
> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> @@ -400,6 +400,10 @@ static int rvin_enum_input(struct file *file, void
> *priv,
>
> i->type = V4L2_INPUT_TYPE_CAMERA;
> i->std = vin->vdev.tvnorms;
> +
> + if (v4l2_subdev_has_op(sd, pad, dv_timings_cap))
> + i->capabilities = V4L2_IN_CAP_DV_TIMINGS;
> +
> strlcpy(i->name, "Camera", sizeof(i->name));
>
> return 0;
> @@ -478,6 +482,78 @@ static int rvin_subscribe_event(struct v4l2_fh *fh,
> return v4l2_ctrl_subscribe_event(fh, sub);
> }
>
> +static int rvin_enum_dv_timings(struct file *file, void *priv_fh,
> + struct v4l2_enum_dv_timings *timings)
> +{
> + struct rvin_dev *vin = video_drvdata(file);
> + struct v4l2_subdev *sd = vin_to_source(vin);
> + int pad, ret;
pad can't be negative, you can make it an unsigned int.
unsigned int pad = timings->pad;
int ret;
timings->pad = vin->src_pad_idx;
> +
> + pad = timings->pad;
> + timings->pad = vin->src_pad_idx;
> +
> + ret = v4l2_subdev_call(sd, pad, enum_dv_timings, timings);
> +
> + timings->pad = pad;
> +
> + return ret;
> +}
> +
> +static int rvin_s_dv_timings(struct file *file, void *priv_fh,
> + struct v4l2_dv_timings *timings)
> +{
> + struct rvin_dev *vin = video_drvdata(file);
> + struct v4l2_subdev *sd = vin_to_source(vin);
> + int err;
The driver uses ret instead of err, let's keep it that way.
> +
> + err = v4l2_subdev_call(sd,
> + video, s_dv_timings, timings);
No need for a line break.
> + if (!err) {
I'd write this
if (ret)
return ret;
(with a return 0; at the end of the function) to lower the indentation level
of the code below.
> + vin->source.width = timings->bt.width;
> + vin->source.height = timings->bt.height;
> + vin->format.width = timings->bt.width;
> + vin->format.height = timings->bt.height;
> + }
> + return err;
> +}
> +
> +static int rvin_g_dv_timings(struct file *file, void *priv_fh,
> + struct v4l2_dv_timings *timings)
> +{
> + struct rvin_dev *vin = video_drvdata(file);
> + struct v4l2_subdev *sd = vin_to_source(vin);
> +
> + return v4l2_subdev_call(sd,
> + video, g_dv_timings, timings);
No need for a line break.
> +}
> +
> +static int rvin_query_dv_timings(struct file *file, void *priv_fh,
> + struct v4l2_dv_timings *timings)
> +{
> + struct rvin_dev *vin = video_drvdata(file);
> + struct v4l2_subdev *sd = vin_to_source(vin);
> +
> + return v4l2_subdev_call(sd,
> + video, query_dv_timings, timings);
No need for a line break.
> +}
> +
> +static int rvin_dv_timings_cap(struct file *file, void *priv_fh,
> + struct v4l2_dv_timings_cap *cap)
> +{
> + struct rvin_dev *vin = video_drvdata(file);
> + struct v4l2_subdev *sd = vin_to_source(vin);
> + int pad, ret;
Same comment as above about pad not being negative.
> +
> + pad = cap->pad;
> + cap->pad = vin->src_pad_idx;
> +
> + ret = v4l2_subdev_call(sd, pad, dv_timings_cap, cap);
> +
> + cap->pad = pad;
> +
> + return ret;
> +}
> +
> static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
> .vidioc_querycap = rvin_querycap,
> .vidioc_try_fmt_vid_cap = rvin_try_fmt_vid_cap,
> @@ -494,6 +570,12 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
> .vidioc_g_input = rvin_g_input,
> .vidioc_s_input = rvin_s_input,
>
> + .vidioc_dv_timings_cap = rvin_dv_timings_cap,
> + .vidioc_enum_dv_timings = rvin_enum_dv_timings,
> + .vidioc_g_dv_timings = rvin_g_dv_timings,
> + .vidioc_s_dv_timings = rvin_s_dv_timings,
> + .vidioc_query_dv_timings = rvin_query_dv_timings,
> +
> .vidioc_querystd = rvin_querystd,
> .vidioc_g_std = rvin_g_std,
> .vidioc_s_std = rvin_s_std,
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2016-06-16 15:05 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-25 19:10 [PATCH 0/8] rcar-vin: Enable Gen3 support Niklas Söderlund
2016-05-25 19:10 ` [PATCH 1/8] media: rcar-vin: pad-aware driver initialisation Niklas Söderlund
2016-06-16 14:56 ` Laurent Pinchart
2016-06-16 14:56 ` Laurent Pinchart
2016-05-25 19:10 ` [PATCH 2/8] media: rcar_vin: Use correct pad number in try_fmt Niklas Söderlund
2016-06-16 14:56 ` Laurent Pinchart
2016-06-16 14:56 ` Laurent Pinchart
2016-05-25 19:10 ` [PATCH 3/8] media: rcar-vin: add DV timings support Niklas Söderlund
2016-06-16 15:05 ` Laurent Pinchart [this message]
2016-06-16 15:05 ` Laurent Pinchart
2016-05-25 19:10 ` [PATCH 4/8] [media] rcar-vin: allow subdevices to be bound late Niklas Söderlund
2016-05-25 19:10 ` [PATCH 5/8] [media] rcar-vin: add Gen3 HW registers Niklas Söderlund
2016-06-16 16:52 ` Laurent Pinchart
2016-06-16 16:52 ` Laurent Pinchart
2016-05-25 19:10 ` [PATCH 6/8] [media] rcar-vin: add shared subdevice groups Niklas Söderlund
2016-05-25 19:10 ` [PATCH 7/8] [media] rcar-vin: enable Gen3 Niklas Söderlund
2016-06-16 16:55 ` Laurent Pinchart
2016-06-16 16:55 ` Laurent Pinchart
2016-05-25 19:10 ` [PATCH 8/8] [media] rcar-vin: add Gen2 and Gen3 fallback compatibility strings Niklas Söderlund
2016-05-25 19:36 ` Sergei Shtylyov
2016-05-27 11:36 ` Niklas Söderlund
2016-05-27 11:36 ` Niklas Söderlund
2016-05-27 18:18 ` Sergei Shtylyov
2016-05-27 18:18 ` Sergei Shtylyov
2016-06-16 16:55 ` Laurent Pinchart
2016-06-16 16:55 ` Laurent Pinchart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1536149.DWb34yPSHI@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=hverkuil@xs4all.nl \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=niklas.soderlund+renesas@ragnatech.se \
--cc=niklas.soderlund@ragnatech.se \
--cc=ulrich.hecht+renesas@gmail.com \
--cc=ulrich.hecht@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.