summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/eve/board.c51
-rw-r--r--board/eve/board.h19
-rw-r--r--board/eve/ec.tasklist1
-rw-r--r--board/eve/gpio.inc6
4 files changed, 58 insertions, 19 deletions
diff --git a/board/eve/board.c b/board/eve/board.c
index 7f6eb35a0b..50190f0fba 100644
--- a/board/eve/board.c
+++ b/board/eve/board.c
@@ -6,7 +6,6 @@
/* Eve board-specific configuration */
#include "adc_chip.h"
-#include "als.h"
#include "bd99992gw.h"
#include "board_config.h"
#include "button.h"
@@ -19,7 +18,7 @@
#include "driver/accel_kionix.h"
#include "driver/accel_kxcj9.h"
#include "driver/accelgyro_bmi160.h"
-#include "driver/als_isl29035.h"
+#include "driver/als_si114x.h"
#include "driver/charger/bd9995x.h"
#include "driver/tcpm/anx74xx.h"
#include "driver/tcpm/tcpci.h"
@@ -267,12 +266,6 @@ const struct temp_sensor_t temp_sensors[] = {
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-/* ALS instances. Must be in same order as enum als_id. */
-struct als_t als[] = {
- {"ISL", isl29035_init, isl29035_read_lux, 5},
-};
-BUILD_ASSERT(ARRAY_SIZE(als) == ALS_COUNT);
-
const struct button_config buttons[CONFIG_BUTTON_COUNT] = {
{"Volume Down", KEYBOARD_BUTTON_VOLUME_DOWN, GPIO_VOLUME_DOWN_L,
30 * MSEC, 0},
@@ -837,7 +830,49 @@ struct motion_sensor_t motion_sensors[] = {
},
},
},
+
+ [LID_LIGHT] = {
+ .name = "Light",
+ .active_mask = SENSOR_ACTIVE_S0,
+ .chip = MOTIONSENSE_CHIP_SI1141,
+ .type = MOTIONSENSE_TYPE_LIGHT,
+ .location = MOTIONSENSE_LOC_LID,
+ .drv = &si114x_drv,
+ .mutex = &g_lid_mutex,
+ .drv_data = &g_si114x_data,
+ .port = I2C_PORT_ALS,
+ .addr = SI114X_ADDR,
+ .rot_standard_ref = NULL,
+ .default_range = 9000, /* 90%: int = 0 - frac = 9000/10000 */
+ .config = {
+ /* AP: by default shutdown all sensors */
+ [SENSOR_CONFIG_AP] = {
+ .odr = 0,
+ .ec_rate = 0,
+ },
+ /* Run ALS sensor in S0 */
+ [SENSOR_CONFIG_EC_S0] = {
+ .odr = 1000,
+ .ec_rate = 0,
+ },
+ /* Sensor off in S3/S5 */
+ [SENSOR_CONFIG_EC_S3] = {
+ .odr = 0,
+ .ec_rate = 0,
+ },
+ /* Sensor off in S3/S5 */
+ [SENSOR_CONFIG_EC_S5] = {
+ .odr = 0,
+ .ec_rate = 0,
+ },
+ },
+ },
};
const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
+/* ALS instances when LPC mapping is needed. Each entry directs to a sensor. */
+const struct motion_sensor_t *motion_als_sensors[] = {
+ &motion_sensors[LID_LIGHT],
+};
+BUILD_ASSERT(ARRAY_SIZE(motion_als_sensors) == ALS_COUNT);
diff --git a/board/eve/board.h b/board/eve/board.h
index 50e28dd6ad..b69d3c78b9 100644
--- a/board/eve/board.h
+++ b/board/eve/board.h
@@ -113,11 +113,12 @@
#define CONFIG_MKBP_EVENT
#define CONFIG_MKBP_USE_HOST_EVENT
#define CONFIG_ACCEL_KXCJ9
-#define CONFIG_ALS_ISL29035
+#define CONFIG_ALS_SI114X 0x40
+#define CONFIG_ALS_SI114X_INT_EVENT TASK_EVENT_CUSTOM(8)
+#define CONFIG_ALS_SI114X_POLLING
#define CONFIG_TEMP_SENSOR
#define CONFIG_TEMP_SENSOR_BD99992GW
#define CONFIG_THERMISTOR_NCP15WB
-
#define CONFIG_ACCELGYRO_BMI160
#define CONFIG_MAG_BMI160_BMM150
#define CONFIG_ACCEL_INTERRUPTS
@@ -232,10 +233,13 @@ enum pwm_channel {
PWM_CH_COUNT
};
-enum als_id {
- ALS_ISL29035,
- ALS_COUNT
-};
+/*
+ * For backward compatibility, to report ALS via ACPI,
+ * Define the number of ALS sensors: motion_sensor copy the data to the ALS
+ * memmap region.
+ */
+#define CONFIG_ALS
+#define ALS_COUNT 1
/*
* Motion sensors:
@@ -248,6 +252,7 @@ enum sensor_id {
BASE_ACCEL,
BASE_GYRO,
BASE_MAG,
+ LID_LIGHT,
};
enum adc_channel {
@@ -277,7 +282,7 @@ void board_set_tcpc_power_mode(int port, int mode);
void board_print_tcpc_fw_version(int port);
/* Sensors without hardware FIFO are in forced mode */
-#define CONFIG_ACCEL_FORCE_MODE_MASK (1 << LID_ACCEL)
+#define CONFIG_ACCEL_FORCE_MODE_MASK ((1 << LID_ACCEL) | (1 << LID_LIGHT))
#endif /* !__ASSEMBLER__ */
diff --git a/board/eve/ec.tasklist b/board/eve/ec.tasklist
index 8a9546aa4a..16f7ec7ec5 100644
--- a/board/eve/ec.tasklist
+++ b/board/eve/ec.tasklist
@@ -22,7 +22,6 @@
#define CONFIG_TASK_LIST \
TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \
- TASK_ALWAYS(ALS, als_task, NULL, TASK_STACK_SIZE) \
TASK_ALWAYS(CHG_RAMP, chg_ramp_task, NULL, TASK_STACK_SIZE) \
TASK_ALWAYS(USB_CHG, usb_charger_task, NULL, TASK_STACK_SIZE) \
TASK_ALWAYS(CHARGER, charger_task, NULL, LARGER_TASK_STACK_SIZE) \
diff --git a/board/eve/gpio.inc b/board/eve/gpio.inc
index 56c564b1ba..f53ca43ce6 100644
--- a/board/eve/gpio.inc
+++ b/board/eve/gpio.inc
@@ -24,6 +24,9 @@ GPIO_INT(WP_L, PIN(4, 0), GPIO_INT_BOTH, switch_interrupt)
GPIO_INT(AC_PRESENT, PIN(C, 1), GPIO_INT_BOTH, extpower_interrupt)
GPIO_INT(ACCELGYRO3_INT_L, PIN(9, 3), GPIO_INT_FALLING, bmi160_interrupt)
+/* Lid KCJX9 accelerometer sensor interrupt */
+GPIO(ACCEL1_INT_L, PIN(C, 7), GPIO_INPUT | GPIO_PULL_UP)
+
GPIO(PCH_RTCRST, PIN(E, 7), GPIO_OUT_LOW) /* RTCRST# to SOC */
GPIO(ENABLE_BACKLIGHT, PIN(5, 6), GPIO_OUT_LOW) /* Enable Backlight */
GPIO(TRACKPAD_SHDN_L, PIN(3, 2), GPIO_OUT_LOW) /* Enable Trackpad */
@@ -44,9 +47,6 @@ GPIO(EC_HAVEN_RESET_ODL, PIN(0, 2), GPIO_ODR_HIGH) /* H1 Reset */
GPIO(ENTERING_RW, PIN(7, 6), GPIO_OUTPUT) /* EC Entering RW */
GPIO(PMIC_INT_L, PIN(6, 0), GPIO_INPUT) /* PMIC interrupt */
-/* Sensor interrupts, not implemented yet */
-GPIO(ACCEL1_INT_L, PIN(C, 7), GPIO_INPUT)
-
/* I2C pins - these will be reconfigured for alternate function below */
GPIO(I2C0_0_SCL, PIN(B, 5), GPIO_INPUT) /* EC_I2C00_USB_C0_SCL */
GPIO(I2C0_0_SDA, PIN(B, 4), GPIO_INPUT) /* EC_I2C00_USB_C0_SDA */