summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2015-10-22 17:05:23 -0700
committerChromeOS bot <3su6n15k.default@developer.gserviceaccount.com>2015-10-29 06:21:49 +0000
commitbdc0438658c83f672741730ad296ee2e48a1bce1 (patch)
tree55547d970a09d9bd4c8d1d194084c81bd52c451e
parenta3856fb8e56a742522cd8aa023bfb7a20a087fbf (diff)
downloadchrome-ec-bdc0438658c83f672741730ad296ee2e48a1bce1.tar.gz
driver: si114x: Fail init of proximity sensor if light sensor fails.
If init of the light sensor fails (for instance, the chip is not present on the i2c bus), we need to fail the init of the proximity sensor. Otherwise, the EC will report an unexistent sensor to the AP. BRANCH=smaug BUG=chrome-os-partner:46638 TEST=check the proximity sensor is not reported if sensor is disconnected from the main board. Change-Id: Ie6b1d74eaac4d6c38d52641626966b5d3ce63bd3 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/308560 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit 7253e57b3c5f415d53558d8e8266c70ff42975a7) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/309596
-rw-r--r--driver/als_si114x.c4
-rw-r--r--driver/als_si114x.h1
2 files changed, 4 insertions, 1 deletions
diff --git a/driver/als_si114x.c b/driver/als_si114x.c
index fb4a19fc6a..482678ca15 100644
--- a/driver/als_si114x.c
+++ b/driver/als_si114x.c
@@ -498,6 +498,8 @@ static int init(const struct motion_sensor_t *s)
data->state = SI114X_IDLE;
resol = 7;
} else {
+ if (data->state == SI114X_NOT_READY)
+ return EC_ERROR_ACCESS_DENIED;
resol = 5;
}
@@ -535,7 +537,7 @@ const struct accelgyro_drv si114x_drv = {
};
struct si114x_drv_data_t g_si114x_data = {
- .state = SI114X_IDLE,
+ .state = SI114X_NOT_READY,
.type_data = {
/* Proximity */
{
diff --git a/driver/als_si114x.h b/driver/als_si114x.h
index 4d524aea66..2e068eb50c 100644
--- a/driver/als_si114x.h
+++ b/driver/als_si114x.h
@@ -207,6 +207,7 @@
extern const struct accelgyro_drv si114x_drv;
enum si114x_state {
+ SI114X_NOT_READY,
SI114X_IDLE,
SI114X_ALS_IN_PROGRESS,
SI114X_ALS_IN_PROGRESS_PS_PENDING,