Skip to contentSkip to conversation

drm/msm/dp: allow eDP sinks without DP_SINK_COUNT

PATCH Superseded Vivek Kumar 3 participants 3 messages Sep 17 – Oct 1

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 drm/msm/dp: allow eDP sinks without DP_SINK_COUNT

Some eDP sinks, especially fixed-format eDP-to-HDMI bridge chips with no downstream AUX-capable panel behind them, do not report a non-zero DP_SINK_COUNT even though they participate normally in DPCD capability exchange and link training.

Treating sink_count == 0 as a permanent disconnect is valid for external DisplayPort, but it breaks eDP probe/enable paths in msm_dp_display_prepare_link().

Use the same eDP exemption as drm_dp_read_sink_count_cap() for the raw sink_count checks in this driver, via a small shared helper, so valid eDP outputs are not rejected as disconnected just because the downstream sink does not expose a usable DP_SINK_COUNT.

Tested on a Qualcomm QCS6490-based board driving a fixed-format eDP-to-HDMI bridge IC (chrontel,ch7218a).

---
 drivers/gpu/drm/msm/dp/dp_aux.c  |  8 ++++++++
 drivers/gpu/drm/msm/dp/dp_aux.h  |  1 +
 drivers/gpu/drm/msm/dp/dp_link.c | 10 ++++++++++
 3 files changed, 19 insertions(+)
drivers/gpu/drm/msm/dp/dp_aux.c +8 -0
index 3825a2fb48e2..3b5a4da93122 100644
@@ -679,6 +679,14 @@ u32 msm_dp_aux_is_link_connected(struct drm_dp_aux *msm_dp_aux)
 	return status;
 }
 
+bool msm_dp_aux_is_edp(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->is_edp;
+}
+
 struct drm_dp_aux *msm_dp_aux_get(struct device *dev,
 			      struct phy *phy,
 			      bool is_edp,
drivers/gpu/drm/msm/dp/dp_aux.h +1 -0
index 4be02e8b4d0b..9ab401c8526f 100644
@@ -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_edp(struct drm_dp_aux *msm_dp_aux);
 
 struct phy;
 struct drm_dp_aux *msm_dp_aux_get(struct device *dev,
drivers/gpu/drm/msm/dp/dp_link.c +10 -0
index 34a91e194a12..bf08b5b18097 100644
@@ -725,6 +725,16 @@ static int msm_dp_link_parse_sink_status_field(struct msm_dp_link_private *link)
 		DRM_ERROR("DP parse sink count failed\n");
 		return ret;
 	}
+
+	/*
+	 * Some eDP sinks do not report a valid sink count, even though they
+	 * otherwise participate in link training and DPCD capability exchange.
+	 * Treat a zero raw count as a valid non-zero placeholder so we do not
+	 * misclassify the link as disconnected on eDP.
+	 */
+	if (msm_dp_aux_is_edp(link->aux) && ret == 0)
+		ret = 1;
+
 	link->msm_dp_link.sink_count = ret;
 
 	ret = drm_dp_dpcd_read_link_status(link->aux,
Signature · 1 line
2.55.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] drm/msm/dp: eDP exemption missing in msm_dp_panel_read_link_caps and error code swallowed --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm/msm/dp: eDP exemption missing in msm_dp_panel_read_link_caps and error code swallowed --

commit 7281f0c6a3afd650cbe36bf532b8b56ce312bf5e
Author: Vivek Kumar <[email protected]>

drm/msm/dp: allow eDP sinks without DP_SINK_COUNT

Some eDP sinks, especially fixed-format eDP-to-HDMI bridge chips with no downstream AUX-capable panel behind them, do not report a non-zero DP_SINK_COUNT even though they participate normally in DPCD capability exchange and link training.

Treating sink_count == 0 as a permanent disconnect is valid for external DisplayPort, but it breaks eDP probe/enable paths in msm_dp_display_prepare_link().

Quoted 9 lines
drivers/gpu/drm/msm/dp/dp_link.c +1 -0
index 34a91e194a124..bf08b5b18097d 100644
@@ -725,6 +725,16 @@ static int msm_dp_link_parse_sink_status_field(struct msm_dp_link_private *link)
 		DRM_ERROR("DP parse sink count failed\n");
 		return ret;
 	}
+

drivers/gpu/drm/msm/dp/dp_link.c static int msm_dp_link_parse_sink_status_field(struct msm_dp_link_private *link) · line 738

