All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sergey Lebedev" <lsa.uz@pm.me>
Cc: robh@kernel.org, devicetree@vger.kernel.org,
	media-ci@linuxtv.org, conor+dt@kernel.org
Subject: Re: [PATCH v6 2/3] media: i2c: Add Sony IMX681 sensor driver
Date: Wed, 23 Sep 2026 19:50:07 +0000	[thread overview]
Message-ID: <20260923195007.A11D41F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260923193805.83998-3-lsa.uz@pm.me>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] media: i2c: imx681: missing clock rate validation
- [Medium] media: i2c: imx681: flip controls silently ignored during streaming
--

commit 9302e1005f9a8ea647ef15f49b763c01aec8d79f
Author: Andre Gilerson <andre.gilerson@gmail.com>

media: i2c: Add Sony IMX681 sensor driver
    
Add a V4L2 sub-device driver for the Sony IMX681, a 10-bit Bayer sensor
on a two-lane CSI-2 bus. It offers a single 3844x2640 mode at 30 fps and
controls for exposure, analogue and digital gain, vertical blanking,
both flips and the sensor's test patterns.

> diff --git a/drivers/media/i2c/imx681.c b/drivers/media/i2c/imx681.c
> new file mode 100644
> index 0000000000000..3be96965c53ec
> --- /dev/null
> +++ b/drivers/media/i2c/imx681.c
> @@ -0,0 +1,1003 @@

[ ... ]

> +static int imx681_set_ctrl(struct v4l2_ctrl *ctrl)
> +{
> +	struct imx681 *imx681 = container_of(ctrl->handler, struct imx681,
> +					     ctrl_handler);

[ ... ]

> +	switch (ctrl->id) {

[ ... ]

> +	case V4L2_CID_HFLIP:
> +	case V4L2_CID_VFLIP:
> +		/* Read from imx681_start_streaming(); the layout changes. */
> +		break;

[Severity: Medium]
Will this silently ignore flip control changes while the sensor is streaming?

When userspace modifies V4L2_CID_HFLIP or V4L2_CID_VFLIP via VIDIOC_S_CTRL
during streaming, returning 0 here without updating the hardware tells the
V4L2 core the change succeeded. This can cause the V4L2 control state to
diverge from the actual hardware state, breaking pipeline format validation
because the reported Bayer format no longer matches the sensor's actual
output.

Should the driver call v4l2_ctrl_grab(..., true) when streaming starts to
prevent these modifications?

[ ... ]

> +static int imx681_probe(struct i2c_client *client)
> +{
> +	struct imx681 *imx681;
> +	int ret;
> +
> +	imx681 = devm_kzalloc(&client->dev, sizeof(*imx681), GFP_KERNEL);
> +	if (!imx681)
> +		return -ENOMEM;

[ ... ]

> +	/* Initialise CCI regmap for 16-bit register addresses */
> +	imx681->cci = devm_cci_regmap_init_i2c(client, 16);
> +	if (IS_ERR(imx681->cci))
> +		return dev_err_probe(imx681->dev, PTR_ERR(imx681->cci),
> +				     "failed to init CCI\n");
> +
> +	/* Get clock (optional - INT3472 provides it on Surface devices) */
> +	imx681->xclk = devm_clk_get_optional(imx681->dev, NULL);

[Severity: Medium]
Does this clock need rate validation?

The sensor's PLL and CSI-2 link timings appear to be configured assuming an
exact 19.2 MHz input clock. If a different clock rate is provided (e.g.,
24 MHz from a device tree or ACPI configuration), this probe will silently
succeed, but the sensor might output garbage or fail to link.

Should we check the rate using clk_get_rate() here?

> +	if (IS_ERR(imx681->xclk))
> +		return dev_err_probe(imx681->dev, PTR_ERR(imx681->xclk),
> +				     "failed to get clock\n");

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260923193805.83998-1-lsa.uz@pm.me?part=2

  reply	other threads:[~2026-09-23 19:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23 19:38 [PATCH v6 0/3] Add support for the Sony IMX681 camera sensor Sergey Lebedev
2026-09-23 19:38 ` [PATCH v6 1/3] dt-bindings: media: Add Sony IMX681 Sergey Lebedev
2026-09-23 19:38 ` [PATCH v6 2/3] media: i2c: Add Sony IMX681 sensor driver Sergey Lebedev
2026-09-23 19:50   ` sashiko-bot [this message]
2026-09-23 19:38 ` [PATCH v6 3/3] media: ipu-bridge: Add Sony IMX681 Sergey Lebedev

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=20260923195007.A11D41F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=lsa.uz@pm.me \
    --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.