diff options
author | Ting Shen <phoenixshen@google.com> | 2020-08-04 18:12:23 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-08-07 10:13:45 +0000 |
commit | ebe586fb7846cfb85af6f46ea8610ac5f993f496 (patch) | |
tree | d2cee8631cf98d10bfb78fef581463869af96623 /board/asurada/board.c | |
parent | 8e1f23e8d3dd0cdd8817768adf8e451c49b54310 (diff) | |
download | chrome-ec-ebe586fb7846cfb85af6f46ea8610ac5f993f496.tar.gz |
asurada: support both rev0/1 AC_PRESENT pin
The location of AC_PRESENT has changed in rev 1, to support
both rev 0 and 1, the default AC_PRESENT is assigned to a
placeholder pin when boot, and re-assign to the correct pin
after ADC is accessible.
BUG=b:162814191
TEST=See "AC on/off" triggered correctly on both rev 0 and rev 1
device.
BRANCH=master
Signed-off-by: Ting Shen <phoenixshen@google.com>
Change-Id: I2d331b60a4a4420004fea19b0c446b1116816f9b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2336661
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Tested-by: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'board/asurada/board.c')
-rw-r--r-- | board/asurada/board.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/board/asurada/board.c b/board/asurada/board.c index 07c0e92ac3..6fa4471291 100644 --- a/board/asurada/board.c +++ b/board/asurada/board.c @@ -82,12 +82,12 @@ const struct pwm_t pwm_channels[] = { BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); /* Wake-up pins for hibernate */ -const enum gpio_signal hibernate_wake_pins[] = { - GPIO_AC_PRESENT, +enum gpio_signal hibernate_wake_pins[] = { + GPIO_AC_PRESENT_PLACEHOLDER, GPIO_LID_OPEN, GPIO_POWER_BUTTON_L, }; -const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins); +int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins); /* power signal list. Must match order of enum power_signal. */ const struct power_signal_info power_signal_list[] = { @@ -603,6 +603,27 @@ int board_regulator_get_voltage(uint32_t index, uint32_t *voltage_mv) return mt6360_ldo_get_voltage(ldo_id, voltage_mv); } +/* gpio */ + +/* TODO(b/163098341): Remove these after rev0 deprecated. */ +enum gpio_signal GPIO_AC_PRESENT = GPIO_AC_PRESENT_PLACEHOLDER; + +static void ac_present_init(void) +{ + if (board_get_version() == 0) + GPIO_AC_PRESENT = GPIO_EC_GPM2; + else + GPIO_AC_PRESENT = GPIO_EC_GPE5; + + /* Set wake pins to the correct one */ + hibernate_wake_pins[0] = GPIO_AC_PRESENT; + + /* Manually run extpower_init() again */ + gpio_enable_interrupt(GPIO_AC_PRESENT); + extpower_interrupt(GPIO_AC_PRESENT); +} +DECLARE_HOOK(HOOK_INIT, ac_present_init, HOOK_PRIO_INIT_ADC + 1); + /* Sensor */ static struct mutex g_base_mutex; static struct mutex g_lid_mutex; |