summaryrefslogtreecommitdiff
path: root/common/pwm_kblight.c
diff options
context:
space:
mode:
authorWai-Hong Tam <waihong@google.com>2020-07-09 13:17:31 -0700
committerCommit Bot <commit-bot@chromium.org>2020-07-10 20:45:07 +0000
commit3b05afd87d249c1318989fda9d0e341ab0d69f91 (patch)
treec1f268cc3daafa9984c6217456a2f8119287be96 /common/pwm_kblight.c
parent0f375d832f747696e60dc700509b545affdfef46 (diff)
downloadchrome-ec-3b05afd87d249c1318989fda9d0e341ab0d69f91.tar.gz
kblight: Unify the behavior with the general PWM driver
The general PWM driver (pwm.c) disables the PWM when the duty cycle is 0%. But the keyboard backlight PWM doesn't do that. It appears some inconsist result that the keyboard backlight shows 0% but the display backlight shows disabled. This CL makes the keyboard backlight PWM the same as the general PWM, that disables the PWM when the duty cycle is 0%. In order to keep it disabled, also modify the init, resume and lid change hooks. BRANCH=None BUG=b:157489286 TEST=Tested the hostcommand to set kblight: (AP console) localhost ~ # ectool pwmsetkblight 20 Keyboard backlight set. localhost ~ # ectool pwmgetkblight Current keyboard backlight percent: 20 (EC console) > pwm PWM channels: 0: 20% 1: 34% > kblight Keyboard backlight: 20% (AP console) localhost ~ # ectool pwmsetkblight 0 Keyboard backlight set. localhost ~ # ectool pwmgetkblight Current keyboard backlight percent: 0 (EC console) > pwm PWM channels: 0: disabled 1: 34% > kblight Keyboard backlight: 0% TEST=The disabled state is preserved across suspend/resume. > powerinfo power state 3 = S0, in 0x001e > pwm PWM channels: 0: disabled 1: 34% > power off > pwm PWM channels: 0: disabled 1: disabled > power on > pwm PWM channels: 0: disabled 1: 34% Change-Id: I39ad2b11518821751ee5658bbe4f0090ba515557 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2290831 Reviewed-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'common/pwm_kblight.c')
-rw-r--r--common/pwm_kblight.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/pwm_kblight.c b/common/pwm_kblight.c
index c6464b7011..4967d36df5 100644
--- a/common/pwm_kblight.c
+++ b/common/pwm_kblight.c
@@ -28,7 +28,7 @@ static int kblight_pwm_init(void)
{
/* dnojiri: Why do we need save/restore setting over sysjump? */
kblight_pwm_set(0);
- pwm_enable(kblight_pwm_ch, 1);
+ pwm_enable(kblight_pwm_ch, 0);
return EC_SUCCESS;
}