From ba83dd4a47bb47da3d2791b2ad6cd816a851b5d0 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Fri, 16 Oct 2026 10:52:43 +0300 Subject: [PATCH] regulator: rpi-panel-attiny: Fix probe failure after a host cold boot attiny_i2c_probe() reads REG_ID with attiny_i2c_read(), a function added in commit e4a7e3f741f7 ("regulator/rpi-panel-attiny: Use two transactions for I2C read") specifically for fixing REG_ID read failures at probe. On TI's BeagleY-AI (but also on other TI boards tested) with the Raspberry Pi 7-inch touchscreen, the first I2C transfer to the attiny after a cold boot of the board usually fails, so the probe fails. Retrying the transfer once fixes the problem. It is unclear why this happens, but as the earlier commit adding attiny_i2c_read() shows, attiny seems to have i2c issues. It is not out of the question that the issue could be on the TI i2c side, but as the other i2c peripherals (like sensors) work fine, adding this workaround to attiny driver feels sensible. Signed-off-by: Tomi Valkeinen Link: https://patch.msgid.link/20261016-attiny-probe-fix-v1-1-96337ba58dfa@ideasonboard.com Signed-off-by: Mark Brown --- drivers/regulator/rpi-panel-attiny-regulator.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/regulator/rpi-panel-attiny-regulator.c b/drivers/regulator/rpi-panel-attiny-regulator.c index 3020839b9ef1..77da916852e1 100644 --- a/drivers/regulator/rpi-panel-attiny-regulator.c +++ b/drivers/regulator/rpi-panel-attiny-regulator.c @@ -249,7 +249,13 @@ static int attiny_i2c_read(struct i2c_client *client, u8 reg, unsigned int *buf) msgs[0].len = ARRAY_SIZE(addr_buf); msgs[0].buf = addr_buf; + /* + * The first transfer after a power-up of the host usually fails on + * (at least) some TI boards, so retry the transfer on failure. + */ ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); + if (ret != ARRAY_SIZE(msgs)) + ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); if (ret != ARRAY_SIZE(msgs)) return -EIO;