diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2015-11-30 13:25:14 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2015-12-01 01:11:11 -0800 |
commit | 02ddede08eb66c752b868c86293eff8fed9e8160 (patch) | |
tree | 6ca1f9b891a207ad3970024efe4909ad7cc5c6d4 /driver | |
parent | 7f6862e5e080a20b3ebe089d3a6e8ea0d9f7bd4e (diff) | |
download | chrome-ec-02ddede08eb66c752b868c86293eff8fed9e8160.tar.gz |
device: si114x: Address overflow condition
If proximity overflow (daylight), we would still assume the data was valid
and consider there is an object very very close.
That would prevent the light to be measured. (cl/312982)
Leave the value as max range for the HAL to handle.
BRANCH=smaug
BUG=b:25573958
TEST=Check in daylight that light is still measured
Change-Id: I684e6f4a9aecd3fd6b338a9939f7ede26752ecb8
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/314921
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r-- | driver/als_si114x.c | 2 | ||||
-rw-r--r-- | driver/als_si114x.h | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/driver/als_si114x.c b/driver/als_si114x.c index f11a2100db..e3cb87a2a4 100644 --- a/driver/als_si114x.c +++ b/driver/als_si114x.c @@ -96,7 +96,7 @@ static int si114x_read_results(struct motion_sensor_t *s, int nb) /* Add offset, calibration */ if (val + type_data->offset <= 0) { val = 1; - } else { + } else if (val != SI114X_OVERFLOW) { val += type_data->offset; /* * Proxmitiy sensor data is inverse of the distance. diff --git a/driver/als_si114x.h b/driver/als_si114x.h index c044a8bddf..93e9b9a9bc 100644 --- a/driver/als_si114x.h +++ b/driver/als_si114x.h @@ -206,6 +206,7 @@ /* Proximity sensor finds an object within 5 cm, disable light sensor */ #define SI114X_COVERED_THRESHOLD 5 +#define SI114X_OVERFLOW 0xffff extern const struct accelgyro_drv si114x_drv; |