[PATCH v9 08/22] drm/bridge: synopsys: dw-dp: Fix support for short I2C reads
Sebastian Reichel <[email protected]> Mon, 03 Aug 2026 20:05:09 +0200
| Newsgroups | org.freedesktop.lists.dri-devel,org.infradead.lists.linux-arm-kernel,org.infradead.lists.linux-rockchip,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <20260803-synopsys-dw-dp-improvements-v9-8-2e6e46135312@collabora.com> |
The transfer functions returns the amount of bytes read for
DP_AUX_I2C_READ. By returning -EBUSY for short reads, the caller has
less information available what is going wrong and possibly simply
resends the read request. On sinks not supporting long reads, this will
simply run into the same issue again.
Instead it makes more sense to return the data from the short read with
the length information, which allows drm_dp_i2c_do_msg() to read data in
smaller chunks and succeed in the end.
Due to lack of a sink, which only supports short reads, this change is
effectively untested.
Fixes: 86eecc3a9c2e ("drm/bridge: synopsys: Add DW DPTX Controller support library")
Reported-by: Sashiko <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
---
drivers/gpu/drm/bridge/synopsys/dw-dp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-dp.c b/drivers/gpu/drm/bridge/synopsys/dw-dp.c
index 8b587a4c5e93..22a244de08aa 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-dp.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-dp.c
@@ -1513,7 +1513,7 @@ static ssize_t dw_dp_aux_transfer(struct drm_dp_aux *aux,
if (msg->request & DP_AUX_I2C_READ) {
size_t count = FIELD_GET(AUX_BYTES_READ, value) - 1;
- if (count != msg->size)
+ if (!count || count > msg->size)
return -EBUSY;
ret = dw_dp_aux_read_data(dp, msg->buffer, count);
--
2.53.0