From: Jameson Thies <jthies@google.com>
To: ukaszb@chromium.org, tzungbi@kernel.org,
linux-usb@vger.kernel.org, chrome-platform@lists.linux.dev
Cc: bleung@chromium.org, heikki.krogerus@linux.intel.com,
gregkh@linuxfoundation.org, dmitry.baryshkov@linaro.org,
abhishekpandit@chromium.org, akuchynski@chromium.org,
Jameson Thies <jthies@google.com>
Subject: [PATCH v1 2/2] usb: typec: ucsi: resume work after EC init
Date: Tue, 4 Feb 2025 02:45:59 +0000 [thread overview]
Message-ID: <20250204024600.4138776-3-jthies@google.com> (raw)
In-Reply-To: <20250204024600.4138776-1-jthies@google.com>
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(-)
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
next prev parent reply other threads:[~2025-02-04 2:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-04 2:45 [PATCH v1 0/2] usb: typec: ucsi: Recover from CrOS EC sysjump Jameson Thies
2025-02-04 2:45 ` [PATCH v1 1/2] platform/chrome: add PD_EVENT_INIT bit definition Jameson Thies
2025-02-04 14:35 ` Benson Leung
2025-02-04 15:01 ` Łukasz Bartosik
2025-02-05 4:27 ` Tzung-Bi Shih
2025-02-04 2:45 ` Jameson Thies [this message]
2025-02-04 14:34 ` [PATCH v1 2/2] usb: typec: ucsi: resume work after EC init Benson Leung
2025-02-04 15:12 ` Łukasz Bartosik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250204024600.4138776-3-jthies@google.com \
--to=jthies@google.com \
--cc=abhishekpandit@chromium.org \
--cc=akuchynski@chromium.org \
--cc=bleung@chromium.org \
--cc=chrome-platform@lists.linux.dev \
--cc=dmitry.baryshkov@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-usb@vger.kernel.org \
--cc=tzungbi@kernel.org \
--cc=ukaszb@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox