diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2015-09-08 11:34:42 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2016-08-25 20:58:17 +0000 |
commit | b199693f8b41ecb84f5207674242d5ad4937bab5 (patch) | |
tree | 298a35ee93b4bfbeaac2a952bbd121b7cbf77dfc | |
parent | 676a9bbd595ac3f8c4d7175b414684b36d900355 (diff) | |
download | chrome-ec-b199693f8b41ecb84f5207674242d5ad4937bab5.tar.gz |
UPSTREAM: 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, samus
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
(cherry picked from commit 33046e7d51af5d521235c79dcddc3308c71189db)
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/370537
-rw-r--r-- | common/motion_sense.c | 5 | ||||
-rw-r--r-- | include/accelgyro.h | 5 | ||||
-rw-r--r-- | include/common.h | 2 |
3 files changed, 9 insertions, 3 deletions
diff --git a/common/motion_sense.c b/common/motion_sense.c index 89d2f4e77b..5a1afb353d 100644 --- a/common/motion_sense.c +++ b/common/motion_sense.c @@ -497,8 +497,9 @@ static int motion_sense_process(struct motion_sensor_t *sensor, #ifdef CONFIG_ACCEL_INTERRUPTS if ((*event & TASK_EVENT_MOTION_INTERRUPT_MASK) && (sensor->drv->irq_handler != NULL)) { - sensor->drv->irq_handler(sensor, event); - sensor->last_collection = ts->le.lo; + ret = sensor->drv->irq_handler(sensor, event); + if (ret == EC_SUCCESS) + sensor->last_collection = ts->le.lo; } #endif #ifdef CONFIG_ACCEL_FIFO diff --git a/include/accelgyro.h b/include/accelgyro.h index f9b68f0e36..a941c2fcb9 100644 --- a/include/accelgyro.h +++ b/include/accelgyro.h @@ -104,7 +104,10 @@ struct accelgyro_drv { * handler for interrupts triggered by the sensor: it runs in task and * process the events that triggered an interrupt. * @s Pointer to sensor data. - * @event Event to process. May add add other events for the next processor. + * @event Event to process. May add other events for the next processor. + * + * Return EC_SUCCESS when one event is handled, EC_ERROR_NOT_HANDLED + * when no events have been proccessed. */ int (*irq_handler)(struct motion_sensor_t *s, uint32_t *event); #endif diff --git a/include/common.h b/include/common.h index eb4ebd7c32..6a17746ebc 100644 --- a/include/common.h +++ b/include/common.h @@ -102,6 +102,8 @@ enum ec_error_list { EC_ERROR_PARAM9 = 19, EC_ERROR_PARAM_COUNT = 20, /* Wrong number of params */ + EC_ERROR_NOT_HANDLED = 21, /* Interrupt event not handled */ + /* Module-internal error codes may use this range. */ EC_ERROR_INTERNAL_FIRST = 0x10000, EC_ERROR_INTERNAL_LAST = 0x1FFFF |