it6505_poweroff() asserts the reset line and disables the regulators
while link_works, hdcp_wait_ksv_list and hdcp_work may still be
running. The work items and the register accessors only check
it6505->powered, and the flag is cleared last, so a work item keeps
driving link training or HDCP authentication into a chip that is
already off until the flag catches up. Cancel the three work items
before touching the power rails. None of them takes a runtime PM
reference or extcon_lock, so the synchronous cancel is safe from
every context that powers the chip off.

Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver")
Assisted-by: LLM
Signed-off-by: Daniel Golle <[email protected]>
---
v7: new patch

---
 drivers/gpu/drm/bridge/ite-it6505.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/bridge/ite-it6505.c 
b/drivers/gpu/drm/bridge/ite-it6505.c
index e980cc6d5760..52d7d818a5ea 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -2804,6 +2804,9 @@ static int it6505_poweroff(struct it6505 *it6505)
        }
 
        disable_irq_nosync(it6505->irq);
+       cancel_work_sync(&it6505->link_works);
+       cancel_work_sync(&it6505->hdcp_wait_ksv_list);
+       cancel_delayed_work_sync(&it6505->hdcp_work);
 
        if (pdata->gpiod_reset)
                gpiod_set_value_cansleep(pdata->gpiod_reset, 1);
-- 
2.55.0

Reply via email to