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

From: Lee Youngjoon

Date: Tue Dec 01 2026 - 05:52:03 EST


Hi,

The Huawei MateBook E Go EC reports connector changes (0x21) and USB
port updates (0x22) on the same threaded IRQ. A failed port-register
read can cause an empty acknowledgment. Waiting for a USB event inside
the connector callback also blocks the IRQ thread that delivers it.

Pengyu pointed out that the proposed EC acknowledgment fix used a fixed
port count while the UCSI driver read the count from the EC. In v3 the
UCSI driver validates the initial D3 count against the register layout
and uses it to select the port. The parent writes the resulting mask
to D2. This uses the existing D3 read and preserves the zero-mask
acknowledgment for a genuine empty USB update.

Patch 1 replaces the PAN ACK patch in the platform series [1] as well
as patch 1 of the previous USB series [2]. Please drop the earlier
PAN ACK patch if taking this version. The separate short-I2C-transfer
fix [3] is still needed and applies independently. Both in-tree users
and the EC helper change together in patch 1. Patch 2 retains the
two-second deferred recheck for each connector.

Changes since v2:
- Derive the active port count from D3. Use a single byte stride to
bound that count and index the port data.
- Construct the ACK mask in the UCSI driver and pass it to the EC
writer. The EC driver no longer needs a connector index or sentinel.
- Rebase onto usb-next. Keep both patches marked for stable.

I cross-built the arm64 Image and modules at each commit. To exercise
the firmware interface without reconnecting a cable, the host test
supplies D3 replies at the I2C boundary and records the actual D2
frames. For a one-port reply, mask 0x02 produces no D2 write. For a
two-port reply, mask 0x02 acknowledges the second port. A real event
with mask zero writes zero, while a timed-out recheck with no matching
update sends nothing. The tests also cover changing port counts and
pending timeout work. The short-transfer case was tested separately
with [3] applied. I have not run this revision on hardware.

OpenAI Codex assisted with source inspection, implementation, the mock
tests and drafting this series.

[1] https://lore.kernel.org/r/CA+m4KrC4-oEkg2_+_B=kn5ObqAd1ZB+f+hpe53Cmqx47LHnGDQ@xxxxxxxxxxxxxx/
[2] https://lore.kernel.org/r/CA+m4KrDEqZ9zRUsTTEfPNbLu2jF5XUF=u30tKE4_Z98C594nPw@xxxxxxxxxxxxxx/
[3] https://lore.kernel.org/r/CA+m4KrCviR01-RnsX2RkaCUr_iXHbQjObtdiUmRfZm8ooOGWYg@xxxxxxxxxxxxxx/

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/platform/arm64/huawei-gaokun-ec.c | 16 +-
drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c | 147 +++++++++++-------
.../linux/platform_data/huawei-gaokun-ec.h | 4 +-
3 files changed, 97 insertions(+), 70 deletions(-)


base-commit: 9357829ac604c28510b71b154cb6630af81226ff