From 8e7ebd6575a61fb969733a2416e3e76db37a0d06 Mon Sep 17 00:00:00 2001 From: Peter Chi Date: Tue, 1 Nov 2022 02:17:47 +0000 Subject: Revert "BB retimer: Set 'DP CONNECTION' bit only when mux_state gets HPD event" This reverts commit 4dfe7f2a385d9ad3ca10064b29e4acb0f68c30a3. Reason for revert: In VESA DisplayPortAltMode v2.0 chapter 3.9.2.2, the HPD will be sent after SBU isolation switches have been close to connect the AUX_CH. In this behavior, it will only enable AUX_CH when received HPD and cause type-c devices couldn't output display. So we need revert this CL to meet the VSEA DisplayPortAltMode spec. Original change's description: > BB retimer: Set 'DP CONNECTION' bit only when mux_state gets HPD event > > For some chromebooks design, there are expanssion card (typeC > to HDMI) communicate with TCPC through CC line, when the HDMI > card connect to chromebook the DP CONNECTION bit would be enable > even no connect HDMI moinitor. > > It will increase BBR power consumption, so set 'DP CONNECTION' > bit only when mux_state gets HPD event. > > BUG=b:233975818 > BRANCH=None > TEST=Test on Banshee, measure BBR power consumption reduce from > 143mW to 7mW. And the HDMI monitor can be output. > > Signed-off-by: johnwc_yeh > Change-Id: I8a80235992cfa1bac28f03c3b6a7ec378e07ecf3 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3726600 > Reviewed-by: Diana Z > Tested-by: Enzo Hong > Commit-Queue: Diana Z Bug: b:233975818, b:240896516 Change-Id: I48f2818d2eaee921bc0374976f6eddcdc152ac36 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3995963 Reviewed-by: caveh jalali Commit-Queue: Peter Chi Tested-by: Peter Chi Code-Coverage: Zoss --- driver/retimer/bb_retimer.c | 24 ++++++++++-------------- zephyr/test/drivers/default/src/bb_retimer.c | 9 ++++++--- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/driver/retimer/bb_retimer.c b/driver/retimer/bb_retimer.c index f7a4ce6164..cb7c58c058 100644 --- a/driver/retimer/bb_retimer.c +++ b/driver/retimer/bb_retimer.c @@ -428,7 +428,14 @@ static int retimer_set_state(const struct usb_mux *me, mux_state_t mux_state, set_retimer_con |= BB_RETIMER_USB_3_SPEED; } + /* + * Bit 8: DP_CONNECTION + * 0 ā€“ No DP connection + * 1 ā€“ DP connected + */ if (mux_state & USB_PD_MUX_DP_ENABLED) { + set_retimer_con |= BB_RETIMER_DP_CONNECTION; + /* * Bit 11-10: DP_PIN_ASSIGNMENT (ignored if BIT8 = 0) * 00 ā€“ Pin assignments E/Eā€™ @@ -545,26 +552,15 @@ void bb_retimer_hpd_update(const struct usb_mux *me, mux_state_t hpd_state, retimer_con_reg &= ~BB_RETIMER_IRQ_HPD; /* - * Bit 8: DP_CONNECTION - * 0 - No DP connection - * 1 - DP connected - * * Bit 15: HPD_LVL (ignored if BIT8 = 0) * 0 - HPD_State Low * 1 - HPD_State High - * - * HDMI card connect to chromebook the DP_CONNECTION bit - * would be enable. - * It will increase BBR power consumption, so enable the DP bit - * only when the HPD bit is set so that the retimer stays in - * low power mode until the external monitor is connected. */ + if (hpd_state & USB_PD_MUX_HPD_LVL) - retimer_con_reg |= - (BB_RETIMER_HPD_LVL | BB_RETIMER_DP_CONNECTION); + retimer_con_reg |= BB_RETIMER_HPD_LVL; else - retimer_con_reg &= - ~(BB_RETIMER_HPD_LVL | BB_RETIMER_DP_CONNECTION); + retimer_con_reg &= ~BB_RETIMER_HPD_LVL; /* Writing the register4 */ bb_retimer_write(me, BB_RETIMER_REG_CONNECTION_STATE, retimer_con_reg); diff --git a/zephyr/test/drivers/default/src/bb_retimer.c b/zephyr/test/drivers/default/src/bb_retimer.c index 5edd0a7cc8..5cfedc789e 100644 --- a/zephyr/test/drivers/default/src/bb_retimer.c +++ b/zephyr/test/drivers/default/src/bb_retimer.c @@ -162,7 +162,8 @@ ZTEST_USER(bb_retimer_no_tasks, test_bb_set_state) zassert_false(ack_required, "ACK is never required for BB retimer"); conn = bb_emul_get_reg(emul, BB_RETIMER_REG_CONNECTION_STATE); exp_conn = BB_RETIMER_USB_DATA_ROLE | - BB_RETIMER_DATA_CONNECTION_PRESENT; + BB_RETIMER_DATA_CONNECTION_PRESENT | + BB_RETIMER_DP_CONNECTION; zassert_equal(exp_conn, conn, "Expected state 0x%lx, got 0x%lx", exp_conn, conn); @@ -175,7 +176,8 @@ ZTEST_USER(bb_retimer_no_tasks, test_bb_set_state) zassert_false(ack_required, "ACK is never required for BB retimer"); conn = bb_emul_get_reg(emul, BB_RETIMER_REG_CONNECTION_STATE); exp_conn = BB_RETIMER_USB_DATA_ROLE | - BB_RETIMER_DATA_CONNECTION_PRESENT | BB_RETIMER_IRQ_HPD; + BB_RETIMER_DATA_CONNECTION_PRESENT | + BB_RETIMER_DP_CONNECTION | BB_RETIMER_IRQ_HPD; zassert_equal(exp_conn, conn, "Expected state 0x%lx, got 0x%lx", exp_conn, conn); @@ -188,7 +190,8 @@ ZTEST_USER(bb_retimer_no_tasks, test_bb_set_state) zassert_false(ack_required, "ACK is never required for BB retimer"); conn = bb_emul_get_reg(emul, BB_RETIMER_REG_CONNECTION_STATE); exp_conn = BB_RETIMER_USB_DATA_ROLE | - BB_RETIMER_DATA_CONNECTION_PRESENT | BB_RETIMER_HPD_LVL; + BB_RETIMER_DATA_CONNECTION_PRESENT | + BB_RETIMER_DP_CONNECTION | BB_RETIMER_HPD_LVL; zassert_equal(exp_conn, conn, "Expected state 0x%lx, got 0x%lx", exp_conn, conn); } -- cgit v1.2.1