1 From d0a44f399526a061e74b9a34b554f3d0e9cdddb3 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Thu, 19 Aug 2021 15:59:31 +0200
4 Subject: [PATCH] drm/vc4: hdmi: Warn if we access the controller while
7 We've had many silent hangs where the kernel would look like it just
8 stalled due to the access to one of the HDMI registers while the
9 controller was disabled.
11 Add a warning if we're about to do that so that it's at least not silent
14 Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
15 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
16 Link: https://patchwork.freedesktop.org/patch/msgid/20210819135931.895976-7-maxime@cerno.tech
18 drivers/gpu/drm/vc4/vc4_hdmi_regs.h | 6 ++++++
19 1 file changed, 6 insertions(+)
21 --- a/drivers/gpu/drm/vc4/vc4_hdmi_regs.h
22 +++ b/drivers/gpu/drm/vc4/vc4_hdmi_regs.h
24 #ifndef _VC4_HDMI_REGS_H_
25 #define _VC4_HDMI_REGS_H_
27 +#include <linux/pm_runtime.h>
31 #define VC4_HDMI_PACKET_STRIDE 0x24
32 @@ -415,6 +417,8 @@ static inline u32 vc4_hdmi_read(struct v
33 const struct vc4_hdmi_variant *variant = hdmi->variant;
36 + WARN_ON(!pm_runtime_active(&hdmi->pdev->dev));
38 if (reg >= variant->num_registers) {
39 dev_warn(&hdmi->pdev->dev,
40 "Invalid register ID %u\n", reg);
41 @@ -441,6 +445,8 @@ static inline void vc4_hdmi_write(struct
42 const struct vc4_hdmi_variant *variant = hdmi->variant;
45 + WARN_ON(!pm_runtime_active(&hdmi->pdev->dev));
47 if (reg >= variant->num_registers) {
48 dev_warn(&hdmi->pdev->dev,
49 "Invalid register ID %u\n", reg);