Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Wenmeng Liu" <wenmeng.liu@oss.qualcomm.com>
Cc: media-ci@linuxtv.org, conor+dt@kernel.org,
	devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v2 2/2] media: i2c: Add Samsung S5KJN5 image sensor driver
Date: Fri, 24 Jul 2026 10:08:17 +0000	[thread overview]
Message-ID: <20260724100817.A29B31F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260724-sk5jn5-v2-2-871d3b9a2e47@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The exposure hardware register is not updated when the maximum exposure limit changes due to a VBLANK modification, leaving the hardware out of sync.
- [Medium] V4L2 controls are silently ignored when CONFIG_PM is disabled, leaving the sensor unconfigured.
--

--- Patch [2]: [PATCH v2 2/2] media: i2c: Add Samsung S5KJN5 image sensor driver ---
commit 583bdec13ff5578760991a928a272b7f11a48522
Author: Wenmeng Liu <wenmeng.liu@oss.qualcomm.com>

media: i2c: Add Samsung S5KJN5 image sensor driver
    
This commit adds a V4L2 sub-device driver for the Samsung S5KJN5 50 MP
GBRG 10-bit RAW MIPI CSI-2 image sensor. It supports 4096x3072 mode and
exposes standard controls such as exposure, gain, and vblank/hblank.

> diff --git a/drivers/media/i2c/s5kjn5.c b/drivers/media/i2c/s5kjn5.c
> new file mode 100644
> index 0000000000000..865db808aabcf
> --- /dev/null
> +++ b/drivers/media/i2c/s5kjn5.c
[ ... ]
> +static int s5kjn5_s_ctrl(struct v4l2_ctrl *ctrl)
> +{
> +	struct s5kjn5 *s5kjn5 =
> +		container_of(ctrl->handler, struct s5kjn5, ctrl_handler);
> +	const struct s5kjn5_mode *mode = &s5kjn5_modes[0];
> +	struct device *dev = s5kjn5->sd.dev;
> +	u32 exposure_max;
> +	int ret = 0;
> +
> +	if (ctrl->id == V4L2_CID_VBLANK) {
> +		/* Update max exposure while meeting expected vblanking */
> +		exposure_max = mode->height + ctrl->val - mode->exposure_margin;
> +		__v4l2_ctrl_modify_range(s5kjn5->exposure,
> +					 s5kjn5->exposure->minimum,
> +					 exposure_max,
> +					 s5kjn5->exposure->step,
> +					 s5kjn5->exposure->default_value);
> +	}

[Severity: High]
If a user decreases VBLANK causing the V4L2 framework to clamp
s5kjn5->exposure->val to the new exposure_max, will this leave the hardware
exposure register out of sync?

Since the vblank and exposure controls are not clustered, s_ctrl is only
invoked for VBLANK. It updates the VTS register but does not sync the newly
clamped exposure value to the hardware, potentially leaving it with an invalid
value that exceeds the new frame length.

> +
> +	if (pm_runtime_get_if_active(dev) <= 0)
> +		return 0;

[Severity: Medium]
When the kernel is built without CONFIG_PM, pm_runtime_get_if_active() is
stubbed to return -EINVAL.

Will this cause the check to evaluate to true and silently drop all hardware
writes in s_ctrl, leaving the camera unconfigurable?

> +
> +	switch (ctrl->id) {
> +	case V4L2_CID_EXPOSURE:
> +		ret = cci_write(s5kjn5->regmap, S5KJN5_REG_EXPOSURE,
> +				ctrl->val, NULL);
> +		break;
[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260724-sk5jn5-v2-0-871d3b9a2e47@oss.qualcomm.com?part=2

  reply	other threads:[~2026-07-24 10:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-24  9:50 [PATCH v2 0/2] media: i2c: Add Samsung S5KJN5 image sensor Wenmeng Liu
2026-07-24  9:50 ` [PATCH v2 1/2] dt-bindings: " Wenmeng Liu
2026-07-24 14:12   ` Vladimir Zapolskiy
2026-07-31  8:15     ` Wenmeng Liu
2026-07-24  9:50 ` [PATCH v2 2/2] media: i2c: Add Samsung S5KJN5 image sensor driver Wenmeng Liu
2026-07-24 10:08   ` sashiko-bot [this message]
2026-07-25  7:22   ` Vladimir Zapolskiy
2026-07-31  8:24     ` Wenmeng Liu
2026-07-31 17:39       ` Vladimir Zapolskiy
2026-08-03  2:53         ` Wenmeng Liu
2026-07-25 10:14   ` Vladimir Zapolskiy

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=20260724100817.A29B31F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=media-ci@linuxtv.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wenmeng.liu@oss.qualcomm.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