From 9577704f30c7e824c0590264df22d95a2c706575 Mon Sep 17 00:00:00 2001 From: Karthikeyan Ramasubramanian Date: Wed, 2 Oct 2019 14:27:47 -0600 Subject: Rename CONFIG_USB_PD_PORT_COUNT as CONFIG_USB_PD_PORT_MAX_COUNT Certain SKUs of certain boards have lesser number of USB PD ports than defined by CONFIG_USB_PD_PORT_COUNT. Hence rename CONFIG_USB_PD_PORT_COUNT as CONFIG_USB_PD_PORT_MAX_COUNT. BUG=b:140816510, b:143196487 BRANCH=octopus TEST=make -j buildall; Boot to ChromeOS Change-Id: I7c33b27150730a1a3b5813b7b4a72fd24ab73c6a Signed-off-by: Karthikeyan Ramasubramanian Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1879337 Tested-by: Karthikeyan Ramasubramanian Reviewed-by: Jett Rink Commit-Queue: Jett Rink --- common/charge_manager.c | 16 ++++---- common/charge_ramp_sw.c | 8 ++-- common/host_command_pd.c | 2 +- common/i2c_master.c | 4 +- common/pd_log.c | 4 +- common/peripheral.c | 6 +-- common/system.c | 3 +- common/usb_charger.c | 4 +- common/usb_pd_policy.c | 26 ++++++------- common/usb_pd_protocol.c | 71 +++++++++++++++++----------------- common/usb_pd_tcpc.c | 16 ++++---- common/usbc/usb_pe_ctvpd_sm.c | 4 +- common/usbc/usb_pe_drp_sm.c | 20 +++++----- common/usbc/usb_prl_sm.c | 16 ++++---- common/usbc/usb_tc_ctvpd_sm.c | 2 +- common/usbc/usb_tc_drp_acc_trysrc_sm.c | 23 +++++------ common/usbc/usb_tc_vpd_sm.c | 2 +- common/usbc/usbc_task.c | 4 +- common/usbc_ppc.c | 2 +- 19 files changed, 118 insertions(+), 115 deletions(-) (limited to 'common') diff --git a/common/charge_manager.c b/common/charge_manager.c index 176781234f..6f8a796999 100644 --- a/common/charge_manager.c +++ b/common/charge_manager.c @@ -103,11 +103,11 @@ static int override_port = OVERRIDE_OFF; static int delayed_override_port = OVERRIDE_OFF; static timestamp_t delayed_override_deadline; -static uint8_t source_port_rp[CONFIG_USB_PD_PORT_COUNT]; +static uint8_t source_port_rp[CONFIG_USB_PD_PORT_MAX_COUNT]; #ifdef CONFIG_USB_PD_MAX_TOTAL_SOURCE_CURRENT /* 3A on one port and 1.5A on the rest */ -BUILD_ASSERT(CONFIG_USB_PD_PORT_COUNT * 1500 + 1500 <= +BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT * 1500 + 1500 <= CONFIG_USB_PD_MAX_TOTAL_SOURCE_CURRENT); #endif @@ -140,7 +140,7 @@ enum charge_manager_change_type { static int is_pd_port(int port) { - return 0 <= port && port < CONFIG_USB_PD_PORT_COUNT; + return port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT; } static int is_sink(int port) @@ -761,7 +761,7 @@ static void charge_manager_refresh(void) if (updated_old_port != CHARGE_PORT_NONE) save_log[updated_old_port] = 1; - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; ++i) + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; ++i) if (save_log[i]) charge_manager_save_log(i); #endif @@ -1111,7 +1111,7 @@ int charge_manager_get_power_limit_uw(void) /* Bitmap of ports used as power source */ static volatile uint32_t source_port_bitmap; -BUILD_ASSERT(sizeof(source_port_bitmap)*8 >= CONFIG_USB_PD_PORT_COUNT); +BUILD_ASSERT(sizeof(source_port_bitmap)*8 >= CONFIG_USB_PD_PORT_MAX_COUNT); static inline int has_other_active_source(int port) { @@ -1138,7 +1138,7 @@ static int can_supply_max_current(int port) if (!is_active_source(port)) /* Non-active ports don't get 3A */ return 0; - for (p = 0; p < CONFIG_USB_PD_PORT_COUNT; p++) { + for (p = 0; p < CONFIG_USB_PD_PORT_MAX_COUNT; p++) { if (p == port) continue; if (source_port_rp[p] == @@ -1166,7 +1166,7 @@ void charge_manager_source_port(int port, int enable) return; /* Set port limit according to policy */ - for (p = 0; p < CONFIG_USB_PD_PORT_COUNT; p++) { + for (p = 0; p < CONFIG_USB_PD_PORT_MAX_COUNT; p++) { rp = can_supply_max_current(p) ? CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT : CONFIG_USB_PD_PULLUP; @@ -1309,7 +1309,7 @@ static void charge_manager_set_external_power_limit(int current_lim, if (voltage_lim == EC_POWER_LIMIT_NONE) voltage_lim = PD_MAX_VOLTAGE_MV; - for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; ++port) { + for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port) { charge_manager_set_ceil(port, CEIL_REQUESTOR_HOST, current_lim); pd_set_external_voltage_limit(port, voltage_lim); } diff --git a/common/charge_ramp_sw.c b/common/charge_ramp_sw.c index 1e1289654e..33dbff656b 100644 --- a/common/charge_ramp_sw.c +++ b/common/charge_ramp_sw.c @@ -59,8 +59,8 @@ struct oc_info { }; /* OCP info for each over-current */ -static struct oc_info oc_info[CONFIG_USB_PD_PORT_COUNT][RAMP_COUNT]; -static int oc_info_idx[CONFIG_USB_PD_PORT_COUNT]; +static struct oc_info oc_info[CONFIG_USB_PD_PORT_MAX_COUNT][RAMP_COUNT]; +static int oc_info_idx[CONFIG_USB_PD_PORT_MAX_COUNT]; #define ACTIVE_OC_INFO (oc_info[active_port][oc_info_idx[active_port]]) /* Active charging information */ @@ -157,7 +157,7 @@ void chg_ramp_task(void *u) int active_icl_new; /* Clear last OCP supplier to guarantee we ramp on first connect */ - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) oc_info[i][0].sup = CHARGE_SUPPLIER_NONE; /* @@ -364,7 +364,7 @@ static int command_chgramp(int argc, char **argv) ccprintf("Chg Ramp:\nState: %d\nMin ICL: %d\nActive ICL: %d\n", ramp_st, min_icl, active_icl); - for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) { + for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) { ccprintf("Port %d:\n", port); ccprintf(" OC idx:%d\n", oc_info_idx[port]); for (i = 0; i < RAMP_COUNT; i++) { diff --git a/common/host_command_pd.c b/common/host_command_pd.c index 3f0f83c4b2..593ac335ec 100644 --- a/common/host_command_pd.c +++ b/common/host_command_pd.c @@ -139,7 +139,7 @@ static void pd_service_tcpc_ports(uint16_t port_status) { int i; - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) { + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) { if ((port_status & (PD_STATUS_TCPC_ALERT_0 << i)) && pd_is_port_enabled(i)) tcpc_alert(i); diff --git a/common/i2c_master.c b/common/i2c_master.c index 091ea7f423..37090c0ad6 100644 --- a/common/i2c_master.c +++ b/common/i2c_master.c @@ -912,7 +912,7 @@ static void i2c_passthru_protect_port(uint32_t port) static void i2c_passthru_protect_tcpc_ports(void) { -#ifdef CONFIG_USB_PD_PORT_COUNT +#ifdef CONFIG_USB_PD_PORT_MAX_COUNT int i; /* @@ -924,7 +924,7 @@ static void i2c_passthru_protect_tcpc_ports(void) return; } - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) { + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) { /* TCPC tunnel not configured. No need to protect anything */ if (!I2C_GET_ADDR(tcpc_config[i].i2c_info.addr_flags)) continue; diff --git a/common/pd_log.c b/common/pd_log.c index b91a58762c..1eb5d3e3ab 100644 --- a/common/pd_log.c +++ b/common/pd_log.c @@ -68,7 +68,7 @@ dequeue_retry: if (r->type == PD_EVENT_NO_ENTRY) { int i, res; incoming_logs = 0; - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; ++i) { + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; ++i) { /* only accessories who knows Google logging format */ if (pd_get_identity_vid(i) != USB_VID_GOOGLE) continue; @@ -96,7 +96,7 @@ static enum ec_status hc_pd_write_log_entry(struct host_cmd_handler_args *args) if (type < PD_EVENT_MCU_BASE || type >= PD_EVENT_ACC_BASE) return EC_RES_INVALID_PARAM; - if (port > 0 && port >= CONFIG_USB_PD_PORT_COUNT) + if (port > 0 && port >= CONFIG_USB_PD_PORT_MAX_COUNT) return EC_RES_INVALID_PARAM; switch (type) { diff --git a/common/peripheral.c b/common/peripheral.c index 686368fd02..7e567974ec 100644 --- a/common/peripheral.c +++ b/common/peripheral.c @@ -29,8 +29,8 @@ static enum ec_status hc_locate_chip(struct host_cmd_handler_args *args) #endif /* CONFIG_CROS_BOARD_INFO */ break; case EC_CHIP_TYPE_TCPC: -#if defined(CONFIG_USB_PD_PORT_COUNT) && !defined(CONFIG_USB_PD_TCPC) - if (params->index >= CONFIG_USB_PD_PORT_COUNT) +#if defined(CONFIG_USB_PD_PORT_MAX_COUNT) && !defined(CONFIG_USB_PD_TCPC) + if (params->index >= CONFIG_USB_PD_PORT_MAX_COUNT) return EC_RES_OVERFLOW; resp->bus_type = tcpc_config[params->index].bus_type; if (resp->bus_type == EC_BUS_TYPE_I2C) { @@ -44,7 +44,7 @@ static enum ec_status hc_locate_chip(struct host_cmd_handler_args *args) #endif #else return EC_RES_UNAVAILABLE; -#endif /* CONFIG_USB_PD_PORT_COUNT */ +#endif /* CONFIG_USB_PD_PORT_MAX_COUNT */ break; default: /* The type was unrecognized */ diff --git a/common/system.c b/common/system.c index 5ae642a560..90029d88b4 100644 --- a/common/system.c +++ b/common/system.c @@ -857,7 +857,8 @@ static int handle_pending_reboot(enum ec_reboot_cmd cmd) { int port; - for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) + for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; + port++) pd_set_suspend(port, 1); } #endif diff --git a/common/usb_charger.c b/common/usb_charger.c index 4d0d615a9b..c2dd062f6f 100644 --- a/common/usb_charger.c +++ b/common/usb_charger.c @@ -52,7 +52,7 @@ int usb_charger_port_is_sourcing_vbus(int port) { if (port == 0) return USB_5V_EN(0); -#if CONFIG_USB_PD_PORT_COUNT >= 2 +#if CONFIG_USB_PD_PORT_MAX_COUNT >= 2 else if (port == 1) return USB_5V_EN(1); #endif @@ -111,7 +111,7 @@ void usb_charger_reset_charge(int port) static void usb_charger_init(void) { int i; - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) { + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) { usb_charger_reset_charge(i); /* Initialize VBUS supplier based on whether VBUS is present. */ update_vbus_supplier(i, pd_is_vbus_present(i)); diff --git a/common/usb_pd_policy.c b/common/usb_pd_policy.c index 090588a034..f36ec396ab 100644 --- a/common/usb_pd_policy.c +++ b/common/usb_pd_policy.c @@ -99,22 +99,22 @@ __attribute__((weak)) int pd_board_check_request(uint32_t rdo, int pdo_cnt) #ifdef CONFIG_USB_PD_DUAL_ROLE /* Last received source cap */ -static uint32_t pd_src_caps[CONFIG_USB_PD_PORT_COUNT][PDO_MAX_OBJECTS]; -static uint8_t pd_src_cap_cnt[CONFIG_USB_PD_PORT_COUNT]; +static uint32_t pd_src_caps[CONFIG_USB_PD_PORT_MAX_COUNT][PDO_MAX_OBJECTS]; +static uint8_t pd_src_cap_cnt[CONFIG_USB_PD_PORT_MAX_COUNT]; /* Cap on the max voltage requested as a sink (in millivolts) */ static unsigned max_request_mv = PD_MAX_VOLTAGE_MV; /* no cap */ const uint32_t * const pd_get_src_caps(int port) { - ASSERT(port < CONFIG_USB_PD_PORT_COUNT); + ASSERT(port < CONFIG_USB_PD_PORT_MAX_COUNT); return pd_src_caps[port]; } uint8_t pd_get_src_cap_cnt(int port) { - ASSERT(port < CONFIG_USB_PD_PORT_COUNT); + ASSERT(port < CONFIG_USB_PD_PORT_MAX_COUNT); return pd_src_cap_cnt[port]; } @@ -164,7 +164,7 @@ int pd_charge_from_device(uint16_t vid, uint16_t pid) } #endif /* CONFIG_USB_PD_DUAL_ROLE */ -static struct pd_cable cable[CONFIG_USB_PD_PORT_COUNT]; +static struct pd_cable cable[CONFIG_USB_PD_PORT_MAX_COUNT]; static uint8_t is_transmit_msg_sop_prime(int port) { @@ -209,7 +209,7 @@ enum idh_ptype get_usb_pd_mux_cable_type(int port) #ifdef CONFIG_USB_PD_ALT_MODE_DFP -static struct pd_policy pe[CONFIG_USB_PD_PORT_COUNT]; +static struct pd_policy pe[CONFIG_USB_PD_PORT_MAX_COUNT]; static int is_vdo_present(int cnt, int index) { @@ -629,7 +629,7 @@ static int command_pe(int argc, char **argv) return EC_ERROR_PARAM_COUNT; /* command: pe */ port = strtoi(argv[1], &e, 10); - if (*e || port >= CONFIG_USB_PD_PORT_COUNT) + if (*e || port >= CONFIG_USB_PD_PORT_MAX_COUNT) return EC_ERROR_PARAM2; if (!strncasecmp(argv[2], "dump", 4)) dump_pe(port); @@ -884,7 +884,7 @@ static int command_cable(int argc, char **argv) if (argc < 2) return EC_ERROR_PARAM_COUNT; port = strtoi(argv[1], &e, 0); - if (*e || port >= CONFIG_USB_PD_PORT_COUNT) + if (*e || port >= CONFIG_USB_PD_PORT_MAX_COUNT) return EC_ERROR_PARAM2; if (!cable[port].is_identified) { @@ -984,7 +984,7 @@ static enum ec_status hc_remote_pd_discovery(struct host_cmd_handler_args *args) const uint8_t *port = args->params; struct ec_params_usb_pd_discovery_entry *r = args->response; - if (*port >= CONFIG_USB_PD_PORT_COUNT) + if (*port >= CONFIG_USB_PD_PORT_MAX_COUNT) return EC_RES_INVALID_PARAM; r->vid = pd_get_identity_vid(*port); @@ -1006,7 +1006,7 @@ static enum ec_status hc_remote_pd_get_amode(struct host_cmd_handler_args *args) const struct ec_params_usb_pd_get_mode_request *p = args->params; struct ec_params_usb_pd_get_mode_response *r = args->response; - if (p->port >= CONFIG_USB_PD_PORT_COUNT) + if (p->port >= CONFIG_USB_PD_PORT_MAX_COUNT) return EC_RES_INVALID_PARAM; /* no more to send */ @@ -1135,17 +1135,17 @@ int pd_custom_flash_vdm(int port, int cnt, uint32_t *payload) #ifdef CONFIG_USB_PD_DISCHARGE void pd_set_vbus_discharge(int port, int enable) { - static struct mutex discharge_lock[CONFIG_USB_PD_PORT_COUNT]; + static struct mutex discharge_lock[CONFIG_USB_PD_PORT_MAX_COUNT]; mutex_lock(&discharge_lock[port]); enable &= !board_vbus_source_enabled(port); #ifdef CONFIG_USB_PD_DISCHARGE_GPIO if (!port) gpio_set_level(GPIO_USB_C0_DISCHARGE, enable); -#if CONFIG_USB_PD_PORT_COUNT > 1 +#if CONFIG_USB_PD_PORT_MAX_COUNT > 1 else gpio_set_level(GPIO_USB_C1_DISCHARGE, enable); -#endif /* CONFIG_USB_PD_PORT_COUNT */ +#endif /* CONFIG_USB_PD_PORT_MAX_COUNT */ #elif defined(CONFIG_USB_PD_DISCHARGE_TCPC) tcpc_discharge_vbus(port, enable); #elif defined(CONFIG_USB_PD_DISCHARGE_PPC) diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index a08027ad5e..5d5df2d4e5 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -36,7 +36,7 @@ #define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args) #define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args) -BUILD_ASSERT(CONFIG_USB_PD_PORT_COUNT <= EC_USB_PD_MAX_PORTS); +BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT <= EC_USB_PD_MAX_PORTS); /* * If we are trying to upgrade the TCPC port that is supplying power, then we @@ -69,7 +69,7 @@ static int debug_level; * detects source/sink connection and disconnection, and will still * provide VBUS, but never sends any PD communication. */ -static uint8_t pd_comm_enabled[CONFIG_USB_PD_PORT_COUNT]; +static uint8_t pd_comm_enabled[CONFIG_USB_PD_PORT_MAX_COUNT]; #else /* CONFIG_COMMON_RUNTIME */ #define CPRINTF(format, args...) #define CPRINTS(format, args...) @@ -125,8 +125,8 @@ enum vdm_states { #ifdef CONFIG_USB_PD_DUAL_ROLE /* Port dual-role state */ -enum pd_dual_role_states drp_state[CONFIG_USB_PD_PORT_COUNT] = { - [0 ... (CONFIG_USB_PD_PORT_COUNT - 1)] = +enum pd_dual_role_states drp_state[CONFIG_USB_PD_PORT_MAX_COUNT] = { + [0 ... (CONFIG_USB_PD_PORT_MAX_COUNT - 1)] = CONFIG_USB_PD_INITIAL_DRP_STATE}; /* Enable variable for Try.SRC states */ @@ -272,7 +272,7 @@ static struct pd_protocol { * When we can give up on a HARD_RESET transmission. */ uint64_t hard_reset_complete_timer; -} pd[CONFIG_USB_PD_PORT_COUNT]; +} pd[CONFIG_USB_PD_PORT_MAX_COUNT]; #ifdef CONFIG_COMMON_RUNTIME static const char * const pd_state_names[] = { @@ -851,11 +851,11 @@ static inline void set_state(int port, enum pd_states next_state) #ifdef CONFIG_LOW_POWER_IDLE /* If a PD device is attached then disable deep sleep */ - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) { + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) { if (pd_capable(i)) break; } - if (i == CONFIG_USB_PD_PORT_COUNT) + if (i == CONFIG_USB_PD_PORT_MAX_COUNT) enable_sleep(SLEEP_MASK_USB_PD); else disable_sleep(SLEEP_MASK_USB_PD); @@ -1477,7 +1477,7 @@ void pd_soft_reset(void) { int i; - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; ++i) + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; ++i) if (pd_is_connected(i)) { set_state(i, PD_STATE_SOFT_RESET); task_wake(PD_PORT_TO_TASK_ID(i)); @@ -2378,7 +2378,7 @@ static void pd_update_try_source(void) int batt_soc = usb_get_battery_soc(); try_src = 0; - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) try_src |= drp_state[i] == PD_DRP_TOGGLE_ON; /* @@ -2411,7 +2411,7 @@ static void pd_update_try_source(void) * mode went from enabled to disabled and trying_source * was active at that time. */ - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) pd[i].flags &= ~PD_FLAGS_TRY_SRC; } #endif /* CONFIG_USB_PD_TRY_SRC */ @@ -2425,7 +2425,7 @@ static void pd_update_snk_reset(void) if (batt_soc < CONFIG_USB_PD_RESET_MIN_BATT_SOC) return; - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) { + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) { if (pd[i].flags & PD_FLAGS_SNK_WAITING_BATT) { /* * Battery has gained sufficient charge to kick off PD @@ -2669,7 +2669,7 @@ int pd_get_partner_data_swap_capable(int port) #ifdef CONFIG_COMMON_RUNTIME void pd_comm_enable(int port, int enable) { - /* We don't check port >= CONFIG_USB_PD_PORT_COUNT deliberately */ + /* We don't check port >= CONFIG_USB_PD_PORT_MAX_COUNT deliberately */ pd_comm_enabled[port] = enable; /* If type-C connection, then update the TCPC RX enable */ @@ -2734,13 +2734,13 @@ static void pd_init_tasks(void) #if defined(HAS_TASK_CHIPSET) && defined(CONFIG_USB_PD_DUAL_ROLE) /* Set dual-role state based on chipset power state */ if (chipset_in_state(CHIPSET_STATE_ANY_OFF)) - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) drp_state[i] = PD_DRP_FORCE_SINK; else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND)) - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) drp_state[i] = PD_DRP_TOGGLE_OFF; else /* CHIPSET_STATE_ON */ - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) drp_state[i] = PD_DRP_TOGGLE_ON; #endif @@ -2755,7 +2755,7 @@ static void pd_init_tasks(void) enable = 1; #endif #endif - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) pd_comm_enabled[i] = enable; CPRINTS("PD comm %sabled", enable ? "en" : "dis"); @@ -2784,7 +2784,7 @@ static int pd_restart_tcpc(int port) /* Events for pd_interrupt_handler_task */ #define PD_PROCESS_INTERRUPT BIT(0) -static uint8_t pd_int_task_id[CONFIG_USB_PD_PORT_COUNT]; +static uint8_t pd_int_task_id[CONFIG_USB_PD_PORT_MAX_COUNT]; void schedule_deferred_pd_interrupt(const int port) { @@ -2812,9 +2812,9 @@ void pd_interrupt_handler_task(void *p) struct { int count; uint32_t time; - } storm_tracker[CONFIG_USB_PD_PORT_COUNT] = {}; + } storm_tracker[CONFIG_USB_PD_PORT_MAX_COUNT] = {}; - ASSERT(port >= 0 && port < CONFIG_USB_PD_PORT_COUNT); + ASSERT(port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT); pd_int_task_id[port] = task_get_current(); @@ -4735,7 +4735,7 @@ static void pd_chipset_resume(void) { int i; - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) { + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) { #ifdef CONFIG_CHARGE_MANAGER if (charge_manager_get_active_charge_port() != i) #endif @@ -4752,7 +4752,7 @@ static void pd_chipset_suspend(void) { int i; - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) pd_set_dual_role(i, PD_DRP_TOGGLE_OFF); CPRINTS("PD:S0->S3"); } @@ -4762,7 +4762,7 @@ static void pd_chipset_startup(void) { int i; - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) { + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) { pd_set_dual_role_no_wakeup(i, PD_DRP_TOGGLE_OFF); pd[i].flags |= PD_FLAGS_CHECK_IDENTITY; /* Reset cable attributes and flags */ @@ -4780,7 +4780,7 @@ static void pd_chipset_shutdown(void) { int i; - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) { + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) { pd_set_dual_role_no_wakeup(i, PD_DRP_FORCE_SINK); task_set_event(PD_PORT_TO_TASK_ID(i), PD_EVENT_POWER_STATE_CHANGE | @@ -4799,7 +4799,7 @@ void pd_prepare_sysjump(void) int i; /* Exit modes before sysjump so we can cleanly enter again later */ - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) { + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) { /* * We can't be in an alternate mode if PD comm is disabled or * the port is suspended, so no need to send the event @@ -4922,13 +4922,13 @@ static int remote_flashing(int argc, char **argv) int port, cnt, cmd; uint32_t data[VDO_MAX_SIZE-1]; char *e; - static int flash_offset[CONFIG_USB_PD_PORT_COUNT]; + static int flash_offset[CONFIG_USB_PD_PORT_MAX_COUNT]; if (argc < 4 || argc > (VDO_MAX_SIZE + 4 - 1)) return EC_ERROR_PARAM_COUNT; port = strtoi(argv[1], &e, 10); - if (*e || port >= CONFIG_USB_PD_PORT_COUNT) + if (*e || port >= CONFIG_USB_PD_PORT_MAX_COUNT) return EC_ERROR_PARAM2; cnt = 0; @@ -5169,7 +5169,7 @@ static int command_pd(int argc, char **argv) port = strtoi(argv[1], &e, 10); if (argc < 3) return EC_ERROR_PARAM_COUNT; - if (*e || port >= CONFIG_USB_PD_PORT_COUNT) + if (*e || port >= CONFIG_USB_PD_PORT_MAX_COUNT) return EC_ERROR_PARAM2; #if defined(CONFIG_CMD_PD) && defined(CONFIG_USB_PD_DUAL_ROLE) @@ -5358,7 +5358,7 @@ DECLARE_CONSOLE_COMMAND(pd, command_pd, static enum ec_status hc_pd_ports(struct host_cmd_handler_args *args) { struct ec_response_usb_pd_ports *r = args->response; - r->num_ports = CONFIG_USB_PD_PORT_COUNT; + r->num_ports = CONFIG_USB_PD_PORT_MAX_COUNT; args->response_size = sizeof(*r); return EC_RES_SUCCESS; @@ -5399,7 +5399,7 @@ static enum ec_status hc_usb_pd_control(struct host_cmd_handler_args *args) struct ec_response_usb_pd_control_v1 *r_v1 = args->response; struct ec_response_usb_pd_control *r = args->response; - if (p->port >= CONFIG_USB_PD_PORT_COUNT) + if (p->port >= CONFIG_USB_PD_PORT_MAX_COUNT) return EC_RES_INVALID_PARAM; if (p->role >= USB_PD_CTRL_ROLE_COUNT || @@ -5499,7 +5499,7 @@ static enum ec_status hc_remote_flash(struct host_cmd_handler_args *args) int i, size, rv = EC_RES_SUCCESS; timestamp_t timeout; - if (port >= CONFIG_USB_PD_PORT_COUNT) + if (port >= CONFIG_USB_PD_PORT_MAX_COUNT) return EC_RES_INVALID_PARAM; if (p->size + sizeof(*p) > args->params_size) @@ -5628,7 +5628,7 @@ static enum ec_status hc_remote_pd_dev_info(struct host_cmd_handler_args *args) const uint8_t *port = args->params; struct ec_params_usb_pd_rw_hash_entry *r = args->response; - if (*port >= CONFIG_USB_PD_PORT_COUNT) + if (*port >= CONFIG_USB_PD_PORT_MAX_COUNT) return EC_RES_INVALID_PARAM; r->dev_id = pd[*port].dev_id; @@ -5654,7 +5654,7 @@ static enum ec_status hc_remote_pd_chip_info(struct host_cmd_handler_args *args) const struct ec_params_pd_chip_info *p = args->params; struct ec_response_pd_chip_info_v1 *info; - if (p->port >= CONFIG_USB_PD_PORT_COUNT) + if (p->port >= CONFIG_USB_PD_PORT_MAX_COUNT) return EC_RES_INVALID_PARAM; if (tcpm_get_chip_info(p->port, p->live, &info)) @@ -5683,7 +5683,8 @@ static enum ec_status hc_remote_pd_set_amode(struct host_cmd_handler_args *args) { const struct ec_params_usb_pd_set_mode_request *p = args->params; - if ((p->port >= CONFIG_USB_PD_PORT_COUNT) || (!p->svid) || (!p->opos)) + if ((p->port >= CONFIG_USB_PD_PORT_MAX_COUNT) || + (!p->svid) || (!p->opos)) return EC_RES_INVALID_PARAM; switch (p->cmd) { @@ -5717,11 +5718,11 @@ DECLARE_HOST_COMMAND(EC_CMD_USB_PD_SET_AMODE, static enum ec_status pd_control(struct host_cmd_handler_args *args) { - static int pd_control_disabled[CONFIG_USB_PD_PORT_COUNT]; + static int pd_control_disabled[CONFIG_USB_PD_PORT_MAX_COUNT]; const struct ec_params_pd_control *cmd = args->params; int enable = 0; - if (cmd->chip >= CONFIG_USB_PD_PORT_COUNT) + if (cmd->chip >= CONFIG_USB_PD_PORT_MAX_COUNT) return EC_RES_INVALID_PARAM; /* Always allow disable command */ diff --git a/common/usb_pd_tcpc.c b/common/usb_pd_tcpc.c index 5decbb0dec..44c6d58a96 100644 --- a/common/usb_pd_tcpc.c +++ b/common/usb_pd_tcpc.c @@ -263,7 +263,7 @@ static struct pd_port_controller { uint16_t tx_head; uint32_t tx_payload[7]; const uint32_t *tx_data; -} pd[CONFIG_USB_PD_PORT_COUNT]; +} pd[CONFIG_USB_PD_PORT_MAX_COUNT]; static int rx_buf_is_full(int port) { @@ -1111,11 +1111,11 @@ int tcpc_set_rx_enable(int port, int enable) #if defined(CONFIG_LOW_POWER_IDLE) && !defined(CONFIG_USB_POWER_DELIVERY) /* If any PD port is connected, then disable deep sleep */ - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; ++i) + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; ++i) if (pd[i].rx_enabled) break; - if (i == CONFIG_USB_PD_PORT_COUNT) + if (i == CONFIG_USB_PD_PORT_MAX_COUNT) enable_sleep(SLEEP_MASK_USB_PD); else disable_sleep(SLEEP_MASK_USB_PD); @@ -1163,7 +1163,7 @@ void tcpc_pre_init(void) int i; /* Mark as uninitialized */ - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) pd[i].power_status |= TCPC_REG_POWER_STATUS_UNINIT | TCPC_REG_POWER_STATUS_VBUS_DET; } @@ -1194,13 +1194,13 @@ void tcpc_init(int port) } #ifdef CONFIG_USB_PD_TCPC_TRACK_VBUS -#if CONFIG_USB_PD_PORT_COUNT >= 2 +#if CONFIG_USB_PD_PORT_MAX_COUNT >= 2 tcpc_set_power_status(port, !gpio_get_level(port ? GPIO_USB_C1_VBUS_WAKE_L : GPIO_USB_C0_VBUS_WAKE_L)); #else tcpc_set_power_status(port, !gpio_get_level(GPIO_USB_C0_VBUS_WAKE_L)); -#endif /* CONFIG_USB_PD_PORT_COUNT >= 2 */ +#endif /* CONFIG_USB_PD_PORT_MAX_COUNT >= 2 */ #endif /* CONFIG_USB_PD_TCPC_TRACK_VBUS */ /* set default alert and power mask register values */ @@ -1219,7 +1219,7 @@ void pd_vbus_evt_p0(enum gpio_signal signal) task_wake(TASK_ID_PD_C0); } -#if CONFIG_USB_PD_PORT_COUNT >= 2 +#if CONFIG_USB_PD_PORT_MAX_COUNT >= 2 void pd_vbus_evt_p1(enum gpio_signal signal) { tcpc_set_power_status(TASK_ID_TO_PD_PORT(TASK_ID_PD_C1), @@ -1423,7 +1423,7 @@ static int command_tcpc(int argc, char **argv) port = strtoi(argv[1], &e, 10); if (argc < 3) return EC_ERROR_PARAM_COUNT; - if (*e || port >= CONFIG_USB_PD_PORT_COUNT) + if (*e || port >= CONFIG_USB_PD_PORT_MAX_COUNT) return EC_ERROR_PARAM2; if (!strcasecmp(argv[2], "clock")) { diff --git a/common/usbc/usb_pe_ctvpd_sm.c b/common/usbc/usb_pe_ctvpd_sm.c index 4f18ed774e..5fe7a6b5a3 100644 --- a/common/usbc/usb_pe_ctvpd_sm.c +++ b/common/usbc/usb_pe_ctvpd_sm.c @@ -29,7 +29,7 @@ static struct policy_engine { struct sm_ctx ctx; /* port flags, see PE_FLAGS_* */ uint32_t flags; -} pe[CONFIG_USB_PD_PORT_COUNT]; +} pe[CONFIG_USB_PD_PORT_MAX_COUNT]; /* List of all policy-engine-level states */ enum usb_pe_state { @@ -55,7 +55,7 @@ static void pe_init(int port) void pe_run(int port, int evt, int en) { - static enum sm_local_state local_state[CONFIG_USB_PD_PORT_COUNT]; + static enum sm_local_state local_state[CONFIG_USB_PD_PORT_MAX_COUNT]; switch (local_state[port]) { case SM_PAUSED: diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c index 15d6c7b356..c6d528516f 100644 --- a/common/usbc/usb_pe_drp_sm.c +++ b/common/usbc/usb_pe_drp_sm.c @@ -251,7 +251,7 @@ enum sub_state { PE_SUB2 }; -static enum sm_local_state local_state[CONFIG_USB_PD_PORT_COUNT]; +static enum sm_local_state local_state[CONFIG_USB_PD_PORT_MAX_COUNT]; /* * Policy Engine State Machine Object @@ -415,7 +415,7 @@ static struct policy_engine { uint32_t src_caps[PDO_MAX_OBJECTS]; int src_cap_cnt; -} pe[CONFIG_USB_PD_PORT_COUNT]; +} pe[CONFIG_USB_PD_PORT_MAX_COUNT]; /* * As a sink, this is the max voltage (in millivolts) we can request @@ -4395,19 +4395,19 @@ int pd_charge_from_device(uint16_t vid, uint16_t pid) #ifdef CONFIG_USB_PD_DISCHARGE void pd_set_vbus_discharge(int port, int enable) { - static struct mutex discharge_lock[CONFIG_USB_PD_PORT_COUNT]; + static struct mutex discharge_lock[CONFIG_USB_PD_PORT_MAX_COUNT]; mutex_lock(&discharge_lock[port]); enable &= !board_vbus_source_enabled(port); #ifdef CONFIG_USB_PD_DISCHARGE_GPIO -#if CONFIG_USB_PD_PORT_COUNT == 0 +#if CONFIG_USB_PD_PORT_MAX_COUNT == 0 gpio_set_level(GPIO_USB_C0_DISCHARGE, enable); -#elif CONFIG_USB_PD_PORT_COUNT == 1 +#elif CONFIG_USB_PD_PORT_MAX_COUNT == 1 gpio_set_level(GPIO_USB_C1_DISCHARGE, enable); -#elif CONFIG_USB_PD_PORT_COUNT == 2 +#elif CONFIG_USB_PD_PORT_MAX_COUNT == 2 gpio_set_level(GPIO_USB_C2_DISCHARGE, enable); -#elif CONFIG_USB_PD_PORT_COUNT == 3 +#elif CONFIG_USB_PD_PORT_MAX_COUNT == 3 gpio_set_level(GPIO_USB_C3_DISCHARGE, enable); #endif #else @@ -4838,7 +4838,7 @@ static int command_pe(int argc, char **argv) /* command: pe */ port = strtoi(argv[1], &e, 10); - if (*e || port >= CONFIG_USB_PD_PORT_COUNT) + if (*e || port >= CONFIG_USB_PD_PORT_MAX_COUNT) return EC_ERROR_PARAM2; if (!strncasecmp(argv[2], "dump", 4)) dump_pe(port); @@ -4856,7 +4856,7 @@ static enum ec_status hc_remote_pd_discovery(struct host_cmd_handler_args *args) const uint8_t *port = args->params; struct ec_params_usb_pd_discovery_entry *r = args->response; - if (*port >= CONFIG_USB_PD_PORT_COUNT) + if (*port >= CONFIG_USB_PD_PORT_MAX_COUNT) return EC_RES_INVALID_PARAM; r->vid = pd_get_identity_vid(*port); @@ -4879,7 +4879,7 @@ static enum ec_status hc_remote_pd_get_amode(struct host_cmd_handler_args *args) const struct ec_params_usb_pd_get_mode_request *p = args->params; struct ec_params_usb_pd_get_mode_response *r = args->response; - if (p->port >= CONFIG_USB_PD_PORT_COUNT) + if (p->port >= CONFIG_USB_PD_PORT_MAX_COUNT) return EC_RES_INVALID_PARAM; /* no more to send */ diff --git a/common/usbc/usb_prl_sm.c b/common/usbc/usb_prl_sm.c index e95f2a3c9e..c92faec8ac 100644 --- a/common/usbc/usb_prl_sm.c +++ b/common/usbc/usb_prl_sm.c @@ -68,7 +68,7 @@ /* PD counter definitions */ #define PD_MESSAGE_ID_COUNT 7 -static enum sm_local_state local_state[CONFIG_USB_PD_PORT_COUNT]; +static enum sm_local_state local_state[CONFIG_USB_PD_PORT_MAX_COUNT]; /* Protocol Transmit States (Section 6.11.2.2) */ enum usb_prl_tx_state { @@ -128,7 +128,7 @@ static struct rx_chunked { uint32_t flags; /* protocol timer */ uint64_t chunk_sender_response_timer; -} rch[CONFIG_USB_PD_PORT_COUNT]; +} rch[CONFIG_USB_PD_PORT_MAX_COUNT]; /* Chunked Tx State Machine Object */ static struct tx_chunked { @@ -140,13 +140,13 @@ static struct tx_chunked { uint64_t chunk_sender_request_timer; /* error to report when moving to tch_report_error state */ enum pe_error error; -} tch[CONFIG_USB_PD_PORT_COUNT]; +} tch[CONFIG_USB_PD_PORT_MAX_COUNT]; /* Message Reception State Machine Object */ static struct protocol_layer_rx { /* message ids for all valid port partners */ int msg_id[NUM_SOP_STAR_TYPES]; -} prl_rx[CONFIG_USB_PD_PORT_COUNT]; +} prl_rx[CONFIG_USB_PD_PORT_MAX_COUNT]; /* Message Transmission State Machine Object */ static struct protocol_layer_tx { @@ -166,7 +166,7 @@ static struct protocol_layer_tx { uint32_t retry_counter; /* transmit status */ int xmit_status; -} prl_tx[CONFIG_USB_PD_PORT_COUNT]; +} prl_tx[CONFIG_USB_PD_PORT_MAX_COUNT]; /* Hard Reset State Machine Object */ static struct protocol_hard_reset { @@ -176,7 +176,7 @@ static struct protocol_hard_reset { uint32_t flags; /* protocol timer */ uint64_t hard_reset_complete_timer; -} prl_hr[CONFIG_USB_PD_PORT_COUNT]; +} prl_hr[CONFIG_USB_PD_PORT_MAX_COUNT]; /* Chunking Message Object */ static struct pd_message { @@ -200,9 +200,9 @@ static struct pd_message { uint32_t num_bytes_received; uint32_t chunk_number_to_send; uint32_t send_offset; -} pdmsg[CONFIG_USB_PD_PORT_COUNT]; +} pdmsg[CONFIG_USB_PD_PORT_MAX_COUNT]; -struct extended_msg emsg[CONFIG_USB_PD_PORT_COUNT]; +struct extended_msg emsg[CONFIG_USB_PD_PORT_MAX_COUNT]; /* Common Protocol Layer Message Transmission */ static void prl_tx_construct_message(int port); diff --git a/common/usbc/usb_tc_ctvpd_sm.c b/common/usbc/usb_tc_ctvpd_sm.c index c935be380f..996b38b6fb 100644 --- a/common/usbc/usb_tc_ctvpd_sm.c +++ b/common/usbc/usb_tc_ctvpd_sm.c @@ -72,7 +72,7 @@ static struct type_c { /* The cc state */ enum pd_cc_states cc_state; uint64_t next_role_swap; -} tc[CONFIG_USB_PD_PORT_COUNT]; +} tc[CONFIG_USB_PD_PORT_MAX_COUNT]; /* List of all TypeC-level states */ enum usb_tc_state { diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c index 2423855c8f..2accd67d6e 100644 --- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c +++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c @@ -159,12 +159,12 @@ static struct type_c { uint16_t dev_id; uint32_t dev_rw_hash[PD_RW_HASH_SIZE/4]; enum ec_current_image current_image; -} tc[CONFIG_USB_PD_PORT_COUNT]; +} tc[CONFIG_USB_PD_PORT_MAX_COUNT]; /* Port dual-role state */ static __maybe_unused -enum pd_dual_role_states drp_state[CONFIG_USB_PD_PORT_COUNT] = { - [0 ... (CONFIG_USB_PD_PORT_COUNT - 1)] = +enum pd_dual_role_states drp_state[CONFIG_USB_PD_PORT_MAX_COUNT] = { + [0 ... (CONFIG_USB_PD_PORT_MAX_COUNT - 1)] = CONFIG_USB_PD_INITIAL_DRP_STATE}; #ifdef CONFIG_USBC_VCONN @@ -602,7 +602,7 @@ void pd_prepare_sysjump(void) * Exit modes before sysjump so we can cleanly enter again * later */ - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) { + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) { /* * We can't be in an alternate mode if PD comm is * disabled, so no need to send the event @@ -832,7 +832,7 @@ static void pd_update_try_source(void) int batt_soc = usb_get_battery_soc(); try_src = 0; - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) try_src |= drp_state[i] == PD_DRP_TOGGLE_ON; /* @@ -977,7 +977,7 @@ static enum ec_status hc_pd_ports(struct host_cmd_handler_args *args) { struct ec_response_usb_pd_ports *r = args->response; - r->num_ports = CONFIG_USB_PD_PORT_COUNT; + r->num_ports = CONFIG_USB_PD_PORT_MAX_COUNT; args->response_size = sizeof(*r); return EC_RES_SUCCESS; @@ -1018,7 +1018,7 @@ static enum ec_status hc_usb_pd_control(struct host_cmd_handler_args *args) struct ec_response_usb_pd_control_v2 *r_v2 = args->response; struct ec_response_usb_pd_control *r = args->response; - if (p->port >= CONFIG_USB_PD_PORT_COUNT) + if (p->port >= CONFIG_USB_PD_PORT_MAX_COUNT) return EC_RES_INVALID_PARAM; if (p->role >= USB_PD_CTRL_ROLE_COUNT || @@ -1113,7 +1113,7 @@ static enum ec_status hc_remote_flash(struct host_cmd_handler_args *args) const uint32_t *data = &(p->size) + 1; int i, size; - if (port >= CONFIG_USB_PD_PORT_COUNT) + if (port >= CONFIG_USB_PD_PORT_MAX_COUNT) return EC_RES_INVALID_PARAM; if (p->size + sizeof(*p) > args->params_size) @@ -1210,7 +1210,7 @@ static enum ec_status hc_remote_pd_dev_info(struct host_cmd_handler_args *args) const uint8_t *port = args->params; struct ec_params_usb_pd_rw_hash_entry *r = args->response; - if (*port >= CONFIG_USB_PD_PORT_COUNT) + if (*port >= CONFIG_USB_PD_PORT_MAX_COUNT) return EC_RES_INVALID_PARAM; r->dev_id = tc[*port].dev_id; @@ -1235,7 +1235,7 @@ static enum ec_status hc_remote_pd_chip_info(struct host_cmd_handler_args *args) const struct ec_params_pd_chip_info *p = args->params; struct ec_response_pd_chip_info_v1 *info; - if (p->port >= CONFIG_USB_PD_PORT_COUNT) + if (p->port >= CONFIG_USB_PD_PORT_MAX_COUNT) return EC_RES_INVALID_PARAM; if (tcpm_get_chip_info(p->port, p->live, &info)) @@ -1281,7 +1281,8 @@ static enum ec_status hc_remote_pd_set_amode(struct host_cmd_handler_args *args) { const struct ec_params_usb_pd_set_mode_request *p = args->params; - if ((p->port >= CONFIG_USB_PD_PORT_COUNT) || (!p->svid) || (!p->opos)) + if ((p->port >= CONFIG_USB_PD_PORT_MAX_COUNT) || + (!p->svid) || (!p->opos)) return EC_RES_INVALID_PARAM; switch (p->cmd) { diff --git a/common/usbc/usb_tc_vpd_sm.c b/common/usbc/usb_tc_vpd_sm.c index dedba97513..8dfed4226b 100644 --- a/common/usbc/usb_tc_vpd_sm.c +++ b/common/usbc/usb_tc_vpd_sm.c @@ -42,7 +42,7 @@ static struct type_c { /* VPD host port cc state */ enum pd_cc_states host_cc_state; uint8_t ct_cc; -} tc[CONFIG_USB_PD_PORT_COUNT]; +} tc[CONFIG_USB_PD_PORT_MAX_COUNT]; /* List of all TypeC-level states */ enum usb_tc_state { diff --git a/common/usbc/usbc_task.c b/common/usbc/usbc_task.c index 48c53af3d2..86f1bcc12d 100644 --- a/common/usbc/usbc_task.c +++ b/common/usbc/usbc_task.c @@ -97,7 +97,7 @@ void set_usb_mux_with_current_data_role(int port) /* Events for pd_interrupt_handler_task */ #define PD_PROCESS_INTERRUPT (1<<0) -static uint8_t pd_int_task_id[CONFIG_USB_PD_PORT_COUNT]; +static uint8_t pd_int_task_id[CONFIG_USB_PD_PORT_MAX_COUNT]; void schedule_deferred_pd_interrupt(const int port) { @@ -115,7 +115,7 @@ void pd_interrupt_handler_task(void *p) const int port = (int) p; const int port_mask = (PD_STATUS_TCPC_ALERT_0 << port); - ASSERT(port >= 0 && port < CONFIG_USB_PD_PORT_COUNT); + ASSERT(port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT); pd_int_task_id[port] = task_get_current(); diff --git a/common/usbc_ppc.c b/common/usbc_ppc.c index 4274443a3d..816c53d06e 100644 --- a/common/usbc_ppc.c +++ b/common/usbc_ppc.c @@ -26,7 +26,7 @@ * occurred. This table is cleared after detecting a physical disconnect of the * sink. */ -static uint8_t oc_event_cnt_tbl[CONFIG_USB_PD_PORT_COUNT]; +static uint8_t oc_event_cnt_tbl[CONFIG_USB_PD_PORT_MAX_COUNT]; static uint32_t connected_ports; -- cgit v1.2.1