All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Armandas Kvietkus" <armandas.kvietkus@proton.me>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
	media-ci@linuxtv.org
Subject: Re: [PATCH v5 2/2] media: i2c: Add Samsung S5K3T2 image sensor driver
Date: Tue, 17 Nov 2026 20:48:56 +0000	[thread overview]
Message-ID: <sashiko-outbox-219647@kernel.org> (raw)
In-Reply-To: <20261117-upstream-s5k3t2-v5-2-1f7f5fde9e2a@proton.me>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] media: i2c: s5k3t2: update pad format code on flip in
  s5k3t2_set_ctrl()
--

commit 1494222806e207d51c67e719677f2ad981aa484e
Author: Armandas Kvietkus <armandas.kvietkus@proton.me>

media: i2c: Add Samsung S5K3T2 image sensor driver

This commit adds a V4L2 subdevice driver for the Samsung S5K3T2 20MP CMOS
image sensor.

> diff --git a/drivers/media/i2c/s5k3t2.c b/drivers/media/i2c/s5k3t2.c
> new file mode 100644
> index 0000000000000..1e504bf5fa24e
> --- /dev/null
> +++ b/drivers/media/i2c/s5k3t2.c
[ ... ]
> +static int s5k3t2_set_ctrl(struct v4l2_ctrl *ctrl)
> +{
> +	struct s5k3t2 *s5k3t2 = container_of_const(ctrl->handler, struct s5k3t2,
> +						   ctrl_handler);
> +	const struct v4l2_mbus_framefmt *fmt;
> +	struct v4l2_subdev_state *state;
> +	s64 exposure_max, exposure_def;
> +	int ret;
> +
> +	state = v4l2_subdev_get_locked_active_state(&s5k3t2->sd);
> +	fmt = v4l2_subdev_state_get_format(state, 0);
> +
> +	if (ctrl->id == V4L2_CID_VBLANK) {
> +		exposure_max = fmt->height + ctrl->val - S5K3T2_EXPOSURE_MARGIN;
> +		exposure_def = min(s5k3t2->exposure->default_value,
> +				   exposure_max);
> +		ret = __v4l2_ctrl_modify_range(s5k3t2->exposure,
> +					       s5k3t2->exposure->minimum,
> +					       exposure_max,
> +					       s5k3t2->exposure->step,
> +					       exposure_def);
> +		if (ret)
> +			return ret;
> +	}
> +
> +	if (!pm_runtime_get_if_active(s5k3t2->dev))
> +		return 0;
> +
> +	switch (ctrl->id) {
[ ... ]
> +	case V4L2_CID_HFLIP:
> +		ret = cci_write(s5k3t2->regmap, S5K3T2_REG_ORIENTATION,
> +				(s5k3t2->hflip->val ? S5K3T2_HFLIP : 0) |
> +				(s5k3t2->vflip->val ? S5K3T2_VFLIP : 0), NULL);
> +		break;

[Severity: Medium]
Should s5k3t2_set_ctrl() also update fmt->code =
s5k3t2_get_format_code(s5k3t2) before the pm_runtime_get_if_active() check
when ctrl->id == V4L2_CID_HFLIP?

Both s5k3t2->hflip and s5k3t2->vflip advertise V4L2_CTRL_FLAG_MODIFY_LAYOUT
and change the Bayer order returned by s5k3t2_get_format_code(), while
s5k3t2_pad_ops uses v4l2_subdev_get_fmt() for .get_fmt.  Without updating
fmt->code in the active subdev state when the flip controls change,
VIDIOC_SUBDEV_G_FMT and media link validation see a stale media bus format
code unless userspace calls VIDIOC_SUBDEV_S_FMT again.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261117-upstream-s5k3t2-v5-0-1f7f5fde9e2a@proton.me?part=2

      reply	other threads:[~2026-11-17 20:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 20:20 [PATCH v5 0/2] media: i2c: Samsung S5K3T2 image sensor Armandas Kvietkus via B4 Relay
2026-11-17 20:20 ` Armandas Kvietkus
2026-11-17 20:20 ` [PATCH v5 1/2] dt-bindings: media: i2c: Add " Armandas Kvietkus via B4 Relay
2026-11-17 20:20   ` Armandas Kvietkus
2026-11-17 20:20 ` [PATCH v5 2/2] media: i2c: Add Samsung S5K3T2 image sensor driver Armandas Kvietkus via B4 Relay
2026-11-17 20:20   ` Armandas Kvietkus
2026-11-17 20:48   ` sashiko-bot [this message]

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=sashiko-outbox-219647@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=armandas.kvietkus@proton.me \
    --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 \
    /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.