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>
This commit is contained in:
Gwendal Grignou
2015-11-30 13:25:14 -08:00
committed by chrome-bot
parent 7f6862e5e0
commit 02ddede08e
2 changed files with 2 additions and 1 deletions

View File

@@ -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.

View File

@@ -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;