Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
* [PATCH] soc: qcom: pmic_glink_altmode: Report HPD low when leaving DP alt mode
@ 2026-11-29 23:29 Joonhoe Kim
  0 siblings, 0 replies; only message in thread
From: Joonhoe Kim @ 2026-11-29 23:29 UTC (permalink / raw)
  To: andersson, konradybcio
  Cc: abelvesa, johan, lumag, yongxing.mou, linux-arm-msm, linux-kernel

Since commit 5090ac9191a1 ("soc: qcom: pmic_glink_altmode: fix spurious
DP hotplug events"), the HPD state is passed to the DP bridge only for
notifications with the DisplayPort SVID, so an unplug is reported only
if the firmware sends a DisplayPort notification with HPD low.

When a DP sink is unplugged during suspend-to-idle, the firmware on the
Lenovo Y700 Gen 5 (TB323FU, Kaanapali) sends only a notification with
the USB SVID and the mux disconnected. Neither the bridge nor the DP
driver is told that the sink is gone, so the connector stays connected
and a later detect tries to read the DPCD of the missing sink over AUX.
With the replay of the last HPD state on HPD enable proposed in [1],
that happens again on every resume.

Report HPD low once when a notification moves the port out of
DisplayPort mode after HPD was reported high. Such a notification
already switches the mux away from DisplayPort, so the HPD state now
follows the mux. Ports that never reported HPD high still get no
hotplug events.

Fixes: 5090ac9191a1 ("soc: qcom: pmic_glink_altmode: fix spurious DP hotplug events")
Link: https://lore.kernel.org/all/20260803-drm-usbdp-preboot-v1-1-2539b362be00@oss.qualcomm.com/ [1]
Signed-off-by: Joonhoe Kim <26rote@gmail.com>
---
Tested on a Lenovo Y700 Gen 5 (TB323FU, Kaanapali), with this change
on a v7.3-based tree that replays the last HPD state directly from
.hpd_enable: after a USB-C DP monitor was unplugged during s2idle, the
resume of the following suspend spent 6 ms in dpm_complete instead of
33 s.

This conflicts in context with "soc: qcom: pmic-glink-altmode: pass down
HPD_IRQ events" from Dmitry's hpd-irq-events series [2], which replaces
the drm_aux_hpd_bridge_notify() call in the DP branch. The added lines
are the same on either base; I can rebase if that lands first.

[2] https://lore.kernel.org/all/20261024-hpd-irq-events-v8-8-6ee949e7a384@oss.qualcomm.com/

 drivers/soc/qcom/pmic_glink_altmode.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/soc/qcom/pmic_glink_altmode.c b/drivers/soc/qcom/pmic_glink_altmode.c
index 9e8e103ef859..efcc722b50ed 100644
--- a/drivers/soc/qcom/pmic_glink_altmode.c
+++ b/drivers/soc/qcom/pmic_glink_altmode.c
@@ -121,6 +121,7 @@ struct pmic_glink_altmode_port {
 	u8 hpd_state;
 	u8 hpd_irq;
 	u8 mux_ctrl;
+	bool hpd_connected;
 };
 
 #define work_to_altmode(w) container_of((w), struct pmic_glink_altmode, enable_work)
@@ -375,6 +376,7 @@ static void pmic_glink_altmode_worker(struct work_struct *work)
 			conn_status = connector_status_disconnected;
 
 		drm_aux_hpd_bridge_notify(&alt_port->bridge->dev, conn_status);
+		alt_port->hpd_connected = conn_status == connector_status_connected;
 	} else if (alt_port->mux_ctrl == MUX_CTRL_STATE_TUNNELING) {
 		if (alt_port->svid == USB_TYPEC_TBT_SID)
 			pmic_glink_altmode_enable_tbt(altmode, alt_port);
@@ -390,6 +392,12 @@ static void pmic_glink_altmode_worker(struct work_struct *work)
 		pmic_glink_altmode_safe(altmode, alt_port);
 	}
 
+	if (alt_port->svid != USB_TYPEC_DP_SID && alt_port->hpd_connected) {
+		drm_aux_hpd_bridge_notify(&alt_port->bridge->dev,
+					  connector_status_disconnected);
+		alt_port->hpd_connected = false;
+	}
+
 	pmic_glink_altmode_request(altmode, ALTMODE_PAN_ACK, alt_port->index);
 }
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-29 23:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-29 23:29 [PATCH] soc: qcom: pmic_glink_altmode: Report HPD low when leaving DP alt mode Joonhoe Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox