summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorZick Wei <zick.wei@quanta.corp-partner.google.com>2021-09-30 09:33:26 +0800
committerCommit Bot <commit-bot@chromium.org>2021-10-22 02:12:53 +0000
commit0cb8c0bde9fbec57367b313aa8c9cb332f317fd3 (patch)
treece1568ed446a6c7d7677316b02ed815fc51c2144 /board
parentf07b08ac2e713e7aac53ec35c2653e5d4103068b (diff)
downloadchrome-ec-0cb8c0bde9fbec57367b313aa8c9cb332f317fd3.tar.gz
nipperkin: support HDMI retimer low power
Add HDMI retimer:PI3HDX1204 low power mode support. On board version 1: Enable/disable retimer when DUT resume/suspend. On board version > 1: Disable retimer when DUT suspend/ not plug in HDMI in S0. Enable retimer when DUT in S0 with HDMI plug in. BUG=b:201496586 BRANCH=none TEST=verify HDMI monitor display normally with both board id 1 and 2(manually update cbi and reworked). Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Change-Id: I288bbec0786b7812c5fcb150bb20ff473b25287a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3192746 Reviewed-by: Rob Barnes <robbarnes@google.com> Reviewed-by: Devin Lu <Devin.Lu@quantatw.com>
Diffstat (limited to 'board')
-rw-r--r--board/nipperkin/board.c45
-rw-r--r--board/nipperkin/gpio.inc2
2 files changed, 46 insertions, 1 deletions
diff --git a/board/nipperkin/board.c b/board/nipperkin/board.c
index 2458ab0a2c..3c0b0b00e1 100644
--- a/board/nipperkin/board.c
+++ b/board/nipperkin/board.c
@@ -12,6 +12,7 @@
#include "chipset.h"
#include "common.h"
#include "cros_board_info.h"
+#include "driver/retimer/pi3hdx1204.h"
#include "driver/retimer/ps8811.h"
#include "driver/retimer/ps8818.h"
#include "driver/temp_sensor/sb_tsi.h"
@@ -29,8 +30,11 @@
#include "temp_sensor/thermistor.h"
#include "temp_sensor/tmp112.h"
#include "thermal.h"
+#include "timer.h"
#include "usb_mux.h"
+static void hdmi_hpd_interrupt(enum gpio_signal signal);
+
#include "gpio_list.h" /* Must come after other header files. */
/*
@@ -134,6 +138,8 @@ __override int board_c1_ps8818_mux_set(const struct usb_mux *me,
static void board_init(void)
{
+ if (get_board_version() > 1)
+ gpio_enable_interrupt(GPIO_HPD_EC_IN);
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
@@ -322,17 +328,31 @@ static int board_get_temp(int idx, int *temp_k)
return get_temp_3v3_30k9_47k_4050b(idx, temp_k);
}
+static int check_hdmi_hpd_status(void)
+{
+ if (get_board_version() > 1)
+ return gpio_get_level(GPIO_HPD_EC_IN);
+ else
+ return true;
+}
+
/* Called on AP resume to S0 */
static void board_chipset_resume(void)
{
ioex_set_level(IOEX_HDMI_DATA_EN, 1);
ioex_set_level(IOEX_EN_PWR_HDMI, 1);
+ msleep(PI3HDX1204_POWER_ON_DELAY_MS);
+ pi3hdx1204_enable(I2C_PORT_TCPC1,
+ PI3HDX1204_I2C_ADDR_FLAGS,
+ check_hdmi_hpd_status());
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT);
/* Called on AP suspend */
static void board_chipset_suspend(void)
{
+ pi3hdx1204_enable(I2C_PORT_TCPC1,
+ PI3HDX1204_I2C_ADDR_FLAGS, 0);
ioex_set_level(IOEX_EN_PWR_HDMI, 0);
ioex_set_level(IOEX_HDMI_DATA_EN, 0);
}
@@ -442,3 +462,28 @@ board_vivaldi_keybd_config(void)
else
return &keybd_wo_privacy_wo_kblight;
}
+
+const struct pi3hdx1204_tuning pi3hdx1204_tuning = {
+ .eq_ch0_ch1_offset = PI3HDX1204_EQ_DB710,
+ .eq_ch2_ch3_offset = PI3HDX1204_EQ_DB710,
+ .vod_offset = PI3HDX1204_VOD_115_ALL_CHANNELS,
+ .de_offset = PI3HDX1204_DE_DB_MINUS5,
+};
+
+static void hdmi_hpd_handler(void)
+{
+ int hpd = check_hdmi_hpd_status();
+
+ 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);
+
+static void hdmi_hpd_interrupt(enum gpio_signal signal)
+{
+ /* Debounce for 2 msec */
+ hook_call_deferred(&hdmi_hpd_handler_data, (2 * MSEC));
+}
diff --git a/board/nipperkin/gpio.inc b/board/nipperkin/gpio.inc
index ec35ce6c2c..4f4abca107 100644
--- a/board/nipperkin/gpio.inc
+++ b/board/nipperkin/gpio.inc
@@ -18,10 +18,10 @@ GPIO(C1_CHARGE_LED_WHITE_L, PIN(7, 0), GPIO_OUT_HIGH)
/* HDMI */
IOEX(EN_PWR_HDMI, EXPIN(USBC_PORT_C0, 0, 3), GPIO_OUT_LOW)
IOEX(HDMI_DATA_EN, EXPIN(USBC_PORT_C0, 1, 4), GPIO_OUT_LOW)
+GPIO_INT(HPD_EC_IN, PIN(6, 2), GPIO_INT_BOTH, hdmi_hpd_interrupt)
/* Test Points */
GPIO(EC_GPIO56, PIN(5, 6), GPIO_INPUT | GPIO_PULL_UP)
-GPIO(EC_PS2_RST, PIN(6, 2), GPIO_INPUT | GPIO_PULL_UP)
GPIO(EC_GPIOB0, PIN(B, 0), GPIO_INPUT | GPIO_PULL_UP)
GPIO(EC_GPIO81, PIN(8, 1), GPIO_INPUT | GPIO_PULL_UP)
GPIO(EC_FLPRG2, PIN(8, 6), GPIO_INPUT | GPIO_PULL_UP)