diff options
author | Nicolas Boichat <drinkcat@chromium.org> | 2019-10-01 15:27:18 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-10-02 12:44:34 +0000 |
commit | 8915e19a9b373ad87878d67973be6cdcaf5eb2e1 (patch) | |
tree | 1a1ba13290796fc0282f76abf547b46e8b9a5d7d /board/hammer/board.c | |
parent | c35ab4daf5c67569cc4d0680eb672ba76e0d455b (diff) | |
download | chrome-ec-8915e19a9b373ad87878d67973be6cdcaf5eb2e1.tar.gz |
board/hammer: Add variant with backlight totally disabled
Some boards lack the external pull-up to indicate absence of
keyboard backlight, so add a new HAS_BACKLIGHT define.
Also, remove support for long deprecated early staff boards,
and move backlight detection to RW only.
BRANCH=none
BUG=b:67722756
BUG=b:140596094
TEST=make BOARD=masterball -j
Change-Id: I20d83ec9df64e2b00eed2ca540e4d302bbbee4d1
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1833034
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 | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/board/hammer/board.c b/board/hammer/board.c index aec8f457f4..c8ebbd856e 100644 --- a/board/hammer/board.c +++ b/board/hammer/board.c @@ -98,17 +98,13 @@ const struct i2c_port_t i2c_ports[] = { const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); #endif -#ifdef BOARD_STAFF -#define KBLIGHT_PWM_FREQ 100 /* Hz */ -#else -#define KBLIGHT_PWM_FREQ 50000 /* Hz */ -#endif - +#ifdef HAS_BACKLIGHT /* PWM channels. Must be in the exactly same order as in enum pwm_channel. */ const struct pwm_t pwm_channels[] = { {STM32_TIM(TIM_KBLIGHT), STM32_TIM_CH(1), 0, KBLIGHT_PWM_FREQ}, }; BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); +#endif /* HAS_BACKLIGHT */ int usb_i2c_board_is_enabled(void) { @@ -163,29 +159,16 @@ static struct usart_config const ec_ec_usart = */ static int has_keyboard_backlight; +#ifdef SECTION_IS_RW static void board_init(void) { +#ifdef HAS_BACKLIGHT /* Detect keyboard backlight: pull-down means it is present. */ has_keyboard_backlight = !gpio_get_level(GPIO_KEYBOARD_BACKLIGHT); CPRINTS("Backlight%s present", has_keyboard_backlight ? "" : " not"); +#endif /* HAS_BACKLIGHT */ -#ifdef BOARD_STAFF - if (!has_keyboard_backlight) { - /* - * Earlier staff boards have both PU and PD stuffed, and end up - * being detected as not have keyboard backlight. However, we - * need to enable internal PD on the pin, otherwise backlight - * will always be on. - * TODO(b:67722756): Remove this hack when old boards are - * deprecated. - */ - gpio_set_flags(GPIO_KEYBOARD_BACKLIGHT, - GPIO_PULL_DOWN | GPIO_INPUT); - } -#endif /* BOARD_STAFF */ - -#ifdef SECTION_IS_RW #ifdef BOARD_WAND /* USB to serial queues */ queue_init(&ec_ec_comm_slave_input); @@ -221,10 +204,10 @@ static void board_init(void) gpio_config_module(MODULE_SPI_MASTER, 1); spi_enable(CONFIG_SPI_TOUCHPAD_PORT, 1); #endif /* HAS_SPI_TOUCHPAD */ -#endif /* SECTION_IS_RW */ } /* This needs to happen before PWM is initialized. */ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_INIT_PWM - 1); +#endif /* SECTION_IS_RW */ void board_config_pre_init(void) { |