mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] regulator: rpi-panel-attiny: Fix probe failure after a host cold boot
@ 2026-10-16  7:52 Tomi Valkeinen
  2026-10-16 20:00 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Tomi Valkeinen @ 2026-10-16  7:52 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Dave Stevenson, Marek Vasut
  Cc: Devarsh Thakkar, linux-kernel, Tomi Valkeinen

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 <tomi.valkeinen@ideasonboard.com>
---
 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;
 

---
base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
change-id: 20261016-attiny-probe-fix-04e447327cf9

Best regards,
--  
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-18  9:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-16  7:52 [PATCH] regulator: rpi-panel-attiny: Fix probe failure after a host cold boot Tomi Valkeinen
2026-10-16 20:00 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®