summaryrefslogtreecommitdiff
path: root/board/dratini/board.c
diff options
context:
space:
mode:
authorTim Wawrzynczak <twawrzynczak@chromium.org>2020-03-13 15:56:54 -0600
committerCommit Bot <commit-bot@chromium.org>2020-03-17 18:18:33 +0000
commit400f37344d1464232b6013a8904fa7f852b93663 (patch)
tree4d07eb66c0b9e7cd41d74e3c053e78aa9de28a95 /board/dratini/board.c
parentaf54ae817e5e070b5cbc0c626013b9fa807bf8d9 (diff)
downloadchrome-ec-400f37344d1464232b6013a8904fa7f852b93663.tar.gz
dratini: Enable HDMI power and add debounce to HDMI HPD low interrupt
Enable power to HDMI rail when AP is in S0, off otherwise. Also, when runtime S0ix kicks in, there can be a long transient pulse low on the HDMI_CONN_HPD signal (300+ ms). This patch adds a 2-second debounce time when the HPD goes low. BUG=b:147261818 BRANCH=firmware-hatch-12672.B TEST=Verified runtime S0ix, suspend/resume S0ix, shutdown, and startup all correctly operate the HDMI & MST signals. Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: Ia9fce8a2020995c57e9bb3634a147765e3c556f8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2103366 Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Diffstat (limited to 'board/dratini/board.c')
-rw-r--r--board/dratini/board.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/board/dratini/board.c b/board/dratini/board.c
index c4670cd65c..10a219bdd9 100644
--- a/board/dratini/board.c
+++ b/board/dratini/board.c
@@ -86,9 +86,24 @@ static void tcpc_alert_event(enum gpio_signal signal)
schedule_deferred_pd_interrupt(port);
}
+static void control_mst_power(void)
+{
+ baseboard_mst_enable_control(MST_HDMI,
+ gpio_get_level(GPIO_HDMI_CONN_HPD));
+}
+DECLARE_DEFERRED(control_mst_power);
+
static void hdmi_hpd_interrupt(enum gpio_signal signal)
{
- baseboard_mst_enable_control(MST_HDMI, gpio_get_level(signal));
+ /*
+ * When the HPD goes high, enable the MST hub right away,
+ * but debounce the low signal for 2 seconds to avoid transient low
+ * pulses on the HPD signal.
+ */
+ if (gpio_get_level(signal))
+ hook_call_deferred(&control_mst_power_data, 0);
+ else
+ hook_call_deferred(&control_mst_power_data, 2 * SECOND);
}
static void bc12_interrupt(enum gpio_signal signal)
@@ -400,6 +415,13 @@ static void board_init(void)
{
/* Initialize Fans */
setup_fans();
+
+ /*
+ * If HDMI is plugged in at boot, the interrupt may have been missed,
+ * so check if the MST hub needs to be powered now.
+ */
+ control_mst_power();
+
/* Enable HDMI HPD interrupt. */
gpio_enable_interrupt(GPIO_HDMI_CONN_HPD);
@@ -455,3 +477,19 @@ const int keyboard_factory_scan_pins[][2] = {
const int keyboard_factory_scan_pins_used =
ARRAY_SIZE(keyboard_factory_scan_pins);
#endif
+
+/* Disable HDMI power while AP is suspended / off */
+static void disable_hdmi(void)
+{
+ gpio_set_level(GPIO_EN_HDMI, 0);
+}
+DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, disable_hdmi, HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, disable_hdmi, HOOK_PRIO_DEFAULT);
+
+/* Enable HDMI power while AP is active */
+static void enable_hdmi(void)
+{
+ gpio_set_level(GPIO_EN_HDMI, 1);
+}
+DECLARE_HOOK(HOOK_CHIPSET_RESUME, enable_hdmi, HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, enable_hdmi, HOOK_PRIO_DEFAULT);