summaryrefslogtreecommitdiff
path: root/board/morphius/board.c
diff options
context:
space:
mode:
authorEdward Hill <ecgh@chromium.org>2020-09-01 19:42:27 -0600
committerCommit Bot <commit-bot@chromium.org>2020-09-08 17:58:10 +0000
commitc535c381a70d2062491793841672aa188f619ef2 (patch)
treecb97aeb1527dfd3a20eeec9bf72c642b593d7c8f /board/morphius/board.c
parent0f5b96513776c0c6701b0efdffba380698dd070f (diff)
downloadchrome-ec-c535c381a70d2062491793841672aa188f619ef2.tar.gz
morphius: Use HPD to disable pi3hdx1204 in S0
BUG=b:165442828 BRANCH=zork TEST=none Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: I32795377040221ac9459eb4c30cb6cf9648855b1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2389321 Tested-by: Keith Tzeng <keith.tzeng@quanta.corp-partner.google.com> Commit-Queue: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'board/morphius/board.c')
-rw-r--r--board/morphius/board.c40
1 files changed, 34 insertions, 6 deletions
diff --git a/board/morphius/board.c b/board/morphius/board.c
index 9d3f87f423..3c9810f9d3 100644
--- a/board/morphius/board.c
+++ b/board/morphius/board.c
@@ -43,6 +43,10 @@
#include "usb_charge.h"
#include "usbc_ppc.h"
+static void hdmi_hpd_interrupt_v2(enum ioex_signal signal);
+static void hdmi_hpd_interrupt_v3(enum gpio_signal signal);
+static void board_gmr_tablet_switch_isr(enum gpio_signal signal);
+
#include "gpio_list.h"
static bool support_aoz_ppc;
@@ -319,6 +323,9 @@ static void board_remap_gpio(void)
rv |= ioex_set_flags(IOEX_USB_C1_PPC_ILIM_3A_EN, GPIO_OUT_LOW);
if (rv)
ccprintf("IOEX Board>=3 Remap FAILED\n");
+
+ if (ec_config_has_hdmi_retimer_pi3hdx1204())
+ gpio_enable_interrupt(GPIO_DP1_HPD_EC_IN);
} else {
gpio_ec_ps2_reset = GPIO_EC_PS2_RESET_V0;
ccprintf("GPIO_EC_PS2_RESET_V0\n");
@@ -567,6 +574,18 @@ void ps2_pwr_en_interrupt(enum gpio_signal signal)
hook_call_deferred(&trackpoint_reset_deferred_data, MSEC);
}
+static int check_hdmi_hpd_status(void)
+{
+ int hpd = 0;
+
+ if (board_ver < 3)
+ ioex_get_level(IOEX_HDMI_CONN_HPD_3V3_DB, &hpd);
+ else
+ hpd = gpio_get_level(GPIO_DP1_HPD_EC_IN);
+
+ return hpd;
+}
+
/*****************************************************************************
* Board suspend / resume
*/
@@ -584,7 +603,7 @@ static void board_chipset_resume(void)
}
pi3hdx1204_enable(I2C_PORT_TCPC1,
PI3HDX1204_I2C_ADDR_FLAGS,
- 1);
+ check_hdmi_hpd_status());
}
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT);
@@ -687,22 +706,31 @@ void mst_hpd_interrupt(enum ioex_signal signal)
static void hdmi_hpd_handler(void)
{
- int hpd = 0;
-
/* Pass HPD through from DB OPT1 HDMI connector to AP's DP1. */
- ioex_get_level(IOEX_HDMI_CONN_HPD_3V3_DB, &hpd);
+ int hpd = check_hdmi_hpd_status();
+
gpio_set_level(GPIO_EC_DP1_HPD, hpd);
ccprints("HDMI HPD %d", hpd);
+ pi3hdx1204_enable(I2C_PORT_TCPC1,
+ PI3HDX1204_I2C_ADDR_FLAGS,
+ chipset_in_or_transitioning_to_state(CHIPSET_STATE_ON)
+ && hpd);
}
DECLARE_DEFERRED(hdmi_hpd_handler);
-void hdmi_hpd_interrupt(enum ioex_signal signal)
+static void hdmi_hpd_interrupt_v2(enum ioex_signal signal)
+{
+ /* Debounce for 2 msec. */
+ hook_call_deferred(&hdmi_hpd_handler_data, (2 * MSEC));
+}
+
+static void hdmi_hpd_interrupt_v3(enum gpio_signal signal)
{
/* Debounce for 2 msec. */
hook_call_deferred(&hdmi_hpd_handler_data, (2 * MSEC));
}
-void board_gmr_tablet_switch_isr(enum gpio_signal signal)
+static void board_gmr_tablet_switch_isr(enum gpio_signal signal)
{
/* Board version more than 3, DUT support GMR sensor */
if (board_ver >= 3)