aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatryk Duda <[email protected]>2021-05-18 16:07:58 +0200
committerBenson Leung <[email protected]>2021-07-26 16:15:55 -0700
commit3abc16af57c9939724df92fcbda296b25cc95168 (patch)
treea5fa5873cb4a82213e84a911ff0203947c7d630d
parentd453ceb6549af8798913de6a20444cb7200fdb69 (diff)
platform/chrome: cros_ec_proto: Send command again when timeout occurs
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: <[email protected]> # 4.4+ Signed-off-by: Patryk Duda <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Benson Leung <[email protected]>
-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 aa7f7aa77297..a7404d69b2d3 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -279,6 +279,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,