Message ID | 20250204024600.4138776-3-jthies@google.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | usb: typec: ucsi: Recover from CrOS EC sysjump | expand |
Hi Jameson, On Tue, Feb 04, 2025 at 02:45:59AM +0000, Jameson Thies wrote: > 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_ucsi to 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 <jthies@google.com> Reviewed-by: Benson Leung <bleung@chromium.org> > --- > drivers/usb/typec/ucsi/cros_ec_ucsi.c | 17 ++++++++++++----- > 1 file changed, 12 insertions(+), 5 deletions(-) > > diff --git a/drivers/usb/typec/ucsi/cros_ec_ucsi.c b/drivers/usb/typec/ucsi/cros_ec_ucsi.c > index c605c8616726..5f17fcbda059 100644 > --- a/drivers/usb/typec/ucsi/cros_ec_ucsi.c > +++ b/drivers/usb/typec/ucsi/cros_ec_ucsi.c > @@ -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 >
On Tue, Feb 4, 2025 at 3:34 PM Benson Leung <bleung@google.com> wrote: > > Hi Jameson, > > On Tue, Feb 04, 2025 at 02:45:59AM +0000, Jameson Thies wrote: > > 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_ucsi to 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 <jthies@google.com> > > Reviewed-by: Benson Leung <bleung@chromium.org> > Reviewed-by: Łukasz Bartosik <ukaszb@chromium.org> > > --- > > drivers/usb/typec/ucsi/cros_ec_ucsi.c | 17 ++++++++++++----- > > 1 file changed, 12 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/usb/typec/ucsi/cros_ec_ucsi.c b/drivers/usb/typec/ucsi/cros_ec_ucsi.c > > index c605c8616726..5f17fcbda059 100644 > > --- a/drivers/usb/typec/ucsi/cros_ec_ucsi.c > > +++ b/drivers/usb/typec/ucsi/cros_ec_ucsi.c > > @@ -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 > >
diff --git a/drivers/usb/typec/ucsi/cros_ec_ucsi.c b/drivers/usb/typec/ucsi/cros_ec_ucsi.c index c605c8616726..5f17fcbda059 100644 --- a/drivers/usb/typec/ucsi/cros_ec_ucsi.c +++ b/drivers/usb/typec/ucsi/cros_ec_ucsi.c @@ -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; }
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_ucsi to 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 <jthies@google.com> --- drivers/usb/typec/ucsi/cros_ec_ucsi.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)