8e36b797943c8fd6ef5556027d88d25c93d65031
[openwrt/staging/pepe2k.git] /
1 From e5e7679d634b10e88df340c85cd8368c9f9989eb Mon Sep 17 00:00:00 2001
2 From: Dom Cobley <popcornmix@gmail.com>
3 Date: Tue, 5 Sep 2023 19:38:24 +0100
4 Subject: [PATCH] drm/vc4: hdmi: Avoid hang with debug registers when suspended
5
6 Trying to read /sys/kernel/debug/dri/1/hdmi1_regs
7 when the hdmi is disconnected results in a fatal system hang.
8
9 This is due to the pm suspend code disabling the dvp clock.
10 That is just a gate of the 108MHz clock in DVP_HT_RPI_MISC_CONFIG,
11 which results in accesses hanging AXI bus.
12
13 Protect against this.
14
15 Signed-off-by: Dom Cobley <popcornmix@gmail.com>
16 ---
17 drivers/gpu/drm/vc4/vc4_hdmi.c | 4 ++++
18 1 file changed, 4 insertions(+)
19
20 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
21 +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
22 @@ -193,6 +193,8 @@ static int vc4_hdmi_debugfs_regs(struct
23 if (!drm_dev_enter(drm, &idx))
24 return -ENODEV;
25
26 + WARN_ON(pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev));
27 +
28 drm_print_regset32(&p, &vc4_hdmi->hdmi_regset);
29 drm_print_regset32(&p, &vc4_hdmi->hd_regset);
30 drm_print_regset32(&p, &vc4_hdmi->cec_regset);
31 @@ -202,6 +204,8 @@ static int vc4_hdmi_debugfs_regs(struct
32 drm_print_regset32(&p, &vc4_hdmi->ram_regset);
33 drm_print_regset32(&p, &vc4_hdmi->rm_regset);
34
35 + pm_runtime_put(&vc4_hdmi->pdev->dev);
36 +
37 drm_dev_exit(idx);
38
39 return 0;