diff options
author | Zick Wei <zick.wei@quanta.corp-partner.google.com> | 2020-09-16 09:13:09 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-10-07 02:22:20 +0000 |
commit | 900189e9b6e95cce90d06586a4f3c8e4c6ce201e (patch) | |
tree | 736ae56936b533a8b3498856070875287e0ba6cd | |
parent | 60e078f5603f344f0ffde51d743309ad19a24e46 (diff) | |
download | chrome-ec-900189e9b6e95cce90d06586a4f3c8e4c6ce201e.tar.gz |
dooly: add oz554 support
This CL add oz554 support and add panel backlight config.
BUG=b:168444976
BRANCH=puff
TEST=make BOARD=dooly
Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com>
Change-Id: I8bb8da1b8efdb819f0ff80d5f5954ad75aa2b7b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2413674
Reviewed-by: Andrew McRae <amcrae@chromium.org>
Commit-Queue: Andrew McRae <amcrae@chromium.org>
-rw-r--r-- | board/dooly/board.c | 27 | ||||
-rw-r--r-- | board/dooly/board.h | 6 | ||||
-rw-r--r-- | board/dooly/gpio.inc | 7 | ||||
-rw-r--r-- | driver/led/oz554.c | 4 |
4 files changed, 41 insertions, 3 deletions
diff --git a/board/dooly/board.c b/board/dooly/board.c index bc3ed0ed6c..8c1c295a66 100644 --- a/board/dooly/board.c +++ b/board/dooly/board.c @@ -15,6 +15,7 @@ #include "core/cortex-m/cpu.h" #include "cros_board_info.h" #include "driver/ina3221.h" +#include "driver/led/oz554.h" #include "driver/ppc/sn5s330.h" #include "driver/tcpm/anx7447.h" #include "driver/tcpm/ps8xxx.h" @@ -944,3 +945,29 @@ static void power_monitor(void) } hook_call_deferred(&power_monitor_data, delay); } + +__override void oz554_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"); + oz554_set_config(0, 0xF3); + oz554_set_config(2, 0x55); + oz554_set_config(5, 0x87); + break; + case 0x02: + CPRINTS("PANEL_WF9_SSA2"); + oz554_set_config(0, 0xF3); + oz554_set_config(2, 0x4C); + oz554_set_config(5, 0xB7); + break; + default: + CPRINTS("PANEL UNKNOWN"); + break; + } +} diff --git a/board/dooly/board.h b/board/dooly/board.h index b79a1d2b74..3ea5583766 100644 --- a/board/dooly/board.h +++ b/board/dooly/board.h @@ -180,6 +180,12 @@ #define I2C_PORT_POWER NPCX_I2C_PORT5_0 #define I2C_PORT_EEPROM NPCX_I2C_PORT7_0 #define I2C_ADDR_EEPROM_FLAGS 0x50 +#define I2C_PORT_BACKLIGHT NPCX_I2C_PORT7_0 + +/* + * LED backlight controller + */ +#define CONFIG_LED_DRIVER_OZ554 #define PP5000_PGOOD_POWER_SIGNAL_MASK POWER_SIGNAL_MASK(PP5000_A_PGOOD) diff --git a/board/dooly/gpio.inc b/board/dooly/gpio.inc index b149ba64ad..aed8bedd82 100644 --- a/board/dooly/gpio.inc +++ b/board/dooly/gpio.inc @@ -42,6 +42,7 @@ GPIO_INT(USB_C0_TCPPC_INT_ODL, PIN(E, 0), GPIO_INT_FALLING, ppc_interrupt) GPIO_INT(USB_C0_TCPC_INT_ODL, PIN(6, 2), GPIO_INT_FALLING, tcpc_alert_event) GPIO_INT(USB_C1_TCPPC_INT_ODL, PIN(A, 2), GPIO_INT_FALLING, ppc_interrupt) GPIO_INT(USB_C1_TCPC_INT_ODL, PIN(E, 4), GPIO_INT_FALLING, tcpc_alert_event) +GPIO_INT(PANEL_BACKLIGHT_EN, PIN(B, 1), GPIO_INT_RISING, backlight_enable_interrupt) /* * Directly connected recovery button. */ @@ -141,11 +142,14 @@ ALTERNATE(PIN_MASK(F, 0x01), 0, MODULE_ADC, 0) /* ADC9 */ /* UART */ ALTERNATE(PIN_MASK(6, 0x30), 0, MODULE_UART, 0) /* UART from EC to Servo */ +/* PANEL ID */ +GPIO(PANEL_ID0, PIN(0, 2), GPIO_INPUT) +GPIO(PANEL_ID1, PIN(C, 6), GPIO_INPUT) + /* Unused pins */ UNUSED(PIN(D, 3)) /* E9 TP55 */ UNUSED(PIN(9, 5)) /* H10 TP54 */ UNUSED(PIN(4, 0)) /* E4 TP56 */ -UNUSED(PIN(B, 1)) /* F8 TP59 */ UNUSED(PIN(5, 0)) /* G4 NC */ UNUSED(PIN(9, 6)) /* M12 TP998 */ UNUSED(PIN(0, 7)) /* E8 TP991 */ @@ -160,7 +164,6 @@ UNUSED(PIN(C, 2)) /* A12 NC */ UNUSED(PIN(1, 2)) /* C6 NC */ UNUSED(PIN(6, 6)) /* H4 NC */ UNUSED(PIN(8, 1)) /* L6 NC */ -UNUSED(PIN(C, 6)) /* B11 NC */ UNUSED(PIN(E, 2)) /* B8 NC */ UNUSED(PIN(8, 5)) /* L7 NC */ UNUSED(PIN(0, 0)) /* D11 NC */ diff --git a/driver/led/oz554.c b/driver/led/oz554.c index fcbbee46ce..504ac55e90 100644 --- a/driver/led/oz554.c +++ b/driver/led/oz554.c @@ -124,9 +124,11 @@ int oz554_set_config(int offset, int data) if (oz554_conf[i].offset == offset) break; } - if (i >= oz554_conf_size) + if (i >= oz554_conf_size) { /* Matching offset not found */ + CPRINTS("oz554: offset %d not found", i); return EC_ERROR_INVAL; + } oz554_conf[i].data = data; return EC_SUCCESS; } |