platform/chrome: cros_ec: Add Type C hard reset
PATCH v3 1/2 platform/chrome: cros_ec: Add Type C hard reset
Update the EC command header to include the new event bit. This bit is included in the latest version of the Chrome EC headers[1].
[1] https://chromium.googlesource.com/chromiumos/platform/ec/+/refs/heads/main/include/ec_commands.h
---
Changes in v3:
- Remove Change-Id tag and add Signed-off-by tag to the commit message.
v2 is the first version the patch was introduced.
include/linux/platform_data/cros_ec_commands.h | 1 + 1 file changed, 1 insertion(+)
include/linux/platform_data/cros_ec_commands.h +1 -0
@@ -5678,6 +5678,7 @@ enum tcpc_cc_polarity {#define PD_STATUS_EVENT_SOP_DISC_DONE BIT(0)#define PD_STATUS_EVENT_SOP_PRIME_DISC_DONE BIT(1) +#define PD_STATUS_EVENT_HARD_RESET BIT(2)struct ec_params_typec_status {uint8_t port;
Signature · 1 line
2.31.1.368.gbe11c130af-goog
PATCH v3 2/2 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.
---
Changes in v3:
- No changes.
Changes in v2:
- Split the header change into a separate patch.
- Updated the commit message to reflect the above.
v1:
https://lore.kernel.org/lkml/[email protected]/
drivers/platform/chrome/cros_ec_typec.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/platform/chrome/cros_ec_typec.c +13 -0
@@ -905,6 +905,19 @@ static void cros_typec_handle_status(struct cros_typec_data *typec, int port_numreturn ; } +/* If we got a hard reset, unregister everything and return. */ +if (resp.events &PD_STATUS_EVENT_HARD_RESET ) { +cros_typec_remove_partner (typec, port_num); +cros_typec_remove_cable (typec, port_num); + + ret =cros_typec_send_clear_event (typec, port_num, +PD_STATUS_EVENT_HARD_RESET ); +if (ret <0 ) +dev_warn (typec->dev, +"Failed hard reset event clear, port: %d\n" , port_num); +return ; + } +/* Handle any events appropriately. */ if (resp.events &PD_STATUS_EVENT_SOP_DISC_DONE && !typec->ports[port_num]->sop_disc_done) {u16 sop_revision;
Signature · 1 line
2.31.1.368.gbe11c130af-goog
Enric Balletbo i Serra
AppliedQuoted 4 lines · Prashant Malani
Update the EC command header to include the new event bit. This bit is included in the latest version of the Chrome EC headers[1].
[1] https://chromium.googlesource.com/chromiumos/platform/ec/+/refs/heads/main/include/ec_commands.h
Applied, thanks!
[1/2] platform/chrome: cros_ec: Add Type C hard reset
commit: 67880f1bc342ed4c94e72cad7f8ca76e5121aae3
[2/2] platform/chrome: cros_ec_typec: Handle hard reset
commit: 944b3a639573796debe3cd47298a5dd79810be73Best regards,
Signature · 1 line
Enric Balletbo i Serra <[email protected]>