diff options
-rw-r--r-- | zephyr/shim/include/usbc/ppc_sn5s330.h | 1 | ||||
-rw-r--r-- | zephyr/shim/include/usbc/ppc_syv682x.h | 1 | ||||
-rw-r--r-- | zephyr/shim/src/ppc.c | 26 | ||||
-rw-r--r-- | zephyr/test/drivers/boards/native_posix.overlay | 2 | ||||
-rw-r--r-- | zephyr/test/drivers/common/src/stubs.c | 17 |
5 files changed, 19 insertions, 28 deletions
diff --git a/zephyr/shim/include/usbc/ppc_sn5s330.h b/zephyr/shim/include/usbc/ppc_sn5s330.h index ecbcb53deb..2b70d69e64 100644 --- a/zephyr/shim/include/usbc/ppc_sn5s330.h +++ b/zephyr/shim/include/usbc/ppc_sn5s330.h @@ -6,6 +6,7 @@ #include "ppc/sn5s330_public.h" #define SN5S330_COMPAT ti_sn5s330 +#define SN5S330_EMUL_COMPAT cros_sn5s330_emul #define PPC_CHIP_SN5S330(id) \ { .i2c_port = I2C_PORT_BY_DEV(id), \ diff --git a/zephyr/shim/include/usbc/ppc_syv682x.h b/zephyr/shim/include/usbc/ppc_syv682x.h index 33813a5256..9924e6da5e 100644 --- a/zephyr/shim/include/usbc/ppc_syv682x.h +++ b/zephyr/shim/include/usbc/ppc_syv682x.h @@ -6,6 +6,7 @@ #include "ppc/syv682x_public.h" #define SYV682X_COMPAT silergy_syv682x +#define SYV682X_EMUL_COMPAT zephyr_syv682x_emul #define PPC_CHIP_SYV682X(id) \ { \ diff --git a/zephyr/shim/src/ppc.c b/zephyr/shim/src/ppc.c index 87161407ae..c4c54d002f 100644 --- a/zephyr/shim/src/ppc.c +++ b/zephyr/shim/src/ppc.c @@ -12,11 +12,13 @@ #include "usbc/ppc_syv682x.h" #include "usbc/ppc.h" -#if DT_HAS_COMPAT_STATUS_OKAY(AOZ1380_COMPAT) || \ - DT_HAS_COMPAT_STATUS_OKAY(NX20P348X_COMPAT) || \ - DT_HAS_COMPAT_STATUS_OKAY(RT1739_PPC_COMPAT) || \ - DT_HAS_COMPAT_STATUS_OKAY(SN5S330_COMPAT) || \ - DT_HAS_COMPAT_STATUS_OKAY(SYV682X_COMPAT) +#if DT_HAS_COMPAT_STATUS_OKAY(AOZ1380_COMPAT) || \ + DT_HAS_COMPAT_STATUS_OKAY(NX20P348X_COMPAT) || \ + DT_HAS_COMPAT_STATUS_OKAY(RT1739_PPC_COMPAT) || \ + DT_HAS_COMPAT_STATUS_OKAY(SN5S330_COMPAT) || \ + DT_HAS_COMPAT_STATUS_OKAY(SN5S330_EMUL_COMPAT) || \ + DT_HAS_COMPAT_STATUS_OKAY(SYV682X_COMPAT) || \ + DT_HAS_COMPAT_STATUS_OKAY(SYV682X_EMUL_COMPAT) #define PPC_CHIP_ENTRY(usbc_id, ppc_id, config_fn) \ [USBC_PORT_NEW(usbc_id)] = config_fn(ppc_id) @@ -25,12 +27,14 @@ COND_CODE_1(DT_NODE_HAS_COMPAT(ppc_id, compat), \ (PPC_CHIP_ENTRY(usbc_id, ppc_id, config_fn)), ()) -#define PPC_CHIP_FIND(usbc_id, ppc_id) \ - CHECK_COMPAT(AOZ1380_COMPAT, usbc_id, ppc_id, PPC_CHIP_AOZ1380) \ - CHECK_COMPAT(NX20P348X_COMPAT, usbc_id, ppc_id, PPC_CHIP_NX20P348X) \ - CHECK_COMPAT(RT1739_PPC_COMPAT, usbc_id, ppc_id, PPC_CHIP_RT1739) \ - CHECK_COMPAT(SN5S330_COMPAT, usbc_id, ppc_id, PPC_CHIP_SN5S330) \ - CHECK_COMPAT(SYV682X_COMPAT, usbc_id, ppc_id, PPC_CHIP_SYV682X) +#define PPC_CHIP_FIND(usbc_id, ppc_id) \ + CHECK_COMPAT(AOZ1380_COMPAT, usbc_id, ppc_id, PPC_CHIP_AOZ1380) \ + CHECK_COMPAT(NX20P348X_COMPAT, usbc_id, ppc_id, PPC_CHIP_NX20P348X) \ + CHECK_COMPAT(RT1739_PPC_COMPAT, usbc_id, ppc_id, PPC_CHIP_RT1739) \ + CHECK_COMPAT(SN5S330_COMPAT, usbc_id, ppc_id, PPC_CHIP_SN5S330) \ + CHECK_COMPAT(SN5S330_EMUL_COMPAT, usbc_id, ppc_id, PPC_CHIP_SN5S330) \ + CHECK_COMPAT(SYV682X_COMPAT, usbc_id, ppc_id, PPC_CHIP_SYV682X) \ + CHECK_COMPAT(SYV682X_EMUL_COMPAT, usbc_id, ppc_id, PPC_CHIP_SYV682X) #define PPC_CHIP(usbc_id) \ COND_CODE_1(DT_NODE_HAS_PROP(usbc_id, ppc), \ diff --git a/zephyr/test/drivers/boards/native_posix.overlay b/zephyr/test/drivers/boards/native_posix.overlay index dca217e181..231a3714aa 100644 --- a/zephyr/test/drivers/boards/native_posix.overlay +++ b/zephyr/test/drivers/boards/native_posix.overlay @@ -37,12 +37,14 @@ reg = <0>; chg = <&isl923x_emul>; tcpc = <&tcpci_emul>; + ppc = <&sn5s330_emul>; }; port1@1 { compatible = "named-usbc-port"; reg = <1>; tcpc = <&ps8xxx_emul>; + ppc = <&syv682x_emul>; }; }; diff --git a/zephyr/test/drivers/common/src/stubs.c b/zephyr/test/drivers/common/src/stubs.c index 2683b326a8..57f4847ffa 100644 --- a/zephyr/test/drivers/common/src/stubs.c +++ b/zephyr/test/drivers/common/src/stubs.c @@ -220,23 +220,6 @@ int pd_set_power_supply_ready(int port) return EC_SUCCESS; } -/* USBC PPC configuration */ -struct ppc_config_t ppc_chips[] = { - [USBC_PORT_C0] = { - .i2c_port = I2C_PORT_USB_C0, - .i2c_addr_flags = SN5S330_ADDR0_FLAGS, - .drv = &sn5s330_drv, - }, - [USBC_PORT_C1] = { - .i2c_port = I2C_PORT_USB_C1, - .i2c_addr_flags = SYV682X_ADDR1_FLAGS, - .frs_en = GPIO_SIGNAL(DT_NODELABEL(gpio_usb_c1_frs_en)), - .drv = &syv682x_drv, - }, -}; -BUILD_ASSERT(ARRAY_SIZE(ppc_chips) == USBC_PORT_COUNT); -unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips); - DEFINE_FAKE_VOID_FUNC(system_hibernate, uint32_t, uint32_t); DEFINE_FAKE_VOID_FUNC(board_reset_pd_mcu); |