diff options
author | Caveh Jalali <caveh@chromium.org> | 2021-05-21 19:38:14 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-05-27 00:49:04 +0000 |
commit | 8f73ff30c84d243ac433b2daf2f6b558a8464bd5 (patch) | |
tree | 2b8a817e92fc7a4078fb315ea65497c8bf0a18e8 /board/brya | |
parent | 49fb3c826171b1c2d90ed8aa562e22e1fd818c78 (diff) | |
download | chrome-ec-8f73ff30c84d243ac433b2daf2f6b558a8464bd5.tar.gz |
brya: Board ID 1: Handle KB_BL_EN reassignment
We are transitioning GPIO definitions to be correct for board ID 2. In
order to support board ID 1 with the same EC image, some GPIOs need to
be reconfigured to their legacy settings at runtime when board ID 1 is
detected. For board ID 2, the keyboard backlight enable GPIO has moved
to a previously unused pin and its polarity is inverted. The original
pin is now an ADC input pin.
BRANCH=none
BUG=b:183452273
TEST=verified keyboard backlight function with "kblight" EC console command
Change-Id: I86a1b09c9aaab8f6275a65cd1331f135b152f538
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2914208
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Boris Mittelberg <bmbm@google.com>
Diffstat (limited to 'board/brya')
-rw-r--r-- | board/brya/board.c | 26 | ||||
-rw-r--r-- | board/brya/board.h | 2 |
2 files changed, 26 insertions, 2 deletions
diff --git a/board/brya/board.c b/board/brya/board.c index 8f336c9dee..4c3c89567e 100644 --- a/board/brya/board.c +++ b/board/brya/board.c @@ -47,7 +47,11 @@ __override void board_cbi_init(void) static void board_chipset_resume(void) { /* Allow keyboard backlight to be enabled */ - gpio_set_level(GPIO_EC_KB_BL_EN, 1); + + if (get_board_id() == 1) + gpio_set_level(GPIO_ID_1_EC_KB_BL_EN, 1); + else + gpio_set_level(GPIO_EC_KB_BL_EN_L, 0); } DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT); @@ -55,7 +59,11 @@ DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT); static void board_chipset_suspend(void) { /* Turn off the keyboard backlight if it's on. */ - gpio_set_level(GPIO_EC_KB_BL_EN, 0); + + if (get_board_id() == 1) + gpio_set_level(GPIO_ID_1_EC_KB_BL_EN, 0); + else + gpio_set_level(GPIO_EC_KB_BL_EN_L, 1); } DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT); @@ -99,3 +107,17 @@ enum battery_present battery_hw_present(void) return gpio_get_level(GPIO_EC_BATT_PRES_ODL) ? BP_NO : BP_YES; } +/* + * Explicitly apply the board ID 1 *gpio.inc settings to pins that + * were reassigned on current boards. + */ + +static void set_board_id_1_gpios(void) +{ + if (get_board_id() != 1) + return; + + gpio_set_flags(GPIO_ID_1_EC_KB_BL_EN, GPIO_OUT_LOW); +} +DECLARE_HOOK(HOOK_INIT, set_board_id_1_gpios, HOOK_PRIO_FIRST); + diff --git a/board/brya/board.h b/board/brya/board.h index b14543e031..b3c79ccdd8 100644 --- a/board/brya/board.h +++ b/board/brya/board.h @@ -138,6 +138,8 @@ #define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL #define GPIO_WP_L GPIO_EC_WP_ODL +#define GPIO_ID_1_EC_KB_BL_EN GPIO_EC_BATT_PRES_ODL + /* System has back-lit keyboard */ #define CONFIG_PWM_KBLIGHT |