summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYidi Lin <yidi.lin@mediatek.com>2017-03-13 14:11:13 +0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2017-05-01 21:20:33 +0000
commit27576199ab734c922789890b1fdb2330f8ed5fde (patch)
tree2fdc8e1cf92d968934f6e9269e1e366bf2ab420d
parent18a55b84cf42a8481a96c465310835f082e8afc8 (diff)
downloadchrome-ec-27576199ab734c922789890b1fdb2330f8ed5fde.tar.gz
UPSTREAM: driver: kionix: Add checking whoami value at initialization.
spi_transaction() always returns success even without the sensor. Check whoami value to make sure that the sensor is existed. BUG=none, b:36973851 BRANCH=strago, ultima TEST=remove LID accel sensor from elm and see init failed log. [1.258973 Lid Accel: 1: init failed: 4] Signed-off-by: Yidi Lin <yidi.lin@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/453579 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> (cherry picked from commit 1d8fcd4fabfed67d8304b3c5ad418cf6f5ae1878) Reviewed-on: https://chromium-review.googlesource.com/484586 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> (cherry picked from commit 76f0ed5101064ea52a26069bb8f195173db0eb13) Change-Id: I55aa35bc9790e5dec61e22aa2f51243e29368a86 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/489784
-rw-r--r--driver/accel_kionix.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/driver/accel_kionix.c b/driver/accel_kionix.c
index e08a602867..805fa94713 100644
--- a/driver/accel_kionix.c
+++ b/driver/accel_kionix.c
@@ -458,7 +458,7 @@ static int init(const struct motion_sensor_t *s)
msleep(1);
/* Read WHO_AM_I to be sure the device has booted */
ret = raw_read8(s->port, s->addr, reg, &val);
- if (ret == EC_SUCCESS)
+ if (ret == EC_SUCCESS && val == KIONIX_WHO_AM_I_VAL(V(s)))
break;
/* Check for timeout. */