mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-09 17:11:42 +00:00
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>
This commit is contained in:
committed by
chrome-internal-fetch
parent
33f29160a0
commit
034e06febf
@@ -27,6 +27,7 @@
|
||||
#define CONFIG_POWER_BUTTON
|
||||
#define CONFIG_POWER_BUTTON_X86
|
||||
|
||||
#define CONFIG_BACKLIGHT_REQ_GPIO GPIO_PCH_BL_EN
|
||||
#define CONFIG_BATTERY_CHECK_CONNECTED
|
||||
#define CONFIG_BATTERY_LINK
|
||||
#define CONFIG_BATTERY_SMART
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user