Quoted 10 lines
drivers/gpu/drm/msm/dp/dp_link.c +9 -0
+	/*
+	 * Some eDP sinks do not report a valid sink count, even though they
+	 * otherwise participate in link training and DPCD capability exchange.
+	 * Treat a zero raw count as a valid non-zero placeholder so we do not
+	 * misclassify the link as disconnected on eDP.
+	 */
+	if (msm_dp_aux_is_edp(link->aux) && ret == 0)
+		ret = 1;
+
 	link->msm_dp_link.sink_count = ret;

[Severity: High]
Does this patch miss a similar check in msm_dp_panel_read_link_caps()?

Looking at drivers/gpu/drm/msm/dp/dp_panel.c, there is another check for the sink count that will still return -ENOTCONN for these eDP branch devices:

drivers/gpu/drm/msm/dp/dp_panel.c:msm_dp_panel_read_link_caps() {
	...
	count = drm_dp_read_sink_count(panel->aux);
	if (!count) {
		panel->link->sink_count = 0;
		return -ENOTCONN;
	}
	...
}

Because this duplicate check aborts the connection process, eDP-to-HDMI bridges reporting a zero sink count will still be broken, negating the purpose of this patch.

Additionally, could the check in msm_dp_panel_read_link_caps() be swallowing negative error codes? Since it only checks if (!count), a negative error code (like -EIO or -ETIMEDOUT) from drm_dp_read_sink_count() will evaluate to false, skipping the error block and allowing the code to continue with an invalid state instead of handling the error.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#2 lore raw
In reply to Vivek Kumar
Quoted 5 lines · Vivek Kumar

Some eDP sinks, especially fixed-format eDP-to-HDMI bridge chips with no downstream AUX-capable panel behind them, do not report a non-zero DP_SINK_COUNT even though they participate normally in DPCD capability exchange and link training.

Quoted 8 lines

Treating sink_count == 0 as a permanent disconnect is valid for external DisplayPort, but it breaks eDP probe/enable paths in msm_dp_display_prepare_link().

Use the same eDP exemption as drm_dp_read_sink_count_cap() for the raw sink_count checks in this driver, via a small shared helper, so valid eDP outputs are not rejected as disconnected just because the downstream sink does not expose a usable DP_SINK_COUNT.

This will still break if the DP has no sink count cap. Could you switch your workaround to using the function which you just mentioned?

Quoted 28 lines

Tested on a Qualcomm QCS6490-based board driving a fixed-format eDP-to-HDMI bridge IC (chrontel,ch7218a).

---
 drivers/gpu/drm/msm/dp/dp_aux.c  |  8 ++++++++
 drivers/gpu/drm/msm/dp/dp_aux.h  |  1 +
 drivers/gpu/drm/msm/dp/dp_link.c | 10 ++++++++++
 3 files changed, 19 insertions(+)
drivers/gpu/drm/msm/dp/dp_aux.h +1 -0
index 4be02e8b4d0b..9ab401c8526f 100644
@@ -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_edp(struct drm_dp_aux *msm_dp_aux);
 
 struct phy;
 struct drm_dp_aux *msm_dp_aux_get(struct device *dev,
drivers/gpu/drm/msm/dp/dp_link.c +0 -0
index 34a91e194a12..bf08b5b18097 100644

drivers/gpu/drm/msm/dp/dp_link.c static int msm_dp_link_parse_sink_status_field(struct msm_dp_link_private *link) · line 734

Quoted 10 lines
drivers/gpu/drm/msm/dp/dp_link.c +7 -0
@@ -725,6 +725,16 @@ static int msm_dp_link_parse_sink_status_field(struct msm_dp_link_private *link)
 		DRM_ERROR("DP parse sink count failed\n");
 		return ret;
 	}
+
+	/*
+	 * Some eDP sinks do not report a valid sink count, even though they
+	 * otherwise participate in link training and DPCD capability exchange.
+	 * Treat a zero raw count as a valid non-zero placeholder so we do not
+	 * misclassify the link as disconnected on eDP.
+	 */

I'm sorry, but this looks like you are using an AI agent. If so, please see Documentation/process/coding-assistants.rst.

The comment duplicates commit message and is generally useless. Please drop it.

Quoted 9 lines
drivers/gpu/drm/msm/dp/dp_link.c +3 -0
+	if (msm_dp_aux_is_edp(link->aux) && ret == 0)
+		ret = 1;
+
 	link->msm_dp_link.sink_count = ret;
 
 	ret = drm_dp_dpcd_read_link_status(link->aux,
Signature · 1 line
2.55.0
Signature · 2 lines
With best wishes
Dmitry