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 <jessica.zhang@oss.qualcomm.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>,
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 v2 06/10] drm/msm/dp: track DP_SINK_COUNT capability and sync prev_sink_count
Date: Fri, 27 Nov 2026 11:14:13 +0100 [thread overview]
Message-ID: <20261127101417.24303-7-gianfranco.mariotti94@gmail.com> (raw)
In-Reply-To: <20261127101417.24303-1-gianfranco.mariotti94@gmail.com>
msm_dp_panel_read_link_caps() only checked DP_SINK_COUNT on branch
devices (without checking count < 0 for AUX errors or updating
panel->link->sink_count when non-zero), while
msm_dp_link_parse_sink_status_field() unconditionally read DP_SINK_COUNT
on every sink.
On non-branch SST sinks that do not implement DP_SINK_COUNT and return 0
at DPCD 0x200, sink_count stayed 0 or flipped between 1 and 0 on
subsequent IRQ_HPD requests, causing msm_dp_display_prepare_link() to
bail out with -ENOTCONN or msm_dp_link_process_ds_port_status_change()
to misclassify link maintenance pulses as DS_PORT_STATUS_CHANGED.
Query drm_dp_read_sink_count_cap() in msm_dp_panel_read_link_caps() and
record it in link->has_sink_count, default sinks without DP_SINK_COUNT
support to sink_count = 1, keep sink_count and prev_sink_count
synchronized via msm_dp_link_set_sink_count(), and clear both on unplug.
Fixes: 8ede2ecc3e5e ("drm/msm/dp: Add DP compliance tests on Snapdragon Chipsets")
Fixes: b7ba5db9c863 ("drm/msm/dp: Use drm_dp_read_sink_count() helper")
Signed-off-by: Gianfranco Mariotti <gianfranco.mariotti94@gmail.com>
---
drivers/gpu/drm/msm/dp/dp_display.c | 3 +++
drivers/gpu/drm/msm/dp/dp_link.c | 26 +++++++++++++++++++++-----
drivers/gpu/drm/msm/dp/dp_link.h | 2 ++
drivers/gpu/drm/msm/dp/dp_panel.c | 19 +++++++++++++++----
4 files changed, 41 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index 3c15f984b29e..7831dd13b067 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -477,6 +477,9 @@ static int msm_dp_hpd_unplug_handle(struct msm_dp_display_private *dp)
if (dp->link->sink_count == 0)
msm_dp_display_host_phy_exit(dp);
+ dp->link->has_sink_count = false;
+ msm_dp_link_set_sink_count(dp->link, 0);
+
/*
* We don't need separate work for disconnect as
* connect/attention interrupts are disabled
diff --git a/drivers/gpu/drm/msm/dp/dp_link.c b/drivers/gpu/drm/msm/dp/dp_link.c
index 34a91e194a12..b619707b8e3b 100644
--- a/drivers/gpu/drm/msm/dp/dp_link.c
+++ b/drivers/gpu/drm/msm/dp/dp_link.c
@@ -720,12 +720,16 @@ static int msm_dp_link_parse_sink_status_field(struct msm_dp_link_private *link)
int ret;
link->prev_sink_count = link->msm_dp_link.sink_count;
- ret = drm_dp_read_sink_count(link->aux);
- if (ret < 0) {
- DRM_ERROR("DP parse sink count failed\n");
- return ret;
+ if (link->msm_dp_link.has_sink_count) {
+ ret = drm_dp_read_sink_count(link->aux);
+ if (ret < 0) {
+ DRM_ERROR("DP parse sink count failed\n");
+ return ret;
+ }
+ link->msm_dp_link.sink_count = ret;
+ } else {
+ link->msm_dp_link.sink_count = 1;
}
- link->msm_dp_link.sink_count = ret;
ret = drm_dp_dpcd_read_link_status(link->aux,
link->link_status);
@@ -1348,3 +1352,15 @@ struct msm_dp_link *msm_dp_link_get(struct device *dev, struct drm_dp_aux *aux)
return msm_dp_link;
}
+
+void msm_dp_link_set_sink_count(struct msm_dp_link *msm_dp_link, u8 sink_count)
+{
+ struct msm_dp_link_private *link;
+
+ if (!msm_dp_link)
+ return;
+
+ link = container_of(msm_dp_link, struct msm_dp_link_private, msm_dp_link);
+ msm_dp_link->sink_count = sink_count;
+ link->prev_sink_count = sink_count;
+}
diff --git a/drivers/gpu/drm/msm/dp/dp_link.h b/drivers/gpu/drm/msm/dp/dp_link.h
index 76125e9c07e9..11be55ade0a8 100644
--- a/drivers/gpu/drm/msm/dp/dp_link.h
+++ b/drivers/gpu/drm/msm/dp/dp_link.h
@@ -72,6 +72,7 @@ struct msm_dp_link {
u32 test_response;
u8 sink_count;
+ bool has_sink_count;
struct msm_dp_link_test_video test_video;
struct msm_dp_link_test_audio test_audio;
struct msm_dp_link_phy_params phy_params;
@@ -112,6 +113,7 @@ static inline u32 msm_dp_link_bit_depth_to_bpp(u32 tbd)
}
void msm_dp_link_reset_phy_params_vx_px(struct msm_dp_link *msm_dp_link);
+void msm_dp_link_set_sink_count(struct msm_dp_link *msm_dp_link, u8 sink_count);
u32 msm_dp_link_get_test_bits_depth(struct msm_dp_link *msm_dp_link, u32 bpp);
int msm_dp_link_process_request(struct msm_dp_link *msm_dp_link);
int msm_dp_link_get_colorimetry_config(struct msm_dp_link *msm_dp_link);
diff --git a/drivers/gpu/drm/msm/dp/dp_panel.c b/drivers/gpu/drm/msm/dp/dp_panel.c
index e633afdf2b47..0f81aaa7e6db 100644
--- a/drivers/gpu/drm/msm/dp/dp_panel.c
+++ b/drivers/gpu/drm/msm/dp/dp_panel.c
@@ -332,6 +332,7 @@ int msm_dp_panel_read_link_caps(struct msm_dp_panel *msm_dp_panel,
{
int rc, bw_code;
int count;
+ struct drm_dp_desc desc;
struct msm_dp_panel_private *panel;
if (!msm_dp_panel || !connector) {
@@ -356,12 +357,22 @@ int msm_dp_panel_read_link_caps(struct msm_dp_panel *msm_dp_panel,
return -EINVAL;
}
- if (drm_dp_is_branch(msm_dp_panel->dpcd)) {
+ rc = drm_dp_read_desc(panel->aux, &desc, drm_dp_is_branch(msm_dp_panel->dpcd));
+ if (rc)
+ return rc;
+
+ panel->link->has_sink_count =
+ drm_dp_read_sink_count_cap(connector, msm_dp_panel->dpcd, &desc);
+
+ if (panel->link->has_sink_count) {
count = drm_dp_read_sink_count(panel->aux);
- if (!count) {
- panel->link->sink_count = 0;
- return -ENOTCONN;
+ if (count <= 0) {
+ msm_dp_link_set_sink_count(panel->link, 0);
+ return count < 0 ? count : -ENOTCONN;
}
+ msm_dp_link_set_sink_count(panel->link, count);
+ } else {
+ msm_dp_link_set_sink_count(panel->link, 1);
}
rc = drm_dp_read_downstream_info(panel->aux, msm_dp_panel->dpcd,
--
2.25.1
next prev parent reply other threads:[~2026-11-27 10:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 10:14 [PATCH v2 00/10] drm/msm/dp: fix DisplayPort hotplug, link training, and multi-lane PHY setup Gianfranco Mariotti
2026-11-27 10:14 ` [PATCH v2 01/10] drm/msm/dp: configure voltage swing and pre-emphasis for all active lanes Gianfranco Mariotti
2026-11-27 10:14 ` [PATCH v2 02/10] drm/msm/dp: reset cached link_info before reading DPCD capabilities Gianfranco Mariotti
2026-11-27 10:14 ` [PATCH v2 03/10] drm/msm/dp: keep training pattern active until stream video is ready Gianfranco Mariotti
2026-11-27 10:14 ` [PATCH v2 04/10] drm/msm/dp: reinit video_comp and guard stream state on link maintenance Gianfranco Mariotti
2026-11-27 10:14 ` [PATCH v2 05/10] drm/msm/dp: avoid synchronous runtime PM put from HPD IRQ thread Gianfranco Mariotti
2026-11-27 10:14 ` Gianfranco Mariotti [this message]
2026-11-27 10:14 ` [PATCH v2 07/10] drm/msm/dp: fix HPD plugged, AUX gate, and runtime PM tracking Gianfranco Mariotti
2026-11-27 10:14 ` [PATCH v2 08/10] drm/msm/dp: keep PHY initialized while plugged across link unprepare Gianfranco Mariotti
2026-11-27 10:14 ` [PATCH v2 09/10] drm/msm/dp: re-read EDID on demand in get_modes when blob is missing Gianfranco Mariotti
2026-11-27 10:14 ` [PATCH v2 10/10] 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=20261127101417.24303-7-gianfranco.mariotti94@gmail.com \
--to=gianfranco.mariotti94@gmail.com \
--cc=abhinav.kumar@linux.dev \
--cc=airlied@gmail.com \
--cc=daleyo@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=jens.glathe@oldschoolsolutions.biz \
--cc=jessica.zhang@oss.qualcomm.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®