[PATCH v1 0/2] usb: typec: ucsi: gaokun: Validate and defer port updates

From: Lee Youngjoon

Date: Thu Nov 26 2026 - 02:31:35 EST


Hi,

On the Huawei MateBook E Go the EC reports UCSI connector changes (0x21)
and USB port updates (0x22) on the same threaded IRQ. The connector
callback currently waits up to two seconds for an event that this IRQ
thread would dispatch. Also, a failed port-register read is handled like
a valid empty mask and can generate a PAN acknowledgment.

Patch 1 validates the EC reply before selecting a port or sending an
acknowledgment. Patch 2 moves the missing-event recheck to per-connector
delayed work. A real USB update retires only the matching recheck. The
existing two-second interval and the first-set-bit policy for a real USB
event are preserved.

The IRQ wait and the mutable port-count bound were also raised in this
earlier review:
https://lore.kernel.org/r/20260607214621.9586A1F00893@xxxxxxxxxxxxxxx

Testing was done against usb-next, building an arm64 Image and modules
at each commit. To exercise the firmware-facing behavior without moving
cables, substitute the D3 register reply at gaokun_ec_ucsi_get_reg()
and capture the connector argument to gaokun_ec_ucsi_pan_ack(). For a
two-port reply, use update mask 01 and port data 04 00 02 00. Queue a
right-port connector change and let the timeout expire: there should be
one D3 read and no D2 write. Next deliver a real 0x22 with update mask
02 and port data 04 00 09 19: the driver should process the right port
and request an ACK for port index 1. A valid zero mask on a real 0x22
retains the no-port ACK. These cases replay EC outputs on the host and
observe the resulting firmware inputs. They do not emulate the EC's
decision to generate a new interrupt.

The two patches use the existing EC API. The separate EC transport fix
is needed for the parent to report all short I2C transfers reliably.
This series does not add speculative firmware ACKs or change DP training.
The isolated series has been tested in host-side replay. System suspend
and resume on hardware remain unverified.

OpenAI Codex assisted with source inspection, the fixes, regression tests
and drafting this series.

Thanks,
Lee Youngjoon

Lee Youngjoon (2):
usb: typec: ucsi: gaokun: Distinguish empty updates from EC errors
usb: typec: ucsi: gaokun: Defer missing USB events per connector

drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c | 138 ++++++++++++--------
1 file changed, 85 insertions(+), 53 deletions(-)


base-commit: 90d6263e867be7089b3d3323bef8d2accd327c77