summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-07-08 14:34:05 -0700
committerChromeBot <chrome-bot@google.com>2013-07-09 08:51:20 -0700
commit3e7d7090aa97fdf10a5b02430d81bef84afe8786 (patch)
treeee7b9478c2c33ff95303e2c908703c4dd3784c12
parent958e43840eb64e5403d08e5d3289f6fa65500ba0 (diff)
downloadchrome-ec-3e7d7090aa97fdf10a5b02430d81bef84afe8786.tar.gz
Keyboard backlight control should hook lid switch itself
It previously relied on the switch module to enable/disable the keyboard backlight when the lid changed position. It can do that itself now. BUG=chrome-os-partner:20743 BRANCH=none TEST=Boot link in a dark room where the keyboard backlight is on. Briefly run a magnet over the lid switch and see the keyboard backlight blink off and then back on. Change-Id: Iadf02b780a4990db25b6f0b3e1e0692f49c5488d Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61194 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r--chip/lm4/pwm_kblight.c7
-rw-r--r--chip/lm4/switch.c5
2 files changed, 7 insertions, 5 deletions
diff --git a/chip/lm4/pwm_kblight.c b/chip/lm4/pwm_kblight.c
index 9382a8e35f..8710896928 100644
--- a/chip/lm4/pwm_kblight.c
+++ b/chip/lm4/pwm_kblight.c
@@ -11,6 +11,7 @@
#include "gpio.h"
#include "hooks.h"
#include "host_command.h"
+#include "lid_switch.h"
#include "pwm.h"
#include "registers.h"
#include "system.h"
@@ -188,3 +189,9 @@ static void pwm_kblight_shutdown(void)
pwm_set_keyboard_backlight(0);
}
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, pwm_kblight_shutdown, HOOK_PRIO_DEFAULT);
+
+static void pwm_kblight_lid_change(void)
+{
+ pwm_enable_keyboard_backlight(lid_is_open());
+}
+DECLARE_HOOK(HOOK_LID_CHANGE, pwm_kblight_lid_change, HOOK_PRIO_DEFAULT);
diff --git a/chip/lm4/switch.c b/chip/lm4/switch.c
index c4f1526275..168b57eb7c 100644
--- a/chip/lm4/switch.c
+++ b/chip/lm4/switch.c
@@ -153,11 +153,6 @@ static void update_backlight(void)
gpio_set_level(GPIO_ENABLE_BACKLIGHT, 1);
else
gpio_set_level(GPIO_ENABLE_BACKLIGHT, 0);
-
-#ifdef CONFIG_PWM_KBLIGHT
- /* Same with keyboard backlight */
- pwm_enable_keyboard_backlight(lid_is_open());
-#endif
}
/**