Skip to content

Commit 944b3a6

Browse files
Prashant MalaniEnric Balletbo i Serra
authored andcommitted
platform/chrome: cros_ec_typec: Handle hard reset
The Chrome Embedded Controller (EC) generates a hard reset type C event when a USB Power Delivery (PD) hard reset is encountered. Handle this event by unregistering the partner and cable on the associated port and clearing the event flag. Cc: Benson Leung <[email protected]> Signed-off-by: Prashant Malani <[email protected]> Signed-off-by: Enric Balletbo i Serra <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 67880f1 commit 944b3a6

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/platform/chrome/cros_ec_typec.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,19 @@ static void cros_typec_handle_status(struct cros_typec_data *typec, int port_num
906906
return;
907907
}
908908

909+
/* If we got a hard reset, unregister everything and return. */
910+
if (resp.events & PD_STATUS_EVENT_HARD_RESET) {
911+
cros_typec_remove_partner(typec, port_num);
912+
cros_typec_remove_cable(typec, port_num);
913+
914+
ret = cros_typec_send_clear_event(typec, port_num,
915+
PD_STATUS_EVENT_HARD_RESET);
916+
if (ret < 0)
917+
dev_warn(typec->dev,
918+
"Failed hard reset event clear, port: %d\n", port_num);
919+
return;
920+
}
921+
909922
/* Handle any events appropriately. */
910923
if (resp.events & PD_STATUS_EVENT_SOP_DISC_DONE && !typec->ports[port_num]->sop_disc_done) {
911924
u16 sop_revision;

0 commit comments

Comments
 (0)