samus: Cap the max LED current to 23mA

Samus panels are spec'ed at 23mA max LED current. Limit the max
current to that.

BRANCH=samus
BUG=chrome-os-partner:35816
TEST=The following command should read back the value of 0x4 after
system boot, resume as well as after panel off/on sequence:
ectool --dev=0 i2cread 8 0 0x58 0x11

Signed-off-by: Sameer Nanda <snanda@chromium.org>

Change-Id: I8f94a8bdc987ca5169ca3b6f8236ab7263ee4ef2
Reviewed-on: https://chromium-review.googlesource.com/242971
Reviewed-by: Eric Caruso <ejcaruso@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Tested-by: Sameer Nanda <snanda@chromium.org>
Commit-Queue: Sameer Nanda <snanda@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
This commit is contained in:
Sameer Nanda
2015-01-23 13:51:47 -08:00
committed by ChromeOS Commit Bot
parent 55e9d8a0c1
commit d5a6128813

View File

@@ -19,6 +19,15 @@
#define LP8555_REG_CONFIG 0x10
#define LP8555_REG_CONFIG_MODE_MASK 0x03
#define LP8555_REG_CONFIG_MODE_PWM 0x00
#define LP8555_REG_CURRENT 0x11
#define LP8555_REG_CURRENT_MAXCURR_5MA 0x00
#define LP8555_REG_CURRENT_MAXCURR_10MA 0x01
#define LP8555_REG_CURRENT_MAXCURR_15MA 0x02
#define LP8555_REG_CURRENT_MAXCURR_20MA 0x03
#define LP8555_REG_CURRENT_MAXCURR_23MA 0x04
#define LP8555_REG_CURRENT_MAXCURR_25MA 0x05
#define LP8555_REG_CURRENT_MAXCURR_30MA 0x06
#define LP8555_REG_CURRENT_MAXCURR_50MA 0x07
/**
* Enable PWM mode in backlight controller and turn it on.
@@ -35,6 +44,10 @@ static void lp8555_enable_pwm_mode(void)
i2c_write8(I2C_PORT_BACKLIGHT, I2C_ADDR_BACKLIGHT,
LP8555_REG_CONFIG, reg);
/* Set max LED current to 23mA. */
i2c_write8(I2C_PORT_BACKLIGHT, I2C_ADDR_BACKLIGHT,
LP8555_REG_CURRENT, LP8555_REG_CURRENT_MAXCURR_23MA);
/* Power on. */
i2c_read8(I2C_PORT_BACKLIGHT, I2C_ADDR_BACKLIGHT,
LP8555_REG_COMMAND, &reg);