[PATCH v7 12/14] drm/bridge: it6505: don't write an error code back to the reset register
From: Daniel Golle
Date: Thu Sep 24 2026 - 15:19:00 EST
it6505_audio_input() saves REG_RESET_CTRL, pulses AUDIO_RESET and
writes the saved value back. it6505_read() returns a negative errno on
i2c failure, which regmap truncates to eight bits on the way out:
-EIO turns into 0xfb, holding video, audio, AUX and HDCP in reset. A
failed REG_AUDIO_INPUT_FREQ read is just as wrong, as any negative
value passes the != 0xFF test and reports an audio clock that was
never sampled. Bail out before touching the register and only report
audio input for a usable readback.
Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver")
Signed-off-by: Daniel Golle <daniel@xxxxxxxxxxxxxx>
---
v7: no changes
v6: new patch
---
drivers/gpu/drm/bridge/ite-it6505.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index d6ba28d1c963..36bb4e905ef8 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -1516,12 +1516,15 @@ static bool it6505_audio_input(struct it6505 *it6505)
int reg05, regbe;
reg05 = it6505_read(it6505, REG_RESET_CTRL);
+ if (reg05 < 0)
+ return false;
+
it6505_set_bits(it6505, REG_RESET_CTRL, AUDIO_RESET, 0x00);
usleep_range(3000, 4000);
regbe = it6505_read(it6505, REG_AUDIO_INPUT_FREQ);
it6505_write(it6505, REG_RESET_CTRL, reg05);
- return regbe != 0xFF;
+ return regbe > 0 && regbe != 0xFF;
}
static void it6505_setup_audio_channel_status(struct it6505 *it6505)
--
2.55.0