summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--baseboard/volteer/baseboard.h22
-rw-r--r--baseboard/volteer/build.mk1
-rw-r--r--board/halvor/board.h21
-rw-r--r--board/halvor/build.mk1
-rw-r--r--board/halvor/sensors.c (renamed from baseboard/volteer/sensors.c)2
-rw-r--r--board/malefor/board.h21
-rw-r--r--board/malefor/build.mk1
-rw-r--r--board/malefor/sensors.c184
-rw-r--r--board/volteer/board.h21
-rw-r--r--board/volteer/build.mk1
-rw-r--r--board/volteer/sensors.c184
11 files changed, 435 insertions, 24 deletions
diff --git a/baseboard/volteer/baseboard.h b/baseboard/volteer/baseboard.h
index 69aabc845b..e37ab14d1b 100644
--- a/baseboard/volteer/baseboard.h
+++ b/baseboard/volteer/baseboard.h
@@ -84,25 +84,11 @@
#define CONFIG_CMD_ACCELS
#define CONFIG_CMD_ACCEL_INFO
-/* BMA253 accelerometer in base */
-#define CONFIG_ACCEL_BMA255
-
/* Camera VSYNC */
#define CONFIG_SYNC
#define CONFIG_SYNC_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
-/* TCS3400 ALS */
-#define CONFIG_ALS
-#define ALS_COUNT 1
-#define CONFIG_ALS_TCS3400
-#define CONFIG_ALS_TCS3400_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(CLEAR_ALS)
-
-/* Sensors without hardware FIFO are in forced mode */
-#define CONFIG_ACCEL_FORCE_MODE_MASK \
- (BIT(LID_ACCEL) | BIT(CLEAR_ALS))
-
/* Thermal features */
#define CONFIG_FANS FAN_CH_COUNT
#define CONFIG_TEMP_SENSOR
@@ -312,14 +298,6 @@ enum usbc_port {
USBC_PORT_COUNT
};
-enum sensor_id {
- LID_ACCEL = 0,
- CLEAR_ALS,
- RGB_ALS,
- VSYNC,
- SENSOR_COUNT,
-};
-
/*
* Daughterboard type is encoded in the lower 4 bits
* of the FW_CONFIG CBI tag.
diff --git a/baseboard/volteer/build.mk b/baseboard/volteer/build.mk
index 50b0e5eaeb..ee12262052 100644
--- a/baseboard/volteer/build.mk
+++ b/baseboard/volteer/build.mk
@@ -9,5 +9,4 @@
baseboard-y=baseboard.o
baseboard-y+=led.o
baseboard-y+=battery_presence.o
-baseboard-y+=sensors.o
baseboard-y+=usb_pd_policy.o
diff --git a/board/halvor/board.h b/board/halvor/board.h
index 1a9d2bf271..af82faaf28 100644
--- a/board/halvor/board.h
+++ b/board/halvor/board.h
@@ -22,6 +22,19 @@
/* Keyboard features */
/* Sensors */
+/* BMA253 accelerometer in base */
+#define CONFIG_ACCEL_BMA255
+
+/* TCS3400 ALS */
+#define CONFIG_ALS
+#define ALS_COUNT 1
+#define CONFIG_ALS_TCS3400
+#define CONFIG_ALS_TCS3400_INT_EVENT \
+ TASK_EVENT_MOTION_SENSOR_INTERRUPT(CLEAR_ALS)
+
+/* Sensors without hardware FIFO are in forced mode */
+#define CONFIG_ACCEL_FORCE_MODE_MASK \
+ (BIT(LID_ACCEL) | BIT(CLEAR_ALS))
/* USB Type C and USB PD defines */
/*
@@ -83,6 +96,14 @@ enum battery_type {
BATTERY_TYPE_COUNT,
};
+enum sensor_id {
+ LID_ACCEL = 0,
+ CLEAR_ALS,
+ RGB_ALS,
+ VSYNC,
+ SENSOR_COUNT,
+};
+
/* TODO: b/143375057 - Remove this code after power on. */
void c10_gate_change(enum gpio_signal signal);
diff --git a/board/halvor/build.mk b/board/halvor/build.mk
index 5a2ccd3d79..d9d20ff7c7 100644
--- a/board/halvor/build.mk
+++ b/board/halvor/build.mk
@@ -30,3 +30,4 @@ ENV_VARS := VOLTEER_POWER_SEQUENCE
board-y=board.o
board-y+=battery.o
board-$(VOLTEER_POWER_SEQUENCE)+=power_sequence.o
+board-y+=sensors.o
diff --git a/baseboard/volteer/sensors.c b/board/halvor/sensors.c
index e063f7dbc1..e13d7fd57e 100644
--- a/baseboard/volteer/sensors.c
+++ b/board/halvor/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/malefor/board.h b/board/malefor/board.h
index 1a9d2bf271..af82faaf28 100644
--- a/board/malefor/board.h
+++ b/board/malefor/board.h
@@ -22,6 +22,19 @@
/* Keyboard features */
/* Sensors */
+/* BMA253 accelerometer in base */
+#define CONFIG_ACCEL_BMA255
+
+/* TCS3400 ALS */
+#define CONFIG_ALS
+#define ALS_COUNT 1
+#define CONFIG_ALS_TCS3400
+#define CONFIG_ALS_TCS3400_INT_EVENT \
+ TASK_EVENT_MOTION_SENSOR_INTERRUPT(CLEAR_ALS)
+
+/* Sensors without hardware FIFO are in forced mode */
+#define CONFIG_ACCEL_FORCE_MODE_MASK \
+ (BIT(LID_ACCEL) | BIT(CLEAR_ALS))
/* USB Type C and USB PD defines */
/*
@@ -83,6 +96,14 @@ enum battery_type {
BATTERY_TYPE_COUNT,
};
+enum sensor_id {
+ LID_ACCEL = 0,
+ CLEAR_ALS,
+ RGB_ALS,
+ VSYNC,
+ SENSOR_COUNT,
+};
+
/* TODO: b/143375057 - Remove this code after power on. */
void c10_gate_change(enum gpio_signal signal);
diff --git a/board/malefor/build.mk b/board/malefor/build.mk
index 5a2ccd3d79..d9d20ff7c7 100644
--- a/board/malefor/build.mk
+++ b/board/malefor/build.mk
@@ -30,3 +30,4 @@ ENV_VARS := VOLTEER_POWER_SEQUENCE
board-y=board.o
board-y+=battery.o
board-$(VOLTEER_POWER_SEQUENCE)+=power_sequence.o
+board-y+=sensors.o
diff --git a/board/malefor/sensors.c b/board/malefor/sensors.c
new file mode 100644
index 0000000000..e13d7fd57e
--- /dev/null
+++ b/board/malefor/sensors.c
@@ -0,0 +1,184 @@
+/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Volteer family-specific sensor configuration */
+#include "common.h"
+#include "accelgyro.h"
+#include "driver/accel_bma2x2.h"
+#include "driver/als_tcs3400.h"
+#include "driver/sync.h"
+#include "keyboard_scan.h"
+#include "hooks.h"
+#include "task.h"
+#include "util.h"
+
+/******************************************************************************/
+/* Sensors */
+static struct mutex g_lid_accel_mutex;
+
+/* BMA253 private data */
+static struct accelgyro_saved_data_t g_bma253_data;
+
+/* TCS3400 private data */
+static struct als_drv_data_t g_tcs3400_data = {
+ .als_cal.scale = 1,
+ .als_cal.uscale = 0,
+ .als_cal.offset = 0,
+ .als_cal.channel_scale = {
+ .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kc from VPD */
+ .cover_scale = ALS_CHANNEL_SCALE(1.0), /* CT */
+ },
+};
+
+/*
+ * TODO: b/146166425 need to calibrate ALS/RGB sensor. At default settings,
+ * shining phone flashlight on sensor pegs all readings at 0xFFFF.
+ */
+static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = {
+ .calibration.rgb_cal[X] = {
+ .offset = 0,
+ .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(0),
+ .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(0),
+ .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(0),
+ .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(0),
+ .scale = {
+ .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kr */
+ .cover_scale = ALS_CHANNEL_SCALE(1.0)
+ }
+ },
+ .calibration.rgb_cal[Y] = {
+ .offset = 0,
+ .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(0),
+ .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(0),
+ .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(0),
+ .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(0),
+ .scale = {
+ .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kg */
+ .cover_scale = ALS_CHANNEL_SCALE(1.0)
+ },
+ },
+ .calibration.rgb_cal[Z] = {
+ .offset = 0,
+ .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(0),
+ .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(0),
+ .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(0),
+ .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(0),
+ .scale = {
+ .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kb */
+ .cover_scale = ALS_CHANNEL_SCALE(1.0)
+ }
+ },
+ .calibration.irt = INT_TO_FP(1),
+ .saturation.again = TCS_DEFAULT_AGAIN,
+ .saturation.atime = TCS_DEFAULT_ATIME,
+};
+
+/* Rotation matrix for the lid accelerometer */
+/* TODO: b/146144170 - the accelerometer is on the motherboard for proto1
+ * for testing. Once the sensor moves to the lid, the rotation matrix needs
+ * to be updated for correct behavior.
+ */
+static const mat33_fp_t lid_standard_ref = {
+ { 0, FLOAT_TO_FP(-1), 0},
+ { FLOAT_TO_FP(-1), 0, 0},
+ { 0, 0, FLOAT_TO_FP(-1)}
+};
+
+struct motion_sensor_t motion_sensors[] = {
+ [LID_ACCEL] = {
+ .name = "Lid Accel",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_BMA255,
+ .type = MOTIONSENSE_TYPE_ACCEL,
+ .location = MOTIONSENSE_LOC_LID,
+ .drv = &bma2x2_accel_drv,
+ .mutex = &g_lid_accel_mutex,
+ .drv_data = &g_bma253_data,
+ .port = I2C_PORT_SENSOR,
+ .i2c_spi_addr_flags = BMA2x2_I2C_ADDR1_FLAGS,
+ .rot_standard_ref = &lid_standard_ref,
+ .min_frequency = BMA255_ACCEL_MIN_FREQ,
+ .max_frequency = BMA255_ACCEL_MAX_FREQ,
+ .default_range = 2, /* g, to support tablet mode */
+ .config = {
+ /* EC use accel for angle detection */
+ [SENSOR_CONFIG_EC_S0] = {
+ .odr = 10000 | ROUND_UP_FLAG,
+ },
+ /* Sensor on in S3 */
+ [SENSOR_CONFIG_EC_S3] = {
+ .odr = 10000 | ROUND_UP_FLAG,
+ },
+ },
+ },
+
+ [CLEAR_ALS] = {
+ .name = "Clear Light",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_TCS3400,
+ .type = MOTIONSENSE_TYPE_LIGHT,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &tcs3400_drv,
+ .drv_data = &g_tcs3400_data,
+ .port = I2C_PORT_SENSOR,
+ .i2c_spi_addr_flags = TCS3400_I2C_ADDR_FLAGS,
+ .rot_standard_ref = NULL,
+ .default_range = 0x10000, /* scale = 1x, uscale = 0 */
+ .min_frequency = TCS3400_LIGHT_MIN_FREQ,
+ .max_frequency = TCS3400_LIGHT_MAX_FREQ,
+ .config = {
+ /* Run ALS sensor in S0 */
+ [SENSOR_CONFIG_EC_S0] = {
+ .odr = 1000,
+ },
+ },
+ },
+
+ [RGB_ALS] = {
+ /*
+ * RGB channels read by CLEAR_ALS and so the i2c port and
+ * address do not need to be defined for RGB_ALS.
+ */
+ .name = "RGB Light",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_TCS3400,
+ .type = MOTIONSENSE_TYPE_LIGHT_RGB,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &tcs3400_rgb_drv,
+ .drv_data = &g_tcs3400_rgb_data,
+ .rot_standard_ref = NULL,
+ .default_range = 0x10000, /* scale = 1x, uscale = 0 */
+ },
+
+ [VSYNC] = {
+ .name = "Camera VSYNC",
+ .active_mask = SENSOR_ACTIVE_S0,
+ .chip = MOTIONSENSE_CHIP_GPIO,
+ .type = MOTIONSENSE_TYPE_SYNC,
+ .location = MOTIONSENSE_LOC_CAMERA,
+ .drv = &sync_drv,
+ .default_range = 0,
+ .min_frequency = 0,
+ .max_frequency = 1,
+ },
+};
+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[CLEAR_ALS],
+};
+BUILD_ASSERT(ARRAY_SIZE(motion_als_sensors) == ALS_COUNT);
+
+static void baseboard_sensors_init(void)
+{
+ /* Note - BMA253 interrupt unused by EC */
+
+ /* Enable gpio interrupt for camera vsync */
+ gpio_enable_interrupt(GPIO_EC_CAM_VSYN_SLP_S0IX);
+ /* Enable interrupt for the TCS3400 color light sensor */
+ gpio_enable_interrupt(GPIO_EC_ALS_RGB_INT_L);
+}
+DECLARE_HOOK(HOOK_INIT, baseboard_sensors_init, HOOK_PRIO_DEFAULT);
diff --git a/board/volteer/board.h b/board/volteer/board.h
index 5cfecc6eeb..8ebc01ede8 100644
--- a/board/volteer/board.h
+++ b/board/volteer/board.h
@@ -22,6 +22,19 @@
/* Keyboard features */
/* Sensors */
+/* BMA253 accelerometer in base */
+#define CONFIG_ACCEL_BMA255
+
+/* TCS3400 ALS */
+#define CONFIG_ALS
+#define ALS_COUNT 1
+#define CONFIG_ALS_TCS3400
+#define CONFIG_ALS_TCS3400_INT_EVENT \
+ TASK_EVENT_MOTION_SENSOR_INTERRUPT(CLEAR_ALS)
+
+/* Sensors without hardware FIFO are in forced mode */
+#define CONFIG_ACCEL_FORCE_MODE_MASK \
+ (BIT(LID_ACCEL) | BIT(CLEAR_ALS))
/* USB Type C and USB PD defines */
/*
@@ -83,6 +96,14 @@ enum battery_type {
BATTERY_TYPE_COUNT,
};
+enum sensor_id {
+ LID_ACCEL = 0,
+ CLEAR_ALS,
+ RGB_ALS,
+ VSYNC,
+ SENSOR_COUNT,
+};
+
/* TODO: b/143375057 - Remove this code after power on. */
void c10_gate_change(enum gpio_signal signal);
diff --git a/board/volteer/build.mk b/board/volteer/build.mk
index 681f1b1fe0..8bca0d11d7 100644
--- a/board/volteer/build.mk
+++ b/board/volteer/build.mk
@@ -30,3 +30,4 @@ ENV_VARS := VOLTEER_POWER_SEQUENCE
board-y=board.o
board-y+=battery.o
board-$(VOLTEER_POWER_SEQUENCE)+=power_sequence.o
+board-y+=sensors.o
diff --git a/board/volteer/sensors.c b/board/volteer/sensors.c
new file mode 100644
index 0000000000..e13d7fd57e
--- /dev/null
+++ b/board/volteer/sensors.c
@@ -0,0 +1,184 @@
+/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Volteer family-specific sensor configuration */
+#include "common.h"
+#include "accelgyro.h"
+#include "driver/accel_bma2x2.h"
+#include "driver/als_tcs3400.h"
+#include "driver/sync.h"
+#include "keyboard_scan.h"
+#include "hooks.h"
+#include "task.h"
+#include "util.h"
+
+/******************************************************************************/
+/* Sensors */
+static struct mutex g_lid_accel_mutex;
+
+/* BMA253 private data */
+static struct accelgyro_saved_data_t g_bma253_data;
+
+/* TCS3400 private data */
+static struct als_drv_data_t g_tcs3400_data = {
+ .als_cal.scale = 1,
+ .als_cal.uscale = 0,
+ .als_cal.offset = 0,
+ .als_cal.channel_scale = {
+ .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kc from VPD */
+ .cover_scale = ALS_CHANNEL_SCALE(1.0), /* CT */
+ },
+};
+
+/*
+ * TODO: b/146166425 need to calibrate ALS/RGB sensor. At default settings,
+ * shining phone flashlight on sensor pegs all readings at 0xFFFF.
+ */
+static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = {
+ .calibration.rgb_cal[X] = {
+ .offset = 0,
+ .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(0),
+ .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(0),
+ .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(0),
+ .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(0),
+ .scale = {
+ .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kr */
+ .cover_scale = ALS_CHANNEL_SCALE(1.0)
+ }
+ },
+ .calibration.rgb_cal[Y] = {
+ .offset = 0,
+ .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(0),
+ .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(0),
+ .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(0),
+ .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(0),
+ .scale = {
+ .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kg */
+ .cover_scale = ALS_CHANNEL_SCALE(1.0)
+ },
+ },
+ .calibration.rgb_cal[Z] = {
+ .offset = 0,
+ .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(0),
+ .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(0),
+ .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(0),
+ .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(0),
+ .scale = {
+ .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kb */
+ .cover_scale = ALS_CHANNEL_SCALE(1.0)
+ }
+ },
+ .calibration.irt = INT_TO_FP(1),
+ .saturation.again = TCS_DEFAULT_AGAIN,
+ .saturation.atime = TCS_DEFAULT_ATIME,
+};
+
+/* Rotation matrix for the lid accelerometer */
+/* TODO: b/146144170 - the accelerometer is on the motherboard for proto1
+ * for testing. Once the sensor moves to the lid, the rotation matrix needs
+ * to be updated for correct behavior.
+ */
+static const mat33_fp_t lid_standard_ref = {
+ { 0, FLOAT_TO_FP(-1), 0},
+ { FLOAT_TO_FP(-1), 0, 0},
+ { 0, 0, FLOAT_TO_FP(-1)}
+};
+
+struct motion_sensor_t motion_sensors[] = {
+ [LID_ACCEL] = {
+ .name = "Lid Accel",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_BMA255,
+ .type = MOTIONSENSE_TYPE_ACCEL,
+ .location = MOTIONSENSE_LOC_LID,
+ .drv = &bma2x2_accel_drv,
+ .mutex = &g_lid_accel_mutex,
+ .drv_data = &g_bma253_data,
+ .port = I2C_PORT_SENSOR,
+ .i2c_spi_addr_flags = BMA2x2_I2C_ADDR1_FLAGS,
+ .rot_standard_ref = &lid_standard_ref,
+ .min_frequency = BMA255_ACCEL_MIN_FREQ,
+ .max_frequency = BMA255_ACCEL_MAX_FREQ,
+ .default_range = 2, /* g, to support tablet mode */
+ .config = {
+ /* EC use accel for angle detection */
+ [SENSOR_CONFIG_EC_S0] = {
+ .odr = 10000 | ROUND_UP_FLAG,
+ },
+ /* Sensor on in S3 */
+ [SENSOR_CONFIG_EC_S3] = {
+ .odr = 10000 | ROUND_UP_FLAG,
+ },
+ },
+ },
+
+ [CLEAR_ALS] = {
+ .name = "Clear Light",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_TCS3400,
+ .type = MOTIONSENSE_TYPE_LIGHT,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &tcs3400_drv,
+ .drv_data = &g_tcs3400_data,
+ .port = I2C_PORT_SENSOR,
+ .i2c_spi_addr_flags = TCS3400_I2C_ADDR_FLAGS,
+ .rot_standard_ref = NULL,
+ .default_range = 0x10000, /* scale = 1x, uscale = 0 */
+ .min_frequency = TCS3400_LIGHT_MIN_FREQ,
+ .max_frequency = TCS3400_LIGHT_MAX_FREQ,
+ .config = {
+ /* Run ALS sensor in S0 */
+ [SENSOR_CONFIG_EC_S0] = {
+ .odr = 1000,
+ },
+ },
+ },
+
+ [RGB_ALS] = {
+ /*
+ * RGB channels read by CLEAR_ALS and so the i2c port and
+ * address do not need to be defined for RGB_ALS.
+ */
+ .name = "RGB Light",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_TCS3400,
+ .type = MOTIONSENSE_TYPE_LIGHT_RGB,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &tcs3400_rgb_drv,
+ .drv_data = &g_tcs3400_rgb_data,
+ .rot_standard_ref = NULL,
+ .default_range = 0x10000, /* scale = 1x, uscale = 0 */
+ },
+
+ [VSYNC] = {
+ .name = "Camera VSYNC",
+ .active_mask = SENSOR_ACTIVE_S0,
+ .chip = MOTIONSENSE_CHIP_GPIO,
+ .type = MOTIONSENSE_TYPE_SYNC,
+ .location = MOTIONSENSE_LOC_CAMERA,
+ .drv = &sync_drv,
+ .default_range = 0,
+ .min_frequency = 0,
+ .max_frequency = 1,
+ },
+};
+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[CLEAR_ALS],
+};
+BUILD_ASSERT(ARRAY_SIZE(motion_als_sensors) == ALS_COUNT);
+
+static void baseboard_sensors_init(void)
+{
+ /* Note - BMA253 interrupt unused by EC */
+
+ /* Enable gpio interrupt for camera vsync */
+ gpio_enable_interrupt(GPIO_EC_CAM_VSYN_SLP_S0IX);
+ /* Enable interrupt for the TCS3400 color light sensor */
+ gpio_enable_interrupt(GPIO_EC_ALS_RGB_INT_L);
+}
+DECLARE_HOOK(HOOK_INIT, baseboard_sensors_init, HOOK_PRIO_DEFAULT);