adf4709e2dbc08c9cfc918350ee31081f510b3ef
[openwrt/staging/dangole.git] /
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
5 disabled
6
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.
10
11 Add a warning if we're about to do that so that it's at least not silent
12 anymore.
13
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
17 ---
18 drivers/gpu/drm/vc4/vc4_hdmi_regs.h | 6 ++++++
19 1 file changed, 6 insertions(+)
20
21 --- a/drivers/gpu/drm/vc4/vc4_hdmi_regs.h
22 +++ b/drivers/gpu/drm/vc4/vc4_hdmi_regs.h
23 @@ -1,6 +1,8 @@
24 #ifndef _VC4_HDMI_REGS_H_
25 #define _VC4_HDMI_REGS_H_
26
27 +#include <linux/pm_runtime.h>
28 +
29 #include "vc4_hdmi.h"
30
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;
34 void __iomem *base;
35
36 + WARN_ON(!pm_runtime_active(&hdmi->pdev->dev));
37 +
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;
43 void __iomem *base;
44
45 + WARN_ON(!pm_runtime_active(&hdmi->pdev->dev));
46 +
47 if (reg >= variant->num_registers) {
48 dev_warn(&hdmi->pdev->dev,
49 "Invalid register ID %u\n", reg);