diff options
author | Wai-Hong Tam <waihong@google.com> | 2020-07-09 11:09:29 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-07-10 02:52:46 +0000 |
commit | bd3fe2f7c9a8ba0168d862f81749e7c82d44f89b (patch) | |
tree | 0f66b3a2aea251b29b7d92159e3adcbdf0a78b40 /board/trogdor | |
parent | 2cc239894c16edf0ec48533ef13bfe5374a7eff7 (diff) | |
download | chrome-ec-bd3fe2f7c9a8ba0168d862f81749e7c82d44f89b.tar.gz |
Trogdor: Initialize the backlight PWMs to be disabled
There are 2 PWMs for the backlight: display and keyboard. The keyboard
background is controlled by the keyboard_backlight.c. The board file
doesn't need to define its behavior. So move it from the board.c.
The display backlight should be initialized to 0% duty cycle and set to
disabled at the beginning. AP will override the value later.
When resume from suspend, keep it disabled if the duty cycle is 0%.
BRANCH=None
BUG=b:157489286
TEST=When EC reboot, the display backlight (channel:1) is disabled.
> pwm
PWM channels:
0: disabled
1: disabled
When booting into the userspace, the display backlight is set to 34%.
> pwm
PWM channels:
0: disabled
1: 34%
Manually set the brightness to 0%.
> pwm
PWM channels:
0: disabled
1: disabled
Change-Id: I07207969b1541326e77167eadc04899554d858dd
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2290830
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Diffstat (limited to 'board/trogdor')
-rw-r--r-- | board/trogdor/board.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/board/trogdor/board.c b/board/trogdor/board.c index 4ada5e7945..00c8e3c024 100644 --- a/board/trogdor/board.c +++ b/board/trogdor/board.c @@ -250,6 +250,9 @@ static void board_init(void) * the CCD_MODE_ODL interrupt to make sure the SBU FETs are connected. */ gpio_enable_interrupt(GPIO_CCD_MODE_ODL); + + /* Set the backlight duty cycle to 0. AP will override it later. */ + pwm_set_duty(PWM_CH_DISPLIGHT, 0); } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); @@ -286,9 +289,6 @@ static void board_chipset_suspend(void) */ gpio_set_level(GPIO_ENABLE_BACKLIGHT, 0); pwm_enable(PWM_CH_DISPLIGHT, 0); - - /* Disable the keyboard backlight */ - pwm_enable(PWM_CH_KBLIGHT, 0); } DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT); @@ -297,8 +297,8 @@ static void board_chipset_resume(void) { /* Turn on display and keyboard backlight in S0. */ gpio_set_level(GPIO_ENABLE_BACKLIGHT, 1); - pwm_enable(PWM_CH_DISPLIGHT, 1); - pwm_enable(PWM_CH_KBLIGHT, 1); + if (pwm_get_duty(PWM_CH_DISPLIGHT)) + pwm_enable(PWM_CH_DISPLIGHT, 1); } DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT); |