usb: typec: ucsi: Recover from CrOS EC sysjump
Subsystems (4)
Jameson Thies
maintainercover usb: typec: ucsi: Recover from CrOS EC sysjump
An EC sysjump can break communication with the cros_ec_ucsi driver by clearing any previously enabled notifications. This updates the cros_ec_ucsi driver to monitor for PD initialization events from the EC and re-enable notifications by treating the init event as a system resume.
Jameson Thies (2):
platform/chrome: add PD_EVENT_INIT bit definition
usb: typec: ucsi: resume work after EC init
drivers/usb/typec/ucsi/cros_ec_ucsi.c | 17 ++++++++++++----- include/linux/platform_data/cros_ec_commands.h | 1 + 2 files changed, 13 insertions(+), 5 deletions(-)
base-commit: 2014c95afecee3e76ca4a56956a936e23283f05b
Signature · 1 line
2.48.1.362.g079036d154-goog
Jameson Thies
maintainerPATCH 1/2 platform/chrome: add PD_EVENT_INIT bit definition
Update cros_ec_commands.h to include a definition for PD_EVENT_INIT. On platforms supporting UCSI, this host event type is sent when the PPM initializes.
--- include/linux/platform_data/cros_ec_commands.h | 1 + 1 file changed, 1 insertion(+)
include/linux/platform_data/cros_ec_commands.h +1 -0
@@ -5046,6 +5046,7 @@ struct ec_response_pd_status {#define PD_EVENT_DATA_SWAP BIT(3)#define PD_EVENT_TYPEC BIT(4)#define PD_EVENT_PPM BIT(5) +#define PD_EVENT_INIT BIT(6)struct ec_response_host_event_status {uint32_t status;/* PD MCU host event status */
Signature · 1 line
2.48.1.362.g079036d154-goog
Re: [PATCH v1 1/2] platform/chrome: add PD_EVENT_INIT bit definition
Hi Jameson,
Quoted 5 lines · Jameson Thies
Update
cros_ec_commands.hto include a definition forPD_EVENT_INIT. On platforms supporting UCSI, this host event type is sent when the PPM initializes.Signed-off-by Jameson Thies <[email protected]>
Quoted 19 lines
--- include/linux/platform_data/cros_ec_commands.h | 1 + 1 file changed, 1 insertion(+)include/linux/platform_data/cros_ec_commands.h +1
-0@@ -5046,6 +5046,7 @@ struct ec_response_pd_status {#define PD_EVENT_DATA_SWAP BIT(3)#define PD_EVENT_TYPEC BIT(4)#define PD_EVENT_PPM BIT(5) +#define PD_EVENT_INIT BIT(6)struct ec_response_host_event_status {uint32_t status;/* PD MCU host event status */ Signature · 1 line
2.48.1.362.g079036d154-goog
Re: [PATCH v1 1/2] platform/chrome: add PD_EVENT_INIT bit definition
Quoted 12 lines · Benson Leung
Hi Jameson,
Quoted 5 lines · Jameson Thies
Update
cros_ec_commands.hto include a definition forPD_EVENT_INIT. On platforms supporting UCSI, this host event type is sent when the PPM initializes.Signed-off-by Jameson Thies <[email protected]>Reviewed-by Benson Leung <[email protected]>
Quoted 19 lines
Quoted 19 lines
--- include/linux/platform_data/cros_ec_commands.h | 1 + 1 file changed, 1 insertion(+)include/linux/platform_data/cros_ec_commands.h +1
-1@@ -5046,6 +5046,7 @@ struct ec_response_pd_status {#define PD_EVENT_DATA_SWAP BIT(3)#define PD_EVENT_TYPEC BIT(4)#define PD_EVENT_PPM BIT(5) +#define PD_EVENT_INIT BIT(6)struct ec_response_host_event_status {uint32_t status;/* PD MCU host event status */ --2.48.1.362.g079036d154-goog
Re: [PATCH v1 1/2] platform/chrome: add PD_EVENT_INIT bit definition
In reply to Jameson ThiesQuoted 5 lines · Jameson Thies
Update
cros_ec_commands.hto include a definition forPD_EVENT_INIT. On platforms supporting UCSI, this host event type is sent when the PPM initializes.Signed-off-by Jameson Thies <[email protected]>
Jameson Thies
maintainerPATCH 2/2 usb: typec: ucsi: resume work after EC init
In reply to Jameson ThiesA manual EC sysjump will restart the PPM and break communication with the UCSI driver by disabling notifications in the initial PPM state. Update cros_ec_ucsi to listen for PPM init events and treat them as a system resume to re-establish communication with the PPM (ChromeOS EC).
--- drivers/usb/typec/ucsi/cros_ec_ucsi.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/usb/typec/ucsi/cros_ec_ucsi.c +12 -5
@@ -205,12 +205,19 @@ static int cros_ucsi_event(struct notifier_block *nb, { struct cros_ucsi_data *udata = container_of(nb, struct cros_ucsi_data, nb); -if (!(host_event &PD_EVENT_PPM )) -return NOTIFY_OK ; +if (host_event &PD_EVENT_INIT ) { +/* Late init event received from ChromeOS EC. Treat this as a +* system resume to re-enable communication with the PPM. +*/ +dev_dbg (udata->dev,"Late PD init received\n" ); +ucsi_resume (udata->ucsi); + } -dev_dbg (udata->dev,"UCSI notification received\n" ); -flush_work (&udata->work); -schedule_work (&udata->work); +if (host_event &PD_EVENT_PPM ) { +dev_dbg (udata->dev,"UCSI notification received\n" ); +flush_work (&udata->work); +schedule_work (&udata->work); + }return NOTIFY_OK ; }
Signature · 1 line
2.48.1.362.g079036d154-goog
Re: [PATCH v1 2/2] usb: typec: ucsi: resume work after EC init
Hi Jameson,
Quoted 6 lines · Jameson Thies
A manual EC sysjump will restart the PPM and break communication with the UCSI driver by disabling notifications in the initial PPM state. Update
cros_ec_ucsito listen for PPM init events and treat them as a system resume to re-establish communication with the PPM (ChromeOS EC).Signed-off-by Jameson Thies <[email protected]>
Quoted 36 lines
--- drivers/usb/typec/ucsi/cros_ec_ucsi.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)drivers/usb/typec/ucsi/cros_ec_ucsi.c +12
-5@@ -205,12 +205,19 @@ static int cros_ucsi_event(struct notifier_block *nb, { struct cros_ucsi_data *udata = container_of(nb, struct cros_ucsi_data, nb); -if (!(host_event &PD_EVENT_PPM )) -return NOTIFY_OK ; +if (host_event &PD_EVENT_INIT ) { +/* Late init event received from ChromeOS EC. Treat this as a +* system resume to re-enable communication with the PPM. +*/ +dev_dbg (udata->dev,"Late PD init received\n" ); +ucsi_resume (udata->ucsi); + } -dev_dbg (udata->dev,"UCSI notification received\n" ); -flush_work (&udata->work); -schedule_work (&udata->work); +if (host_event &PD_EVENT_PPM ) { +dev_dbg (udata->dev,"UCSI notification received\n" ); +flush_work (&udata->work); +schedule_work (&udata->work); + }return NOTIFY_OK ; }Signature · 1 line
2.48.1.362.g079036d154-goog
Re: [PATCH v1 2/2] usb: typec: ucsi: resume work after EC init
Quoted 4 lines · Benson Leung
Hi Jameson,
On Tue, Feb 04, 2025 at 02:45:59AM +0000, Jameson Thies wrote:
Quoted 9 lines
Quoted 6 lines
A manual EC sysjump will restart the PPM and break communication with the UCSI driver by disabling notifications in the initial PPM state. Update
cros_ec_ucsito listen for PPM init events and treat them as a system resume to re-establish communication with the PPM (ChromeOS EC).Signed-off-by Jameson Thies <[email protected]>Reviewed-by Benson Leung <[email protected]>
Quoted 36 lines
Quoted 36 lines
--- drivers/usb/typec/ucsi/cros_ec_ucsi.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)drivers/usb/typec/ucsi/cros_ec_ucsi.c +12
-6@@ -205,12 +205,19 @@ static int cros_ucsi_event(struct notifier_block *nb, { struct cros_ucsi_data *udata = container_of(nb, struct cros_ucsi_data, nb); -if (!(host_event &PD_EVENT_PPM )) -return NOTIFY_OK ; +if (host_event &PD_EVENT_INIT ) { +/* Late init event received from ChromeOS EC. Treat this as a +* system resume to re-enable communication with the PPM. +*/ +dev_dbg (udata->dev,"Late PD init received\n" ); +ucsi_resume (udata->ucsi); + } -dev_dbg (udata->dev,"UCSI notification received\n" ); -flush_work (&udata->work); -schedule_work (&udata->work); +if (host_event &PD_EVENT_PPM ) { +dev_dbg (udata->dev,"UCSI notification received\n" ); +flush_work (&udata->work); +schedule_work (&udata->work); + }return NOTIFY_OK ; } --2.48.1.362.g079036d154-goog