summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Norris <briannorris@chromium.org>2022-03-01 18:11:38 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-06-14 16:52:35 +0200
commit29b62b06774c41d0a5a7bb505bf367120bc70ecd (patch)
treef01db485030da46ba027a0264bcaf58b059e4055
parent8189f44270db1be78169e11eec51a3eeb980bc63 (diff)
downloadlinux-stable-29b62b06774c41d0a5a7bb505bf367120bc70ecd.tar.gz
linux-stable-29b62b06774c41d0a5a7bb505bf367120bc70ecd.tar.bz2
linux-stable-29b62b06774c41d0a5a7bb505bf367120bc70ecd.zip
drm/bridge: analogix_dp: Grab runtime PM reference for DP-AUX
commit 8fb6c44fe8468f92ac7b8bbfcca4404a4e88645f upstream. 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 a runtime PM reference, and check that we "see" the panel. Don't force any panel power-up, etc., because that can be intrusive, and that's not what other drivers do (see drivers/gpu/drm/bridge/ti-sn65dsi86.c and drivers/gpu/drm/bridge/parade-ps8640.c.) Fixes: 0d97ad03f422 ("drm/bridge: analogix_dp: Remove duplicated code") Cc: <stable@vger.kernel.org> Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com> Signed-off-by: Brian Norris <briannorris@chromium.org> Reviewed-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Douglas Anderson <dianders@chromium.org> Link: https://patchwork.freedesktop.org/patch/msgid/20220301181107.v4.1.I773a08785666ebb236917b0c8e6c05e3de471e75@changeid Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/gpu/drm/bridge/analogix/analogix_dp_core.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index 72ec93de0e76..d1077a342f38 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -1275,8 +1275,19 @@ 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;
+
+ pm_runtime_get_sync(dp->dev);
- return analogix_dp_transfer(dp, msg);
+ ret = analogix_dp_detect_hpd(dp);
+ if (ret)
+ goto out;
+
+ ret = analogix_dp_transfer(dp, msg);
+out:
+ pm_runtime_put(dp->dev);
+
+ return ret;
}
int analogix_dp_bind(struct device *dev, struct drm_device *drm_dev,