linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: jacopo mondi <jacopo@jmondi.org>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Jacopo Mondi <jacopo+renesas@jmondi.org>,
	laurent.pinchart@ideasonboard.com, magnus.damm@gmail.com,
	geert@glider.be, mchehab@kernel.org, festevam@gmail.com,
	sakari.ailus@iki.fi, robh+dt@kernel.org, mark.rutland@arm.com,
	pombredanne@nexb.com, linux-renesas-soc@vger.kernel.org,
	linux-media@vger.kernel.org, linux-sh@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v9 07/11] media: i2c: ov772x: Support frame interval handling
Date: Wed, 21 Feb 2018 16:16:44 +0100	[thread overview]
Message-ID: <20180221151644.GI7203@w540> (raw)
In-Reply-To: <f154f229-6977-4d3e-38b9-6d1669adbf91@xs4all.nl>

Hi Hans,

On Wed, Feb 21, 2018 at 01:12:14PM +0100, Hans Verkuil wrote:

[snip]

> > +static int ov772x_g_frame_interval(struct v4l2_subdev *sd,
> > +				   struct v4l2_subdev_frame_interval *ival)
> > +{
> > +	struct ov772x_priv *priv = to_ov772x(sd);
> > +	struct v4l2_fract *tpf = &ival->interval;
> > +
> > +	memset(ival->reserved, 0, sizeof(ival->reserved));
>
> This memset...
>
> > +	tpf->numerator = 1;
> > +	tpf->denominator = priv->fps;
> > +
> > +	return 0;
> > +}
> > +
> > +static int ov772x_s_frame_interval(struct v4l2_subdev *sd,
> > +				   struct v4l2_subdev_frame_interval *ival)
> > +{
> > +	struct ov772x_priv *priv = to_ov772x(sd);
> > +	struct v4l2_fract *tpf = &ival->interval;
> > +
> > +	memset(ival->reserved, 0, sizeof(ival->reserved));
>
> ... and this memset can be dropped. The core code will memset this for you.
>
>

I see! Ok, I'll drop them in v10

> > +
> > +	return ov772x_set_frame_rate(priv, tpf, priv->cfmt, priv->win);
> > +}
> > +
> >  static int ov772x_s_ctrl(struct v4l2_ctrl *ctrl)
> >  {
> >  	struct ov772x_priv *priv = container_of(ctrl->handler,
> > @@ -757,6 +905,7 @@ static int ov772x_set_params(struct ov772x_priv *priv,
> >  			     const struct ov772x_win_size *win)
> >  {
> >  	struct i2c_client *client = v4l2_get_subdevdata(&priv->subdev);
> > +	struct v4l2_fract tpf;
> >  	int ret;
> >  	u8  val;
> >
> > @@ -885,6 +1034,13 @@ static int ov772x_set_params(struct ov772x_priv *priv,
> >  	if (ret < 0)
> >  		goto ov772x_set_fmt_error;
> >
> > +	/* COM4, CLKRC: Set pixel clock and framerate. */
> > +	tpf.numerator = 1;
> > +	tpf.denominator = priv->fps;
> > +	ret = ov772x_set_frame_rate(priv, &tpf, cfmt, win);
> > +	if (ret < 0)
> > +		goto ov772x_set_fmt_error;
> > +
> >  	/*
> >  	 * set COM8
> >  	 */
> > @@ -1043,6 +1199,24 @@ static const struct v4l2_subdev_core_ops ov772x_subdev_core_ops = {
> >  	.s_power	= ov772x_s_power,
> >  };
> >
> > +static int ov772x_enum_frame_interval(struct v4l2_subdev *sd,
> > +				      struct v4l2_subdev_pad_config *cfg,
> > +				      struct v4l2_subdev_frame_interval_enum *fie)
> > +{
> > +	if (fie->pad || fie->index >= OV772X_N_FRAME_INTERVALS)
> > +		return -EINVAL;
> > +
> > +	if (fie->width != VGA_WIDTH && fie->width != QVGA_WIDTH)
> > +		return -EINVAL;
> > +	if (fie->height != VGA_HEIGHT && fie->height != QVGA_HEIGHT)
> > +		return -EINVAL;
> > +
> > +	fie->interval.numerator = 1;
> > +	fie->interval.denominator = ov772x_frame_intervals[fie->index];
> > +
> > +	return 0;
> > +}
> > +
> >  static int ov772x_enum_mbus_code(struct v4l2_subdev *sd,
> >  		struct v4l2_subdev_pad_config *cfg,
> >  		struct v4l2_subdev_mbus_code_enum *code)
> > @@ -1055,14 +1229,17 @@ static int ov772x_enum_mbus_code(struct v4l2_subdev *sd,
> >  }
> >
> >  static const struct v4l2_subdev_video_ops ov772x_subdev_video_ops = {
> > -	.s_stream	= ov772x_s_stream,
> > +	.s_stream		= ov772x_s_stream,
> > +	.s_frame_interval	= ov772x_s_frame_interval,
> > +	.g_frame_interval	= ov772x_g_frame_interval,
> >  };
> >
> >  static const struct v4l2_subdev_pad_ops ov772x_subdev_pad_ops = {
> > -	.enum_mbus_code = ov772x_enum_mbus_code,
> > -	.get_selection	= ov772x_get_selection,
> > -	.get_fmt	= ov772x_get_fmt,
> > -	.set_fmt	= ov772x_set_fmt,
> > +	.enum_frame_interval	= ov772x_enum_frame_interval,
> > +	.enum_mbus_code		= ov772x_enum_mbus_code,
> > +	.get_selection		= ov772x_get_selection,
> > +	.get_fmt		= ov772x_get_fmt,
> > +	.set_fmt		= ov772x_set_fmt,
>
> Shouldn't these last four ops be added in the previous patch?
> They don't have anything to do with the frame interval support.
>

If you look closely you'll notice I have just re-aligned them, since I
was at there to add enum_frame_interval operation

> Anyway, after taking care of the memsets and these four ops you can add
> my:
>
> Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Thanks
   j

  reply	other threads:[~2018-02-21 15:16 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-19 16:59 [PATCH v9 00/11] Renesas Capture Engine Unit (CEU) V4L2 driver Jacopo Mondi
2018-02-19 16:59 ` [PATCH v9 01/11] dt-bindings: media: Add Renesas CEU bindings Jacopo Mondi
2018-02-19 16:59 ` [PATCH v9 02/11] include: media: Add Renesas CEU driver interface Jacopo Mondi
2018-02-19 16:59 ` [PATCH v9 03/11] media: platform: Add Renesas CEU driver Jacopo Mondi
2018-02-20  3:35   ` kbuild test robot
2018-02-21 12:03   ` Hans Verkuil
2018-02-21 12:29     ` Laurent Pinchart
2018-02-21 13:02       ` Hans Verkuil
2018-02-21 16:43         ` jacopo mondi
2018-02-19 16:59 ` [PATCH v9 04/11] ARM: dts: r7s72100: Add Capture Engine Unit (CEU) Jacopo Mondi
2018-02-19 16:59 ` [PATCH v9 05/11] media: i2c: Copy ov772x soc_camera sensor driver Jacopo Mondi
2018-02-19 16:59 ` [PATCH v9 06/11] media: i2c: ov772x: Remove soc_camera dependencies Jacopo Mondi
2018-02-21 12:08   ` Hans Verkuil
2018-02-19 16:59 ` [PATCH v9 07/11] media: i2c: ov772x: Support frame interval handling Jacopo Mondi
2018-02-20  4:25   ` kbuild test robot
2018-02-20  5:22   ` kbuild test robot
2018-02-20  5:22   ` [RFC PATCH] media: i2c: ov772x: ov772x_frame_intervals[] can be static kbuild test robot
2018-02-21 12:12   ` [PATCH v9 07/11] media: i2c: ov772x: Support frame interval handling Hans Verkuil
2018-02-21 15:16     ` jacopo mondi [this message]
2018-02-21 15:23       ` Hans Verkuil
2018-02-19 16:59 ` [PATCH v9 08/11] media: i2c: Copy tw9910 soc_camera sensor driver Jacopo Mondi
2018-02-19 16:59 ` [PATCH v9 09/11] media: i2c: tw9910: Remove soc_camera dependencies Jacopo Mondi
2018-02-19 16:59 ` [PATCH v9 10/11] arch: sh: migor: Use new renesas-ceu camera driver Jacopo Mondi
2018-02-19 16:59 ` [PATCH v9 11/11] media: i2c: ov7670: Fully set mbus frame fmt Jacopo Mondi
2018-02-19 19:19   ` Laurent Pinchart
2018-02-20  8:58     ` jacopo mondi
2018-02-21 15:47       ` jacopo mondi
2018-02-21 16:28         ` Hans Verkuil
2018-02-21 20:28       ` Laurent Pinchart
2018-02-22 12:04         ` jacopo mondi
2018-02-22 12:14           ` Laurent Pinchart
2018-02-22 12:36             ` jacopo mondi
2018-02-22 12:47               ` Laurent Pinchart
2018-02-22 14:26                 ` jacopo mondi

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=20180221151644.GI7203@w540 \
    --to=jacopo@jmondi.org \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=geert@glider.be \
    --cc=hverkuil@xs4all.nl \
    --cc=jacopo+renesas@jmondi.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=mark.rutland@arm.com \
    --cc=mchehab@kernel.org \
    --cc=pombredanne@nexb.com \
    --cc=robh+dt@kernel.org \
    --cc=sakari.ailus@iki.fi \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).