drm/vc4: hdmi: Avoid hang with debug registers when suspended
authorDom Cobley <popcornmix@gmail.com>
Tue, 5 Sep 2023 18:38:24 +0000 (19:38 +0100)
committerDom Cobley <popcornmix@gmail.com>
Mon, 19 Feb 2024 11:34:56 +0000 (11:34 +0000)
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.

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
drivers/gpu/drm/vc4/vc4_hdmi.c

index a546853..18c79be 100644 (file)
@@ -185,6 +185,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);
@@ -194,6 +196,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;