summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTang Qijun <qijun.tang@ecs.corp-partner.google.com>2023-04-29 10:26:48 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-05-03 21:30:29 +0000
commit037c04236fdccb37b02075f46b47c7ee92ac9ab8 (patch)
tree2ed7e188da44cc189796737071f64b0b7ea2b068
parentb647360e5d8b79c87644dd06ef54ecd3e0746b1c (diff)
downloadchrome-ec-037c04236fdccb37b02075f46b47c7ee92ac9ab8.tar.gz
crystaldrift: modify port0 ppc config
design port0 ppc change from aoz1380 to sm5360 BRANCH=skyrim BUG=b:260771028 TEST=1. zmake build crystaldrift test port0 typeC function is ok 2. twister -T zephyr/test/skyrim Change-Id: I4c33c1004d18a07e84cb9390ccf1b686e71c9da7 Signed-off-by: Tang Qijun <qijun.tang@ecs.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4493843 Commit-Queue: Chao Gui <chaogui@google.com> Reviewed-by: Diana Z <dzigterman@chromium.org> (cherry picked from commit dcb771689a6fd8c78a3ea110ac492e957c4e1850) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4493445 Reviewed-by: Chao Gui <chaogui@google.com>
-rw-r--r--zephyr/program/skyrim/crystaldrift/project.overlay6
-rw-r--r--zephyr/program/skyrim/crystaldrift/src/ppc_config.c20
-rw-r--r--zephyr/test/skyrim/testcase.yaml2
-rw-r--r--zephyr/test/skyrim/tests/crystaldrift/CMakeLists.txt1
-rw-r--r--zephyr/test/skyrim/tests/crystaldrift/src/ppc_config.c37
5 files changed, 40 insertions, 26 deletions
diff --git a/zephyr/program/skyrim/crystaldrift/project.overlay b/zephyr/program/skyrim/crystaldrift/project.overlay
index bf4e420367..7a6219d4be 100644
--- a/zephyr/program/skyrim/crystaldrift/project.overlay
+++ b/zephyr/program/skyrim/crystaldrift/project.overlay
@@ -158,16 +158,10 @@
0 0 1>;
};
};
-
- ppc_port0: aoz1380 {
- compatible = "aoz,aoz1380";
- status = "okay";
- };
};
/* i2c overrides */
&i2c0_0 {
- /delete-node/ nx20p348x@71;
/delete-node/ anx7483@3e;
};
&i2c4_1 {
diff --git a/zephyr/program/skyrim/crystaldrift/src/ppc_config.c b/zephyr/program/skyrim/crystaldrift/src/ppc_config.c
index 0e5cd33606..4a4bb07a3f 100644
--- a/zephyr/program/skyrim/crystaldrift/src/ppc_config.c
+++ b/zephyr/program/skyrim/crystaldrift/src/ppc_config.c
@@ -14,29 +14,11 @@
#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
-/*
- * In the AOZ1380 PPC, there are no programmable features. We use
- * the attached NCT3807 to control a GPIO to indicate 1A5 or 3A0
- * current limits.
- */
-int board_aoz1380_set_vbus_source_current_limit(int port, enum tcpc_rp_value rp)
-{
- int rv = EC_SUCCESS;
-
- if (port != 0)
- return EC_ERROR_INVAL;
-
- rv = gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(ioex_usb_c0_ilim_3a_en),
- (rp == TYPEC_RP_3A0) ? 1 : 0);
-
- return rv;
-}
-
void ppc_interrupt(enum gpio_signal signal)
{
switch (signal) {
case GPIO_USB_C0_PPC_INT_ODL:
- aoz1380_interrupt(0);
+ nx20p348x_interrupt(0);
break;
case GPIO_USB_C1_PPC_INT_ODL:
diff --git a/zephyr/test/skyrim/testcase.yaml b/zephyr/test/skyrim/testcase.yaml
index 43ea40da6f..2084a37bba 100644
--- a/zephyr/test/skyrim/testcase.yaml
+++ b/zephyr/test/skyrim/testcase.yaml
@@ -34,7 +34,7 @@ tests:
skyrim.crystaldrift.ppc_config:
extra_configs:
- CONFIG_TEST_BOARD_CRYSTALDRIFT=y
- - CONFIG_TEST_BOARD_PPC_CONFIG=y
+ - CONFIG_TEST_BOARD_PPC_CONFIG_CUSTOM=y
# Frostflow tests
skyrim.frostflow:
diff --git a/zephyr/test/skyrim/tests/crystaldrift/CMakeLists.txt b/zephyr/test/skyrim/tests/crystaldrift/CMakeLists.txt
index e78711fed2..cec3317f7f 100644
--- a/zephyr/test/skyrim/tests/crystaldrift/CMakeLists.txt
+++ b/zephyr/test/skyrim/tests/crystaldrift/CMakeLists.txt
@@ -3,3 +3,4 @@
# found in the LICENSE file.
target_sources(app PRIVATE src/common.c)
+target_sources_ifdef(CONFIG_TEST_BOARD_PPC_CONFIG app PRIVATE src/ppc_config.c)
diff --git a/zephyr/test/skyrim/tests/crystaldrift/src/ppc_config.c b/zephyr/test/skyrim/tests/crystaldrift/src/ppc_config.c
new file mode 100644
index 0000000000..0f319d8ea4
--- /dev/null
+++ b/zephyr/test/skyrim/tests/crystaldrift/src/ppc_config.c
@@ -0,0 +1,37 @@
+/* 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 <zephyr/fff.h>
+#include <zephyr/ztest.h>
+
+#include <gpio.h>
+#include <usbc_ppc.h>
+
+FAKE_VOID_FUNC(nx20p348x_interrupt, int);
+
+static void ppc_config_before(void *fixture)
+{
+ ARG_UNUSED(fixture);
+ RESET_FAKE(nx20p348x_interrupt);
+}
+
+void ppc_interrupt(enum gpio_signal signal);
+
+ZTEST_SUITE(ppc_config, NULL, NULL, ppc_config_before, NULL, NULL);
+
+ZTEST(ppc_config, test_ppc_interrupt_c0)
+{
+ ppc_interrupt(GPIO_USB_C0_PPC_INT_ODL);
+ zassert_equal(nx20p348x_interrupt_fake.call_count, 1);
+ /* port */
+ zassert_equal(nx20p348x_interrupt_fake.arg0_val, 0);
+}
+
+ZTEST(ppc_config, test_ppc_interrupt_c1)
+{
+ ppc_interrupt(GPIO_USB_C1_PPC_INT_ODL);
+ zassert_equal(nx20p348x_interrupt_fake.call_count, 1);
+ /* port */
+ zassert_equal(nx20p348x_interrupt_fake.arg0_val, 1);
+}