Re: [PATCH 2/2] i2c: qcom-cci: Suspend the controller 50 ms after the last transfer

From: Loic Poulain

Date: Wed Oct 21 2026 - 03:45:04 EST


Hi Birk,

On Tue, Oct 20, 2026 at 9:40 PM Birk Skyum <birk.skyum@xxxxx> wrote:
>
> With a 1 s autosuspend delay the controller stays clocked across any
> power cycle of a target that is shorter than a second, so the reset on
> resume never runs in between and the first transfer after the target
> comes back stalls until the 100 ms timeout. Camera sensors are powered
> down when they stop streaming and up again when they start, so closing
> and reopening a camera quickly hits this.
>
> On the Lenovo Yoga Slim 7x (X1E80100), restarting the OV02C10 with
> v4l2-ctl after pauses of 0.05, 0.1, 0.2 and 0.5 s failed in 19 of 20
> cycles each, and in 16 of 20 after 1 s pauses. With this change and the
> reset on resume, all 100 cycles started, and so did 150 of 150
> libcamera starts back to back.
>
> Transfers come in bursts (a sensor mode alone is a few hundred register
> writes), so suspending 50 ms after the last one costs one reset per
> burst.

So, no, we should not rely on runtime suspend/resume timing as a
workaround for this. That approach is inherently bad and fragile.

Have you been able to probe the CCI I2C bus during resume? It would be
useful to see whether there is any activity on SCL/SDA and, in
particular, whether either line is being held low.

I wonder if enabling SCL stretching support could help here. One
possibility is that the sensor (or another I2C slave) is not yet ready
when the transfer is initiated and therefore holds SCL low. If that's
the case, have you tried the change below?
https://lore.kernel.org/all/20261007050147.274096-1-hitesh@xxxxxxxxxxxxxx/#t

Regards,
Loic

>
> Signed-off-by: Birk Skyum <birk.skyum@xxxxx>
> ---
> drivers/i2c/busses/i2c-qcom-cci.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-qcom-cci.c b/drivers/i2c/busses/i2c-qcom-cci.c
> index 51ce174..62b0fcb 100644
> --- a/drivers/i2c/busses/i2c-qcom-cci.c
> +++ b/drivers/i2c/busses/i2c-qcom-cci.c
> @@ -794,7 +794,7 @@ static int cci_probe(struct platform_device *pdev)
> if (ret < 0)
> goto disable_clocks;
>
> - pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC);
> + pm_runtime_set_autosuspend_delay(dev, 50);
> ret = devm_pm_runtime_set_active_enabled(dev);
> if (ret)
> goto disable_clocks;
> --
> 2.53.0
>
>