summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2015-08-06 12:06:10 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-08-22 09:31:57 +0000
commitda4239f64b6aea43d160b4dc3914a9b30949f3ca (patch)
tree2c5d12260bd150c0a44df58dd52b823daf74152b
parentbbbbde0fc044358bb511dab7ca94b974cccfdbd2 (diff)
downloadchrome-ec-stabilize-jetstream-7390.62.B.tar.gz
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>
-rw-r--r--board/ryu/board.c37
-rw-r--r--board/ryu/board.h6
-rw-r--r--board/ryu/gpio.inc1
3 files changed, 43 insertions, 1 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);
diff --git a/board/ryu/board.h b/board/ryu/board.h
index 3a22f811c9..3b411ffda6 100644
--- a/board/ryu/board.h
+++ b/board/ryu/board.h
@@ -57,7 +57,7 @@
#define CONFIG_MKBP_EVENT
#define CONFIG_VBOOT_HASH
#define CONFIG_WATCHDOG_HELP
-#undef CONFIG_TASK_PROFILING
+#define CONFIG_TASK_PROFILING
#define CONFIG_INDUCTIVE_CHARGING
#undef CONFIG_HIBERNATE
#undef CONFIG_UART_TX_DMA /* DMAC_CH7 is used by USB PD */
@@ -97,6 +97,7 @@
#define I2C_PORT_BATTERY I2C_PORT_MASTER
#define I2C_PORT_LIGHTBAR I2C_PORT_MASTER
#define I2C_PORT_ACCEL I2C_PORT_MASTER
+#define I2C_PORT_ALS I2C_PORT_MASTER
#define I2C_PORT_PERICOM I2C_PORT_MASTER
#define BMM150_I2C_ADDRESS BMM150_ADDR0
@@ -149,6 +150,9 @@
/* Sensor support */
#define CONFIG_ACCELGYRO_BMI160
#define CONFIG_MAG_BMI160_BMM150
+#define CONFIG_ALS_SI114X 0x41
+#define CONFIG_ACCELGYRO_BMI160_INT_EVENT TASK_EVENT_CUSTOM(4)
+#define CONFIG_ALS_SI114X_INT_EVENT TASK_EVENT_CUSTOM(8)
#define CONFIG_ACCEL_INTERRUPTS
#define CONFIG_CMD_ACCELS
#define CONFIG_CMD_ACCEL_INFO
diff --git a/board/ryu/gpio.inc b/board/ryu/gpio.inc
index 16bb5949cc..936c9a1bb0 100644
--- a/board/ryu/gpio.inc
+++ b/board/ryu/gpio.inc
@@ -14,6 +14,7 @@ GPIO_INT(CHARGE_DONE, PIN(E, 6), GPIO_INT_BOTH, indu
GPIO_INT(AP_IN_SUSPEND, PIN(F, 9), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(AP_HOLD, PIN(E, 3), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(ACC_IRQ1, PIN(D, 12), GPIO_INT_FALLING, bmi160_interrupt)
+GPIO_INT(ALS_PROXY_INT_L, PIN(E, 15), GPIO_INT_FALLING | GPIO_PULL_UP, si114x_interrupt)
/* Interrupt lines not used yet */
GPIO(BC_TEMP_ALERT_L, PIN(C, 5), GPIO_INT_FALLING)