Devicetree
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Dave Stevenson <dave.stevenson@raspberrypi.com>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>,
	Jai Luthra <jai.luthra@ideasonboard.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Alexander Shiyan <eagle.alexander923@gmail.com>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v7 15/18] media: sony-starvis2: Parameterise exposure min and step
Date: Mon, 30 Nov 2026 14:39:18 +0900	[thread overview]
Message-ID: <20261130053918.GG4286@killaraus.ideasonboard.com> (raw)
In-Reply-To: <20261029-media-starvis2-v7-15-b33a1332fdfc@raspberrypi.com>

On Thu, Oct 29, 2026 at 02:18:36PM +0000, Dave Stevenson wrote:
> All the Starvis2 sensors supported to this point have specified
> the range for the SHR (exposure) register as being 4 to
> (number of line per frame -1).
> 
> Newer sensors are deviating from that, so parameterise
> these into the sensor variant, replacing STARVIS2_EXPOSURE_MIN,
> STARVIS2_EXPOSURE_STEP, and STARVIS2_SHR_MIN.
> 
> Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
> ---
>  drivers/media/i2c/sony-starvis2.c | 37 ++++++++++++++++++++++++++-----------
>  1 file changed, 26 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/media/i2c/sony-starvis2.c b/drivers/media/i2c/sony-starvis2.c
> index e64d943369b1..15d5a066a556 100644
> --- a/drivers/media/i2c/sony-starvis2.c
> +++ b/drivers/media/i2c/sony-starvis2.c
> @@ -68,11 +68,8 @@
>  
>  /* SHR internal */
>  #define STARVIS2_REG_SHR		CCI_REG24_LE(0x3050)
> -#define STARVIS2_SHR_MIN		4
>  
>  /* Exposure control */
> -#define STARVIS2_EXPOSURE_MIN		1
> -#define STARVIS2_EXPOSURE_STEP		1
>  #define STARVIS2_EXPOSURE_DEFAULT	1000
>  
>  /*
> @@ -641,6 +638,9 @@ struct starvis2_variant {
>  	unsigned int vmax_default;
>  	const u16 *hmax_min_link_freq;
>  	u16 hmax_min_pixel_array;
> +	unsigned int exposure_min;
> +	unsigned int exposure_step;
> +	unsigned int shr_min;
>  };
>  
>  static const struct starvis2_variant imx678_variant_def = {
> @@ -668,6 +668,9 @@ static const struct starvis2_variant imx678_variant_def = {
>  	.vmax_default = 2250,
>  	.hmax_min_link_freq = imx678_min_hmax_2lane,
>  	.hmax_min_pixel_array = 550,
> +	.exposure_min = 1,
> +	.exposure_step = 1,
> +	.shr_min = 4,
>  };
>  
>  static const struct cci_reg_sequence imx662_common_regs[] = {
> @@ -798,6 +801,9 @@ static const struct starvis2_variant imx662_variant_def = {
>  	.vmax_default = 1136,
>  	.hmax_min_link_freq = imx662_min_hmax_2lane,
>  	.hmax_min_pixel_array = 990,
> +	.exposure_min = 1,
> +	.exposure_step = 1,
> +	.shr_min = 4,
>  };
>  
>  static const struct cci_reg_sequence imx675_common_regs[] = {
> @@ -985,6 +991,9 @@ static const struct starvis2_variant imx675_variant_def = {
>  	.vmax_default = 2024,
>  	.hmax_min_link_freq = imx675_min_hmax_2lane,
>  	.hmax_min_pixel_array = 528,
> +	.exposure_min = 1,
> +	.exposure_step = 1,
> +	.shr_min = 4,
>  };
>  
>  static const struct cci_reg_sequence imx832_common_regs[] = {
> @@ -1078,6 +1087,9 @@ static const struct starvis2_variant imx832_variant_def = {
>  	.vmax_default = 1136,
>  	.hmax_min_link_freq = imx832_min_hmax_2lane,
>  	.hmax_min_pixel_array = 990,
> +	.exposure_min = 1,
> +	.exposure_step = 1,
> +	.shr_min = 4,
>  };
>  
>  struct starvis2_model_info {
> @@ -1249,12 +1261,15 @@ static int starvis2_set_ctrl(struct v4l2_ctrl *ctrl)
>  		starvis2->vmax = format->height + ctrl->val;
>  
>  		current_exposure = clamp_t(u32, current_exposure,
> -					   STARVIS2_EXPOSURE_MIN,
> -					   starvis2->vmax - STARVIS2_SHR_MIN);
> +					   starvis2->variant->exposure_min,
> +					   starvis2->vmax -
> +						starvis2->variant->shr_min);
>  		ret = __v4l2_ctrl_modify_range(starvis2->exposure,
> -					       STARVIS2_EXPOSURE_MIN,
> -					       starvis2->vmax - STARVIS2_SHR_MIN,
> -					       1, current_exposure);
> +					       starvis2->variant->exposure_min,
> +					       starvis2->vmax -
> +						starvis2->variant->shr_min,

Wrong indentation.

> +					       starvis2->variant->exposure_step,
> +					       current_exposure);
>  		if (ret)
>  			return ret;
>  	}
> @@ -1778,10 +1793,10 @@ static int starvis2_init_controls(struct starvis2 *starvis2)
>  
>  	starvis2->exposure = v4l2_ctrl_new_std(ctrl_hdlr, &starvis2_ctrl_ops,
>  					       V4L2_CID_EXPOSURE,
> -					       STARVIS2_EXPOSURE_MIN,
> +					       starvis2->variant->exposure_min,
>  					       starvis2->variant->vmax_default -
> -					       STARVIS2_SHR_MIN,
> -					       STARVIS2_EXPOSURE_STEP,
> +						starvis2->variant->shr_min,

Same.

> +					       starvis2->variant->exposure_step,
>  					       STARVIS2_EXPOSURE_DEFAULT);
>  
>  	v4l2_ctrl_new_std(ctrl_hdlr, &starvis2_ctrl_ops, V4L2_CID_ANALOGUE_GAIN,

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2026-11-30  5:39 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 14:18 [PATCH v7 00/18] Update imx678 to act as a common Sony Starvis 2 driver Dave Stevenson
2026-10-29 14:18 ` [PATCH v7 01/18] media: imx678: Rework into a common Starvis 2 sensor driver Dave Stevenson
2026-11-30  2:31   ` Laurent Pinchart
2026-10-29 14:18 ` [PATCH v7 02/18] media: sony-starvis2: Reorder link frequencies to remove lookup Dave Stevenson
2026-11-30  2:44   ` Laurent Pinchart
2026-10-29 14:18 ` [PATCH v7 03/18] media: sony-starvis2: Always program the sensor in window mode Dave Stevenson
2026-11-30  2:46   ` Laurent Pinchart
2026-10-29 14:18 ` [PATCH v7 04/18] media: sony-starvis2: Parameterise the configuration to allow for other models Dave Stevenson
2026-11-30  3:13   ` Laurent Pinchart
2026-11-30  4:08     ` Laurent Pinchart
2026-10-29 14:18 ` [PATCH v7 05/18] media: sony-starvis2: Rework 2 lane support for higher link freqs Dave Stevenson
2026-10-29 14:18 ` [PATCH v7 06/18] media: sony-starvis2: Allow runtime control of link frequency Dave Stevenson
2026-11-30  3:27   ` Laurent Pinchart
2026-10-29 14:18 ` [PATCH v7 07/18] media: sony-starvis2: Correct the exposure range Dave Stevenson
2026-10-29 14:18 ` [PATCH v7 08/18] media: sony-starvis2: Put module into standby after identify Dave Stevenson
2026-11-30  3:30   ` Laurent Pinchart
2026-10-29 14:18 ` [PATCH v7 09/18] media: sony-starvis2: Use pm_runtime_autosuspend Dave Stevenson
2026-10-29 14:18 ` [PATCH v7 10/18] media: dt-bindings: sony,imx678: Add other Starvis 2 family members Dave Stevenson
2026-10-29 14:18 ` [PATCH v7 11/18] media: sony-starvis2: Add support for IMX662 Dave Stevenson
2026-11-30  4:08   ` Laurent Pinchart
2026-10-29 14:18 ` [PATCH v7 12/18] media: sony-starvis2: Add support for IMX675 Dave Stevenson
2026-10-29 14:18 ` [PATCH v7 13/18] media: sony-starvis2: Add support for IMX832 Dave Stevenson
2026-10-29 14:18 ` [PATCH v7 14/18] media: sony-starvis2: Only update bits for window mode Dave Stevenson
2026-10-29 14:18 ` [PATCH v7 15/18] media: sony-starvis2: Parameterise exposure min and step Dave Stevenson
2026-11-30  5:39   ` Laurent Pinchart [this message]
2026-10-29 14:18 ` [PATCH v7 16/18] media: sony-starvis2: Parameterise the mono ID register Dave Stevenson
2026-10-29 14:18 ` [PATCH v7 17/18] media: sony-starvis2: Add support for IMX585 Dave Stevenson
2026-10-29 14:18 ` [PATCH v7 18/18] media: sony-starvis2: Add support for IMX676 Dave Stevenson
2026-11-30  5:45 ` [PATCH v7 00/18] Update imx678 to act as a common Sony Starvis 2 driver 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=20261130053918.GG4286@killaraus.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=conor+dt@kernel.org \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=devicetree@vger.kernel.org \
    --cc=eagle.alexander923@gmail.com \
    --cc=jai.luthra@ideasonboard.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=robh@kernel.org \
    --cc=sakari.ailus@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox