[PATCH v1 1/2] usb: typec: ucsi: gaokun: Forward HPD low on physical detach

From: Lee Youngjoon

Date: Thu Nov 26 2026 - 02:53:38 EST


On the MateBook E Go, removing the DP adapter can clear the mux, CC
orientation and HPD in a single EC update. By the time the driver checks
the SVID, the port is already out of DP mode and the HPD bridge misses
the disconnect.

Remember that a port has reported HPD high. If that port subsequently
reports no CC orientation, no mux and HPD low, forward the disconnect
even after the DP SVID is gone. Clear the remembered level so repeated
empty reports and USB-only activity do not generate extra disconnects.

Fixes: 1c2b66a7d725 ("usb: ucsi: huawei_gaokun: support mode switching")
Signed-off-by: Lee Youngjoon <getfeus@xxxxxxxxx>
---
drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c
b/drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c
index 9b51b60b2..9cb7c9bc1 100644
--- a/drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c
+++ b/drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c
@@ -99,6 +99,7 @@ struct gaokun_ucsi_port {
u16 svid;
u8 hpd_state;
u8 hpd_irq;
+ bool hpd_connected;
};

struct gaokun_ucsi {
@@ -326,12 +327,17 @@ static void gaokun_ucsi_handle_usb_mode(struct
gaokun_ucsi_port *port)
if (ret)
dev_err(uec->dev, "failed to set mux %d\n", ret);

- /* UCSI callback .connector_status() have set orientation */
- if (port->bridge && port->svid == USB_TYPEC_DP_SID)
+ /* A physical detach can clear the DP SVID together with HPD. */
+ if (port->bridge &&
+ (port->svid == USB_TYPEC_DP_SID ||
+ (port->hpd_connected && port->ccx == USBC_CCX_NONE &&
+ port->mux == USBC_MUX_NONE && !port->hpd_state))) {
+ port->hpd_connected = port->hpd_state;
drm_aux_hpd_bridge_notify(&port->bridge->dev,
port->hpd_state ?
connector_status_connected :
connector_status_disconnected);
+ }

gaokun_ec_ucsi_pan_ack(uec->ec, port->idx);
}