summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Yuan <jasonyuan@google.com>2023-01-11 16:49:15 -0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-01-13 19:23:52 +0000
commit088f0aba43e335e5aaa916517d5b6b569188768d (patch)
tree89a75098d244bbb4d433f98516b7d6b317adb2e7
parent993ed40ead436cfa93f3ef285436ef8b7c426891 (diff)
downloadchrome-ec-088f0aba43e335e5aaa916517d5b6b569188768d.tar.gz
zephyr: Test all ports for correct pd information
pd_chip_info is tested for all ports instead of just port 0. BUG=b:261874683 TEST=twister BRANCH=none Change-Id: I338af9781539cd1fe325410d085593832f776120 Signed-off-by: Jason Yuan <jasonyuan@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4159971 Auto-Submit: zhi cheng yuan <jasonyuan@chromium.org> Tested-by: zhi cheng yuan <jasonyuan@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com> Reviewed-by: Wai-Hong Tam <waihong@google.com>
-rw-r--r--zephyr/emul/tcpc/emul_ps8xxx.c1
-rw-r--r--zephyr/test/drivers/host_cmd/src/pd_chip_info.c10
2 files changed, 7 insertions, 4 deletions
diff --git a/zephyr/emul/tcpc/emul_ps8xxx.c b/zephyr/emul/tcpc/emul_ps8xxx.c
index 90b9ce7af3..d0be005144 100644
--- a/zephyr/emul/tcpc/emul_ps8xxx.c
+++ b/zephyr/emul/tcpc/emul_ps8xxx.c
@@ -633,6 +633,7 @@ static int ps8xxx_emul_init(const struct emul *emul,
ret |= ps8xxx_emul_tcpc_reset(emul);
+ tcpci_emul_set_reg(emul, TCPC_REG_VENDOR_ID, PS8XXX_VENDOR_ID);
tcpci_emul_set_reg(emul, TCPC_REG_PRODUCT_ID, data->prod_id);
/* FW rev is never 0 in a working device. Set arbitrary FW rev. */
tcpci_emul_set_reg(emul, PS8XXX_REG_FW_REV, 0x31);
diff --git a/zephyr/test/drivers/host_cmd/src/pd_chip_info.c b/zephyr/test/drivers/host_cmd/src/pd_chip_info.c
index c04e74810a..e016bec97b 100644
--- a/zephyr/test/drivers/host_cmd/src/pd_chip_info.c
+++ b/zephyr/test/drivers/host_cmd/src/pd_chip_info.c
@@ -4,6 +4,7 @@
*/
#include "console.h"
+#include "driver/tcpm/tcpci.h"
#include "ec_commands.h"
#include "test/drivers/stubs.h"
#include "test/drivers/test_state.h"
@@ -12,7 +13,6 @@
#include <zephyr/shell/shell.h>
#include <zephyr/ztest.h>
-#define TEST_PORT USBC_PORT_C0
#define BAD_PORT 65
static enum ec_status run_pd_chip_info(int port,
@@ -27,10 +27,12 @@ static enum ec_status run_pd_chip_info(int port,
ZTEST_USER(host_cmd_pd_chip_info, test_good_index)
{
- struct ec_response_pd_chip_info_v1 response;
+ for (enum usbc_port p = USBC_PORT_C0; p < USBC_PORT_COUNT; p++) {
+ struct ec_response_pd_chip_info_v1 response;
- zassert_ok(run_pd_chip_info(TEST_PORT, &response),
- "Failed to process pd_get_chip_info for port %d", TEST_PORT);
+ zassert_ok(run_pd_chip_info(p, &response),
+ "Failed to process pd_get_chip_info for port %d", p);
+ }
/*
* Note: verification of the specific fields depends on the chips used
* and therefore would belong in a driver-level test