From b7f5f40c7d183e4c79451106c8b434ddf3265db3 Mon Sep 17 00:00:00 2001 From: "YongBeum.Ha" Date: Fri, 8 Oct 2021 08:36:36 +0900 Subject: bugzzy : LCD current setting on MP3372 In order to meet the specification of LCD brightness, it is necessary to set the current value of the LCD controller. BUG=b:202344727 BRANCH=None TEST=make -j BOARD=bugzzy Signed-off-by: YongBeum.Ha Change-Id: I4a688613681e9a68d9bb4c9103ddbf342c416d17 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3217483 Reviewed-by: Aseda Aboagye --- board/bugzzy/board.c | 28 ++++++++++++++++++++++++++++ board/bugzzy/board.h | 5 +++++ 2 files changed, 33 insertions(+) diff --git a/board/bugzzy/board.c b/board/bugzzy/board.c index 499e6c5e62..7fc6776b3f 100644 --- a/board/bugzzy/board.c +++ b/board/bugzzy/board.c @@ -774,3 +774,31 @@ DECLARE_HOOK(HOOK_AC_CHANGE, handle_tsp_ta, HOOK_PRIO_DEFAULT); const int usb_port_enable[USB_PORT_COUNT] = { GPIO_EN_USB_A0_VBUS, }; + +/* + * Change LED Driver Current + * LED driver current must be written when EN_BL_OD goes from Low to High. + */ +static int backup_enable_backlight = -1; +void backlit_gpio_tick(void) +{ + int signal = gpio_get_level(GPIO_ENABLE_BACKLIGHT); + + if (backup_enable_backlight == signal) + return; + + backup_enable_backlight = signal; + if (board_id == -1) { + uint32_t val; + + if (cbi_get_board_version(&val) == EC_SUCCESS) + board_id = val; + } + + if (board_id >= 4 && signal == 1) + i2c_write16(I2C_PORT_LCD, I2C_ADDR_MP3372_FLAGS, + MP3372_REG_ISET_CHEN, + MP3372_ISET_21P8_CHEN_ALL); + +} +DECLARE_HOOK(HOOK_TICK, backlit_gpio_tick, HOOK_PRIO_DEFAULT); diff --git a/board/bugzzy/board.h b/board/bugzzy/board.h index dba33aac0b..617d99ea1d 100644 --- a/board/bugzzy/board.h +++ b/board/bugzzy/board.h @@ -122,6 +122,7 @@ #define I2C_ADDR_EEPROM_FLAGS 0x50 /* 7b address */ #define I2C_ADDR_ISL98607_FLAGS 0x29 +#define I2C_ADDR_MP3372_FLAGS 0x28 /* ISL98607 registers and value */ /* VBST Voltage Adjustment */ @@ -136,6 +137,10 @@ #define ISL98607_REG_VP_OUT 0x09 #define ISL98607_VP_OUT_5P5 0x0a +/* MP3372 registers and value */ +/* ISET & CHEN */ +#define MP3372_REG_ISET_CHEN 0x00 +#define MP3372_ISET_21P8_CHEN_ALL 0x70ff /* * I2C pin names for baseboard * -- cgit v1.2.1