summaryrefslogtreecommitdiff
path: root/driver/als_si114x.c
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2015-10-14 21:36:29 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-10-15 21:40:37 -0700
commit917effebbf4f64607a94b10490c143817bf10801 (patch)
treefcaf9c61902689d7018bc3aab64ff37c8a3f1ddb /driver/als_si114x.c
parent3fa05020369579459898dd1d822f9a8a07ac3751 (diff)
downloadchrome-ec-917effebbf4f64607a94b10490c143817bf10801.tar.gz
common: motion: Fix forced mode computation
When the sensor is defined to be used in forced mode, ec rate was not calculated properly: if the AP rate was rounded up, ec_rate requested by the AP would always be 0. If the EC rate is 0, the sensor may potientally never be queried. Also, when the sensor was disable for a long time, the last timestamp of collection may appear to be in the future, so collection was not initiated. (long time more than 35 minutes, less than 71 minutes). We still see instance where the sensor seems locked up. accelinit would not help because the state machine was not reseted, fix that. BRANCH=smaug BUG=chrome-os-partner:45627 TEST=With accelerate 3/4, check the value is now correct. Check proximity sensor is not stuck 45 minutes after last collection. Change-Id: Ia6805b75f67b048cb0b42c0f91a73dfaf94a254f Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/305823 Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'driver/als_si114x.c')
-rw-r--r--driver/als_si114x.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/driver/als_si114x.c b/driver/als_si114x.c
index fb927e9367..fb4a19fc6a 100644
--- a/driver/als_si114x.c
+++ b/driver/als_si114x.c
@@ -482,6 +482,7 @@ static int set_interrupt(const struct motion_sensor_t *s,
static int init(const struct motion_sensor_t *s)
{
int ret, resol;
+ struct si114x_drv_data_t *data = SI114X_GET_DATA(s);
/* initialize only once: light must be declared first. */
if (s->type == MOTIONSENSE_TYPE_LIGHT) {
@@ -493,6 +494,8 @@ static int init(const struct motion_sensor_t *s)
ret = si114x_initialize(s);
if (ret != EC_SUCCESS)
return ret;
+
+ data->state = SI114X_IDLE;
resol = 7;
} else {
resol = 5;