rt1711h_probe() masks all alerts before tcpci_register_port() and only writes the real mask after devm_request_threaded_irq(). TCPM starts looking for a partner several milliseconds after the registration returns. The ET7304 (RT1715 compatible) does not latch a CC status change in TCPC_ALERT while its mask bit is clear, and setting the bit later does not bring it back. If the partner shows up before the mask is written, CC_STATUS has the Rd but no alert is pending. TCPM stays in SRC_UNATTACHED and VBUS stays off until the cable is replugged. On a Radxa Cubie A7Z (Allwinner A733) with PREEMPT_RT, a source-only port and a sink attached at boot, 6 of 12 boots ended like that. In each of them the mask write finished after TCPM started driving Rp, and in each of the other six it finished before. With this change 0 of 12 failed. Write the mask right before the registration, so the setup before it still runs masked, and drop the write after the interrupt request. The interrupt is still requested after the registration. It is level triggered, so an alert raised in between is handled once it is requested. Fixes: d6b82dafd17d ("usb: typec: tcpci_rt1711h: Unmask alert interrupts to fix functionality") Cc: stable@vger.kernel.org Signed-off-by: Vinicius Pedrosa Reviewed-by: Heikki Krogerus --- v2: rebase on usb-testing, as Greg asked. The context in probe() changed (cable_comm_capable); the diff is otherwise the same. v1: https://lore.kernel.org/r/20261126195059.1139494-1-vinicius.eduardo.pedrosa@gmail.com/ drivers/usb/typec/tcpm/tcpci_rt1711h.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/usb/typec/tcpm/tcpci_rt1711h.c b/drivers/usb/typec/tcpm/tcpci_rt1711h.c index 0fc583077078..a5688876a06a 100644 --- a/drivers/usb/typec/tcpm/tcpci_rt1711h.c +++ b/drivers/usb/typec/tcpm/tcpci_rt1711h.c @@ -338,6 +338,15 @@ static int rt1711h_probe(struct i2c_client *client) chip->data.set_vconn = rt1711h_set_vconn; chip->data.start_drp_toggling = rt1711h_start_drp_toggling; chip->data.cable_comm_capable = true; + + /* + * Unmask alerts before TCPM starts looking for a partner. The ET7304 + * does not latch CC changes in ALERT while its mask bit is clear. + */ + ret = rt1711h_write16(chip, TCPC_ALERT_MASK, alert_mask); + if (ret < 0) + return ret; + chip->tcpci = tcpci_register_port(chip->dev, &chip->data); if (IS_ERR_OR_NULL(chip->tcpci)) return PTR_ERR(chip->tcpci); @@ -353,11 +362,6 @@ static int rt1711h_probe(struct i2c_client *client) if (ret < 0) return ret; - /* Enable alert interrupts */ - ret = rt1711h_write16(chip, TCPC_ALERT_MASK, alert_mask); - if (ret < 0) - return ret; - enable_irq_wake(client->irq); return 0; -- 2.43.0