summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjeffrey Lin <jeffrey_Lin@pegatron.corp-partner.google.com>2023-03-08 17:30:06 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-03-16 04:58:01 +0000
commit02ff9e2a746add8f27e5f6d1a93f6972d5067a16 (patch)
treeafbadc243a2df96e446f513cee1b478ae3bc6886
parent95d4954a93e9d19f6b13caab240c7f5855adca17 (diff)
downloadchrome-ec-02ff9e2a746add8f27e5f6d1a93f6972d5067a16.tar.gz
zephyr/test: add tentacruel usb mux init test
Add testing for checking the tentacruel project usb mux init. BUG=b:250798561 TEST=./twister -T zephyr/test/krabby BRANCH=none Change-Id: Ie84f0b717ad14979d945746ccf4c9f2ec1f7b59f Signed-off-by: jeffrey Lin <jeffrey_Lin@pegatron.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4318614 Reviewed-by: Jeffrey Lin <jeffrey_lin@pegatron.corp-partner.google.com> Tested-by: Jeffrey Lin <jeffrey_lin@pegatron.corp-partner.google.com> Commit-Queue: Jeffrey Lin <jeffrey_lin@pegatron.corp-partner.google.com> Reviewed-by: Ting Shen <phoenixshen@chromium.org>
-rw-r--r--zephyr/program/corsola/include/baseboard_usbc_config.h1
-rw-r--r--zephyr/test/krabby/CMakeLists.txt1
-rw-r--r--zephyr/test/krabby/krabby.tentacruel.overlay13
-rw-r--r--zephyr/test/krabby/src/usb_mux_tentacruel.c23
4 files changed, 38 insertions, 0 deletions
diff --git a/zephyr/program/corsola/include/baseboard_usbc_config.h b/zephyr/program/corsola/include/baseboard_usbc_config.h
index a80aa10446..e5ade293b4 100644
--- a/zephyr/program/corsola/include/baseboard_usbc_config.h
+++ b/zephyr/program/corsola/include/baseboard_usbc_config.h
@@ -21,6 +21,7 @@ void ccd_interrupt(enum gpio_signal signal);
void hdmi_hpd_interrupt(enum gpio_signal signal);
void ps185_hdmi_hpd_mux_set(void);
int corsola_is_dp_muxable(int port);
+int ps8743_eq_c1_setting(void);
/* USB-A ports */
enum usba_port { USBA_PORT_A0 = 0, USBA_PORT_COUNT };
diff --git a/zephyr/test/krabby/CMakeLists.txt b/zephyr/test/krabby/CMakeLists.txt
index 27b5c83002..eb99938456 100644
--- a/zephyr/test/krabby/CMakeLists.txt
+++ b/zephyr/test/krabby/CMakeLists.txt
@@ -32,6 +32,7 @@ target_sources_ifdef(CONFIG_TEST_TENTACRUEL
src/ppc_tentacruel.c
src/temp_tentacruel.c
src/fwconfig_tentacruel.c
+ src/usb_mux_tentacruel.c
${PLATFORM_EC_PROGRAM_DIR}/corsola/tentacruel/src/ppc.c
${PLATFORM_EC_PROGRAM_DIR}/corsola/tentacruel/src/temp.c
${PLATFORM_EC_PROGRAM_DIR}/corsola/tentacruel/src/sensor.c)
diff --git a/zephyr/test/krabby/krabby.tentacruel.overlay b/zephyr/test/krabby/krabby.tentacruel.overlay
index cd247f15b4..3ae38d8daa 100644
--- a/zephyr/test/krabby/krabby.tentacruel.overlay
+++ b/zephyr/test/krabby/krabby.tentacruel.overlay
@@ -169,6 +169,9 @@
};
port1@1 {
ppc = <&ppc_port1>;
+ usb-mux-chain-1 {
+ usb-muxes = <&ps8743_mux_1>;
+ };
};
};
};
@@ -224,3 +227,13 @@
&lis2dw12_data {
compatible = "cros-ec,drvdata-bmi260";
};
+
+&i2c_ctrl4 {
+ /delete-node/ tusb1064-mux-1@44;
+
+ ps8743_mux_1: ps8743-mux-1@10 {
+ compatible = "zephyr,ps8743-emul";
+ reg = <0x10>;
+ board-init = "ps8743_eq_c1_setting";
+ };
+};
diff --git a/zephyr/test/krabby/src/usb_mux_tentacruel.c b/zephyr/test/krabby/src/usb_mux_tentacruel.c
new file mode 100644
index 0000000000..2e8ed6714e
--- /dev/null
+++ b/zephyr/test/krabby/src/usb_mux_tentacruel.c
@@ -0,0 +1,23 @@
+/* Copyright 2023 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#include "baseboard_usbc_config.h"
+#include "driver/usb_mux/ps8743.h"
+#include "emul/emul_ps8743.h"
+#include "usb_mux.h"
+#include "usbc/usb_muxes.h"
+
+#include <zephyr/devicetree.h>
+#include <zephyr/drivers/emul.h>
+#include <zephyr/ztest.h>
+
+const static struct emul *emul = EMUL_DT_GET(DT_NODELABEL(ps8743_mux_1));
+
+ZTEST(usb_mux_tentacruel_init, test_mux_init_value)
+{
+ ps8743_eq_c1_setting();
+ zassert_equal(ps8743_emul_peek_reg(emul, PS8743_REG_USB_EQ_RX), 0x90);
+}
+
+ZTEST_SUITE(usb_mux_tentacruel_init, NULL, NULL, NULL, NULL, NULL);