diff options
Diffstat (limited to 'board/berknip')
-rw-r--r-- | board/berknip/board.c | 44 | ||||
-rw-r--r-- | board/berknip/board.h | 6 | ||||
-rw-r--r-- | board/berknip/gpio.inc | 3 |
3 files changed, 51 insertions, 2 deletions
diff --git a/board/berknip/board.c b/board/berknip/board.c index 4d9d8f4166..b91ee5af3d 100644 --- a/board/berknip/board.c +++ b/board/berknip/board.c @@ -9,6 +9,7 @@ #include "adc_chip.h" #include "button.h" #include "cbi_ec_fw_config.h" +#include "cros_board_info.h" #include "driver/accelgyro_bmi_common.h" #include "driver/accel_kionix.h" #include "driver/accel_kx022.h" @@ -468,3 +469,46 @@ const int keyboard_factory_scan_pins[][2] = { const int keyboard_factory_scan_pins_used = ARRAY_SIZE(keyboard_factory_scan_pins); #endif + +/***************************************************************************** + * Power signals + */ + +struct power_signal_info power_signal_list[] = { + [X86_SLP_S3_N] = { + .gpio = GPIO_PCH_SLP_S3_L, + .flags = POWER_SIGNAL_ACTIVE_HIGH, + .name = "SLP_S3_DEASSERTED", + }, + [X86_SLP_S5_N] = { + .gpio = GPIO_PCH_SLP_S5_L, + .flags = POWER_SIGNAL_ACTIVE_HIGH, + .name = "SLP_S5_DEASSERTED", + }, + [X86_S0_PGOOD] = { + .gpio = GPIO_S0_PWROK_OD_V0, + .flags = POWER_SIGNAL_ACTIVE_HIGH, + .name = "S0_PGOOD", + }, + [X86_S5_PGOOD] = { + .gpio = GPIO_S5_PGOOD, + .flags = POWER_SIGNAL_ACTIVE_HIGH, + .name = "S5_PGOOD", + }, +}; +BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT); + +enum gpio_signal GPIO_S0_PGOOD = GPIO_S0_PWROK_OD_V0; + +void board_version_check(void) +{ + uint32_t board_ver = 0; + + cbi_get_board_version(&board_ver); + + if (board_ver == 2) { + power_signal_list[X86_S0_PGOOD].gpio = GPIO_S0_PWROK_OD_V1; + GPIO_S0_PGOOD = GPIO_S0_PWROK_OD_V1; + } +} +DECLARE_HOOK(HOOK_INIT, board_version_check, HOOK_PRIO_INIT_I2C); diff --git a/board/berknip/board.h b/board/berknip/board.h index f6c0523a9a..c3f27a7e79 100644 --- a/board/berknip/board.h +++ b/board/berknip/board.h @@ -45,6 +45,8 @@ #define CONFIG_USBC_RETIMER_TUSB544 #define TUSB544_I2C_ADDR_FLAGS1 0x0F +#define CONFIG_POWER_SIGNAL_RUNTIME_CONFIG + /* GPIO mapping from board specific name to EC common name. */ #define CONFIG_BATTERY_PRESENT_GPIO GPIO_EC_BATT_PRES_ODL #define CONFIG_SCI_GPIO GPIO_EC_FCH_SCI_ODL @@ -61,7 +63,6 @@ #define GPIO_PCH_SYS_PWROK GPIO_EC_FCH_PWROK #define GPIO_PCH_WAKE_L GPIO_EC_FCH_WAKE_L #define GPIO_POWER_BUTTON_L GPIO_EC_PWR_BTN_ODL -#define GPIO_S0_PGOOD GPIO_S0_PWROK_OD #define GPIO_S5_PGOOD GPIO_EC_PWROK_OD #define GPIO_SYS_RESET_L GPIO_EC_SYS_RST_L #define GPIO_VOLUME_DOWN_L GPIO_VOLDN_BTN_ODL @@ -71,6 +72,9 @@ #ifndef __ASSEMBLER__ +/* This GPIOs moved. Temporarily detect and support the V0 HW. */ +extern enum gpio_signal GPIO_S0_PGOOD; + enum adc_channel { ADC_TEMP_SENSOR_5V_REGULATOR, ADC_TEMP_SENSOR_CHARGER, diff --git a/board/berknip/gpio.inc b/board/berknip/gpio.inc index df0f4c965c..9cb694e65f 100644 --- a/board/berknip/gpio.inc +++ b/board/berknip/gpio.inc @@ -16,7 +16,8 @@ GPIO_INT(USB_C0_BC12_INT_ODL, PIN(9, 3), GPIO_INT_FALLING | GPIO_PULL_UP, bc12_i GPIO_INT(USB_C1_BC12_INT_ODL, PIN(A, 4), GPIO_INT_FALLING | GPIO_PULL_UP, bc12_interrupt) GPIO_INT(SLP_S3_L, PIN(7, 4), GPIO_INT_BOTH, power_signal_interrupt) GPIO_INT(SLP_S5_L, PIN(E, 0), GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(S0_PWROK_OD, PIN(5, 6), GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(S0_PWROK_OD_V0, PIN(5, 6), GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(S0_PWROK_OD_V1, PIN(B, 1), GPIO_INT_BOTH, power_signal_interrupt) GPIO_INT(EC_PWROK_OD, PIN(3, 7), GPIO_INT_BOTH, power_signal_interrupt) GPIO_INT(EC_PWR_BTN_ODL, PIN(0, 1), GPIO_INT_BOTH, power_button_interrupt) GPIO_INT(LID_OPEN, PIN(D, 2), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, lid_interrupt) |