c5227662017f3a914461fad92cd7685fae9e759d
[openwrt/staging/linusw.git] /
1 From f67dbf74cc7bce6d85b7c4b5b917c30f2dfc2626 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Mon, 5 Jul 2021 10:32:30 +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 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
15 ---
16 drivers/gpu/drm/vc4/vc4_hdmi_regs.h | 6 ++++++
17 1 file changed, 6 insertions(+)
18
19 --- a/drivers/gpu/drm/vc4/vc4_hdmi_regs.h
20 +++ b/drivers/gpu/drm/vc4/vc4_hdmi_regs.h
21 @@ -1,6 +1,8 @@
22 #ifndef _VC4_HDMI_REGS_H_
23 #define _VC4_HDMI_REGS_H_
24
25 +#include <linux/pm_runtime.h>
26 +
27 #include "vc4_hdmi.h"
28
29 #define VC4_HDMI_PACKET_STRIDE 0x24
30 @@ -412,6 +414,8 @@ static inline u32 vc4_hdmi_read(struct v
31 const struct vc4_hdmi_variant *variant = hdmi->variant;
32 void __iomem *base;
33
34 + WARN_ON(!pm_runtime_active(&hdmi->pdev->dev));
35 +
36 if (reg >= variant->num_registers) {
37 dev_warn(&hdmi->pdev->dev,
38 "Invalid register ID %u\n", reg);
39 @@ -438,6 +442,8 @@ static inline void vc4_hdmi_write(struct
40 const struct vc4_hdmi_variant *variant = hdmi->variant;
41 void __iomem *base;
42
43 + WARN_ON(!pm_runtime_active(&hdmi->pdev->dev));
44 +
45 if (reg >= variant->num_registers) {
46 dev_warn(&hdmi->pdev->dev,
47 "Invalid register ID %u\n", reg);