Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Joonhoe Kim <26rote@gmail.com>
To: andersson@kernel.org, konradybcio@kernel.org
Cc: abelvesa@kernel.org, johan@kernel.org, lumag@kernel.org,
	yongxing.mou@oss.qualcomm.com, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] soc: qcom: pmic_glink_altmode: Report HPD low when leaving DP alt mode
Date: Mon, 30 Nov 2026 08:29:15 +0900	[thread overview]
Message-ID: <20261129232915.468-1-26rote@gmail.com> (raw)

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


                 reply	other threads:[~2026-11-29 23:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261129232915.468-1-26rote@gmail.com \
    --to=26rote@gmail.com \
    --cc=abelvesa@kernel.org \
    --cc=andersson@kernel.org \
    --cc=johan@kernel.org \
    --cc=konradybcio@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lumag@kernel.org \
    --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