diff options
Diffstat (limited to 'zephyr/shim')
-rw-r--r-- | zephyr/shim/include/charger_enum.h | 4 | ||||
-rw-r--r-- | zephyr/shim/include/config_chip.h | 64 | ||||
-rw-r--r-- | zephyr/shim/include/shimmed_tasks.h | 44 | ||||
-rw-r--r-- | zephyr/shim/src/tcpc_nct38xx.c | 4 |
4 files changed, 65 insertions, 51 deletions
diff --git a/zephyr/shim/include/charger_enum.h b/zephyr/shim/include/charger_enum.h index 3e94ab81c3..a2acc3e000 100644 --- a/zephyr/shim/include/charger_enum.h +++ b/zephyr/shim/include/charger_enum.h @@ -13,9 +13,9 @@ */ enum chg_id { CHARGER_PRIMARY, -#if (CONFIG_PLATFORM_EC_USB_PD_PORT_MAX_COUNT > 1) +#if (CONFIG_USB_PD_PORT_MAX_COUNT > 1) CHARGER_SECONDARY, -#endif /* CONFIG_PLATFORM_EC_USB_PD_PORT_MAX_COUNT > 1 */ +#endif /* CONFIG_USB_PD_PORT_MAX_COUNT > 1 */ CHARGER_NUM, }; diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h index 0fc6212bc5..ed9c3f7ea7 100644 --- a/zephyr/shim/include/config_chip.h +++ b/zephyr/shim/include/config_chip.h @@ -1336,9 +1336,67 @@ extern struct jump_data mock_jump_data; #endif #undef CONFIG_USB_PD_PORT_MAX_COUNT -#ifdef CONFIG_PLATFORM_EC_USB_PD_PORT_MAX_COUNT -#define CONFIG_USB_PD_PORT_MAX_COUNT CONFIG_PLATFORM_EC_USB_PD_PORT_MAX_COUNT -#endif +#define CONFIG_USB_PD_PORT_MAX_COUNT DT_NUM_INST_STATUS_OKAY(named_usbc_port) + +#ifdef CONFIG_PLATFORM_EC_USB_POWER_DELIVERY +/* USBC-PD Port 0 */ +#if CONFIG_USB_PD_PORT_MAX_COUNT > 0 +#define HAS_TASK_PD_C0 1 + +#ifndef CONFIG_PLATFORM_EC_USB_PD_PORT_0_SHARED +#define HAS_TASK_PD_INT_C0 1 +#endif /* !CONFIG_PLATFORM_EC_USB_PD_PORT_0_SHARED */ + +#endif /* CONFIG_USB_PD_PORT_MAX_COUNT > 0 */ + +/* USBC-PD Port 1 */ +#if CONFIG_USB_PD_PORT_MAX_COUNT > 1 +#define HAS_TASK_PD_C1 1 + +#ifndef CONFIG_PLATFORM_EC_USB_PD_PORT_1_SHARED +#define HAS_TASK_PD_INT_C1 1 +#endif /* !CONFIG_PLATFORM_EC_USB_PD_PORT_1_SHARED */ + +#endif /* CONFIG_USB_PD_PORT_MAX_COUNT > 1 */ + +/* USBC-PD Port 2 */ +#if CONFIG_USB_PD_PORT_MAX_COUNT > 2 +#define HAS_TASK_PD_C2 1 + +#ifndef CONFIG_PLATFORM_EC_USB_PD_PORT_2_SHARED +#define HAS_TASK_PD_INT_C2 1 +#endif /* !CONFIG_PLATFORM_EC_USB_PD_PORT_2_SHARED */ + +#endif /* CONFIG_USB_PD_PORT_MAX_COUNT > 2 */ + +/* USBC-PD Port 3 */ +#if CONFIG_USB_PD_PORT_MAX_COUNT > 3 +#define HAS_TASK_PD_C3 1 + +#ifndef CONFIG_PLATFORM_EC_USB_PD_PORT_3_SHARED +#define HAS_TASK_PD_INT_C3 1 +#endif /* !CONFIG_PLATFORM_EC_USB_PD_PORT_3_SHARED */ + +#endif /* CONFIG_USB_PD_PORT_MAX_COUNT > 3 */ + +#endif /* CONFIG_PLATFORM_EC_USB_POWER_DELIVERY */ + +#ifdef CONFIG_PLATFORM_EC_USB_CHARGER +#define HAS_TASK_USB_CHG_P0 1 + +#if CONFIG_USB_PD_PORT_MAX_COUNT > 1 +#define HAS_TASK_USB_CHG_P1 1 +#endif /* CONFIG_USB_PD_PORT_MAX_COUNT > 1 */ + +#if CONFIG_USB_PD_PORT_MAX_COUNT > 2 +#define HAS_TASK_USB_CHG_P2 1 +#endif /* CONFIG_USB_PD_PORT_MAX_COUNT > 2 */ + +#if CONFIG_USB_PD_PORT_MAX_COUNT > 3 +#define HAS_TASK_USB_CHG_P3 1 +#endif /* CONFIG_USB_PD_PORT_MAX_COUNT > 3 */ + +#endif /* CONFIG_PLATFORM_EC_USB_CHARGER */ #undef CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT #ifdef CONFIG_PLATFORM_EC_USB_PD_ITE_ACTIVE_PORT_COUNT diff --git a/zephyr/shim/include/shimmed_tasks.h b/zephyr/shim/include/shimmed_tasks.h index 07552f1b27..d1fb6129d3 100644 --- a/zephyr/shim/include/shimmed_tasks.h +++ b/zephyr/shim/include/shimmed_tasks.h @@ -39,54 +39,10 @@ #define HAS_TASK_MOTIONSENSE 1 #endif /* CONFIG_HAS_TASK_MOTIONSENSE */ -#ifdef CONFIG_HAS_TASK_PD_C0 -#define HAS_TASK_PD_C0 1 -#endif /* CONFIG_HAS_TASK_PD_C0 */ - -#ifdef CONFIG_HAS_TASK_PD_C1 -#define HAS_TASK_PD_C1 1 -#endif /* CONFIG_HAS_TASK_PD_C1 */ - -#ifdef CONFIG_HAS_TASK_PD_C2 -#define HAS_TASK_PD_C2 1 -#endif /* CONFIG_HAS_TASK_PD_C2 */ - -#ifdef CONFIG_HAS_TASK_PD_C3 -#define HAS_TASK_PD_C3 1 -#endif /* CONFIG_HAS_TASK_PD_C3 */ - -#ifdef CONFIG_HAS_TASK_PD_INT_C0 -#define HAS_TASK_PD_INT_C0 1 -#endif /* CONFIG_HAS_TASK_PD_INT_C0 */ - -#ifdef CONFIG_HAS_TASK_PD_INT_C1 -#define HAS_TASK_PD_INT_C1 1 -#endif /* CONFIG_HAS_TASK_PD_INT_C1 */ - -#ifdef CONFIG_HAS_TASK_PD_INT_C2 -#define HAS_TASK_PD_INT_C2 1 -#endif /* CONFIG_HAS_TASK_PD_INT_C2 */ - -#ifdef CONFIG_HAS_TASK_PD_INT_C3 -#define HAS_TASK_PD_INT_C3 1 -#endif /* CONFIG_HAS_TASK_PD_INT_C3 */ - #ifdef CONFIG_HAS_TASK_POWERBTN #define HAS_TASK_POWERBTN 1 #endif /* CONFIG_HAS_TASK_POWERBTN */ -#ifdef CONFIG_HAS_TASK_USB_CHG_P0 -#define HAS_TASK_USB_CHG_P0 1 -#endif /* CONFIG_HAS_TASK_USB_CHG_P0 */ - -#ifdef CONFIG_HAS_TASK_USB_CHG_P1 -#define HAS_TASK_USB_CHG_P1 1 -#endif /* CONFIG_HAS_TASK_USB_CHG_P1 */ - -#ifdef CONFIG_HAS_TASK_USB_CHG_P2 -#define HAS_TASK_USB_CHG_P2 1 -#endif /* CONFIG_HAS_TASK_USB_CHG_P2 */ - #ifdef CONFIG_PLATFORM_EC_USB_MUX_TASK #define HAS_TASK_USB_MUX 1 #endif /* CONFIG_PLATFORM_EC_USB_MUX_TASK */ diff --git a/zephyr/shim/src/tcpc_nct38xx.c b/zephyr/shim/src/tcpc_nct38xx.c index d18e4ccbbe..9481961e5e 100644 --- a/zephyr/shim/src/tcpc_nct38xx.c +++ b/zephyr/shim/src/tcpc_nct38xx.c @@ -19,13 +19,13 @@ /* NCT38XX GPIO device pool for binding the TCPC port and NCT38XX GPIO device */ static const struct device - *nct38xx_gpio_devices[CONFIG_PLATFORM_EC_USB_PD_PORT_MAX_COUNT] = { + *nct38xx_gpio_devices[CONFIG_USB_PD_PORT_MAX_COUNT] = { DT_FOREACH_STATUS_OKAY(nuvoton_nct38xx, GPIO_DEV_BINDING) }; const struct device *nct38xx_get_gpio_device_from_port(const int port) { - if (port < 0 || port >= CONFIG_PLATFORM_EC_USB_PD_PORT_MAX_COUNT) + if (port < 0 || port >= CONFIG_USB_PD_PORT_MAX_COUNT) return NULL; return nct38xx_gpio_devices[port]; } |