From d5a61288137b26c3fa4e52e0eb0ff621ffb36807 Mon Sep 17 00:00:00 2001 From: Sameer Nanda Date: Fri, 23 Jan 2015 13:51:47 -0800 Subject: [PATCH] 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 Change-Id: I8f94a8bdc987ca5169ca3b6f8236ab7263ee4ef2 Reviewed-on: https://chromium-review.googlesource.com/242971 Reviewed-by: Eric Caruso Reviewed-by: Duncan Laurie Tested-by: Sameer Nanda Commit-Queue: Sameer Nanda Reviewed-by: Alec Berg --- board/samus/panel.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/board/samus/panel.c b/board/samus/panel.c index dacb0bcf3e..b0cb77a6d5 100644 --- a/board/samus/panel.c +++ b/board/samus/panel.c @@ -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, ®);