diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2015-08-06 12:06:10 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-08-22 09:31:57 +0000 |
commit | da4239f64b6aea43d160b4dc3914a9b30949f3ca (patch) | |
tree | 2c5d12260bd150c0a44df58dd52b823daf74152b /board/ryu/board.c | |
parent | bbbbde0fc044358bb511dab7ca94b974cccfdbd2 (diff) | |
download | chrome-ec-da4239f64b6aea43d160b4dc3914a9b30949f3ca.tar.gz |
ryu: add si1141 supportstabilize-jetstream-7390.62.Bstabilize-jetstream-7390.54.Bstabilize-7390.68.Bstabilize-7390.59.Brelease-R46-7390.B
Add si1141 to the list of motion sensors.
Setup IRQ line and other constants.
BRANCH=smaug
TEST=Check sensor is working
BUG=chrome-os-partner:32829
Change-Id: Ic05bc24164d067a1dee6a6241681420348d7a843
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/291336
Reviewed-by: Sheng-liang Song <ssl@chromium.org>
Diffstat (limited to 'board/ryu/board.c')
-rw-r--r-- | board/ryu/board.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/board/ryu/board.c b/board/ryu/board.c index 045fbe3dd4..ed18f40a60 100644 --- a/board/ryu/board.c +++ b/board/ryu/board.c @@ -16,6 +16,7 @@ #include "common.h" #include "console.h" #include "driver/accelgyro_bmi160.h" +#include "driver/als_si114x.h" #include "ec_version.h" #include "gpio.h" #include "hooks.h" @@ -157,6 +158,9 @@ static void board_init(void) /* Enable interrupts from BMI160 sensor. */ gpio_enable_interrupt(GPIO_ACC_IRQ1); + /* Enable interrupts from SI1141 sensor. */ + gpio_enable_interrupt(GPIO_ALS_PROXY_INT_L); + if (board_has_spi_sensors()) { for (i = MOTIONSENSE_TYPE_ACCEL; i <= MOTIONSENSE_TYPE_MAG; i++) { @@ -284,6 +288,7 @@ struct motion_sensor_t motion_sensors[] = { .addr = BMI160_ADDR0, .rot_standard_ref = &accelgyro_standard_ref, .default_config = { + /* 100Hz is fast enough for double tap detection */ .odr = 100000, .range = 8, /* g */ .ec_rate = SUSPEND_SAMPLING_INTERVAL, @@ -323,6 +328,38 @@ struct motion_sensor_t motion_sensors[] = { .ec_rate = MAX_MOTION_SENSE_WAIT_TIME, } }, + {.name = "Light", + .active_mask = SENSOR_ACTIVE_S0_S3_S5, + .chip = MOTIONSENSE_CHIP_SI1141, + .type = MOTIONSENSE_TYPE_LIGHT, + .location = MOTIONSENSE_LOC_LID, + .drv = &si114x_drv, + .mutex = &g_mutex, + .drv_data = &g_si114x_data, + .addr = SI114X_ADDR, + .rot_standard_ref = NULL, + .default_config = { + .odr = 0, + .range = 9000, /* 90%: int = 0 - frac = 9000/10000 */ + .ec_rate = 1000 * MSEC, + } + }, + {.name = "Proxi", + .active_mask = SENSOR_ACTIVE_S0_S3_S5, + .chip = MOTIONSENSE_CHIP_SI1141, + .type = MOTIONSENSE_TYPE_PROX, + .location = MOTIONSENSE_LOC_LID, + .drv = &si114x_drv, + .mutex = &g_mutex, + .drv_data = &g_si114x_data, + .addr = SI114X_ADDR, + .rot_standard_ref = NULL, + .default_config = { + .odr = 0, + .range = 1 << 16, /* 100% fuzzy unit */ + .ec_rate = 1000 * MSEC, + } + }, }; const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); |