summaryrefslogtreecommitdiff
path: root/board/poppy/board.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/poppy/board.c')
-rw-r--r--board/poppy/board.c58
1 files changed, 47 insertions, 11 deletions
diff --git a/board/poppy/board.c b/board/poppy/board.c
index 6d87057ee2..09327c9801 100644
--- a/board/poppy/board.c
+++ b/board/poppy/board.c
@@ -534,17 +534,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[] = {
- /*
- * attenuation_factor is set to 1 because there would be a calibration
- * in iio framework of kernel which would be configured in factory
- * flow.
- */
- {"TI", opt3001_init, opt3001_read_lux, 1},
-};
-BUILD_ASSERT(ARRAY_SIZE(als) == ALS_COUNT);
-
const struct button_config *recovery_buttons[] = {
&buttons[BUTTON_VOLUME_DOWN],
&buttons[BUTTON_VOLUME_UP],
@@ -853,6 +842,11 @@ int board_get_version(void)
static struct mutex g_lid_mutex;
static struct bmi160_drv_data_t g_bmi160_data;
+static struct opt3001_drv_data_t g_opt3001_data = {
+ .scale = 1,
+ .uscale = 0,
+ .offset = 0,
+};
/* Matrix to rotate accelrator into standard reference frame */
const matrix_3x3_t mag_standard_ref = {
@@ -999,9 +993,51 @@ struct motion_sensor_t motion_sensors[] = {
},
},
},
+ [LID_ALS] = {
+ .name = "Light",
+ .active_mask = SENSOR_ACTIVE_S0,
+ .chip = MOTIONSENSE_CHIP_OPT3001,
+ .type = MOTIONSENSE_TYPE_LIGHT,
+ .location = MOTIONSENSE_LOC_LID,
+ .drv = &opt3001_drv,
+ .drv_data = &g_opt3001_data,
+ .port = I2C_PORT_ALS,
+ .addr = OPT3001_I2C_ADDR,
+ .rot_standard_ref = NULL,
+ .default_range = 0x10000, /* scale = 1; uscale = 0 */
+ .min_frequency = OPT3001_LIGHT_MIN_FREQ,
+ .max_frequency = OPT3001_LIGHT_MAX_FREQ,
+ .config = {
+ /* AP: by default shutdown all sensors */
+ [SENSOR_CONFIG_AP] = {
+ .odr = 0,
+ .ec_rate = 0,
+ },
+ [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_ALS],
+};
+BUILD_ASSERT(ARRAY_SIZE(motion_als_sensors) == ALS_COUNT);
+
#ifdef BOARD_SORAKA
static void board_sensor_init(void)
{