summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatryk Duda <pdk@semihalf.com>2021-05-18 16:07:58 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-09-22 12:26:38 +0200
commit3c232895b8352418b3b98469a6af6503d2b0c416 (patch)
treee67d85582caa4c807522eaede890df3975092cfe
parent0569920e43100154e22b018ffe8325ece147cb23 (diff)
downloadlinux-stable-3c232895b8352418b3b98469a6af6503d2b0c416.tar.gz
linux-stable-3c232895b8352418b3b98469a6af6503d2b0c416.tar.bz2
linux-stable-3c232895b8352418b3b98469a6af6503d2b0c416.zip
platform/chrome: cros_ec_proto: Send command again when timeout occurs
commit 3abc16af57c9939724df92fcbda296b25cc95168 upstream. Sometimes kernel is trying to probe Fingerprint MCU (FPMCU) when it hasn't initialized SPI yet. This can happen because FPMCU is restarted during system boot and kernel can send message in short window eg. between sysjump to RW and SPI initialization. Cc: <stable@vger.kernel.org> # 4.4+ Signed-off-by: Patryk Duda <pdk@semihalf.com> Link: https://lore.kernel.org/r/20210518140758.29318-1-pdk@semihalf.com Signed-off-by: Benson Leung <bleung@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/platform/chrome/cros_ec_proto.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
index f659f96bda12..9b575e9dd71c 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -213,6 +213,15 @@ static int cros_ec_host_command_proto_query(struct cros_ec_device *ec_dev,
msg->insize = sizeof(struct ec_response_get_protocol_info);
ret = send_command(ec_dev, msg);
+ /*
+ * Send command once again when timeout occurred.
+ * Fingerprint MCU (FPMCU) is restarted during system boot which
+ * introduces small window in which FPMCU won't respond for any
+ * messages sent by kernel. There is no need to wait before next
+ * attempt because we waited at least EC_MSG_DEADLINE_MS.
+ */
+ if (ret == -ETIMEDOUT)
+ ret = send_command(ec_dev, msg);
if (ret < 0) {
dev_dbg(ec_dev->dev,