diff options
Diffstat (limited to 'board/ampton')
-rw-r--r-- | board/ampton/board.c | 26 | ||||
-rw-r--r-- | board/ampton/board.h | 6 | ||||
-rw-r--r-- | board/ampton/gpio.inc | 4 |
3 files changed, 32 insertions, 4 deletions
diff --git a/board/ampton/board.c b/board/ampton/board.c index 065aea53f2..5f9c2a41cb 100644 --- a/board/ampton/board.c +++ b/board/ampton/board.c @@ -14,6 +14,7 @@ #include "driver/accel_kionix.h" #include "driver/accelgyro_bmi160.h" #include "driver/ppc/sn5s330.h" +#include "driver/sync.h" #include "driver/tcpm/it83xx_pd.h" #include "driver/tcpm/ps8xxx.h" #include "driver/usb_mux_it5205.h" @@ -224,6 +225,17 @@ struct motion_sensor_t motion_sensors[] = { .min_frequency = BMI160_GYRO_MIN_FREQ, .max_frequency = BMI160_GYRO_MAX_FREQ, }, + [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); @@ -235,6 +247,12 @@ static int board_is_convertible(void) || sku_id == 255; } +static int board_with_ar_cam(void) +{ + /* SKU ID of Ampton with AR Cam: 3, 4 */ + return sku_id == 3 || sku_id == 4; +} + static void board_update_sensor_config_from_sku(void) { if (board_is_convertible()) { @@ -249,6 +267,14 @@ static void board_update_sensor_config_from_sku(void) gpio_set_flags(GPIO_BASE_SIXAXIS_INT_L, GPIO_INPUT | GPIO_PULL_DOWN); } + + if (board_with_ar_cam()) { + /* Enable interrupt from camera */ + gpio_enable_interrupt(GPIO_WFCAM_VSYNC); + } else { + /* Camera isn't stuffed, don't allow line to float */ + gpio_set_flags(GPIO_WFCAM_VSYNC, GPIO_INPUT | GPIO_PULL_DOWN); + } } static void board_customize_usbc_mux(uint32_t board_version) diff --git a/board/ampton/board.h b/board/ampton/board.h index c4d6058560..9a406e1c3b 100644 --- a/board/ampton/board.h +++ b/board/ampton/board.h @@ -35,6 +35,7 @@ #define CONFIG_ACCEL_KX022 /* Lid accel */ #define CONFIG_ACCELGYRO_BMI160 /* Base accel */ +#define CONFIG_SYNC /* Camera VSYNC */ #define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT /* Sensors without hardware FIFO are in forced mode */ @@ -61,9 +62,9 @@ /* Depends on how fast the AP boots and typical ODRs */ #define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO / 3) #define CONFIG_MKBP_EVENT -#define CONFIG_MKBP_USE_HOST_EVENT -#define CONFIG_ACCELGYRO_BMI160_INT_EVENT TASK_EVENT_CUSTOM(1 << 2) +#define CONFIG_ACCELGYRO_BMI160_INT_EVENT TASK_EVENT_CUSTOM(1 << 2) +#define CONFIG_SYNC_INT_EVENT TASK_EVENT_CUSTOM(1 << 3) #ifndef __ASSEMBLER__ @@ -90,6 +91,7 @@ enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, + VSYNC, SENSOR_COUNT }; diff --git a/board/ampton/gpio.inc b/board/ampton/gpio.inc index e79acaccba..3de2c663c2 100644 --- a/board/ampton/gpio.inc +++ b/board/ampton/gpio.inc @@ -42,6 +42,7 @@ GPIO_INT(TABLET_MODE_L, PIN(H, 4), GPIO_INT_BOTH, hall_sensor_isr) GPIO_INT(EC_VOLDN_BTN_ODL, PIN(D, 6), GPIO_INT_BOTH, button_interrupt) GPIO_INT(EC_VOLUP_BTN_ODL, PIN(D, 5), GPIO_INT_BOTH, button_interrupt) GPIO_INT(BASE_SIXAXIS_INT_L, PIN(J, 2), GPIO_INT_FALLING | GPIO_SEL_1P8V, bmi160_interrupt) +GPIO_INT(WFCAM_VSYNC, PIN(D, 4), GPIO_INT_RISING, sync_interrupt) GPIO(LID_ACCEL_INT_L, PIN(J, 3), GPIO_INPUT | GPIO_SEL_1P8V) GPIO(PCH_PLTRST_L, PIN(E, 3), GPIO_INPUT) /* PLT_RST_L: Platform Reset from SoC */ @@ -111,8 +112,7 @@ GPIO(BAT_LED_AMBER, PIN(A, 6), GPIO_OUT_LOW) /* LED_1_EC */ GPIO(BAT_LED_WHITE, PIN(A, 3), GPIO_OUT_LOW) /* LED_2_EC */ /* Camera */ -GPIO(WFCAM_VSYNC, PIN(D, 4), GPIO_INPUT) -GPIO(CAM_SOC_EC_SYNC, PIN(E, 6), GPIO_INPUT) +GPIO(EC_INT_L, PIN(E, 6), GPIO_ODR_HIGH) UNIMPLEMENTED(KB_BL_PWR_EN) |