diff options
author | Yidi Lin <yidi.lin@mediatek.com> | 2017-03-13 14:11:13 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-03-13 22:40:00 -0700 |
commit | 1d8fcd4fabfed67d8304b3c5ad418cf6f5ae1878 (patch) | |
tree | 7f98930f0d14b708f28541fe7660dcb28b19a4dc | |
parent | cdfce3bc83271f1980f96d6b1d3d0567185ecf76 (diff) | |
download | chrome-ec-1d8fcd4fabfed67d8304b3c5ad418cf6f5ae1878.tar.gz |
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
BRANCH=none
TEST=remove LID accel sensor from elm and see init failed log.
[1.258973 Lid Accel: 1: init failed: 4]
Change-Id: I55aa35bc9790e5dec61e22aa2f51243e29368a86
Signed-off-by: Yidi Lin <yidi.lin@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/453579
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
-rw-r--r-- | driver/accel_kionix.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/driver/accel_kionix.c b/driver/accel_kionix.c index de03120404..7323abf6f0 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. */ |