[PATCH v2 0/2] i2c: qcom-cci: Recover after a target powers down under a running controller
From: Birk Skyum via B4 Relay
Date: Tue Dec 01 2026 - 12:22:47 EST
On the Lenovo Yoga Slim 7x (X1E80100) the OV02C10 front camera on CCI1
master 1 fails to start whenever it is opened again within about a
second of being closed. The first register write times out ("master 1
queue 0 timeout") and the stream does not start.
While powered down, the OV02C10 clamps SCL and SDA low (both read low at
the TLMM pins with internal pull-ups enabled). When powered back on,
both lines read high again, and enabling SCL clock stretching (now
upstream in 0265dfc5d2a8) does not prevent the timeout. If CCI stayed
clocked across the target power cycle, the master stalls on its first
command (CUR_CMD 0x08010339, CUR_WORD_CNT 1, EXEC_WORD_CNT 3,
REPORT_STATUS 0, IRQ_STATUS_0 0) until cci_reset() runs.
Patch 1 calls cci_reset() unconditionally in cci_resume_runtime() so
resuming after a runtime suspend without power-domain collapse also
clears the stuck state.
Patch 2 keeps the 1 s runtime autosuspend delay unchanged and retries a
timed-out first message once in cci_xfer() after cci_run_queue() has
reset the controller (returning -EIO instead of retrying if cci_reset()
itself fails).
Tested on the Lenovo Yoga Slim 7x (X1E80100) on Linux 7.3 with SCL
stretching enabled:
- Patch 1 alone (cci_reset() without cci_init() first): 30/30 camera
restarts after 2 s pauses with CCI suspended in between, no reset
timeouts.
- Both patches with 1 s autosuspend unchanged: 120/120 camera restarts
across 0.05, 0.1, 0.2, 0.5, 1, and 2 s pauses (20 cycles each; 91 hit
the stall and every retry succeeded).
Changes in v2:
- Patch 1: call cci_reset() directly in cci_resume_runtime() without
calling cci_init() first (Loic Poulain).
- Patch 2: drop the 50 ms autosuspend delay patch (Loic Poulain) and
replace it with a single retry of the first message on -ETIMEDOUT
after cci_run_queue() resets the controller (returning -EIO if the
reset itself fails).
- Link to v1: https://lore.kernel.org/r/20261020193946.51478-1-birk.skyum@xxxxx
Signed-off-by: Birk Skyum <birk.skyum@xxxxx>
---
Birk Skyum (2):
i2c: qcom-cci: Reset the controller when it resumes
i2c: qcom-cci: Retry a timed-out first message after resetting
drivers/i2c/busses/i2c-qcom-cci.c | 40 +++++++++++++++++++++++++++++----------
1 file changed, 30 insertions(+), 10 deletions(-)
---
base-commit: ef922b721a5e99348fc1f5801fdeb427ee14ee9f
change-id: 20261201-i2c-qcom-cci-recovery-b0fc5589882a
Best regards,
--
Birk Skyum <birk.skyum@xxxxx>