public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Quentin Freimanis <quentin@q-lab.dev>
To: Alexander Shiyan <eagle.alexander923@gmail.com>,
	linux-media@vger.kernel.org
Cc: Isaac Scott <isaac.scott@ideasonboard.com>,
	Dave Stevenson <dave.stevenson@raspberrypi.com>,
	Dongcheng Yan <dongcheng.yan@intel.com>,
	devicetree@vger.kernel.org,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Hans Verkuil <hverkuil@kernel.org>,
	Hans de Goede <johannes.goede@oss.qualcomm.com>,
	Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>,
	Mehdi Djait <mehdi.djait@linux.intel.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Benjamin Mugnier <benjamin.mugnier@foss.st.com>,
	Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	Jingjing Xiong <jingjing.xiong@intel.com>,
	Svyatoslav Ryhel <clamor95@gmail.com>
Subject: Re: [RFC PATCH v3 2/2] media: i2c: Add onsemi AR0234 image sensor driver
Date: Wed, 6 May 2026 21:12:20 -0700	[thread overview]
Message-ID: <a7daefb2-3ab4-43db-b7cc-c3b7d0c0fae4@q-lab.dev> (raw)
In-Reply-To: <20260306103614.3208182-3-eagle.alexander923@gmail.com>

On 3/6/26 2:36 AM, Alexander Shiyan wrote:
> +
> +static int ar0234_set_ctrl(struct v4l2_ctrl *ctrl)
> +{
> +	struct ar0234 *ar0234 = container_of(ctrl->handler,
> +					     struct ar0234, ctrls);
> +	int ret = 0;
> +
> +	if (ctrl->flags & V4L2_CTRL_FLAG_READ_ONLY)
> +		return 0;
> +
> +	if (ctrl->id == V4L2_CID_VBLANK) {
> +		int exposure_max = ar0234->crop.height + ctrl->val - 1;
> +		int exposure_val = clamp(ar0234->exposure->val,
> +					 AR0234_EXPOSURE_MIN, exposure_max);
> +
> +		ret = __v4l2_ctrl_modify_range(ar0234->exposure,
> +					       AR0234_EXPOSURE_MIN,
> +					       exposure_max,
> +					       AR0234_EXPOSURE_STEP,
> +					       exposure_val);
> +		if (ret)
> +			return ret;
> +	}
> +
> +	if (pm_runtime_get_if_in_use(ar0234->dev) == 0)
> +		return 0;
> +
> +	switch (ctrl->id) {
> +	case V4L2_CID_HBLANK:
> +		cci_write(ar0234->regmap, AR0234_REG_LINE_LENGTH_PCK,
> +			  (ar0234->crop.width / 4) + ctrl->val, &ret);

should be (crop->width + ctrl->val) / 4, &ret) to keep the control in 
units of pixels

> +		break;
> +	case V4L2_CID_VBLANK:
> +		cci_write(ar0234->regmap, AR0234_REG_FRAME_LENGTH_LINES,
> +			  ar0234->crop.height + ctrl->val, &ret);
REG_FRAME_LENGTH_LINES seems to actually be total lines - 5

I had to make these 2 changes to be able to get the expected framerate 
when not using the default 120fps.

> +		if (ret)
> +			break;
> +		ctrl = ar0234->exposure;
> +		fallthrough;
> +	case V4L2_CID_EXPOSURE:
> +		cci_write(ar0234->regmap, AR0234_REG_COARSE_INTEGRATION_TIME,
> +			  ctrl->val, &ret);
> +		break;
> +	case V4L2_CID_ANALOGUE_GAIN:
> +		ret = ar0234_set_analog_gain(ar0234, ctrl->val);
> +		break;
> +	case V4L2_CID_DIGITAL_GAIN:
> +		cci_write(ar0234->regmap, AR0234_REG_GLOBAL_GAIN,
> +			  ctrl->val, &ret);
> +		break;
- Quentin

  parent reply	other threads:[~2026-05-07  4:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-06 10:36 [RFC PATCH v3 0/2] media: i2c: Add onsemi AR0234 camera sensor driver Alexander Shiyan
2026-03-06 10:36 ` [RFC PATCH v3 1/2] dt-bindings: media: i2c: Add onsemi AR0234 image sensor binding Alexander Shiyan
2026-05-05 10:15   ` Laurent Pinchart
2026-05-05 14:09     ` Alexander Shiyan
2026-05-05 16:37       ` Laurent Pinchart
2026-03-06 10:36 ` [RFC PATCH v3 2/2] media: i2c: Add onsemi AR0234 image sensor driver Alexander Shiyan
2026-05-05  4:21   ` Quentin Freimanis
2026-05-05 16:11   ` Laurent Pinchart
2026-05-06 18:41     ` Alexander Shiyan
2026-05-07  4:12   ` Quentin Freimanis [this message]
2026-05-05 10:29 ` [RFC PATCH v3 0/2] media: i2c: Add onsemi AR0234 camera " 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=a7daefb2-3ab4-43db-b7cc-c3b7d0c0fae4@q-lab.dev \
    --to=quentin@q-lab.dev \
    --cc=benjamin.mugnier@foss.st.com \
    --cc=bryan.odonoghue@linaro.org \
    --cc=clamor95@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dongcheng.yan@intel.com \
    --cc=eagle.alexander923@gmail.com \
    --cc=hverkuil@kernel.org \
    --cc=isaac.scott@ideasonboard.com \
    --cc=jingjing.xiong@intel.com \
    --cc=johannes.goede@oss.qualcomm.com \
    --cc=krzk+dt@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=mehdi.djait@linux.intel.com \
    --cc=robh@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=vladimir.zapolskiy@linaro.org \
    /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