summaryrefslogtreecommitdiff
path: root/board/ryu/board.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/ryu/board.c')
-rw-r--r--board/ryu/board.c37
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);