From: Gianfranco Mariotti <gianfranco.mariotti94@gmail.com>
To: Rob Clark <robin.clark@oss.qualcomm.com>,
Dmitry Baryshkov <lumag@kernel.org>,
Abhinav Kumar <abhinav.kumar@linux.dev>,
Jessica Zhang <jesszhan0024@gmail.com>,
Sean Paul <sean@poorly.run>,
Marijn Suijten <marijn.suijten@somainline.org>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>
Cc: Yongxing Mou <yongxing.mou@oss.qualcomm.com>,
Xiangxu Yin <xiangxu.yin@oss.qualcomm.com>,
Dale Whinham <daleyo@gmail.com>,
Stephen Boyd <swboyd@chromium.org>,
Bjorn Andersson <andersson@kernel.org>,
Jens Glathe <jens.glathe@oldschoolsolutions.biz>,
linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Gianfranco Mariotti <gianfranco.mariotti94@gmail.com>
Subject: [PATCH v3 10/11] drm/msm/dp: guard internal HPD state checks when external HPD is used
Date: Thu, 3 Dec 2026 00:46:39 +0100 [thread overview]
Message-ID: <20261202234640.9379-11-gianfranco.mariotti94@gmail.com> (raw)
In-Reply-To: <20261202234640.9379-1-gianfranco.mariotti94@gmail.com>
When DisplayPort HPD is handled by a downstream bridge (such as USB
Type-C AltMode or display-connector with hpd-gpios, including behind a
QMP combo PHY drm_aux_bridge), msm_dp_bridge_hpd_enable() is never
called and REG_DP_DP_HPD_CTRL remains disabled. As a result,
msm_dp_aux_is_link_connected() unconditionally reads 0
(ISR_DISCONNECTED) even while a sink is physically connected:
- In msm_dp_ctrl_on_link(), failing DP_TRAINING_1 or DP_TRAINING_2
immediately breaks out of the training loop instead of downshifting
the link rate or lane count; in addition, the return value of
drm_dp_dpcd_read_link_status() was unchecked, leaving link_status
uninitialized on AUX errors.
- In msm_dp_display_process_hpd_high(), a failed EDID read falsely
treats the link as unplugged and aborts with -ETIMEDOUT.
- In msm_dp_aux_transfer(), AUX timeouts skip msm_dp_aux_reset().
Track whether the controller's internal HPD block is enabled via
msm_dp_aux_is_hpd_enabled(), gate those internal HPD state checks on it
(also returning false immediately in msm_dp_display_is_dongle_plugged()
when internal HPD is enabled and reports ISR_DISCONNECTED), and check
drm_dp_dpcd_read_link_status() <= 0 in msm_dp_ctrl_on_link(). Keep the
!priv->plugged && !ret guard in msm_dp_bridge_detect() unconditional so
USB Type-C connectors using drm_aux_hpd_bridge stay disconnected until
AltMode mux and orientation setup notify HPD.
Fixes: a8e981ac2d0e ("drm/msm/dp: enable HDP plugin/unplugged interrupts at hpd_enable/disable")
Fixes: 5043357e75ba ("drm/msm/dp: rework HPD handling")
Signed-off-by: Gianfranco Mariotti <gianfranco.mariotti94@gmail.com>
---
drivers/gpu/drm/msm/dp/dp_aux.c | 13 ++++++++++++-
drivers/gpu/drm/msm/dp/dp_aux.h | 1 +
drivers/gpu/drm/msm/dp/dp_ctrl.c | 14 ++++++++++----
drivers/gpu/drm/msm/dp/dp_display.c | 7 ++++++-
4 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/msm/dp/dp_aux.c b/drivers/gpu/drm/msm/dp/dp_aux.c
index 3825a2fb48e2..74a90d8de167 100644
--- a/drivers/gpu/drm/msm/dp/dp_aux.c
+++ b/drivers/gpu/drm/msm/dp/dp_aux.c
@@ -40,6 +40,7 @@ struct msm_dp_aux_private {
bool initted;
bool is_edp;
bool enable_xfers;
+ bool hpd_enabled;
u32 offset;
u32 segment;
@@ -412,7 +413,7 @@ static ssize_t msm_dp_aux_transfer(struct drm_dp_aux *msm_dp_aux,
phy_calibrate(aux->phy);
}
/* reset aux if link is in connected state */
- if (msm_dp_aux_is_link_connected(msm_dp_aux))
+ if (!aux->hpd_enabled || msm_dp_aux_is_link_connected(msm_dp_aux))
msm_dp_aux_reset(aux);
} else {
aux->retry_cnt = 0;
@@ -606,6 +607,7 @@ void msm_dp_aux_hpd_enable(struct drm_dp_aux *msm_dp_aux)
/* Enable HPD */
msm_dp_write_aux(aux, REG_DP_DP_HPD_CTRL, DP_DP_HPD_CTRL_HPD_EN);
+ aux->hpd_enabled = true;
}
void msm_dp_aux_hpd_disable(struct drm_dp_aux *msm_dp_aux)
@@ -614,6 +616,7 @@ void msm_dp_aux_hpd_disable(struct drm_dp_aux *msm_dp_aux)
container_of(msm_dp_aux, struct msm_dp_aux_private, msm_dp_aux);
u32 reg;
+ aux->hpd_enabled = false;
reg = msm_dp_read_aux(aux, REG_DP_DP_HPD_REFTIMER);
reg &= ~DP_DP_HPD_REFTIMER_ENABLE;
msm_dp_write_aux(aux, REG_DP_DP_HPD_REFTIMER, reg);
@@ -679,6 +682,14 @@ u32 msm_dp_aux_is_link_connected(struct drm_dp_aux *msm_dp_aux)
return status;
}
+bool msm_dp_aux_is_hpd_enabled(struct drm_dp_aux *msm_dp_aux)
+{
+ struct msm_dp_aux_private *aux =
+ container_of(msm_dp_aux, struct msm_dp_aux_private, msm_dp_aux);
+
+ return aux->hpd_enabled;
+}
+
struct drm_dp_aux *msm_dp_aux_get(struct device *dev,
struct phy *phy,
bool is_edp,
diff --git a/drivers/gpu/drm/msm/dp/dp_aux.h b/drivers/gpu/drm/msm/dp/dp_aux.h
index 4be02e8b4d0b..d3cf281f159a 100644
--- a/drivers/gpu/drm/msm/dp/dp_aux.h
+++ b/drivers/gpu/drm/msm/dp/dp_aux.h
@@ -22,6 +22,7 @@ void msm_dp_aux_hpd_intr_enable(struct drm_dp_aux *msm_dp_aux);
void msm_dp_aux_hpd_intr_disable(struct drm_dp_aux *msm_dp_aux);
u32 msm_dp_aux_get_hpd_intr_status(struct drm_dp_aux *msm_dp_aux);
u32 msm_dp_aux_is_link_connected(struct drm_dp_aux *msm_dp_aux);
+bool msm_dp_aux_is_hpd_enabled(struct drm_dp_aux *msm_dp_aux);
struct phy;
struct drm_dp_aux *msm_dp_aux_get(struct device *dev,
diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c b/drivers/gpu/drm/msm/dp/dp_ctrl.c
index ceff9a99147f..36fc9c6bd9f4 100644
--- a/drivers/gpu/drm/msm/dp/dp_ctrl.c
+++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c
@@ -2435,10 +2435,13 @@ int msm_dp_ctrl_on_link(struct msm_dp_ctrl *msm_dp_ctrl,
break;
} else if (training_step == DP_TRAINING_1) {
/* link train_1 failed */
- if (!msm_dp_aux_is_link_connected(ctrl->aux))
+ if (msm_dp_aux_is_hpd_enabled(ctrl->aux) &&
+ !msm_dp_aux_is_link_connected(ctrl->aux))
break;
- drm_dp_dpcd_read_link_status(ctrl->aux, link_status);
+ if (drm_dp_dpcd_read_link_status(ctrl->aux,
+ link_status) <= 0)
+ break;
rc = msm_dp_ctrl_link_rate_down_shift(ctrl);
if (rc < 0) { /* already in RBR = 1.6G */
@@ -2460,10 +2463,13 @@ int msm_dp_ctrl_on_link(struct msm_dp_ctrl *msm_dp_ctrl,
}
} else if (training_step == DP_TRAINING_2) {
/* link train_2 failed */
- if (!msm_dp_aux_is_link_connected(ctrl->aux))
+ if (msm_dp_aux_is_hpd_enabled(ctrl->aux) &&
+ !msm_dp_aux_is_link_connected(ctrl->aux))
break;
- drm_dp_dpcd_read_link_status(ctrl->aux, link_status);
+ if (drm_dp_dpcd_read_link_status(ctrl->aux,
+ link_status) <= 0)
+ break;
if (!drm_dp_clock_recovery_ok(link_status,
ctrl->link->link_params.num_lanes))
diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index b83de4c3d234..b4ea61a88d68 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -294,7 +294,8 @@ static int msm_dp_display_process_hpd_high(struct msm_dp_display_private *dp)
if (connector->force != DRM_FORCE_OFF)
DRM_ERROR("panel edid read failed\n");
/* check edid read fail is due to unplug */
- if (!msm_dp_aux_is_link_connected(dp->aux)) {
+ if (msm_dp_aux_is_hpd_enabled(dp->aux) &&
+ !msm_dp_aux_is_link_connected(dp->aux)) {
rc = -ETIMEDOUT;
goto end;
}
@@ -1693,6 +1694,10 @@ static bool msm_dp_display_is_dongle_plugged(struct msm_dp_display_private *dp,
if (!dp->plugged || !dp->link->has_sink_count)
return false;
+ if (msm_dp_aux_is_hpd_enabled(dp->aux) &&
+ hpd_link_status == ISR_DISCONNECTED)
+ return false;
+
if (!dp->link->sink_count && hpd_link_status != ISR_DISCONNECTED)
return true;
--
2.25.1
next prev parent reply other threads:[~2026-12-02 23:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 23:46 [PATCH v3 00/11] drm/msm/dp: fix DisplayPort hotplug, link training, PHY lifecycle, and external HPD Gianfranco Mariotti
2026-12-02 23:46 ` [PATCH v3 01/11] drm/msm/dp: configure voltage swing and pre-emphasis for all active lanes Gianfranco Mariotti
2026-12-02 23:46 ` [PATCH v3 02/11] drm/msm/dp: reset cached link_info before reading DPCD capabilities Gianfranco Mariotti
2026-12-02 23:46 ` [PATCH v3 03/11] drm/msm/dp: keep training pattern active until stream video is ready Gianfranco Mariotti
2026-12-02 23:46 ` [PATCH v3 04/11] drm/msm/dp: reinit video_comp and guard stream state on link maintenance Gianfranco Mariotti
2026-12-02 23:46 ` [PATCH v3 05/11] drm/msm/dp: avoid synchronous runtime PM put from HPD IRQ thread Gianfranco Mariotti
2026-12-02 23:46 ` [PATCH v3 06/11] drm/msm/dp: track DP_SINK_COUNT capability and sync prev_sink_count Gianfranco Mariotti
2026-12-02 23:46 ` [PATCH v3 07/11] drm/msm/dp: fix HPD plugged, AUX gate, and runtime PM tracking Gianfranco Mariotti
2026-12-02 23:46 ` [PATCH v3 08/11] drm/msm/dp: keep PHY initialized while plugged across link unprepare Gianfranco Mariotti
2026-12-02 23:46 ` [PATCH v3 09/11] drm/msm/dp: re-read EDID on demand in get_modes when blob is missing Gianfranco Mariotti
2026-12-02 23:46 ` Gianfranco Mariotti [this message]
2026-12-02 23:46 ` [PATCH v3 11/11] drm/msm/dp: dispatch native IRQ_HPD directly to msm_dp_irq_hpd_handle() Gianfranco Mariotti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261202234640.9379-11-gianfranco.mariotti94@gmail.com \
--to=gianfranco.mariotti94@gmail.com \
--cc=abhinav.kumar@linux.dev \
--cc=airlied@gmail.com \
--cc=andersson@kernel.org \
--cc=daleyo@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=jens.glathe@oldschoolsolutions.biz \
--cc=jesszhan0024@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lumag@kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=robin.clark@oss.qualcomm.com \
--cc=sean@poorly.run \
--cc=simona@ffwll.ch \
--cc=swboyd@chromium.org \
--cc=xiangxu.yin@oss.qualcomm.com \
--cc=yongxing.mou@oss.qualcomm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®