summaryrefslogtreecommitdiff
path: root/board/lazor/board.c
diff options
context:
space:
mode:
authorWai-Hong Tam <waihong@google.com>2020-07-09 11:09:29 -0700
committerCommit Bot <commit-bot@chromium.org>2020-07-10 02:52:46 +0000
commitbd3fe2f7c9a8ba0168d862f81749e7c82d44f89b (patch)
tree0f66b3a2aea251b29b7d92159e3adcbdf0a78b40 /board/lazor/board.c
parent2cc239894c16edf0ec48533ef13bfe5374a7eff7 (diff)
downloadchrome-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/lazor/board.c')
-rw-r--r--board/lazor/board.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/board/lazor/board.c b/board/lazor/board.c
index fcec96169e..76739e7380 100644
--- a/board/lazor/board.c
+++ b/board/lazor/board.c
@@ -236,6 +236,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);
@@ -272,9 +275,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);
@@ -283,8 +283,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);