From bc66c458cf35a122f4f50e111be834e69410d996 Mon Sep 17 00:00:00 2001 From: David Huang Date: Mon, 8 Jun 2020 13:05:00 +0800 Subject: Zork: Disable PI3HDX1204 when HDMI didn't connect. Disable PI3HDX1204 when HDMI didn't connect for saving 1W in S0. BUG=b:158136599 BRANCH=none TEST=check pi3hdx1204 register setting is correct. Signed-off-by: David Huang Change-Id: I9170cf56b34d71abcdd430bd7d8d7f3839de2558 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2234046 Reviewed-by: Edward Hill Reviewed-by: Vincent Wang --- baseboard/zork/baseboard.c | 10 ++++++++-- baseboard/zork/baseboard.h | 3 +++ board/ezkinil/board.c | 6 ++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/baseboard/zork/baseboard.c b/baseboard/zork/baseboard.c index 204a133f32..703e188024 100644 --- a/baseboard/zork/baseboard.c +++ b/baseboard/zork/baseboard.c @@ -329,6 +329,12 @@ void board_hibernate(void) } } +__overridable int check_hdmi_hpd_status(void) +{ + /* Default hdmi insert. */ + return 1; +} + const struct pi3hdx1204_tuning pi3hdx1204_tuning = { .eq_ch0_ch1_offset = PI3HDX1204_EQ_DB710, .eq_ch2_ch3_offset = PI3HDX1204_EQ_DB710, @@ -336,11 +342,11 @@ const struct pi3hdx1204_tuning pi3hdx1204_tuning = { .de_offset = PI3HDX1204_DE_DB_MINUS5, }; -static void pi3hdx1204_retimer_power(void) +void pi3hdx1204_retimer_power(void) { if (ec_config_has_hdmi_retimer_pi3hdx1204()) { int enable = chipset_in_or_transitioning_to_state( - CHIPSET_STATE_ON); + CHIPSET_STATE_ON) && check_hdmi_hpd_status(); pi3hdx1204_enable(I2C_PORT_TCPC1, PI3HDX1204_I2C_ADDR_FLAGS, enable); diff --git a/baseboard/zork/baseboard.h b/baseboard/zork/baseboard.h index 6de9bf2296..239c1d583d 100644 --- a/baseboard/zork/baseboard.h +++ b/baseboard/zork/baseboard.h @@ -357,6 +357,9 @@ void ppc_interrupt(enum gpio_signal signal); int board_tcpc_fast_role_swap_enable(int port, int enable); #endif +void pi3hdx1204_retimer_power(void); +__override_proto int check_hdmi_hpd_status(void); + #endif /* !__ASSEMBLER__ */ #endif /* __CROS_EC_BASEBOARD_H */ diff --git a/board/ezkinil/board.c b/board/ezkinil/board.c index e22d3368d3..8a9c979e27 100644 --- a/board/ezkinil/board.c +++ b/board/ezkinil/board.c @@ -323,6 +323,7 @@ static void hdmi_hpd_handler(void) gpio_set_level(GPIO_DP1_HPD, hpd); ccprints("HDMI HPD %d", hpd); + pi3hdx1204_retimer_power(); } DECLARE_DEFERRED(hdmi_hpd_handler); @@ -332,6 +333,11 @@ void hdmi_hpd_interrupt(enum gpio_signal signal) hook_call_deferred(&hdmi_hpd_handler_data, (2 * MSEC)); } +__override int check_hdmi_hpd_status(void) +{ + return gpio_get_level(GPIO_DP1_HPD_EC_IN); +} + /***************************************************************************** * Fan */ -- cgit v1.2.1