[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210929144010.1.I773a08785666ebb236917b0c8e6c05e3de471e75@changeid>
Date: Wed, 29 Sep 2021 14:41:03 -0700
From: Brian Norris <briannorris@...omium.org>
To: Andrzej Hajda <a.hajda@...sung.com>,
Neil Armstrong <narmstrong@...libre.com>
Cc: dri-devel@...ts.freedesktop.org,
linux-rockchip@...ts.infradead.org,
Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
linux-kernel@...r.kernel.org, Jonas Karlman <jonas@...boo.se>,
Jernej Skrabec <jernej.skrabec@...il.com>,
Brian Norris <briannorris@...omium.org>,
stable@...r.kernel.org, Tomeu Vizoso <tomeu.vizoso@...labora.com>
Subject: [PATCH] drm/brdige: analogix_dp: Grab runtime PM reference for DP-AUX
If the display is not enable()d, then we aren't holding a runtime PM
reference here. Thus, it's easy to accidentally cause a hang, if user
space is poking around at /dev/drm_dp_aux0 at the "wrong" time.
Let's get the panel and PM state right before trying to talk AUX.
Fixes: 0d97ad03f422 ("drm/bridge: analogix_dp: Remove duplicated code")
Cc: <stable@...r.kernel.org>
Cc: Tomeu Vizoso <tomeu.vizoso@...labora.com>
Signed-off-by: Brian Norris <briannorris@...omium.org>
---
.../gpu/drm/bridge/analogix/analogix_dp_core.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index b7d2e4449cfa..a1b553904b85 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -1632,8 +1632,23 @@ static ssize_t analogix_dpaux_transfer(struct drm_dp_aux *aux,
struct drm_dp_aux_msg *msg)
{
struct analogix_dp_device *dp = to_dp(aux);
+ int ret, ret2;
- return analogix_dp_transfer(dp, msg);
+ ret = analogix_dp_prepare_panel(dp, true, false);
+ if (ret) {
+ DRM_DEV_ERROR(dp->dev, "Failed to prepare panel (%d)\n", ret);
+ return ret;
+ }
+
+ pm_runtime_get_sync(dp->dev);
+ ret = analogix_dp_transfer(dp, msg);
+ pm_runtime_put(dp->dev);
+
+ ret2 = analogix_dp_prepare_panel(dp, false, false);
+ if (ret2)
+ DRM_DEV_ERROR(dp->dev, "Failed to unprepare panel (%d)\n", ret2);
+
+ return ret;
}
struct analogix_dp_device *
--
2.33.0.685.g46640cef36-goog
Powered by blists - more mailing lists