Skip to content

Commit 808a8b9

Browse files
Christian A. Ehrhardtgregkh
authored andcommitted
usb: typec: ucsi: Check for notifications after init
The completion notification for the final SET_NOTIFICATION_ENABLE command during initialization can include a connector change notification. However, at the time this completion notification is processed, the ucsi struct is not ready to handle this notification. As a result the notification is ignored and the controller never sends an interrupt again. Re-check CCI for a pending connector state change after initialization is complete. Adjust the corresponding debug message accordingly. Fixes: 71a1fa0 ("usb: typec: ucsi: Store the notification mask") Cc: [email protected] Signed-off-by: Christian A. Ehrhardt <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Tested-by: Neil Armstrong <[email protected]> # on SM8550-QRD Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 15b2e71 commit 808a8b9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

drivers/usb/typec/ucsi/ucsi.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,7 @@ void ucsi_connector_change(struct ucsi *ucsi, u8 num)
12371237
struct ucsi_connector *con = &ucsi->connector[num - 1];
12381238

12391239
if (!(ucsi->ntfy & UCSI_ENABLE_NTFY_CONNECTOR_CHANGE)) {
1240-
dev_dbg(ucsi->dev, "Bogus connector change event\n");
1240+
dev_dbg(ucsi->dev, "Early connector change event\n");
12411241
return;
12421242
}
12431243

@@ -1636,6 +1636,7 @@ static int ucsi_init(struct ucsi *ucsi)
16361636
{
16371637
struct ucsi_connector *con, *connector;
16381638
u64 command, ntfy;
1639+
u32 cci;
16391640
int ret;
16401641
int i;
16411642

@@ -1688,6 +1689,13 @@ static int ucsi_init(struct ucsi *ucsi)
16881689

16891690
ucsi->connector = connector;
16901691
ucsi->ntfy = ntfy;
1692+
1693+
ret = ucsi->ops->read(ucsi, UCSI_CCI, &cci, sizeof(cci));
1694+
if (ret)
1695+
return ret;
1696+
if (UCSI_CCI_CONNECTOR(READ_ONCE(cci)))
1697+
ucsi_connector_change(ucsi, cci);
1698+
16911699
return 0;
16921700

16931701
err_unregister:

0 commit comments

Comments
 (0)