]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/vc4: hdmi: Avoid hang with debug registers when suspended
authorDom Cobley <popcornmix@gmail.com>
Fri, 21 Jun 2024 15:20:40 +0000 (16:20 +0100)
committerDave Stevenson <dave.stevenson@raspberrypi.com>
Mon, 9 Sep 2024 12:02:53 +0000 (13:02 +0100)
Trying to read /sys/kernel/debug/dri/1/hdmi1_regs
when the hdmi is disconnected results in a fatal system hang.

This is due to the pm suspend code disabling the dvp clock.
That is just a gate of the 108MHz clock in DVP_HT_RPI_MISC_CONFIG,
which results in accesses hanging AXI bus.

Protect against this.

Fixes: 25eb441d55d4 ("drm/vc4: hdmi: Add all the vc5 HDMI registers into the debugfs dumps")
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-17-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
drivers/gpu/drm/vc4/vc4_hdmi.c

index 60cbf1d4c7dd1fa72cda2fad0ac05b1619bf1224..28792dfa8c556a476d32d94353e63a65ed167410 100644 (file)
@@ -147,6 +147,8 @@ static int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused)
        if (!drm_dev_enter(drm, &idx))
                return -ENODEV;
 
+       WARN_ON(pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev));
+
        drm_print_regset32(&p, &vc4_hdmi->hdmi_regset);
        drm_print_regset32(&p, &vc4_hdmi->hd_regset);
        drm_print_regset32(&p, &vc4_hdmi->cec_regset);
@@ -156,6 +158,8 @@ static int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused)
        drm_print_regset32(&p, &vc4_hdmi->ram_regset);
        drm_print_regset32(&p, &vc4_hdmi->rm_regset);
 
+       pm_runtime_put(&vc4_hdmi->pdev->dev);
+
        drm_dev_exit(idx);
 
        return 0;