diff options
Diffstat (limited to 'board/scarlet/board.c')
-rw-r--r-- | board/scarlet/board.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/board/scarlet/board.c b/board/scarlet/board.c index af9b5926cd..5d3dc341ec 100644 --- a/board/scarlet/board.c +++ b/board/scarlet/board.c @@ -16,6 +16,7 @@ #include "ec_commands.h" #include "driver/accelgyro_bmi160.h" #include "driver/charger/rt946x.h" +#include "driver/sync.h" #include "driver/tcpm/fusb302.h" #include "driver/temp_sensor/tmp432.h" #include "extpower.h" @@ -244,6 +245,9 @@ static void board_init(void) /* Enable interrupts from BMI160 sensor. */ gpio_enable_interrupt(GPIO_ACCEL_INT_L); + /* Enable interrupt for the camera vsync. */ + gpio_enable_interrupt(GPIO_SYNC_INT); + /* Set SPI2 pins to high speed */ /* pins D0/D1/D3/D4 */ STM32_GPIO_OSPEEDR(GPIO_D) |= 0x000003cf; @@ -447,6 +451,40 @@ struct motion_sensor_t motion_sensors[] = { }, }, }, + [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, + .config = { + /* AP: by default shutdown all sensors */ + [SENSOR_CONFIG_AP] = { + .odr = 0, + .ec_rate = 0, + }, + /* EC does not need in S0 */ + [SENSOR_CONFIG_EC_S0] = { + .odr = 0, + .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); #endif /* defined(HAS_TASK_MOTIONSENSE) */ |