All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Sakari Ailus <sakari.ailus@linux.intel.com>, linux-media@vger.kernel.org
Cc: tfiga@chromium.org, bingbu.cao@intel.com,
	jian.xu.zheng@intel.com, rajmohan.mani@intel.com,
	tian.shu.qiu@intel.com, ricardo.ribalda@gmail.com,
	grundler@chromium.org, ping-chung.chen@intel.com,
	andy.yeh@intel.com, jim.lai@intel.com, helmut.grohne@intenta.de,
	laurent.pinchart@ideasonboard.com, snawrocki@kernel.org
Subject: Re: [PATCH 5/5] smiapp: Set control units
Date: Fri, 28 Sep 2018 16:28:00 +0200	[thread overview]
Message-ID: <9ecff9d7-d329-3d52-e75a-5a640ebe55b9@xs4all.nl> (raw)
In-Reply-To: <20180925101434.20327-6-sakari.ailus@linux.intel.com>

On 09/25/2018 12:14 PM, Sakari Ailus wrote:
> Assign units for the controls exposed by the smiapp driver.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
>  drivers/media/i2c/smiapp/smiapp-core.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
> index 99f3b295ae3c7..289313c232430 100644
> --- a/drivers/media/i2c/smiapp/smiapp-core.c
> +++ b/drivers/media/i2c/smiapp/smiapp-core.c
> @@ -562,17 +562,10 @@ static int smiapp_init_controls(struct smiapp_sensor *sensor)
>  	sensor->vblank = v4l2_ctrl_new_std(
>  		&sensor->pixel_array->ctrl_handler, &smiapp_ctrl_ops,
>  		V4L2_CID_VBLANK, 0, 1, 1, 0);
> -
> -	if (sensor->vblank)
> -		sensor->vblank->flags |= V4L2_CTRL_FLAG_UPDATE;
> -
>  	sensor->hblank = v4l2_ctrl_new_std(
>  		&sensor->pixel_array->ctrl_handler, &smiapp_ctrl_ops,
>  		V4L2_CID_HBLANK, 0, 1, 1, 0);
>  
> -	if (sensor->hblank)
> -		sensor->hblank->flags |= V4L2_CTRL_FLAG_UPDATE;
> -
>  	sensor->pixel_rate_parray = v4l2_ctrl_new_std(
>  		&sensor->pixel_array->ctrl_handler, &smiapp_ctrl_ops,
>  		V4L2_CID_PIXEL_RATE, 1, INT_MAX, 1, 1);
> @@ -589,6 +582,13 @@ static int smiapp_init_controls(struct smiapp_sensor *sensor)
>  		return sensor->pixel_array->ctrl_handler.error;
>  	}
>  
> +	sensor->exposure->unit = V4L2_CTRL_UNIT_LINE;
> +	sensor->vblank->flags |= V4L2_CTRL_FLAG_UPDATE;
> +	sensor->vblank->unit = V4L2_CTRL_UNIT_LINE;

You can fill in the unit for this control in v4l2_ctrl_fill(). That means that this
function gets extra arguments, but that's OK.

There are probably quite a few controls were you can be explicit about the unit.

BTW, it might be easier to add a new v4l2_ctrl_fill_units() function, I'm not sure
what is best.

> +	sensor->hblank->flags |= V4L2_CTRL_FLAG_UPDATE;
> +	sensor->hblank->unit = V4L2_CTRL_UNIT_PIXEL;
> +	sensor->pixel_rate_parray->unit = V4L2_CTRL_UNIT_PIXELS_PER_SEC;
> +
>  	sensor->pixel_array->sd.ctrl_handler =
>  		&sensor->pixel_array->ctrl_handler;
>  
> @@ -611,6 +611,8 @@ static int smiapp_init_controls(struct smiapp_sensor *sensor)
>  		return sensor->src->ctrl_handler.error;
>  	}
>  
> +	sensor->pixel_rate_csi->unit = V4L2_CTRL_UNIT_PIXELS_PER_SEC;
> +
>  	sensor->src->sd.ctrl_handler = &sensor->src->ctrl_handler;
>  
>  	return 0;
> 

Regards,

	Hans

  reply	other threads:[~2018-09-28 20:52 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-25 10:14 [PATCH 0/5] Add units to controls Sakari Ailus
2018-09-25 10:14 ` [PATCH 1/5] videodev2.h: Use 8 hexadecimals (32 bits) for control flags Sakari Ailus
2018-09-28 13:16   ` Laurent Pinchart
2018-09-28 13:48   ` Hans Verkuil
2018-09-25 10:14 ` [PATCH 2/5] v4l: controls: Add support for exponential bases, prefixes and units Sakari Ailus
2018-09-28 14:00   ` Hans Verkuil
2018-10-01  9:27     ` Helmut Grohne
2018-10-01  9:48       ` Hans Verkuil
2018-11-14  9:09     ` Tomasz Figa
2018-10-14  6:14   ` Pavel Machek
2018-09-25 10:14 ` [PATCH 3/5] Documentation: media: Document control exponential bases, units, prefixes Sakari Ailus
2018-09-25 10:39   ` Helmut Grohne
2018-09-25 10:51     ` Sakari Ailus
2018-09-28 14:20   ` Hans Verkuil
2018-09-25 10:14 ` [PATCH 4/5] v4l: controls: QUERY_EXT_CTRL support for base, prefix and unit Sakari Ailus
2018-09-26 22:40   ` kbuild test robot
2018-09-28 14:23   ` Hans Verkuil
2018-09-25 10:14 ` [PATCH 5/5] smiapp: Set control units Sakari Ailus
2018-09-28 14:28   ` Hans Verkuil [this message]
2018-09-25 11:48 ` [PATCH 0/5] Add units to controls Helmut Grohne
2018-09-25 12:30   ` Sakari Ailus
2018-09-26 10:24     ` Helmut Grohne
2018-09-28 13:25     ` Laurent Pinchart
2018-09-28 14:36       ` Hans Verkuil
2018-10-03  9:15     ` Tomasz Figa

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=9ecff9d7-d329-3d52-e75a-5a640ebe55b9@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=andy.yeh@intel.com \
    --cc=bingbu.cao@intel.com \
    --cc=grundler@chromium.org \
    --cc=helmut.grohne@intenta.de \
    --cc=jian.xu.zheng@intel.com \
    --cc=jim.lai@intel.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=ping-chung.chen@intel.com \
    --cc=rajmohan.mani@intel.com \
    --cc=ricardo.ribalda@gmail.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=snawrocki@kernel.org \
    --cc=tfiga@chromium.org \
    --cc=tian.shu.qiu@intel.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.