diff options
author | Tommy Chung <tommy.chung@quanta.corp-partner.google.com> | 2021-12-01 21:17:15 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-12-03 20:29:21 +0000 |
commit | f9bf94b5f908d13360238a818a53da0dd8a0d8a6 (patch) | |
tree | 84d35c3be5958579b97e4fc4b733afc8c7d012b9 | |
parent | de76a1b2b604bae6ed25b8eebe3abef95fefff02 (diff) | |
download | chrome-ec-f9bf94b5f908d13360238a818a53da0dd8a0d8a6.tar.gz |
drawcia: Don't report HDMI_HPD to CPU when power state S5
Since PP5000_HDMI is enabled by EN_PP5000_U, which means that it's
still turned on when power state S5, VOLUP_BTN_ODL_HDMI_HPD will be
asserted when HDMI is plugged in. If we report this to CPU through
EC_AP_USB_C1_HDMI_HPD, there will be leakage current on CPU side
which might lead to unabling to power on the system.
BUG=none
BRANCH=dedede
TEST=make sure that EC_AP_USB_C1_HDMI_HPD is deasserted when power
state S5 and HDMI plugged in, while it can work when system resume.
Signed-off-by: Tommy Chung <tommy.chung@quanta.corp-partner.google.com>
Change-Id: I67d1af60b74343611e0ca6f54773216cf4caa895
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3306791
Reviewed-by: Devin Lu <Devin.Lu@quantatw.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r-- | board/drawcia/board.c | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/board/drawcia/board.c b/board/drawcia/board.c index 80f93e4d1d..89b0ba90f7 100644 --- a/board/drawcia/board.c +++ b/board/drawcia/board.c @@ -135,14 +135,30 @@ static void usb_c1_interrupt(enum gpio_signal s) hook_call_deferred(&check_c1_line_data, INT_RECHECK_US); } +static void board_enable_hdmi_hpd(int enable) +{ + enum fw_config_db db = get_cbi_fw_config_db(); + int hdmi_hpd = gpio_get_level(GPIO_VOLUP_BTN_ODL_HDMI_HPD); + + if (db == DB_1A_HDMI || db == DB_LTE_HDMI || db == DB_1A_HDMI_LTE) { + /* Check if we can report HDMI_HPD signal to CPU */ + if (enable) + gpio_set_level(GPIO_EC_AP_USB_C1_HDMI_HPD, hdmi_hpd); + else + gpio_set_level(GPIO_EC_AP_USB_C1_HDMI_HPD, 0); + } +} + static void button_sub_hdmi_hpd_interrupt(enum gpio_signal s) { enum fw_config_db db = get_cbi_fw_config_db(); int hdmi_hpd = gpio_get_level(GPIO_VOLUP_BTN_ODL_HDMI_HPD); - if (db == DB_1A_HDMI || db == DB_LTE_HDMI || db == DB_1A_HDMI_LTE) - gpio_set_level(GPIO_EC_AP_USB_C1_HDMI_HPD, hdmi_hpd); - else + if (db == DB_1A_HDMI || db == DB_LTE_HDMI || db == DB_1A_HDMI_LTE) { + /* Do not report HDMI_HPD signal to CPU when system off. */ + if (!chipset_in_state(CHIPSET_STATE_ANY_OFF)) + gpio_set_level(GPIO_EC_AP_USB_C1_HDMI_HPD, hdmi_hpd); + } else button_interrupt(s); } @@ -417,6 +433,9 @@ void board_init(void) if (!gpio_get_level(GPIO_PEN_DET_ODL)) gpio_set_level(GPIO_EN_PP5000_PEN, 1); + /* Make sure HDMI_HPD signal can be reported to CPU at sysjump */ + board_enable_hdmi_hpd(1); + /* Charger on the MB will be outputting PROCHOT_ODL and OD CHG_DET */ sm5803_configure_gpio0(CHARGER_PRIMARY, GPIO0_MODE_PROCHOT, 1); sm5803_configure_chg_det_od(CHARGER_PRIMARY, 1); @@ -438,6 +457,9 @@ static void board_resume(void) sm5803_disable_low_power_mode(CHARGER_PRIMARY); if (board_get_charger_chip_count() > 1) sm5803_disable_low_power_mode(CHARGER_SECONDARY); + + /* Enable reporting HDMI_HPD to CPU when system resume */ + board_enable_hdmi_hpd(1); } DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_resume, HOOK_PRIO_DEFAULT); @@ -449,6 +471,13 @@ static void board_suspend(void) } DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_suspend, HOOK_PRIO_DEFAULT); +static void board_shutdown(void) +{ + /* Disable reporting HDMI_HPD to CPU at shutdown */ + board_enable_hdmi_hpd(0); +} +DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_shutdown, HOOK_PRIO_DEFAULT); + void board_hibernate(void) { /* |