summaryrefslogtreecommitdiff
path: root/zephyr/test/drivers/src/stubs.c
diff options
context:
space:
mode:
authorTomasz Michalec <tm@semihalf.com>2021-10-21 10:30:17 +0200
committerCommit Bot <commit-bot@chromium.org>2021-10-28 13:08:38 +0000
commitfeb548f53cb8364117ecc6f43fede0560291c8b9 (patch)
tree0b2897f2e0b1f0582ade649b7393502ed19b1fce /zephyr/test/drivers/src/stubs.c
parentf90c8bd2eeb5ff5f7275dd17a668b65e1e77a83b (diff)
downloadchrome-ec-feb548f53cb8364117ecc6f43fede0560291c8b9.tar.gz
zephyr: drivers: Add PS8815 unit tests
This patch adds unit tests for code of PS8xxx driver that is specific for PS8815 device. Config to enable PS8815 and multiple PS8xxx devices is added. Drivers stubs.c is extended with board_get_ps8xxx_product_id() and board_set_ps8xxx_product_id() to allow test to select which PS8xxx variant is tested. BUG=b:184857030 BRANCH=none TEST=make configure --test zephyr/test/drivers Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I2580c3ac8b54cf1dad9605a7c918735d36ab2ad1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3236728 Tested-by: Tomasz Michalec <tmichalec@google.com> Commit-Queue: Tomasz Michalec <tmichalec@google.com> Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
Diffstat (limited to 'zephyr/test/drivers/src/stubs.c')
-rw-r--r--zephyr/test/drivers/src/stubs.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/zephyr/test/drivers/src/stubs.c b/zephyr/test/drivers/src/stubs.c
index 9418207349..a8a478a86f 100644
--- a/zephyr/test/drivers/src/stubs.c
+++ b/zephyr/test/drivers/src/stubs.c
@@ -139,6 +139,22 @@ struct tcpc_config_t tcpc_config[] = {
BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == USBC_PORT_COUNT);
BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT);
+static uint16_t ps8xxx_product_id = PS8805_PRODUCT_ID;
+
+uint16_t board_get_ps8xxx_product_id(int port)
+{
+ if (port != USBC_PORT_C1) {
+ return 0;
+ }
+
+ return ps8xxx_product_id;
+}
+
+void board_set_ps8xxx_product_id(uint16_t product_id)
+{
+ ps8xxx_product_id = product_id;
+}
+
int board_is_sourcing_vbus(int port)
{
return 0;