[PATCH v9 07/22] drm/bridge: synopsys: dw-dp: Fix AUX transfer timeout race condition
Sebastian Reichel <[email protected]> Mon, 03 Aug 2026 20:05:08 +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-7-2e6e46135312@collabora.com> |
The DP AUX transfer method uses a completion triggered by an interrupt, which can timeout. If the function runs into the timeout and the interrupt fires afterwards, the following DP aux transfer completion would trigger immediately without waiting for the interrupt. This in turn means the next one would also be broken and so on. Fix this potential issue by re-initializing the completion directly before sending the AUX command. As this is racy (the interrupt might arrive between the completion re-init and the new command being programmed), also reset the AUX controller on timeouts and synchronize pending interrupts to gurantee that there are no pending AUX transfers when the dw_dp_aux_transfer() returns. Due to lack of a sink, which generates AUX timeouts, this change is effectively untested. Reported-by: Sashiko <[email protected]> Fixes: 86eecc3a9c2e ("drm/bridge: synopsys: Add DW DPTX Controller support library") Signed-off-by: Sebastian Reichel <[email protected]> --- drivers/gpu/drm/bridge/synopsys/dw-dp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-dp.c b/drivers/gpu/drm/bridge/synopsys/dw-dp.c index af3fa7886429..8b587a4c5e93 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-dp.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-dp.c @@ -1466,6 +1466,8 @@ static ssize_t dw_dp_aux_transfer(struct drm_dp_aux *aux, if (WARN_ON(msg->size > 16)) return -E2BIG; + reinit_completion(&dp->complete); + switch (msg->request & ~DP_AUX_I2C_MOT) { case DP_AUX_NATIVE_WRITE: case DP_AUX_I2C_WRITE: @@ -1492,6 +1494,12 @@ static ssize_t dw_dp_aux_transfer(struct drm_dp_aux *aux, status = wait_for_completion_timeout(&dp->complete, timeout); if (!status) { dev_err(dp->dev, "timeout waiting for AUX reply\n"); + regmap_update_bits(dp->regmap, DW_DP_SOFT_RESET_CTRL, + AUX_RESET, FIELD_PREP(AUX_RESET, 1)); + usleep_range(10, 20); + regmap_update_bits(dp->regmap, DW_DP_SOFT_RESET_CTRL, + AUX_RESET, FIELD_PREP(AUX_RESET, 0)); + synchronize_irq(dp->irq); return -ETIMEDOUT; } -- 2.53.0