summaryrefslogtreecommitdiff
path: root/board/waddledoo
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2021-01-12 14:59:47 -0800
committerCommit Bot <commit-bot@chromium.org>2021-01-13 07:13:22 +0000
commit104d2c0873aa2f336b0114f9f7c7e848debabc85 (patch)
tree5bfabddec6b7c7c836f2a7a6f46985dbad485572 /board/waddledoo
parent56dc63df86d676cf970a49d2aa3189af74805a2c (diff)
downloadchrome-ec-104d2c0873aa2f336b0114f9f7c7e848debabc85.tar.gz
waddledoo: Add guards for 5V GPIO remap
Early versions of waddledoo had to have their 5V GPIO remapped between versions. As variants of waddledoo are created, they end up copying the same code which is not applicable to their board. This commit restricts the remap to the waddledoo board only. BUG=None BRANCH=dedede TEST=Copy code to a waddledoo variant, verify that board builds and 5V still works. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: I6de5ffc9bf7eb5d35f5778cc2c798519af3b18c9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2625794 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Auto-Submit: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'board/waddledoo')
-rw-r--r--board/waddledoo/board.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/board/waddledoo/board.c b/board/waddledoo/board.c
index 186b99a36c..d173a6019f 100644
--- a/board/waddledoo/board.c
+++ b/board/waddledoo/board.c
@@ -242,13 +242,14 @@ void board_reset_pd_mcu(void)
*/
}
+#ifdef BOARD_WADDLEDOO
static void reconfigure_5v_gpio(void)
{
/*
- * b/147257497: On early boards, GPIO_EN_PP5000 was swapped with
- * GPIO_VOLUP_BTN_ODL. Therefore, we'll actually need to set that GPIO
- * instead for those boards. Note that this breaks the volume up button
- * functionality.
+ * b/147257497: On early waddledoo boards, GPIO_EN_PP5000 was swapped
+ * with GPIO_VOLUP_BTN_ODL. Therefore, we'll actually need to set that
+ * GPIO instead for those boards. Note that this breaks the volume up
+ * button functionality.
*/
if (system_get_board_version() < 0) {
CPRINTS("old board - remapping 5V en");
@@ -256,24 +257,28 @@ static void reconfigure_5v_gpio(void)
}
}
DECLARE_HOOK(HOOK_INIT, reconfigure_5v_gpio, HOOK_PRIO_INIT_I2C+1);
+#endif /* BOARD_WADDLEDOO */
static void set_5v_gpio(int level)
{
int version;
- enum gpio_signal gpio;
+ enum gpio_signal gpio = GPIO_EN_PP5000;
/*
- * b/147257497: On early boards, GPIO_EN_PP5000 was swapped with
- * GPIO_VOLUP_BTN_ODL. Therefore, we'll actually need to set that GPIO
- * instead for those boards. Note that this breaks the volume up button
- * functionality.
+ * b/147257497: On early waddledoo boards, GPIO_EN_PP5000 was swapped
+ * with GPIO_VOLUP_BTN_ODL. Therefore, we'll actually need to set that
+ * GPIO instead for those boards. Note that this breaks the volume up
+ * button functionality.
*/
- version = system_get_board_version();
+ if (IS_ENABLED(BOARD_WADDLEDOO)) {
+ version = system_get_board_version();
- /*
- * If the CBI EEPROM wasn't formatted, assume it's a very early board.
- */
- gpio = version < 0 ? GPIO_VOLUP_BTN_ODL : GPIO_EN_PP5000;
+ /*
+ * If the CBI EEPROM wasn't formatted, assume it's a very early
+ * board.
+ */
+ gpio = version < 0 ? GPIO_VOLUP_BTN_ODL : GPIO_EN_PP5000;
+ }
gpio_set_level(gpio, level);
}