diff options
author | Duncan Laurie <dlaurie@chromium.org> | 2013-11-12 14:12:10 +0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2013-11-13 05:19:05 +0000 |
commit | 034e06febf0e3ed1daf55f66f82e7c6c804bcb3b (patch) | |
tree | a1b6221b2efc50c976a233783064c1ef801494b5 /board/samus/panel.c | |
parent | 33f29160a0caa776a5e6e341b30d915119f84f51 (diff) | |
download | chrome-ec-034e06febf0e3ed1daf55f66f82e7c6c804bcb3b.tar.gz |
samus: Fix backlight panel interrupt
The backlight_interrupt() function is defined to NULL if the magic
CONFIG_BACKLIGHT_REQ_GPIO is not defined.
Enabling that exposed an issue where the backlight workaround was
attempted in interrupt context and should instead be deferred since
it involves i2c transactions.
BUG=chrome-os-partner:23752
BRANCH=none
TEST=build and boot on samus proto1b and see recovery screen
Change-Id: Id1377033c791a5c279fdb4faeecc4b2c0d142eaa
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/176514
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'board/samus/panel.c')
-rw-r--r-- | board/samus/panel.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/board/samus/panel.c b/board/samus/panel.c index 9b62f0e2c9..c9c9c3f6cb 100644 --- a/board/samus/panel.c +++ b/board/samus/panel.c @@ -21,7 +21,7 @@ /** * Enable PWM mode in backlight controller and turn it on. */ -static int lp8555_enable_pwm_mode(void) +static void lp8555_enable_pwm_mode(void) { int reg; @@ -39,9 +39,8 @@ static int lp8555_enable_pwm_mode(void) reg |= LP8555_REG_COMMAND_ON; i2c_write8(I2C_PORT_BACKLIGHT, I2C_ADDR_BACKLIGHT, LP8555_REG_COMMAND, reg); - - return EC_SUCCESS; } +DECLARE_DEFERRED(lp8555_enable_pwm_mode); /** * Host command to toggle backlight. @@ -67,7 +66,7 @@ void backlight_interrupt(enum gpio_signal signal) * PCH indicates it is turning on backlight so we should * attempt to put the backlight controller into PWM mode. */ - lp8555_enable_pwm_mode(); + hook_call_deferred(lp8555_enable_pwm_mode, 0); } /** @@ -80,6 +79,8 @@ static void update_backlight(void) * the AP in hardware. */ gpio_set_level(GPIO_ENABLE_BACKLIGHT, lid_is_open()); + if (lid_is_open()) + hook_call_deferred(lp8555_enable_pwm_mode, 0); } DECLARE_HOOK(HOOK_LID_CHANGE, update_backlight, HOOK_PRIO_DEFAULT); @@ -89,6 +90,6 @@ DECLARE_HOOK(HOOK_LID_CHANGE, update_backlight, HOOK_PRIO_DEFAULT); static void backlight_init(void) { gpio_enable_interrupt(GPIO_PCH_BL_EN); - update_backlight(); + gpio_set_level(GPIO_ENABLE_BACKLIGHT, lid_is_open()); } DECLARE_HOOK(HOOK_INIT, backlight_init, HOOK_PRIO_DEFAULT); |