summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2015-09-08 11:34:42 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-09-19 15:18:08 -0700
commit33046e7d51af5d521235c79dcddc3308c71189db (patch)
tree9dfdd80fcd1c3cc98270e8adac0030ae72a4856b /driver
parent9d1910f5a0772b06c3c48a5c5f3c3412b0a1b682 (diff)
downloadchrome-ec-33046e7d51af5d521235c79dcddc3308c71189db.tar.gz
common: accel: Add error code for irq handler
When IRQ handler is not processing any event raised, return NOT_HANDLED. Without this change, any event would set the light sensor process timestamp and, if the light sensor frequency was lower than BM160 fifo interrupt frequency, we would never read from the light sensor. BRANCH=smaug BUG=chrome-os-partner:43800 TEST=Compile. Check that light sensor data get updated. Change-Id: I302f80c5cd9b4f3c926362fdafdc8b5074cabb60 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/298686
Diffstat (limited to 'driver')
-rw-r--r--driver/accelgyro_bmi160.c2
-rw-r--r--driver/als_si114x.c9
2 files changed, 7 insertions, 4 deletions
diff --git a/driver/accelgyro_bmi160.c b/driver/accelgyro_bmi160.c
index f781313243..cbbb78f7cb 100644
--- a/driver/accelgyro_bmi160.c
+++ b/driver/accelgyro_bmi160.c
@@ -713,7 +713,7 @@ static int irq_handler(struct motion_sensor_t *s, uint32_t *event)
if ((s->type != MOTIONSENSE_TYPE_ACCEL) ||
(!(*event & CONFIG_ACCELGYRO_BMI160_INT_EVENT)))
- return EC_SUCCESS;
+ return EC_ERROR_NOT_HANDLED;
raw_read32(s->addr, BMI160_INT_STATUS_0, &interrupt);
diff --git a/driver/als_si114x.c b/driver/als_si114x.c
index 52d3a3ae7b..944712f655 100644
--- a/driver/als_si114x.c
+++ b/driver/als_si114x.c
@@ -155,11 +155,14 @@ static int irq_handler(struct motion_sensor_t *s, uint32_t *event)
struct si114x_typed_data_t *type_data = SI114X_GET_TYPED_DATA(s);
if (!(*event & CONFIG_ALS_SI114X_INT_EVENT))
- return EC_SUCCESS;
+ return EC_ERROR_NOT_HANDLED;
ret = raw_read8(s->addr, SI114X_REG_IRQ_STATUS, &val);
- if (ret < 0 || !(val & type_data->irq_flags))
- return EC_SUCCESS;
+ if (ret)
+ return ret;
+
+ if (!(val & type_data->irq_flags))
+ return EC_ERROR_INVAL;
/* clearing IRQ */
ret = raw_write8(s->addr, SI114X_REG_IRQ_STATUS,