diff options
author | Zick Wei <zick.wei@quanta.corp-partner.google.com> | 2021-12-10 11:36:26 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-12-20 05:07:30 +0000 |
commit | 8637afa2123785ae0e3ffc4a35de273c79c304c4 (patch) | |
tree | f6d6fa5cd9318953eff48a9ae1e70420d1d5ce1a /board/dooly/board.c | |
parent | d6a4b19c732a9b690baa12a90614b1506a2e61c5 (diff) | |
download | chrome-ec-8637afa2123785ae0e3ffc4a35de273c79c304c4.tar.gz |
dooly: support led driver mp3385
This patch add support mp3385 as second source led
backlight ic.
BUG=b:208722790
BRANCH=puff
TEST=verify backlight ic setting different by SSFC.
Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com>
Change-Id: I88c5b9e4c13afe61812c0f51b944b6525d6959c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3329188
Reviewed-by: Andrew McRae <amcrae@google.com>
Diffstat (limited to 'board/dooly/board.c')
-rw-r--r-- | board/dooly/board.c | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/board/dooly/board.c b/board/dooly/board.c index 6518b36770..06e479649d 100644 --- a/board/dooly/board.c +++ b/board/dooly/board.c @@ -18,6 +18,7 @@ #include "driver/als_tcs3400.h" #include "driver/ina3221.h" #include "driver/led/oz554.h" +#include "driver/led/mp3385.h" #include "driver/ppc/sn5s330.h" #include "driver/tcpm/anx7447.h" #include "driver/tcpm/ps8xxx.h" @@ -762,8 +763,11 @@ static void board_init(void) memmap_batt_flags = host_get_memmap(EC_MEMMAP_BATT_FLAG); *memmap_batt_flags |= EC_BATT_FLAG_AC_PRESENT; - /* Initial backlight ic setting */ - oz554_board_init(); + /* Initial backlight ic setting by ssfc */ + if (ec_ssfc_get_led_ic() == SSFC_LED_MP3385) + mp3385_board_init(); + else + oz554_board_init(); gpio_enable_interrupt(GPIO_PANEL_BACKLIGHT_EN); } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); @@ -1256,3 +1260,45 @@ void oz554_board_init(void) break; } } + +void mp3385_board_init(void) +{ + int pin_status = 0; + + pin_status |= gpio_get_level(GPIO_PANEL_ID0) << 0; + pin_status |= gpio_get_level(GPIO_PANEL_ID1) << 1; + + switch (pin_status) { + case 0x00: + CPRINTS("PANEL_HAN01.10A"); + mp3385_set_config(0, 0xF1); + mp3385_set_config(2, 0x4C); + mp3385_set_config(5, 0xB7); + break; + case 0x02: + CPRINTS("PANEL_WF9_SSA2"); + mp3385_set_config(0, 0xF1); + mp3385_set_config(2, 0x55); + mp3385_set_config(5, 0x87); + break; + default: + CPRINTS("PANEL UNKNOWN"); + break; + } +} + +void board_backlight_enable_interrupt(enum gpio_signal signal) +{ + switch (ec_ssfc_get_led_ic()) { + case SSFC_LED_OZ554: + oz554_interrupt(signal); + break; + case SSFC_LED_MP3385: + mp3385_interrupt(signal); + break; + default: + oz554_interrupt(signal); + break; + } + +} |