mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-11 02:15:14 +00:00
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>
This commit is contained in:
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user