From: Enric Balletbo i Serra <enric.balletbo@collabora.com>
To: Lee Jones <lee.jones@linaro.org>
Cc: groeck@chromium.org, gwendal@chromium.org, bleung@chromium.org,
linux-kernel@vger.kernel.org, kernel@collabora.com
Subject: [PATCH 5/6] mfd: cros_ec_dev: Check communication with ec at resume
Date: Mon, 19 Feb 2018 23:41:11 +0100 [thread overview]
Message-ID: <20180219224111.21601-1-enric.balletbo@collabora.com> (raw)
From: Gwendal Grignou <gwendal@chromium.org>
Send dummy command to EC at resume time, wait for status.
If EC loses that command and return a status for the
pre-suspend command, we will not interpret that status as an
answer for an important command.
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---
drivers/mfd/cros_ec_dev.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
index fc98e0564061..c901839317ae 100644
--- a/drivers/mfd/cros_ec_dev.c
+++ b/drivers/mfd/cros_ec_dev.c
@@ -553,6 +553,16 @@ static __maybe_unused int ec_device_suspend(struct device *dev)
static __maybe_unused int ec_device_resume(struct device *dev)
{
struct cros_ec_dev *ec = dev_get_drvdata(dev);
+ char msg[sizeof(struct ec_response_get_version) +
+ sizeof(CROS_EC_DEV_VERSION)];
+ int ret;
+
+ /* Be sure the communication with the EC is reestablished */
+ ret = ec_get_version(ec, msg, sizeof(msg));
+ if (ret < 0) {
+ dev_err(ec->ec_dev->dev, "No EC response at resume: %d\n", ret);
+ return 0;
+ }
lb_resume(ec);
--
2.16.1
next reply other threads:[~2018-02-19 22:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-19 22:41 Enric Balletbo i Serra [this message]
2018-02-22 2:20 ` Gwendal Grignou
2018-02-22 9:41 ` Enric Balletbo i Serra
2018-02-23 9:01 ` Gwendal Grignou
2018-02-23 9:04 ` Enric Balletbo i Serra
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=20180219224111.21601-1-enric.balletbo@collabora.com \
--to=enric.balletbo@collabora.com \
--cc=bleung@chromium.org \
--cc=groeck@chromium.org \
--cc=gwendal@chromium.org \
--cc=kernel@collabora.com \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®