diff options
author | Nicolas Boichat <drinkcat@chromium.org> | 2019-08-12 08:52:37 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-08-12 05:39:14 +0000 |
commit | e4440d52945fef7e5f3c98911f50363e65fc488e (patch) | |
tree | 73cffd4360d9bdccd72cee70770f29075301cd1f /board/hammer/board.c | |
parent | fb0eb4d1b932ba469f7385e42cf43f5a11f09c85 (diff) | |
download | chrome-ec-e4440d52945fef7e5f3c98911f50363e65fc488e.tar.gz |
hammer: Refactor config options to support more variants
board.h is already quite difficult to read, and will become worse
as we add more and more derivatives, let's refactor most of the
variations into variants.h.
BRANCH=none
BUG=b:138968914
TEST=make buildall -j, see that there is no size change before
and after the change.
Change-Id: Ideb381d8d04c65c3e76eb3ab9353e1ce5cdee954
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1746352
Reviewed-by: Wei-Han Chen <stimim@chromium.org>
Reviewed-by: Yilun Lin <yllin@chromium.org>
Diffstat (limited to 'board/hammer/board.c')
-rw-r--r-- | board/hammer/board.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/board/hammer/board.c b/board/hammer/board.c index 6b7a4029cf..fe50321fa9 100644 --- a/board/hammer/board.c +++ b/board/hammer/board.c @@ -72,7 +72,7 @@ BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT); */ #ifdef SECTION_IS_RW -#ifdef BOARD_WHISKERS +#ifdef HAS_SPI_TOUCHPAD /* SPI devices */ const struct spi_device_t spi_devices[] = { [SPI_ST_TP_DEVICE_ID] = { CONFIG_SPI_TOUCHPAD_PORT, 2, GPIO_SPI1_NSS }, @@ -83,7 +83,7 @@ USB_SPI_CONFIG(usb_spi, USB_IFACE_I2C_SPI, USB_EP_I2C_SPI); /* SPI interface is always enabled, no need to do anything. */ void usb_spi_board_enable(struct usb_spi_config const *config) {} void usb_spi_board_disable(struct usb_spi_config const *config) {} -#endif /* !BOARD_WHISKERS */ +#endif /* !HAS_SPI_TOUCHPAD */ /* I2C ports */ const struct i2c_port_t i2c_ports[] = { @@ -193,8 +193,11 @@ static void board_init(void) usart_init(&ec_ec_usart); #endif /* BOARD_WAND */ -#ifdef BOARD_WHISKERS +#ifdef CONFIG_LED_DRIVER_LM3630A lm3630a_poweron(); +#endif + +#ifdef HAS_SPI_TOUCHPAD spi_enable(CONFIG_SPI_TOUCHPAD_PORT, 0); /* Disable SPI passthrough when the system is locked */ @@ -215,7 +218,7 @@ static void board_init(void) /* Enable SPI for touchpad */ gpio_config_module(MODULE_SPI_MASTER, 1); spi_enable(CONFIG_SPI_TOUCHPAD_PORT, 1); -#endif /* BOARD_WHISKERS */ +#endif /* HAS_SPI_TOUCHPAD */ #endif /* SECTION_IS_RW */ } /* This needs to happen before PWM is initialized. */ @@ -243,7 +246,7 @@ int board_has_keyboard_backlight(void) /* Reset the touchpad, mainly used to recover it from malfunction. */ void board_touchpad_reset(void) { -#ifdef BOARD_WHISKERS +#ifdef HAS_EN_PP3300_TP_ACTIVE_HIGH gpio_set_level(GPIO_EN_PP3300_TP, 0); msleep(100); gpio_set_level(GPIO_EN_PP3300_TP, 1); @@ -256,7 +259,7 @@ void board_touchpad_reset(void) #endif } -#if defined(BOARD_WHISKERS) && defined(SECTION_IS_RW) +#ifdef CONFIG_KEYBOARD_TABLET_MODE_SWITCH static void board_tablet_mode_change(void) { /* |