diff options
author | johnwc_yeh <johnwc_yeh@compal.corp-partner.google.com> | 2022-11-23 09:58:24 +0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-12-13 19:24:29 +0000 |
commit | 78eaccf378e8db32c4721f45e1325b1e06096313 (patch) | |
tree | 35a23e9903aa472607f445abcaa78b87d7d616bb /zephyr/test/drivers/default | |
parent | f439c4f2098d14e66f29d2ac65dadc095d984e5d (diff) | |
download | chrome-ec-78eaccf378e8db32c4721f45e1325b1e06096313.tar.gz |
BB retimer: Add condition to set 'DP CONNECTION' bit
Set 'DP CONNECTION' bit when mux_state gets HPD event only on
the ports with HDMI/DP card
It will increase BBR power consumption, so set 'DP CONNECTION'
bit only when mux_state gets HPD event only on the ports with
HDMI/DP card.
BUG=b:233975818
BRANCH=None
TEST=Test on Banshee, when only hdmi card 'DP CONNECTION' bit
is 0. Enter console command bb 1 r 4 =0x403, plug in hdmi
monitor bb 1 r 4 =0x8503.
Run ./twister -T zephyr/test/drivers
Signed-off-by: johnwc_yeh <johnwc_yeh@compal.corp-partner.google.com>
Change-Id: I87b2a4379e66e08830c556d703390a7fb96d3258
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4050320
Reviewed-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Commit-Queue: Boris Mittelberg <bmbm@google.com>
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Reviewed-by: Boris Mittelberg <bmbm@google.com>
Diffstat (limited to 'zephyr/test/drivers/default')
-rw-r--r-- | zephyr/test/drivers/default/src/bb_retimer.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/zephyr/test/drivers/default/src/bb_retimer.c b/zephyr/test/drivers/default/src/bb_retimer.c index 78d483817a..c6e66d7626 100644 --- a/zephyr/test/drivers/default/src/bb_retimer.c +++ b/zephyr/test/drivers/default/src/bb_retimer.c @@ -240,6 +240,35 @@ ZTEST_USER(bb_retimer_no_tasks, test_bb_set_idle_mode) usb3_conn, conn); } +/** Test retimer dp connection setting. */ +ZTEST_USER(bb_retimer_no_tasks, test_bb_retimer_set_dp_connection) +{ + const uint32_t enable_dp_conn = BB_RETIMER_DP_CONNECTION; + const uint32_t disable_dp_conn = 0; + const struct emul *emul = EMUL_DT_GET(BB_RETIMER_NODE); + struct usb_mux usb_mux_c1; + uint32_t conn; + + set_test_runner_tid(); + + usb_mux_c1 = *usb_muxes[USBC_PORT_C1].mux; + + /* Check if DP is enabled */ + zassert_equal(EC_SUCCESS, + bb_retimer_set_dp_connection(&usb_mux_c1, true), NULL); + conn = bb_emul_get_reg(emul, BB_RETIMER_REG_CONNECTION_STATE); + zassert_equal(conn, enable_dp_conn, "Expected state 0x%02x, got 0x%02x", + enable_dp_conn, conn); + + /* Check if DP is disabled */ + zassert_equal(EC_SUCCESS, + bb_retimer_set_dp_connection(&usb_mux_c1, false), NULL); + conn = bb_emul_get_reg(emul, BB_RETIMER_REG_CONNECTION_STATE); + zassert_equal(conn, disable_dp_conn, + "Expected state 0x%02x, got 0x%02x", disable_dp_conn, + conn); +} + /** Test setting different options for DFP role */ ZTEST_USER(bb_retimer_no_tasks, test_bb_set_dfp_state) { |