summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarthikeyan Ramasubramanian <kramasub@google.com>2019-11-15 14:01:11 -0700
committerCommit Bot <commit-bot@chromium.org>2019-11-18 18:50:28 +0000
commit737737e711786d69555825291e0f0f6a1779073c (patch)
treed82ac2deb40ca2781487178b74485c6710b2814d
parentdc3d384f983c46285531c3e424d253133814ec3d (diff)
downloadchrome-ec-737737e711786d69555825291e0f0f6a1779073c.tar.gz
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 <kramasub@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1922234 Reviewed-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Commit-Queue: Karthikeyan Ramasubramanian <kramasub@chromium.org> Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org>
-rw-r--r--baseboard/dragonegg/baseboard.c10
-rw-r--r--baseboard/dragonegg/baseboard.h2
-rw-r--r--baseboard/dragonegg/usb_pd_policy.c4
-rw-r--r--baseboard/grunt/baseboard.c6
-rw-r--r--baseboard/grunt/baseboard.h2
-rw-r--r--baseboard/grunt/usb_pd_policy.c6
-rw-r--r--baseboard/kalista/baseboard.c6
-rw-r--r--baseboard/kalista/baseboard.h2
-rw-r--r--baseboard/kalista/usb_pd_policy.c4
-rw-r--r--baseboard/octopus/baseboard.c8
-rw-r--r--baseboard/octopus/baseboard.h2
-rw-r--r--baseboard/octopus/usb_pd_policy.c4
-rw-r--r--baseboard/octopus/variant_usbc_ec_tcpcs.c6
-rw-r--r--baseboard/octopus/variant_usbc_standalone_tcpcs.c6
-rw-r--r--board/aleena/board.c2
-rw-r--r--board/ampton/battery.c2
-rw-r--r--board/ampton/board.c2
-rw-r--r--board/atlas/board.c8
-rw-r--r--board/atlas/board.h2
-rw-r--r--board/atlas/usb_pd_policy.c8
-rw-r--r--board/bloog/board.c2
-rw-r--r--board/bobba/board.c2
-rw-r--r--board/careena/board.c2
-rw-r--r--board/casta/board.c2
-rw-r--r--board/chell/board.c6
-rw-r--r--board/chell/board.h2
-rw-r--r--board/chell/usb_pd_policy.c6
-rw-r--r--board/cheza/board.c12
-rw-r--r--board/cheza/board.h2
-rw-r--r--board/cheza/usb_pd_policy.c8
-rw-r--r--board/coffeecake/board.h2
-rw-r--r--board/coral/board.c6
-rw-r--r--board/coral/board.h2
-rw-r--r--board/coral/usb_pd_policy.c8
-rw-r--r--board/delan/board.c2
-rw-r--r--board/dingdong/board.h2
-rw-r--r--board/dood/board.c2
-rw-r--r--board/elm/board.c6
-rw-r--r--board/elm/board.h2
-rw-r--r--board/elm/usb_pd_policy.c4
-rw-r--r--board/eve/board.c6
-rw-r--r--board/eve/board.h2
-rw-r--r--board/eve/led.c2
-rw-r--r--board/eve/usb_pd_policy.c8
-rw-r--r--board/fizz/board.c6
-rw-r--r--board/fizz/board.h2
-rw-r--r--board/fizz/usb_pd_policy.c4
l---------board/flapjack~HEAD1
-rw-r--r--board/fleex/board.c2
-rw-r--r--board/garg/board.c2
-rw-r--r--board/glados/board.c6
-rw-r--r--board/glados/board.h2
-rw-r--r--board/glados/usb_pd_policy.c6
-rw-r--r--board/glados_pd/board.h2
-rw-r--r--board/glkrvp/board.h2
-rw-r--r--board/glkrvp/chg_usb_pd.c6
-rw-r--r--board/glkrvp/usb_pd_policy.c4
-rw-r--r--board/glkrvp_ite/board.h2
-rw-r--r--board/glkrvp_ite/chg_usb_pd.c6
-rw-r--r--board/glkrvp_ite/usb_pd_policy.c4
-rw-r--r--board/grunt/board.c2
-rw-r--r--board/hoho/board.h2
-rw-r--r--board/it83xx_evb/board.c2
-rw-r--r--board/it83xx_evb/board.h2
-rw-r--r--board/it83xx_evb/usb_pd_policy.c4
-rw-r--r--board/kukui/board.c4
-rw-r--r--board/kukui/board.h2
-rw-r--r--board/kukui/usb_pd_policy.c6
-rw-r--r--board/liara/board.c2
-rw-r--r--board/mchpevb1/board.c14
-rw-r--r--board/mchpevb1/board.h2
-rw-r--r--board/mchpevb1/usb_pd_policy.c6
-rw-r--r--board/meep/board.c2
-rw-r--r--board/nami/board.c8
-rw-r--r--board/nami/board.h2
-rw-r--r--board/nami/usb_pd_policy.c8
-rw-r--r--board/nautilus/board.c8
-rw-r--r--board/nautilus/board.h2
-rw-r--r--board/nautilus/usb_pd_policy.c8
-rw-r--r--board/nocturne/board.c8
-rw-r--r--board/nocturne/board.h2
-rw-r--r--board/nocturne/usb_pd_policy.c6
-rw-r--r--board/oak/board.c12
-rw-r--r--board/oak/board.h2
-rw-r--r--board/oak/usb_pd_policy.c4
-rw-r--r--board/pdeval-stm32f072/PD_evaluation.md2
-rw-r--r--board/pdeval-stm32f072/board.c2
-rw-r--r--board/pdeval-stm32f072/board.h2
-rw-r--r--board/pdeval-stm32f072/usb_pd_policy.c6
-rw-r--r--board/phaser/board.c2
-rw-r--r--board/plankton/board.h2
-rw-r--r--board/poppy/board.c8
-rw-r--r--board/poppy/board.h2
-rw-r--r--board/poppy/usb_pd_policy.c8
-rw-r--r--board/rainier/board.c4
-rw-r--r--board/rainier/board.h2
-rw-r--r--board/rainier/usb_pd_policy.c4
-rw-r--r--board/rammus/board.c8
-rw-r--r--board/rammus/board.h2
-rw-r--r--board/rammus/usb_pd_policy.c8
-rw-r--r--board/reef/board.c6
-rw-r--r--board/reef/board.h2
-rw-r--r--board/reef/usb_pd_policy.c8
-rw-r--r--board/reef_it8320/board.c6
-rw-r--r--board/reef_it8320/board.h2
-rw-r--r--board/reef_it8320/usb_pd_policy.c8
-rw-r--r--board/reef_mchp/board.c6
-rw-r--r--board/reef_mchp/board.h2
-rw-r--r--board/reef_mchp/usb_pd_policy.c8
-rw-r--r--board/rowan/board.c6
-rw-r--r--board/rowan/board.h2
-rw-r--r--board/rowan/usb_pd_policy.c4
-rw-r--r--board/samus_pd/board.c2
-rw-r--r--board/samus_pd/board.h2
-rw-r--r--board/samus_pd/usb_mux.c4
-rw-r--r--board/samus_pd/usb_pd_policy.c4
-rw-r--r--board/scarlet/board.c4
-rw-r--r--board/scarlet/board.h2
-rw-r--r--board/scarlet/usb_pd_policy.c4
-rw-r--r--board/servo_v4/board.h2
-rw-r--r--board/servo_v4/usb_pd_policy.c2
-rw-r--r--board/strago/board.c6
-rw-r--r--board/strago/board.h2
-rw-r--r--board/strago/usb_pd_policy.c2
-rw-r--r--board/twinkie/board.h2
-rw-r--r--board/yorp/board.c2
-rw-r--r--board/zinger/board.h2
-rw-r--r--chip/host/usb_pd_phy.c2
-rw-r--r--chip/mec1322/system.c8
-rw-r--r--chip/npcx/system.c4
-rw-r--r--chip/stm32/system.c2
-rw-r--r--chip/stm32/usb_pd_phy.c10
-rw-r--r--common/charge_manager.c16
-rw-r--r--common/charge_ramp_sw.c8
-rw-r--r--common/host_command_pd.c2
-rw-r--r--common/i2c_master.c4
-rw-r--r--common/pd_log.c4
-rw-r--r--common/peripheral.c6
-rw-r--r--common/system.c3
-rw-r--r--common/usb_charger.c4
-rw-r--r--common/usb_pd_policy.c18
-rw-r--r--common/usb_pd_protocol.c69
-rw-r--r--common/usb_pd_tcpc.c16
-rw-r--r--common/usbc_ppc.c2
-rw-r--r--driver/bc12/max14637.c2
-rw-r--r--driver/bc12/max14637.h2
-rw-r--r--driver/bc12/pi3usb9281.c4
-rw-r--r--driver/charger/bd9995x.c8
-rw-r--r--driver/ppc/nx20p348x.c6
-rw-r--r--driver/ppc/sn5s330.c4
-rw-r--r--driver/ppc/syv682x.c2
-rw-r--r--driver/tcpm/anx7447.c4
-rw-r--r--driver/tcpm/anx74xx.c6
-rw-r--r--driver/tcpm/fusb302.c2
-rw-r--r--driver/tcpm/it83xx.c4
-rw-r--r--driver/tcpm/ps8xxx.c2
-rw-r--r--driver/tcpm/tcpci.c10
-rw-r--r--driver/usb_mux.c8
-rw-r--r--driver/usb_mux_virtual.c4
-rw-r--r--fuzz/fuzz_config.h2
-rw-r--r--fuzz/usb_pd_fuzz.c4
-rw-r--r--include/charge_manager.h2
-rw-r--r--include/config.h2
-rw-r--r--include/ec_commands.h2
-rw-r--r--include/usb_pd.h4
-rw-r--r--test/charge_manager.c14
-rw-r--r--test/test_config.h6
-rw-r--r--test/usb_pd.c4
168 files changed, 410 insertions, 407 deletions
diff --git a/baseboard/dragonegg/baseboard.c b/baseboard/dragonegg/baseboard.c
index e4ed7344ab..542e1cad2d 100644
--- a/baseboard/dragonegg/baseboard.c
+++ b/baseboard/dragonegg/baseboard.c
@@ -162,7 +162,7 @@ void board_hibernate(void)
}
/******************************************************************************/
/* USB-C TPCP Configuration */
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_ITE_0] = {
/* TCPC is embedded within EC so no i2c config needed */
.drv = &it83xx_tcpm_drv,
@@ -185,7 +185,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
/******************************************************************************/
/* USB-C PPC Configuration */
-struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_COUNT] = {
+struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_ITE_0] = {
.i2c_port = I2C_PORT_USBC0,
.i2c_addr = SN5S330_ADDR0,
@@ -206,7 +206,7 @@ struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_COUNT] = {
};
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_ITE_0] = {
.driver = &virtual_usb_mux_driver,
.hpd_update = &virtual_hpd_update,
@@ -226,7 +226,7 @@ struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
/******************************************************************************/
/* BC 1.2 chip Configuration */
-const struct max14637_config_t max14637_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct max14637_config_t max14637_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.chip_enable_pin = GPIO_USB_C0_BC12_VBUS_ON_ODL,
.chg_det_pin = GPIO_USB_C0_BC12_CHG_MAX,
@@ -301,7 +301,7 @@ void board_pd_vconn_ctrl(int port, int cc_pin, int enabled)
int board_set_active_charge_port(int port)
{
int is_valid_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_COUNT);
+ port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
if (!is_valid_port && port != CHARGE_PORT_NONE)
diff --git a/baseboard/dragonegg/baseboard.h b/baseboard/dragonegg/baseboard.h
index 1334b1c36d..f7850d9724 100644
--- a/baseboard/dragonegg/baseboard.h
+++ b/baseboard/dragonegg/baseboard.h
@@ -80,7 +80,7 @@
* on the MLB for now. In addition, this config option will likely move to
* board.h as it likely board dependent and not same across all follower boards.
*/
-#define CONFIG_USB_PD_PORT_COUNT 3
+#define CONFIG_USB_PD_PORT_MAX_COUNT 3
#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_LOGGING
diff --git a/baseboard/dragonegg/usb_pd_policy.c b/baseboard/dragonegg/usb_pd_policy.c
index 1fe2b928d7..e1693f9efe 100644
--- a/baseboard/dragonegg/usb_pd_policy.c
+++ b/baseboard/dragonegg/usb_pd_policy.c
@@ -277,8 +277,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
diff --git a/baseboard/grunt/baseboard.c b/baseboard/grunt/baseboard.c
index 032ae55076..ca034c06d1 100644
--- a/baseboard/grunt/baseboard.c
+++ b/baseboard/grunt/baseboard.c
@@ -84,7 +84,7 @@ const struct power_signal_info power_signal_list[] = {
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_ANX74XX] = {
.i2c_host_port = I2C_PORT_TCPC0,
.i2c_slave_addr = ANX74XX_I2C_ADDR1,
@@ -118,7 +118,7 @@ void tcpc_alert_event(enum gpio_signal signal)
schedule_deferred_pd_interrupt(port);
}
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_ANX74XX] = {
.driver = &anx74xx_tcpm_usb_mux_driver,
.hpd_update = &anx74xx_tcpc_update_hpd_status,
@@ -154,7 +154,7 @@ int ppc_get_alert_status(int port)
/* BC 1.2 chip Configuration */
-const struct max14637_config_t max14637_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct max14637_config_t max14637_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_ANX74XX] = {
.chip_enable_pin = GPIO_USB_C0_BC12_VBUS_ON_L,
.chg_det_pin = GPIO_USB_C0_BC12_CHG_DET,
diff --git a/baseboard/grunt/baseboard.h b/baseboard/grunt/baseboard.h
index e5e3a681c1..482e284555 100644
--- a/baseboard/grunt/baseboard.h
+++ b/baseboard/grunt/baseboard.h
@@ -113,7 +113,7 @@
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_TCPC_LOW_POWER
#define CONFIG_USB_PD_TCPM_ANX3429
#define CONFIG_USB_PD_TCPM_MUX
diff --git a/baseboard/grunt/usb_pd_policy.c b/baseboard/grunt/usb_pd_policy.c
index 5c8b7e2359..f2646946ba 100644
--- a/baseboard/grunt/usb_pd_policy.c
+++ b/baseboard/grunt/usb_pd_policy.c
@@ -235,8 +235,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
@@ -299,7 +299,7 @@ static int svdm_dp_config(int port, uint32_t *payload)
* timestamp of the next possible toggle to ensure the 2-ms spacing
* between IRQ_HPD.
*/
-static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_COUNT];
+static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_MAX_COUNT];
#define PORT_TO_HPD(port) ((port) ? GPIO_USB_C1_DP_HPD : GPIO_USB_C0_DP_HPD)
static void svdm_dp_post_config(int port)
diff --git a/baseboard/kalista/baseboard.c b/baseboard/kalista/baseboard.c
index 8b9cec5cb4..0b3ae6953a 100644
--- a/baseboard/kalista/baseboard.c
+++ b/baseboard/kalista/baseboard.c
@@ -157,7 +157,7 @@ const struct i2c_port_t i2c_ports[] = {
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* TCPC mux configuration */
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{I2C_PORT_TCPC0, I2C_ADDR_TCPC0, &ps8xxx_tcpm_drv,
TCPC_ALERT_ACTIVE_LOW},
};
@@ -169,7 +169,7 @@ static int ps8751_tune_mux(int port)
return EC_SUCCESS;
}
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.driver = &tcpci_tcpm_usb_mux_driver,
.hpd_update = &ps8xxx_tcpc_update_hpd_status,
@@ -214,7 +214,7 @@ void board_tcpc_init(void)
* Initialize HPD to low; after sysjump SOC needs to see
* HPD pulse to enable video path
*/
- for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) {
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) {
const struct usb_mux *mux = &usb_muxes[port];
mux->hpd_update(port, 0, 0);
}
diff --git a/baseboard/kalista/baseboard.h b/baseboard/kalista/baseboard.h
index 2ad12be3c0..5ccd068737 100644
--- a/baseboard/kalista/baseboard.h
+++ b/baseboard/kalista/baseboard.h
@@ -101,7 +101,7 @@
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_PORT_COUNT 1
+#define CONFIG_USB_PD_PORT_MAX_COUNT 1
#define CONFIG_USB_PD_VBUS_DETECT_GPIO
#define CONFIG_USB_PD_TCPC_LOW_POWER
#define CONFIG_USB_PD_TCPM_MUX
diff --git a/baseboard/kalista/usb_pd_policy.c b/baseboard/kalista/usb_pd_policy.c
index d6fe6ab6a3..c577c27282 100644
--- a/baseboard/kalista/usb_pd_policy.c
+++ b/baseboard/kalista/usb_pd_policy.c
@@ -232,8 +232,8 @@ int board_get_battery_soc(void)
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
diff --git a/baseboard/octopus/baseboard.c b/baseboard/octopus/baseboard.c
index 1f5abc55f4..b464611158 100644
--- a/baseboard/octopus/baseboard.c
+++ b/baseboard/octopus/baseboard.c
@@ -84,7 +84,7 @@ const int usb_port_enable[USB_PORT_COUNT] = {
/******************************************************************************/
/* BC 1.2 chip Configuration */
-const struct max14637_config_t max14637_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct max14637_config_t max14637_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.chip_enable_pin = GPIO_USB_C0_BC12_VBUS_ON,
.chg_det_pin = GPIO_USB_C0_BC12_CHG_DET_L,
@@ -231,7 +231,7 @@ void baseboard_tcpc_init(void)
* Initialize HPD to low; after sysjump SOC needs to see
* HPD pulse to enable video path
*/
- for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) {
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) {
const struct usb_mux *mux = &usb_muxes[port];
mux->hpd_update(port, 0, 0);
@@ -250,7 +250,7 @@ void board_rtc_reset(void)
int board_set_active_charge_port(int port)
{
int is_valid_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_COUNT);
+ port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
if (!is_valid_port && port != CHARGE_PORT_NONE)
@@ -356,7 +356,7 @@ void board_hibernate(void)
* low power mode or open the SNK FET based on which signals wake up
* the EC from hibernate.
*/
- for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) {
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) {
if (!pd_is_vbus_present(port)) {
#ifdef VARIANT_OCTOPUS_EC_ITE8320
/*
diff --git a/baseboard/octopus/baseboard.h b/baseboard/octopus/baseboard.h
index bfcacc0939..5ba244d588 100644
--- a/baseboard/octopus/baseboard.h
+++ b/baseboard/octopus/baseboard.h
@@ -185,7 +185,7 @@
/* Common USB-C defines */
#define CONFIG_USB_POWER_DELIVERY
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_LOGGING
#define CONFIG_USB_PD_ALT_MODE
diff --git a/baseboard/octopus/usb_pd_policy.c b/baseboard/octopus/usb_pd_policy.c
index 554c625387..4f6abbde57 100644
--- a/baseboard/octopus/usb_pd_policy.c
+++ b/baseboard/octopus/usb_pd_policy.c
@@ -254,8 +254,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
diff --git a/baseboard/octopus/variant_usbc_ec_tcpcs.c b/baseboard/octopus/variant_usbc_ec_tcpcs.c
index 570a919b6c..f2e915c9e4 100644
--- a/baseboard/octopus/variant_usbc_ec_tcpcs.c
+++ b/baseboard/octopus/variant_usbc_ec_tcpcs.c
@@ -27,7 +27,7 @@
/******************************************************************************/
/* USB-C TPCP Configuration */
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_ITE_0] = {
/* TCPC is embedded within EC so no i2c config needed */
.drv = &it83xx_tcpm_drv,
@@ -61,7 +61,7 @@ static void board_it83xx_hpd_status(int port, int hpd_lvl, int hpd_irq)
}
/* This configuration might be override by each boards */
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_ITE_0] = {
/* Driver uses I2C_PORT_USB_MUX as I2C port */
.port_addr = IT5205_I2C_ADDR1,
@@ -80,7 +80,7 @@ struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
/******************************************************************************/
/* USB-C PPC Configuration */
-struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_COUNT] = {
+struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_ITE_0] = {
.i2c_port = I2C_PORT_USBC0,
.i2c_addr = SN5S330_ADDR0,
diff --git a/baseboard/octopus/variant_usbc_standalone_tcpcs.c b/baseboard/octopus/variant_usbc_standalone_tcpcs.c
index fbae3e70d0..5d59789232 100644
--- a/baseboard/octopus/variant_usbc_standalone_tcpcs.c
+++ b/baseboard/octopus/variant_usbc_standalone_tcpcs.c
@@ -29,7 +29,7 @@
/******************************************************************************/
/* USB-C TPCP Configuration */
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_TCPC_0] = {
.i2c_host_port = I2C_PORT_TCPC0,
#if defined(VARIANT_OCTOPUS_TCPC_0_PS8751)
@@ -62,7 +62,7 @@ static int ps8751_tune_mux(int port)
}
#endif
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_TCPC_0] = {
#if defined(VARIANT_OCTOPUS_TCPC_0_PS8751)
.driver = &tcpci_tcpm_usb_mux_driver,
@@ -81,7 +81,7 @@ struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
/******************************************************************************/
/* USB-C PPC Configuration */
-struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_COUNT] = {
+struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_TCPC_0] = {
.i2c_port = I2C_PORT_TCPC0,
.i2c_addr = NX20P3483_ADDR2,
diff --git a/board/aleena/board.c b/board/aleena/board.c
index 5c235b7cad..9fda8c848e 100644
--- a/board/aleena/board.c
+++ b/board/aleena/board.c
@@ -152,7 +152,7 @@ void board_tcpc_init(void)
* Initialize HPD to low; after sysjump SOC needs to see
* HPD pulse to enable video path
*/
- for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) {
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) {
const struct usb_mux *mux = &usb_muxes[port];
mux->hpd_update(port, 0, 0);
diff --git a/board/ampton/battery.c b/board/ampton/battery.c
index 2bc0aa3482..481216cf61 100644
--- a/board/ampton/battery.c
+++ b/board/ampton/battery.c
@@ -133,7 +133,7 @@ static void reduce_input_voltage_when_full(void)
else
max_pd_voltage_mv = PD_MAX_VOLTAGE_MV;
if (pd_get_max_voltage() != max_pd_voltage_mv) {
- for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++)
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++)
pd_set_external_voltage_limit(port, max_pd_voltage_mv);
}
}
diff --git a/board/ampton/board.c b/board/ampton/board.c
index 08cb017489..b8fa444cdf 100644
--- a/board/ampton/board.c
+++ b/board/ampton/board.c
@@ -68,7 +68,7 @@ int ppc_get_alert_status(int port)
static int tune_mux(int port);
-struct usb_mux ampton_usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux ampton_usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_ITE_0] = {
/* Use PS8751 as mux only */
.port_addr = MUX_PORT_AND_ADDR(
diff --git a/board/atlas/board.c b/board/atlas/board.c
index b0e945f3b8..5deb1e3d64 100644
--- a/board/atlas/board.c
+++ b/board/atlas/board.c
@@ -168,7 +168,7 @@ const struct i2c_port_t i2c_ports[] = {
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* TCPC mux configuration */
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
/* left port */
.i2c_host_port = I2C_PORT_TCPC0,
@@ -185,7 +185,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
},
};
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.driver = &tcpci_tcpm_usb_mux_driver,
.hpd_update = &ps8xxx_tcpc_update_hpd_status,
@@ -218,7 +218,7 @@ void board_tcpc_init(void)
* Initialize HPD to low; after sysjump SOC needs to see
* HPD pulse to enable video path
*/
- for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) {
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) {
const struct usb_mux *mux = &usb_muxes[port];
mux->hpd_update(port, 0, 0);
@@ -465,7 +465,7 @@ int board_set_active_charge_port(int charge_port)
{
/* charge port is a physical port */
int is_real_port = (charge_port >= 0 &&
- charge_port < CONFIG_USB_PD_PORT_COUNT);
+ charge_port < CONFIG_USB_PD_PORT_MAX_COUNT);
/* check if we are sourcing VBUS on the port */
int is_source = gpio_get_level(charge_port == 0 ?
GPIO_USB_C0_5V_EN : GPIO_USB_C1_5V_EN);
diff --git a/board/atlas/board.h b/board/atlas/board.h
index 009b78d609..3cbfc54752 100644
--- a/board/atlas/board.h
+++ b/board/atlas/board.h
@@ -137,7 +137,7 @@
#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
#define CONFIG_USB_PD_LOGGING
#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_VBUS_DETECT_TCPC
#define CONFIG_USB_PD_TCPC_LOW_POWER
#define CONFIG_USB_PD_TCPM_MUX
diff --git a/board/atlas/usb_pd_policy.c b/board/atlas/usb_pd_policy.c
index fbf1f4d299..369582642f 100644
--- a/board/atlas/usb_pd_policy.c
+++ b/board/atlas/usb_pd_policy.c
@@ -54,8 +54,8 @@ void pd_transition_voltage(int idx)
/* No-operation: we are always 5V */
}
-static uint8_t vbus_en[CONFIG_USB_PD_PORT_COUNT];
-static uint8_t vbus_rp[CONFIG_USB_PD_PORT_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5};
+static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5};
int board_vbus_source_enabled(int port)
{
@@ -279,8 +279,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
diff --git a/board/bloog/board.c b/board/bloog/board.c
index 6d56d25735..a77221d058 100644
--- a/board/bloog/board.c
+++ b/board/bloog/board.c
@@ -301,7 +301,7 @@ const int keyboard_factory_scan_pins_used =
void board_overcurrent_event(int port, int is_overcurrented)
{
/* Sanity check the port. */
- if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT))
+ if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT))
return;
/* Note that the level is inverted because the pin is active low. */
diff --git a/board/bobba/board.c b/board/bobba/board.c
index 32b79e886e..76ea4e343a 100644
--- a/board/bobba/board.c
+++ b/board/bobba/board.c
@@ -399,7 +399,7 @@ void lid_angle_peripheral_enable(int enable)
void board_overcurrent_event(int port, int is_overcurrented)
{
/* Sanity check the port. */
- if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT))
+ if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT))
return;
/* Note that the level is inverted because the pin is active low. */
diff --git a/board/careena/board.c b/board/careena/board.c
index 0774cd9adc..0b72c06e12 100644
--- a/board/careena/board.c
+++ b/board/careena/board.c
@@ -137,7 +137,7 @@ void board_tcpc_init(void)
* Initialize HPD to low; after sysjump SOC needs to see
* HPD pulse to enable video path
*/
- for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) {
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) {
const struct usb_mux *mux = &usb_muxes[port];
mux->hpd_update(port, 0, 0);
diff --git a/board/casta/board.c b/board/casta/board.c
index 64c2d86003..8172427d05 100644
--- a/board/casta/board.c
+++ b/board/casta/board.c
@@ -145,7 +145,7 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
void board_overcurrent_event(int port, int is_overcurrented)
{
/* Sanity check the port. */
- if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT))
+ if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT))
return;
/* Note that the level is inverted because the pin is active low. */
diff --git a/board/chell/board.c b/board/chell/board.c
index a3f7875166..c7cf53641e 100644
--- a/board/chell/board.c
+++ b/board/chell/board.c
@@ -121,7 +121,7 @@ const struct i2c_port_t i2c_ports[] = {
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR, &tcpci_tcpm_drv},
{I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR + 2, &tcpci_tcpm_drv},
};
@@ -181,7 +181,7 @@ static int ps874x_tune_mux(int port)
return EC_SUCCESS;
}
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.port_addr = 0x34,
.driver = &ps874x_usb_mux_driver,
@@ -311,7 +311,7 @@ int board_set_active_charge_port(int charge_port)
{
/* charge port is a realy physical port */
int is_real_port = (charge_port >= 0 &&
- charge_port < CONFIG_USB_PD_PORT_COUNT);
+ charge_port < CONFIG_USB_PD_PORT_MAX_COUNT);
/* check if we are source vbus on that port */
int source = gpio_get_level(charge_port == 0 ? GPIO_USB_C0_5V_EN :
GPIO_USB_C1_5V_EN);
diff --git a/board/chell/board.h b/board/chell/board.h
index f9a75bf4c5..d53651b6d2 100644
--- a/board/chell/board.h
+++ b/board/chell/board.h
@@ -76,7 +76,7 @@
#define CONFIG_USB_PD_COMM_LOCKED
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_TCPM_TCPCI
#define CONFIG_USB_PD_TRY_SRC
#define CONFIG_USB_PD_VBUS_DETECT_GPIO
diff --git a/board/chell/usb_pd_policy.c b/board/chell/usb_pd_policy.c
index 7031a39bcc..3a2a6b2afc 100644
--- a/board/chell/usb_pd_policy.c
+++ b/board/chell/usb_pd_policy.c
@@ -196,9 +196,9 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
/* DP Status VDM as returned by UFP */
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
@@ -261,7 +261,7 @@ static int svdm_dp_config(int port, uint32_t *payload)
* timestamp of the next possible toggle to ensure the 2-ms spacing
* between IRQ_HPD.
*/
-static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_COUNT];
+static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_MAX_COUNT];
#define PORT_TO_HPD(port) ((port) ? GPIO_USB_C1_DP_HPD : GPIO_USB_C0_DP_HPD)
static void svdm_dp_post_config(int port)
diff --git a/board/cheza/board.c b/board/cheza/board.c
index 4bccdff7d1..118d367b01 100644
--- a/board/cheza/board.c
+++ b/board/cheza/board.c
@@ -253,7 +253,7 @@ struct ppc_config_t ppc_chips[] = {
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
/* TCPC mux configuration */
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_ANX3429] = {I2C_PORT_TCPC0, 0x50, &anx74xx_tcpm_drv,
TCPC_ALERT_ACTIVE_LOW, TCPC_ALERT_OPEN_DRAIN},
[USB_PD_PORT_PS8751] = {I2C_PORT_TCPC1, 0x16, &ps8xxx_tcpm_drv,
@@ -338,7 +338,7 @@ const struct usb_mux_driver port1_usb_mux_driver = {
.enter_low_power_mode = &port1_usb_mux_enter_low_power,
};
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.driver = &port0_usb_mux_driver,
.hpd_update = &virtual_hpd_update,
@@ -401,7 +401,7 @@ void board_tcpc_init(void)
* Initialize HPD to low; after sysjump SOC needs to see
* HPD pulse to enable video path
*/
- for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) {
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) {
const struct usb_mux *mux = &usb_muxes[port];
mux->hpd_update(port, 0, 0);
@@ -518,7 +518,7 @@ void board_overcurrent_event(int port, int is_overcurrented)
int board_set_active_charge_port(int port)
{
int is_real_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_COUNT);
+ port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
int rv;
@@ -529,7 +529,7 @@ int board_set_active_charge_port(int port)
if (port == CHARGE_PORT_NONE) {
/* Disable all ports. */
- for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) {
+ for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) {
rv = board_vbus_sink_enable(i, 0);
if (rv) {
CPRINTS("Disabling p%d sink path failed.", i);
@@ -550,7 +550,7 @@ int board_set_active_charge_port(int port)
* Turn off the other ports' sink path FETs, before enabling the
* requested charge port.
*/
- for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) {
+ for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) {
if (i == port)
continue;
diff --git a/board/cheza/board.h b/board/cheza/board.h
index 72ba9d3151..75c0bad8aa 100644
--- a/board/cheza/board.h
+++ b/board/cheza/board.h
@@ -106,7 +106,7 @@
#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
#define CONFIG_USB_PD_LOGGING
#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_TCPC_LOW_POWER
#define CONFIG_USB_PD_TCPM_ANX3429
#define CONFIG_USB_PD_TCPM_PS8751
diff --git a/board/cheza/usb_pd_policy.c b/board/cheza/usb_pd_policy.c
index 1344bc9b1b..3e0f0ed893 100644
--- a/board/cheza/usb_pd_policy.c
+++ b/board/cheza/usb_pd_policy.c
@@ -101,8 +101,8 @@ int pd_is_valid_input_voltage(int mv)
return 1;
}
-static uint8_t vbus_en[CONFIG_USB_PD_PORT_COUNT];
-static uint8_t vbus_rp[CONFIG_USB_PD_PORT_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5};
+static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5};
static void board_vbus_update_source_current(int port)
{
@@ -268,8 +268,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
diff --git a/board/coffeecake/board.h b/board/coffeecake/board.h
index 77abfa7f99..62dea70847 100644
--- a/board/coffeecake/board.h
+++ b/board/coffeecake/board.h
@@ -49,7 +49,7 @@
#define CONFIG_USB_PD_LOGGING
#undef CONFIG_EVENT_LOG_SIZE
#define CONFIG_EVENT_LOG_SIZE 256
-#define CONFIG_USB_PD_PORT_COUNT 1
+#define CONFIG_USB_PD_PORT_MAX_COUNT 1
#define CONFIG_USB_PD_TCPC
#define CONFIG_USB_PD_TCPM_STUB
#define CONFIG_USB_PD_VBUS_DETECT_NONE
diff --git a/board/coral/board.c b/board/coral/board.c
index 5955474620..769176535d 100644
--- a/board/coral/board.c
+++ b/board/coral/board.c
@@ -240,7 +240,7 @@ struct i2c_stress_test i2c_stress_tests[] = {
const int i2c_test_dev_used = ARRAY_SIZE(i2c_stress_tests);
#endif /* CONFIG_CMD_I2C_STRESS_TEST */
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_ANX74XX] = {
.i2c_host_port = NPCX_I2C_PORT0_0,
.i2c_slave_addr = ANX74XX_I2C_ADDR1,
@@ -287,7 +287,7 @@ static int ps8751_tune_mux(int port)
return EC_SUCCESS;
}
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_ANX74XX] = {
.driver = &anx74xx_tcpm_usb_mux_driver,
.hpd_update = &anx74xx_tcpc_update_hpd_status,
@@ -404,7 +404,7 @@ static void board_tcpc_init(void)
* Initialize HPD to low; after sysjump SOC needs to see
* HPD pulse to enable video path
*/
- for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) {
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) {
const struct usb_mux *mux = &usb_muxes[port];
mux->hpd_update(port, 0, 0);
diff --git a/board/coral/board.h b/board/coral/board.h
index db16a7d538..24c62c803f 100644
--- a/board/coral/board.h
+++ b/board/coral/board.h
@@ -86,7 +86,7 @@
#define CONFIG_USB_PD_DISCHARGE_TCPC
#define CONFIG_USB_PD_LOGGING
#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_VBUS_DETECT_CHARGER
#define CONFIG_USB_PD_TCPC_LOW_POWER
#define CONFIG_USB_PD_TCPM_MUX /* for both PS8751 and ANX3429 */
diff --git a/board/coral/usb_pd_policy.c b/board/coral/usb_pd_policy.c
index 60cbdd3276..85c6cdb253 100644
--- a/board/coral/usb_pd_policy.c
+++ b/board/coral/usb_pd_policy.c
@@ -56,8 +56,8 @@ void pd_transition_voltage(int idx)
/* No-operation: we are always 5V */
}
-static uint8_t vbus_en[CONFIG_USB_PD_PORT_COUNT];
-static uint8_t vbus_rp[CONFIG_USB_PD_PORT_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5};
+static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5};
int board_vbus_source_enabled(int port)
{
@@ -270,8 +270,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
diff --git a/board/delan/board.c b/board/delan/board.c
index 4304ce25e4..0a5ebd04a5 100644
--- a/board/delan/board.c
+++ b/board/delan/board.c
@@ -150,7 +150,7 @@ void board_tcpc_init(void)
* Initialize HPD to low; after sysjump SOC needs to see
* HPD pulse to enable video path
*/
- for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) {
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) {
const struct usb_mux *mux = &usb_muxes[port];
mux->hpd_update(port, 0, 0);
diff --git a/board/dingdong/board.h b/board/dingdong/board.h
index 3ecbf7658c..db9af71df2 100644
--- a/board/dingdong/board.h
+++ b/board/dingdong/board.h
@@ -39,7 +39,7 @@
#define CONFIG_USB_PD_LOGGING
#undef CONFIG_EVENT_LOG_SIZE
#define CONFIG_EVENT_LOG_SIZE 256
-#define CONFIG_USB_PD_PORT_COUNT 1
+#define CONFIG_USB_PD_PORT_MAX_COUNT 1
#define CONFIG_USB_PD_TCPC
#define CONFIG_USB_PD_TCPM_STUB
#undef CONFIG_WATCHDOG_HELP
diff --git a/board/dood/board.c b/board/dood/board.c
index ebc7cde8cd..dca0d9c45e 100644
--- a/board/dood/board.c
+++ b/board/dood/board.c
@@ -281,7 +281,7 @@ void lid_angle_peripheral_enable(int enable)
void board_overcurrent_event(int port, int is_overcurrented)
{
/* Sanity check the port. */
- if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT))
+ if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT))
return;
/* Note that the level is inverted because the pin is active low. */
diff --git a/board/elm/board.c b/board/elm/board.c
index f2d567ace7..990bd3ebd2 100644
--- a/board/elm/board.c
+++ b/board/elm/board.c
@@ -120,7 +120,7 @@ const struct spi_device_t spi_devices[] = {
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/* TCPC */
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR, &anx7688_tcpm_drv},
};
@@ -152,7 +152,7 @@ const struct temp_sensor_t temp_sensors[] = {
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.driver = &anx7688_usb_mux_driver,
},
@@ -281,7 +281,7 @@ int board_set_active_charge_port(int charge_port)
{
/* charge port is a physical port */
int is_real_port = (charge_port >= 0 &&
- charge_port < CONFIG_USB_PD_PORT_COUNT);
+ charge_port < CONFIG_USB_PD_PORT_MAX_COUNT);
/* check if we are source VBUS on the port */
int source = gpio_get_level(GPIO_USB_C0_5V_EN);
diff --git a/board/elm/board.h b/board/elm/board.h
index b2036896e4..2e0d230ae9 100644
--- a/board/elm/board.h
+++ b/board/elm/board.h
@@ -92,7 +92,7 @@
#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_PORT_COUNT 1
+#define CONFIG_USB_PD_PORT_MAX_COUNT 1
#define CONFIG_USB_PD_TCPM_MUX
#define CONFIG_USB_PD_TCPM_ANX7688
#define CONFIG_USB_PD_TCPM_TCPCI
diff --git a/board/elm/usb_pd_policy.c b/board/elm/usb_pd_policy.c
index 766d38cc5c..11e1ca2c6a 100644
--- a/board/elm/usb_pd_policy.c
+++ b/board/elm/usb_pd_policy.c
@@ -209,9 +209,9 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
/* DP Status VDM as returned by UFP */
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
diff --git a/board/eve/board.c b/board/eve/board.c
index a8288d5d9d..5153858b4e 100644
--- a/board/eve/board.c
+++ b/board/eve/board.c
@@ -213,7 +213,7 @@ const struct i2c_port_t i2c_ports[] = {
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* TCPC mux configuration */
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.i2c_host_port = I2C_PORT_TCPC0,
.i2c_slave_addr = ANX74XX_I2C_ADDR1,
@@ -228,7 +228,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
},
};
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.driver = &anx74xx_tcpm_usb_mux_driver,
.hpd_update = &anx74xx_tcpc_update_hpd_status,
@@ -317,7 +317,7 @@ void board_tcpc_init(void)
* Initialize HPD to low; after sysjump SOC needs to see
* HPD pulse to enable video path
*/
- for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) {
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) {
const struct usb_mux *mux = &usb_muxes[port];
mux->hpd_update(port, 0, 0);
diff --git a/board/eve/board.h b/board/eve/board.h
index 8b43e0eef1..6ff05a0c7b 100644
--- a/board/eve/board.h
+++ b/board/eve/board.h
@@ -161,7 +161,7 @@
#define CONFIG_BD9995X_DELAY_INPUT_PORT_SELECT
#define CONFIG_USB_PD_LOGGING
#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_VBUS_DETECT_CHARGER
#define CONFIG_USB_PD_TCPC_LOW_POWER
#define CONFIG_USB_PD_TCPM_MUX
diff --git a/board/eve/led.c b/board/eve/led.c
index a98a6d53e0..e851092672 100644
--- a/board/eve/led.c
+++ b/board/eve/led.c
@@ -439,7 +439,7 @@ static void eve_led_set_power_battery(void)
/* Get active charge port which maps directly to left/right LED */
side = charge_manager_get_active_charge_port();
/* Ensure that side can be safely used as an index */
- if (side < 0 || side >= CONFIG_USB_PD_PORT_COUNT)
+ if (side < 0 || side >= CONFIG_USB_PD_PORT_MAX_COUNT)
side = LED_BOTH;
/* Get percent charge */
diff --git a/board/eve/usb_pd_policy.c b/board/eve/usb_pd_policy.c
index c27183510b..2969eb0a94 100644
--- a/board/eve/usb_pd_policy.c
+++ b/board/eve/usb_pd_policy.c
@@ -56,8 +56,8 @@ void pd_transition_voltage(int idx)
/* No-operation: we are always 5V */
}
-static uint8_t vbus_en[CONFIG_USB_PD_PORT_COUNT];
-static uint8_t vbus_rp[CONFIG_USB_PD_PORT_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5};
+static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5};
int board_vbus_source_enabled(int port)
{
@@ -302,8 +302,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
diff --git a/board/fizz/board.c b/board/fizz/board.c
index 75450fd725..7321234fe4 100644
--- a/board/fizz/board.c
+++ b/board/fizz/board.c
@@ -190,7 +190,7 @@ const struct i2c_port_t i2c_ports[] = {
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* TCPC mux configuration */
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{NPCX_I2C_PORT0_0, I2C_ADDR_TCPC0, &ps8xxx_tcpm_drv,
TCPC_ALERT_ACTIVE_LOW},
};
@@ -202,7 +202,7 @@ static int ps8751_tune_mux(int port)
return EC_SUCCESS;
}
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.driver = &tcpci_tcpm_usb_mux_driver,
.hpd_update = &ps8xxx_tcpc_update_hpd_status,
@@ -248,7 +248,7 @@ void board_tcpc_init(void)
* Initialize HPD to low; after sysjump SOC needs to see
* HPD pulse to enable video path
*/
- for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) {
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) {
const struct usb_mux *mux = &usb_muxes[port];
mux->hpd_update(port, 0, 0);
}
diff --git a/board/fizz/board.h b/board/fizz/board.h
index 09f5e15c4c..1bbd332afd 100644
--- a/board/fizz/board.h
+++ b/board/fizz/board.h
@@ -103,7 +103,7 @@
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_PORT_COUNT 1
+#define CONFIG_USB_PD_PORT_MAX_COUNT 1
#define CONFIG_USB_PD_VBUS_DETECT_GPIO
#define CONFIG_USB_PD_TCPC_LOW_POWER
#define CONFIG_USB_PD_TCPM_MUX
diff --git a/board/fizz/usb_pd_policy.c b/board/fizz/usb_pd_policy.c
index bac29cfa52..fe4a4c4192 100644
--- a/board/fizz/usb_pd_policy.c
+++ b/board/fizz/usb_pd_policy.c
@@ -266,8 +266,8 @@ int board_get_battery_soc(void)
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
diff --git a/board/flapjack~HEAD b/board/flapjack~HEAD
new file mode 120000
index 0000000000..0b14d5a383
--- /dev/null
+++ b/board/flapjack~HEAD
@@ -0,0 +1 @@
+kukui \ No newline at end of file
diff --git a/board/fleex/board.c b/board/fleex/board.c
index c2b76a0875..6bcdcb3a90 100644
--- a/board/fleex/board.c
+++ b/board/fleex/board.c
@@ -254,7 +254,7 @@ void lid_angle_peripheral_enable(int enable)
void board_overcurrent_event(int port, int is_overcurrented)
{
/* Sanity check the port. */
- if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT))
+ if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT))
return;
/* Note that the level is inverted because the pin is active low. */
diff --git a/board/garg/board.c b/board/garg/board.c
index ee9982d0cb..e583452214 100644
--- a/board/garg/board.c
+++ b/board/garg/board.c
@@ -295,7 +295,7 @@ void lid_angle_peripheral_enable(int enable)
void board_overcurrent_event(int port, int is_overcurrented)
{
/* Sanity check the port. */
- if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT))
+ if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT))
return;
/* Note that the level is inverted because the pin is active low. */
diff --git a/board/glados/board.c b/board/glados/board.c
index e1a5c566fc..7e126b1888 100644
--- a/board/glados/board.c
+++ b/board/glados/board.c
@@ -128,7 +128,7 @@ const struct i2c_port_t i2c_ports[] = {
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR, &tcpci_tcpm_drv},
{I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR + 2, &tcpci_tcpm_drv},
};
@@ -160,7 +160,7 @@ struct pi3usb9281_config pi3usb9281_chips[] = {
BUILD_ASSERT(ARRAY_SIZE(pi3usb9281_chips) ==
CONFIG_BC12_DETECT_PI3USB9281_CHIP_COUNT);
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.port_addr = 0xa8,
.driver = &pi3usb30532_usb_mux_driver,
@@ -271,7 +271,7 @@ int board_set_active_charge_port(int charge_port)
{
/* charge port is a realy physical port */
int is_real_port = (charge_port >= 0 &&
- charge_port < CONFIG_USB_PD_PORT_COUNT);
+ charge_port < CONFIG_USB_PD_PORT_MAX_COUNT);
/* check if we are source vbus on that port */
int source = gpio_get_level(charge_port == 0 ? GPIO_USB_C0_5V_EN :
GPIO_USB_C1_5V_EN);
diff --git a/board/glados/board.h b/board/glados/board.h
index 3e7df4451c..836d4f5718 100644
--- a/board/glados/board.h
+++ b/board/glados/board.h
@@ -74,7 +74,7 @@
#define CONFIG_USB_PD_ALT_MODE_DFP
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_TCPM_TCPCI
#define CONFIG_USB_PD_TRY_SRC
#define CONFIG_USB_PD_VBUS_DETECT_GPIO
diff --git a/board/glados/usb_pd_policy.c b/board/glados/usb_pd_policy.c
index 10fefd8c11..1870791358 100644
--- a/board/glados/usb_pd_policy.c
+++ b/board/glados/usb_pd_policy.c
@@ -209,9 +209,9 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
/* DP Status VDM as returned by UFP */
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
@@ -273,7 +273,7 @@ static int svdm_dp_config(int port, uint32_t *payload)
* timestamp of the next possible toggle to ensure the 2-ms spacing
* between IRQ_HPD.
*/
-static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_COUNT];
+static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_MAX_COUNT];
#define PORT_TO_HPD(port) ((port) ? GPIO_USB_C1_DP_HPD : GPIO_USB_C0_DP_HPD)
static void svdm_dp_post_config(int port)
diff --git a/board/glados_pd/board.h b/board/glados_pd/board.h
index 9310ee8715..d3d2e2edb1 100644
--- a/board/glados_pd/board.h
+++ b/board/glados_pd/board.h
@@ -61,7 +61,7 @@
#define CONFIG_UART_TX_BUF_SIZE 128
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_INTERNAL_COMP
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_TCPC
#define CONFIG_USB_PD_TCPC_TRACK_VBUS
#define CONFIG_USBC_VCONN
diff --git a/board/glkrvp/board.h b/board/glkrvp/board.h
index fc37732bc8..2f527bb31f 100644
--- a/board/glkrvp/board.h
+++ b/board/glkrvp/board.h
@@ -64,7 +64,7 @@
/* USB PD config */
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_TCPM_TCPCI
#define CONFIG_USB_PD_TRY_SRC
#define CONFIG_USB_PD_VBUS_DETECT_TCPC
diff --git a/board/glkrvp/chg_usb_pd.c b/board/glkrvp/chg_usb_pd.c
index 152e79142b..6ca5006860 100644
--- a/board/glkrvp/chg_usb_pd.c
+++ b/board/glkrvp/chg_usb_pd.c
@@ -30,13 +30,13 @@ enum glkrvp_charge_ports {
DC_JACK_PORT_0 = DEDICATED_CHARGE_PORT,
};
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{NPCX_I2C_PORT7_0, 0xA0, &tcpci_tcpm_drv, TCPC_ALERT_ACTIVE_LOW},
{NPCX_I2C_PORT7_0, 0xA4, &tcpci_tcpm_drv, TCPC_ALERT_ACTIVE_LOW},
};
-BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == CONFIG_USB_PD_PORT_COUNT);
+BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == CONFIG_USB_PD_PORT_MAX_COUNT);
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.port_addr = 0x20,
.driver = &ps874x_usb_mux_driver,
diff --git a/board/glkrvp/usb_pd_policy.c b/board/glkrvp/usb_pd_policy.c
index 57b114fe5d..72c54d3ec3 100644
--- a/board/glkrvp/usb_pd_policy.c
+++ b/board/glkrvp/usb_pd_policy.c
@@ -202,8 +202,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
diff --git a/board/glkrvp_ite/board.h b/board/glkrvp_ite/board.h
index 3d5abee7e0..d201a77fed 100644
--- a/board/glkrvp_ite/board.h
+++ b/board/glkrvp_ite/board.h
@@ -64,7 +64,7 @@
/* USB PD config */
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_TCPM_TCPCI
#define CONFIG_USB_PD_TRY_SRC
#define CONFIG_USB_PD_VBUS_DETECT_TCPC
diff --git a/board/glkrvp_ite/chg_usb_pd.c b/board/glkrvp_ite/chg_usb_pd.c
index 0b1a188081..6d6111d19a 100644
--- a/board/glkrvp_ite/chg_usb_pd.c
+++ b/board/glkrvp_ite/chg_usb_pd.c
@@ -30,13 +30,13 @@ enum glkrvp_charge_ports {
DC_JACK_PORT_0 = DEDICATED_CHARGE_PORT,
};
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{IT83XX_I2C_CH_B, 0xA0, &tcpci_tcpm_drv, TCPC_ALERT_ACTIVE_LOW},
{IT83XX_I2C_CH_B, 0xA4, &tcpci_tcpm_drv, TCPC_ALERT_ACTIVE_LOW},
};
-BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == CONFIG_USB_PD_PORT_COUNT);
+BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == CONFIG_USB_PD_PORT_MAX_COUNT);
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.port_addr = 0x20,
.driver = &ps874x_usb_mux_driver,
diff --git a/board/glkrvp_ite/usb_pd_policy.c b/board/glkrvp_ite/usb_pd_policy.c
index bd11eb4d8f..e269d217f5 100644
--- a/board/glkrvp_ite/usb_pd_policy.c
+++ b/board/glkrvp_ite/usb_pd_policy.c
@@ -202,8 +202,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
diff --git a/board/grunt/board.c b/board/grunt/board.c
index 13e062589a..f9baa71039 100644
--- a/board/grunt/board.c
+++ b/board/grunt/board.c
@@ -160,7 +160,7 @@ void board_tcpc_init(void)
* Initialize HPD to low; after sysjump SOC needs to see
* HPD pulse to enable video path
*/
- for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) {
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) {
const struct usb_mux *mux = &usb_muxes[port];
mux->hpd_update(port, 0, 0);
diff --git a/board/hoho/board.h b/board/hoho/board.h
index dd5fe2c767..d57c804d17 100644
--- a/board/hoho/board.h
+++ b/board/hoho/board.h
@@ -44,7 +44,7 @@
#define CONFIG_USB_PD_LOGGING
#undef CONFIG_EVENT_LOG_SIZE
#define CONFIG_EVENT_LOG_SIZE 256
-#define CONFIG_USB_PD_PORT_COUNT 1
+#define CONFIG_USB_PD_PORT_MAX_COUNT 1
#define CONFIG_USB_PD_TCPC
#define CONFIG_USB_PD_TCPM_STUB
#define CONFIG_USB_PD_VBUS_DETECT_NONE
diff --git a/board/it83xx_evb/board.c b/board/it83xx_evb/board.c
index 94efaae39e..15819f57f3 100644
--- a/board/it83xx_evb/board.c
+++ b/board/it83xx_evb/board.c
@@ -38,7 +38,7 @@ int board_get_battery_soc(void)
return 100;
}
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{-1, -1, &it83xx_tcpm_drv},
{-1, -1, &it83xx_tcpm_drv},
};
diff --git a/board/it83xx_evb/board.h b/board/it83xx_evb/board.h
index 379362d4c5..c186862b75 100644
--- a/board/it83xx_evb/board.h
+++ b/board/it83xx_evb/board.h
@@ -39,7 +39,7 @@
#define CONFIG_USB_PD_ALT_MODE_DFP
#define CONFIG_USB_PD_CHECK_MAX_REQUEST_ALLOWED
#define CONFIG_USB_PD_DUAL_ROLE
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_TCPM_ITE83XX
#define CONFIG_USB_PD_TRY_SRC
#define CONFIG_USB_PD_VBUS_DETECT_GPIO
diff --git a/board/it83xx_evb/usb_pd_policy.c b/board/it83xx_evb/usb_pd_policy.c
index 81e243dc61..03d83f02f3 100644
--- a/board/it83xx_evb/usb_pd_policy.c
+++ b/board/it83xx_evb/usb_pd_policy.c
@@ -195,9 +195,9 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
/* DP Status VDM as returned by UFP */
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
diff --git a/board/kukui/board.c b/board/kukui/board.c
index c2b866bd0a..cb0ceca478 100644
--- a/board/kukui/board.c
+++ b/board/kukui/board.c
@@ -121,11 +121,11 @@ const struct spi_device_t spi_devices[] = {
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{I2C_PORT_TCPC0, MT6370_TCPC_I2C_ADDR, &mt6370_tcpm_drv},
};
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.driver = &virtual_usb_mux_driver,
.hpd_update = &virtual_hpd_update,
diff --git a/board/kukui/board.h b/board/kukui/board.h
index c0ff9efcb7..4be6c40c9a 100644
--- a/board/kukui/board.h
+++ b/board/kukui/board.h
@@ -123,7 +123,7 @@
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_PORT_COUNT 1
+#define CONFIG_USB_PD_PORT_MAX_COUNT 1
#define CONFIG_USB_PD_TCPC_LOW_POWER
#define CONFIG_USB_PD_TCPM_MT6370
#define CONFIG_USB_PD_TCPM_TCPCI
diff --git a/board/kukui/usb_pd_policy.c b/board/kukui/usb_pd_policy.c
index 42b0ce7e03..44f9d9ee49 100644
--- a/board/kukui/usb_pd_policy.c
+++ b/board/kukui/usb_pd_policy.c
@@ -216,9 +216,9 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
/* DP Status VDM as returned by UFP */
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
@@ -277,7 +277,7 @@ static int svdm_dp_config(int port, uint32_t *payload)
* timestamp of the next possible toggle to ensure the 2-ms spacing
* between IRQ_HPD.
*/
-static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_COUNT];
+static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_dp_post_config(int port)
{
diff --git a/board/liara/board.c b/board/liara/board.c
index 67e79d76c1..d6bdcec13a 100644
--- a/board/liara/board.c
+++ b/board/liara/board.c
@@ -150,7 +150,7 @@ void board_tcpc_init(void)
* Initialize HPD to low; after sysjump SOC needs to see
* HPD pulse to enable video path
*/
- for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) {
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) {
const struct usb_mux *mux = &usb_muxes[port];
mux->hpd_update(port, 0, 0);
diff --git a/board/mchpevb1/board.c b/board/mchpevb1/board.c
index eeeb557b96..b8d3b8ea45 100644
--- a/board/mchpevb1/board.c
+++ b/board/mchpevb1/board.c
@@ -274,7 +274,7 @@ int board_i2c_p2c(int port)
}
#ifdef CONFIG_USB_POWER_DELIVERY
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR, &tcpci_tcpm_drv},
{I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR + 2, &tcpci_tcpm_drv},
};
@@ -393,7 +393,7 @@ struct pi3usb9281_config pi3usb9281_chips[] = {
BUILD_ASSERT(ARRAY_SIZE(pi3usb9281_chips) ==
CONFIG_BC12_DETECT_PI3USB9281_CHIP_COUNT);
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.port_addr = 0xa8,
.driver = &pi3usb30532_usb_mux_driver,
@@ -600,7 +600,7 @@ int board_set_active_charge_port(int charge_port)
{
/* charge port is a realy physical port */
int is_real_port = (charge_port >= 0 &&
- charge_port < CONFIG_USB_PD_PORT_COUNT);
+ charge_port < CONFIG_USB_PD_PORT_MAX_COUNT);
/* check if we are source vbus on that port */
int source = gpio_get_level(charge_port == 0 ? GPIO_USB_C0_5V_EN :
GPIO_USB_C1_5V_EN);
@@ -755,20 +755,20 @@ void board_hibernate_late(void)
*/
gpio_set_level(GPIO_USB_PD_WAKE, 0);
-#ifdef CONFIG_USB_PD_PORT_COUNT
+#ifdef CONFIG_USB_PD_PORT_MAX_COUNT
/*
* Leave USB-C charging enabled in hibernate, in order to
* allow wake-on-plug. 5V enable must be pulled low.
*/
-#if CONFIG_USB_PD_PORT_COUNT > 0
+#if CONFIG_USB_PD_PORT_MAX_COUNT > 0
gpio_set_flags(GPIO_USB_C0_5V_EN, GPIO_PULL_DOWN | GPIO_INPUT);
gpio_set_level(GPIO_USB_C0_CHARGE_EN_L, 0);
#endif
-#if CONFIG_USB_PD_PORT_COUNT > 1
+#if CONFIG_USB_PD_PORT_MAX_COUNT > 1
gpio_set_flags(GPIO_USB_C1_5V_EN, GPIO_PULL_DOWN | GPIO_INPUT);
gpio_set_level(GPIO_USB_C1_CHARGE_EN_L, 0);
#endif
-#endif /* CONFIG_USB_PD_PORT_COUNT */
+#endif /* CONFIG_USB_PD_PORT_MAX_COUNT */
}
/* Any glados boards post version 2 should have ROP_LDO_EN stuffed. */
diff --git a/board/mchpevb1/board.h b/board/mchpevb1/board.h
index 9cc28a38fd..0963f6a347 100644
--- a/board/mchpevb1/board.h
+++ b/board/mchpevb1/board.h
@@ -237,7 +237,7 @@
#define CONFIG_USB_PD_ALT_MODE_DFP
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_TCPM_TCPCI
#endif
/*
diff --git a/board/mchpevb1/usb_pd_policy.c b/board/mchpevb1/usb_pd_policy.c
index d5eff63316..f763c3aa0e 100644
--- a/board/mchpevb1/usb_pd_policy.c
+++ b/board/mchpevb1/usb_pd_policy.c
@@ -212,9 +212,9 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
/* DP Status VDM as returned by UFP */
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
@@ -277,7 +277,7 @@ static int svdm_dp_config(int port, uint32_t *payload)
* timestamp of the next possible toggle to ensure the 2-ms spacing
* between IRQ_HPD.
*/
-static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_COUNT];
+static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_MAX_COUNT];
#define PORT_TO_HPD(port) \
((port) ? GPIO_USB_C1_DP_HPD : GPIO_USB_C0_DP_HPD)
diff --git a/board/meep/board.c b/board/meep/board.c
index 2de5907a9e..7ad6b2cb4c 100644
--- a/board/meep/board.c
+++ b/board/meep/board.c
@@ -299,7 +299,7 @@ const int keyboard_factory_scan_pins_used =
void board_overcurrent_event(int port, int is_overcurrented)
{
/* Sanity check the port. */
- if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT))
+ if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT))
return;
/* Note that the level is inverted because the pin is active low. */
diff --git a/board/nami/board.c b/board/nami/board.c
index 3957eba1ae..ac413125a3 100644
--- a/board/nami/board.c
+++ b/board/nami/board.c
@@ -216,7 +216,7 @@ const struct i2c_port_t i2c_ports[] = {
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* TCPC mux configuration */
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_PS8751] = {
.i2c_host_port = NPCX_I2C_PORT0_0,
.i2c_slave_addr = PS8751_I2C_ADDR1,
@@ -231,7 +231,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
},
};
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.driver = &tcpci_tcpm_usb_mux_driver,
.hpd_update = &ps8xxx_tcpc_update_hpd_status,
@@ -290,7 +290,7 @@ void board_tcpc_init(void)
* Initialize HPD to low; after sysjump SOC needs to see
* HPD pulse to enable video path
*/
- for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) {
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) {
const struct usb_mux *mux = &usb_muxes[port];
mux->hpd_update(port, 0, 0);
}
@@ -608,7 +608,7 @@ int board_set_active_charge_port(int charge_port)
{
/* charge port is a physical port */
int is_real_port = (charge_port >= 0 &&
- charge_port < CONFIG_USB_PD_PORT_COUNT);
+ charge_port < CONFIG_USB_PD_PORT_MAX_COUNT);
/* check if we are sourcing VBUS on the port */
/* dnojiri: revisit */
int is_source = gpio_get_level(charge_port == 0 ?
diff --git a/board/nami/board.h b/board/nami/board.h
index 0c88875e2f..62b67b24a7 100644
--- a/board/nami/board.h
+++ b/board/nami/board.h
@@ -168,7 +168,7 @@
#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
#define CONFIG_USB_PD_LOGGING
#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_MAX_TOTAL_SOURCE_CURRENT 4500
#define CONFIG_USB_PD_VBUS_DETECT_GPIO
#define CONFIG_USB_PD_TCPC_LOW_POWER
diff --git a/board/nami/usb_pd_policy.c b/board/nami/usb_pd_policy.c
index 214dc226d9..88877aa6f9 100644
--- a/board/nami/usb_pd_policy.c
+++ b/board/nami/usb_pd_policy.c
@@ -54,8 +54,8 @@ void pd_transition_voltage(int idx)
/* No-operation: we are always 5V */
}
-static uint8_t vbus_en[CONFIG_USB_PD_PORT_COUNT];
-static uint8_t vbus_rp[CONFIG_USB_PD_PORT_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5};
+static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5};
int board_vbus_source_enabled(int port)
{
@@ -270,8 +270,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
diff --git a/board/nautilus/board.c b/board/nautilus/board.c
index c98de155d7..d95e4171ff 100644
--- a/board/nautilus/board.c
+++ b/board/nautilus/board.c
@@ -166,7 +166,7 @@ const struct i2c_port_t i2c_ports[] = {
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* TCPC mux configuration */
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.i2c_host_port = NPCX_I2C_PORT0_0,
.i2c_slave_addr = PS8751_I2C_ADDR1,
@@ -181,7 +181,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
},
};
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.driver = &tcpci_tcpm_usb_mux_driver,
.hpd_update = &ps8xxx_tcpc_update_hpd_status,
@@ -236,7 +236,7 @@ void board_tcpc_init(void)
* Initialize HPD to low; after sysjump SOC needs to see
* HPD pulse to enable video path
*/
- for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) {
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) {
const struct usb_mux *mux = &usb_muxes[port];
mux->hpd_update(port, 0, 0);
@@ -479,7 +479,7 @@ int board_set_active_charge_port(int charge_port)
{
/* charge port is a physical port */
int is_real_port = (charge_port >= 0 &&
- charge_port < CONFIG_USB_PD_PORT_COUNT);
+ charge_port < CONFIG_USB_PD_PORT_MAX_COUNT);
/* check if we are source VBUS on the port */
int source = gpio_get_level(charge_port == 0 ? GPIO_USB_C0_5V_EN :
GPIO_USB_C1_5V_EN);
diff --git a/board/nautilus/board.h b/board/nautilus/board.h
index acbed5897e..d8bf07b9b2 100644
--- a/board/nautilus/board.h
+++ b/board/nautilus/board.h
@@ -144,7 +144,7 @@
#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
#define CONFIG_USB_PD_LOGGING
#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_VBUS_DETECT_GPIO
#define CONFIG_USB_PD_TCPC_LOW_POWER
#define CONFIG_USB_PD_TCPM_MUX
diff --git a/board/nautilus/usb_pd_policy.c b/board/nautilus/usb_pd_policy.c
index aa1c185345..b9f5b5f568 100644
--- a/board/nautilus/usb_pd_policy.c
+++ b/board/nautilus/usb_pd_policy.c
@@ -54,8 +54,8 @@ void pd_transition_voltage(int idx)
/* No-operation: we are always 5V */
}
-static uint8_t vbus_en[CONFIG_USB_PD_PORT_COUNT];
-static uint8_t vbus_rp[CONFIG_USB_PD_PORT_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5};
+static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5};
int board_vbus_source_enabled(int port)
{
@@ -300,8 +300,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
diff --git a/board/nocturne/board.c b/board/nocturne/board.c
index 20b4b3983b..883c1c87c2 100644
--- a/board/nocturne/board.c
+++ b/board/nocturne/board.c
@@ -296,7 +296,7 @@ struct ppc_config_t ppc_chips[] = {
};
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.i2c_host_port = I2C_PORT_USB_C0,
.i2c_slave_addr = PS8751_I2C_ADDR1,
@@ -312,7 +312,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
},
};
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.driver = &tcpci_tcpm_usb_mux_driver,
.hpd_update = &ps8xxx_tcpc_update_hpd_status,
@@ -577,7 +577,7 @@ void board_overcurrent_event(int port, int is_overcurrented)
int lvl;
/* Sanity check the port. */
- if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT))
+ if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT))
return;
/* Note that the levels are inverted because the pin is active low. */
@@ -700,7 +700,7 @@ void board_rtc_reset(void)
int board_set_active_charge_port(int port)
{
int is_real_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_COUNT);
+ port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
int rv;
diff --git a/board/nocturne/board.h b/board/nocturne/board.h
index 4222ff6f9a..a34c0c67c8 100644
--- a/board/nocturne/board.h
+++ b/board/nocturne/board.h
@@ -127,7 +127,7 @@
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_TCPC_LOW_POWER
#define CONFIG_USB_PD_TCPM_PS8805
#define CONFIG_USB_PD_TCPM_TCPCI
diff --git a/board/nocturne/usb_pd_policy.c b/board/nocturne/usb_pd_policy.c
index 3b07ff7461..a56a287121 100644
--- a/board/nocturne/usb_pd_policy.c
+++ b/board/nocturne/usb_pd_policy.c
@@ -241,8 +241,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
@@ -305,7 +305,7 @@ static int svdm_dp_config(int port, uint32_t *payload)
* timestamp of the next possible toggle to ensure the 2-ms spacing
* between IRQ_HPD.
*/
-static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_COUNT];
+static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_MAX_COUNT];
#define PORT_TO_HPD(port) ((port) ? GPIO_USB_C1_DP_HPD : GPIO_USB_C0_DP_HPD)
diff --git a/board/oak/board.c b/board/oak/board.c
index 4fd49330d1..86f9f16dac 100644
--- a/board/oak/board.c
+++ b/board/oak/board.c
@@ -112,7 +112,7 @@ const struct spi_device_t spi_devices[] = {
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
#endif
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR, &tcpci_tcpm_drv},
{I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR + 2, &tcpci_tcpm_drv},
};
@@ -160,7 +160,7 @@ struct als_t als[] = {
BUILD_ASSERT(ARRAY_SIZE(als) == ALS_COUNT);
#endif
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.port_addr = 0x54 << 1,
.driver = &pi3usb30532_usb_mux_driver,
@@ -276,7 +276,7 @@ int board_set_active_charge_port(int charge_port)
{
/* charge port is a physical port */
int is_real_port = (charge_port >= 0 &&
- charge_port < CONFIG_USB_PD_PORT_COUNT);
+ charge_port < CONFIG_USB_PD_PORT_MAX_COUNT);
/* check if we are source VBUS on the port */
int source = gpio_get_level(charge_port == 0 ? GPIO_USB_C0_5V_EN :
GPIO_USB_C1_5V_EN);
@@ -324,7 +324,7 @@ void board_set_charge_limit(int port, int supplier, int charge_ma,
* timestamp of the next possible toggle to ensure the 2-ms spacing
* between IRQ_HPD.
*/
-static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_COUNT];
+static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_MAX_COUNT];
static void board_typec_set_dp_hpd(int port, int level)
{
@@ -465,11 +465,11 @@ void vbus_task(void)
uint8_t device_type;
uint8_t charger_status;
uint8_t vbus;
- } bc12[CONFIG_USB_PD_PORT_COUNT];
+ } bc12[CONFIG_USB_PD_PORT_MAX_COUNT];
uint8_t port, vbus, reg, wake;
while (1) {
- for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) {
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) {
#if BOARD_REV == OAK_REV3
vbus = !gpio_get_level(port ? GPIO_USB_C1_VBUS_WAKE_L :
GPIO_USB_C0_VBUS_WAKE_L);
diff --git a/board/oak/board.h b/board/oak/board.h
index 3e8dbd0698..c945467e61 100644
--- a/board/oak/board.h
+++ b/board/oak/board.h
@@ -95,7 +95,7 @@
#define CONFIG_USB_PD_ALT_MODE_DFP
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_TCPM_TCPCI
#define CONFIG_USB_PD_TRY_SRC
#define CONFIG_USB_PD_VBUS_DETECT_TCPC
diff --git a/board/oak/usb_pd_policy.c b/board/oak/usb_pd_policy.c
index 2268945144..be6868f268 100644
--- a/board/oak/usb_pd_policy.c
+++ b/board/oak/usb_pd_policy.c
@@ -207,9 +207,9 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
/* DP Status VDM as returned by UFP */
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
diff --git a/board/pdeval-stm32f072/PD_evaluation.md b/board/pdeval-stm32f072/PD_evaluation.md
index 395466f477..95e31996fc 100644
--- a/board/pdeval-stm32f072/PD_evaluation.md
+++ b/board/pdeval-stm32f072/PD_evaluation.md
@@ -35,7 +35,7 @@ then document the new `CONFIG_USB_PD_TCPM_` variable in the [include/config.h](.
### Board configuration
-In [board/pdeval-stm32f072/board.h](board.h), you can update `CONFIG_USB_PD_PORT_COUNT` to the actual number of ports on your board.
+In [board/pdeval-stm32f072/board.h](board.h), you can update `CONFIG_USB_PD_PORT_MAX_COUNT` to the actual number of ports on your board.
You also need to create/delete the corresponding `PD_Cx` tasks in [board/pdeval-stm32f072/ec.tasklist](ec.tasklist).
By default, the firmware is using I2C1 with SCL/SDA on pins PB6 and PB7, running with a 100kHz clock, and tries to talk to TCPCs at i2c slave addresses 0x9c and 0x9e.
diff --git a/board/pdeval-stm32f072/board.c b/board/pdeval-stm32f072/board.c
index a306d853ac..2e8fd072b3 100644
--- a/board/pdeval-stm32f072/board.c
+++ b/board/pdeval-stm32f072/board.c
@@ -57,7 +57,7 @@ const struct i2c_port_t i2c_ports[] = {
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{I2C_PORT_TCPC, AN7447_TCPC3_I2C_ADDR, &anx7447_tcpm_drv}
};
diff --git a/board/pdeval-stm32f072/board.h b/board/pdeval-stm32f072/board.h
index 7d25def826..b008edc860 100644
--- a/board/pdeval-stm32f072/board.h
+++ b/board/pdeval-stm32f072/board.h
@@ -25,7 +25,7 @@
#define CONFIG_USB_PD_ALT_MODE
#define CONFIG_USB_PD_ALT_MODE_DFP
#define CONFIG_USB_PD_DUAL_ROLE
-#define CONFIG_USB_PD_PORT_COUNT 1
+#define CONFIG_USB_PD_PORT_MAX_COUNT 1
#define CONFIG_USB_PD_TCPM_TCPCI
#define CONFIG_USB_PD_VBUS_DETECT_TCPC
#define CONFIG_USB_PD_TCPM_ANX7447
diff --git a/board/pdeval-stm32f072/usb_pd_policy.c b/board/pdeval-stm32f072/usb_pd_policy.c
index ba899f5efb..01a28fbb45 100644
--- a/board/pdeval-stm32f072/usb_pd_policy.c
+++ b/board/pdeval-stm32f072/usb_pd_policy.c
@@ -36,7 +36,7 @@ const uint32_t pd_snk_pdo[] = {
const int pd_snk_pdo_cnt = ARRAY_SIZE(pd_snk_pdo);
#if defined(CONFIG_USB_PD_TCPM_MUX) && defined(CONFIG_USB_PD_TCPM_ANX7447)
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.driver = &anx7447_usb_mux_driver,
},
@@ -253,8 +253,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
diff --git a/board/phaser/board.c b/board/phaser/board.c
index 630662a75f..057a94daad 100644
--- a/board/phaser/board.c
+++ b/board/phaser/board.c
@@ -290,7 +290,7 @@ DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
void board_overcurrent_event(int port, int is_overcurrented)
{
/* Sanity check the port. */
- if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT))
+ if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT))
return;
/* Note that the level is inverted because the pin is active low. */
diff --git a/board/plankton/board.h b/board/plankton/board.h
index d42a76b0d6..cb1b6c9a1a 100644
--- a/board/plankton/board.h
+++ b/board/plankton/board.h
@@ -25,7 +25,7 @@
#define CONFIG_USB_PD_IDENTITY_HW_VERS 1
#define CONFIG_USB_PD_IDENTITY_SW_VERS 1
#define CONFIG_USB_PD_INTERNAL_COMP
-#define CONFIG_USB_PD_PORT_COUNT 1
+#define CONFIG_USB_PD_PORT_MAX_COUNT 1
#define CONFIG_USB_PD_TCPC
#define CONFIG_USB_PD_TCPM_STUB
#define CONFIG_USB_PD_VBUS_DETECT_GPIO
diff --git a/board/poppy/board.c b/board/poppy/board.c
index 3a158ef050..08870c0efa 100644
--- a/board/poppy/board.c
+++ b/board/poppy/board.c
@@ -208,7 +208,7 @@ const struct i2c_port_t i2c_ports[] = {
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* TCPC mux configuration */
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.i2c_host_port = NPCX_I2C_PORT0_0,
.i2c_slave_addr = ANX74XX_I2C_ADDR1,
@@ -223,7 +223,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
},
};
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.driver = &anx74xx_tcpm_usb_mux_driver,
.hpd_update = &anx74xx_tcpc_update_hpd_status,
@@ -322,7 +322,7 @@ void board_tcpc_init(void)
* Initialize HPD to low; after sysjump SOC needs to see
* HPD pulse to enable video path
*/
- for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) {
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) {
const struct usb_mux *mux = &usb_muxes[port];
mux->hpd_update(port, 0, 0);
@@ -614,7 +614,7 @@ int board_set_active_charge_port(int charge_port)
{
/* charge port is a physical port */
int is_real_port = (charge_port >= 0 &&
- charge_port < CONFIG_USB_PD_PORT_COUNT);
+ charge_port < CONFIG_USB_PD_PORT_MAX_COUNT);
/* check if we are source VBUS on the port */
int source = gpio_get_level(charge_port == 0 ? GPIO_USB_C0_5V_EN :
GPIO_USB_C1_5V_EN);
diff --git a/board/poppy/board.h b/board/poppy/board.h
index 92d15ce0f7..a331ce2985 100644
--- a/board/poppy/board.h
+++ b/board/poppy/board.h
@@ -154,7 +154,7 @@
#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
#define CONFIG_USB_PD_LOGGING
#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_VBUS_DETECT_GPIO
#define CONFIG_USB_PD_TCPC_LOW_POWER
#define CONFIG_USB_PD_TCPM_MUX
diff --git a/board/poppy/usb_pd_policy.c b/board/poppy/usb_pd_policy.c
index 19407900fb..a9077aabfb 100644
--- a/board/poppy/usb_pd_policy.c
+++ b/board/poppy/usb_pd_policy.c
@@ -55,8 +55,8 @@ void pd_transition_voltage(int idx)
/* No-operation: we are always 5V */
}
-static uint8_t vbus_en[CONFIG_USB_PD_PORT_COUNT];
-static uint8_t vbus_rp[CONFIG_USB_PD_PORT_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5};
+static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5};
int board_vbus_source_enabled(int port)
{
@@ -301,8 +301,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
diff --git a/board/rainier/board.c b/board/rainier/board.c
index a8211560d7..097f73f8fc 100644
--- a/board/rainier/board.c
+++ b/board/rainier/board.c
@@ -126,11 +126,11 @@ const enum gpio_signal hibernate_wake_pins[] = {
const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/******************************************************************************/
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{I2C_PORT_TCPC0, FUSB302_I2C_SLAVE_ADDR, &fusb302_tcpm_drv},
};
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.driver = &virtual_usb_mux_driver,
.hpd_update = &virtual_hpd_update,
diff --git a/board/rainier/board.h b/board/rainier/board.h
index 89d445c416..0d91046c5f 100644
--- a/board/rainier/board.h
+++ b/board/rainier/board.h
@@ -91,7 +91,7 @@
#define CONFIG_USB_PD_ALT_MODE_DFP
#define CONFIG_USB_PD_DISCHARGE_GPIO
#define CONFIG_USB_PD_DUAL_ROLE
-#define CONFIG_USB_PD_PORT_COUNT 1
+#define CONFIG_USB_PD_PORT_MAX_COUNT 1
#define CONFIG_USB_PD_TCPM_FUSB302
#define CONFIG_USB_PD_TCPM_TCPCI
#define CONFIG_USB_PD_VBUS_DETECT_TCPC
diff --git a/board/rainier/usb_pd_policy.c b/board/rainier/usb_pd_policy.c
index f5e2e267f2..0f5040e96e 100644
--- a/board/rainier/usb_pd_policy.c
+++ b/board/rainier/usb_pd_policy.c
@@ -215,9 +215,9 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
/* DP Status VDM as returned by UFP */
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
diff --git a/board/rammus/board.c b/board/rammus/board.c
index 340cca0028..e5b8f7ef38 100644
--- a/board/rammus/board.c
+++ b/board/rammus/board.c
@@ -160,7 +160,7 @@ const struct i2c_port_t i2c_ports[] = {
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* TCPC mux configuration */
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_PS8751] = {
.i2c_host_port = I2C_PORT_TCPC1,
.i2c_slave_addr = PS8751_I2C_ADDR1,
@@ -175,7 +175,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
},
};
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_PS8751] = {
.driver = &tcpci_tcpm_usb_mux_driver,
.hpd_update = &ps8xxx_tcpc_update_hpd_status,
@@ -234,7 +234,7 @@ void board_tcpc_init(void)
* Initialize HPD to low; after sysjump SOC needs to see
* HPD pulse to enable video path
*/
- for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) {
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) {
const struct usb_mux *mux = &usb_muxes[port];
mux->hpd_update(port, 0, 0);
}
@@ -463,7 +463,7 @@ int board_set_active_charge_port(int charge_port)
{
/* charge port is a physical port */
int is_real_port = (charge_port >= 0 &&
- charge_port < CONFIG_USB_PD_PORT_COUNT);
+ charge_port < CONFIG_USB_PD_PORT_MAX_COUNT);
/* check if we are source VBUS on the port */
int source = gpio_get_level(charge_port == 0 ? GPIO_USB_C0_5V_EN :
GPIO_USB_C1_5V_EN);
diff --git a/board/rammus/board.h b/board/rammus/board.h
index adeaa259b1..f1650988f4 100644
--- a/board/rammus/board.h
+++ b/board/rammus/board.h
@@ -147,7 +147,7 @@
#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
#define CONFIG_USB_PD_LOGGING
#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_VBUS_DETECT_GPIO
#define CONFIG_USB_PD_TCPC_LOW_POWER
#define CONFIG_USB_PD_TCPM_MUX
diff --git a/board/rammus/usb_pd_policy.c b/board/rammus/usb_pd_policy.c
index 5d6190f915..c92d996ba4 100644
--- a/board/rammus/usb_pd_policy.c
+++ b/board/rammus/usb_pd_policy.c
@@ -54,8 +54,8 @@ void pd_transition_voltage(int idx)
/* No-operation: we are always 5V */
}
-static uint8_t vbus_en[CONFIG_USB_PD_PORT_COUNT];
-static uint8_t vbus_rp[CONFIG_USB_PD_PORT_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5};
+static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5};
int board_vbus_source_enabled(int port)
{
@@ -271,8 +271,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
diff --git a/board/reef/board.c b/board/reef/board.c
index beeb5d823f..ba1621c430 100644
--- a/board/reef/board.c
+++ b/board/reef/board.c
@@ -245,7 +245,7 @@ struct i2c_stress_test i2c_stress_tests[] = {
const int i2c_test_dev_used = ARRAY_SIZE(i2c_stress_tests);
#endif /* CONFIG_CMD_I2C_STRESS_TEST */
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_ANX74XX] = {
.i2c_host_port = NPCX_I2C_PORT0_0,
.i2c_slave_addr = ANX74XX_I2C_ADDR1,
@@ -292,7 +292,7 @@ static int ps8751_tune_mux(int port)
return EC_SUCCESS;
}
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_ANX74XX] = {
.driver = &anx74xx_tcpm_usb_mux_driver,
.hpd_update = &anx74xx_tcpc_update_hpd_status,
@@ -398,7 +398,7 @@ void board_tcpc_init(void)
* Initialize HPD to low; after sysjump SOC needs to see
* HPD pulse to enable video path
*/
- for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) {
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) {
const struct usb_mux *mux = &usb_muxes[port];
mux->hpd_update(port, 0, 0);
diff --git a/board/reef/board.h b/board/reef/board.h
index b166d24c8b..abf391c121 100644
--- a/board/reef/board.h
+++ b/board/reef/board.h
@@ -84,7 +84,7 @@
#define CONFIG_USB_PD_DISCHARGE_TCPC
#define CONFIG_USB_PD_LOGGING
#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_VBUS_DETECT_CHARGER
#define CONFIG_USB_PD_TCPC_LOW_POWER
#define CONFIG_USB_PD_TCPM_MUX /* for both PS8751 and ANX3429 */
diff --git a/board/reef/usb_pd_policy.c b/board/reef/usb_pd_policy.c
index 60cbdd3276..85c6cdb253 100644
--- a/board/reef/usb_pd_policy.c
+++ b/board/reef/usb_pd_policy.c
@@ -56,8 +56,8 @@ void pd_transition_voltage(int idx)
/* No-operation: we are always 5V */
}
-static uint8_t vbus_en[CONFIG_USB_PD_PORT_COUNT];
-static uint8_t vbus_rp[CONFIG_USB_PD_PORT_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5};
+static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5};
int board_vbus_source_enabled(int port)
{
@@ -270,8 +270,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
diff --git a/board/reef_it8320/board.c b/board/reef_it8320/board.c
index 03ce723338..0cf8b22fb2 100644
--- a/board/reef_it8320/board.c
+++ b/board/reef_it8320/board.c
@@ -93,7 +93,7 @@ const struct i2c_port_t i2c_ports[] = {
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{-1, -1, &it83xx_tcpm_drv, 0},
{-1, -1, &it83xx_tcpm_drv, 0},
};
@@ -173,7 +173,7 @@ static void it83xx_tcpc_update_hpd_status(int port, int hpd_lvl, int hpd_irq)
}
}
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.port_addr = 0xa8,
.driver = &pi3usb30532_usb_mux_driver,
@@ -260,7 +260,7 @@ static void board_init(void)
* Initialize HPD to low; after sysjump SOC needs to see
* HPD pulse to enable video path
*/
- for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++)
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++)
usb_muxes[port].hpd_update(port, 0, 0);
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_INIT_I2C + 1);
diff --git a/board/reef_it8320/board.h b/board/reef_it8320/board.h
index 85399a3cc5..0124441920 100644
--- a/board/reef_it8320/board.h
+++ b/board/reef_it8320/board.h
@@ -73,7 +73,7 @@
#define CONFIG_USB_PD_DISCHARGE_GPIO
#define CONFIG_USB_PD_LOGGING
#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_VBUS_DETECT_CHARGER
#define CONFIG_USB_PD_TCPM_ITE83XX
#define CONFIG_USB_PD_TCPM_TCPCI
diff --git a/board/reef_it8320/usb_pd_policy.c b/board/reef_it8320/usb_pd_policy.c
index 8fd92ca908..cec92999ed 100644
--- a/board/reef_it8320/usb_pd_policy.c
+++ b/board/reef_it8320/usb_pd_policy.c
@@ -56,8 +56,8 @@ void pd_transition_voltage(int idx)
/* No-operation: we are always 5V */
}
-static uint8_t vbus_en[CONFIG_USB_PD_PORT_COUNT];
-static uint8_t vbus_rp[CONFIG_USB_PD_PORT_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5};
+static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5};
int board_vbus_source_enabled(int port)
{
@@ -263,8 +263,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
diff --git a/board/reef_mchp/board.c b/board/reef_mchp/board.c
index c0fb36d5d8..99b5207461 100644
--- a/board/reef_mchp/board.c
+++ b/board/reef_mchp/board.c
@@ -359,7 +359,7 @@ struct i2c_stress_test i2c_stress_tests[] = {
const int i2c_test_dev_used = ARRAY_SIZE(i2c_stress_tests);
#endif /* CONFIG_CMD_I2C_STRESS_TEST */
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_ANX74XX] = {
.i2c_host_port = MCHP_I2C_PORT0,
.i2c_slave_addr = 0x50,
@@ -432,7 +432,7 @@ static int ps8751_tune_mux(int port)
* tcpc_config array. The tcpc_config array contains the actual EC I2C
* port, device slave address, and a function pointer into the driver code.
*/
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_ANX74XX] = {
.driver = &anx74xx_tcpm_usb_mux_driver,
.hpd_update = &anx74xx_tcpc_update_hpd_status,
@@ -547,7 +547,7 @@ void board_tcpc_init(void)
* Initialize HPD to low; after sysjump SOC needs to see
* HPD pulse to enable video path
*/
- for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) {
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) {
const struct usb_mux *mux = &usb_muxes[port];
mux->hpd_update(port, 0, 0);
diff --git a/board/reef_mchp/board.h b/board/reef_mchp/board.h
index 1250689d0d..9c4692529d 100644
--- a/board/reef_mchp/board.h
+++ b/board/reef_mchp/board.h
@@ -84,7 +84,7 @@
#define CONFIG_USB_PD_DISCHARGE_TCPC
#define CONFIG_USB_PD_LOGGING
#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_VBUS_DETECT_CHARGER
#define CONFIG_USB_PD_TCPC_LOW_POWER
#define CONFIG_USB_PD_TCPM_MUX /* for both PS8751 and ANX3429 */
diff --git a/board/reef_mchp/usb_pd_policy.c b/board/reef_mchp/usb_pd_policy.c
index ba8195248f..3442058694 100644
--- a/board/reef_mchp/usb_pd_policy.c
+++ b/board/reef_mchp/usb_pd_policy.c
@@ -58,8 +58,8 @@ void pd_transition_voltage(int idx)
/* No-operation: we are always 5V */
}
-static uint8_t vbus_en[CONFIG_USB_PD_PORT_COUNT];
-static uint8_t vbus_rp[CONFIG_USB_PD_PORT_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5};
+static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5};
int board_vbus_source_enabled(int port)
{
@@ -278,8 +278,8 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
diff --git a/board/rowan/board.c b/board/rowan/board.c
index 1a8ec50102..f5755f178d 100644
--- a/board/rowan/board.c
+++ b/board/rowan/board.c
@@ -121,7 +121,7 @@ const struct spi_device_t spi_devices[] = {
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/* TCPC */
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR, &anx7688_tcpm_drv},
};
@@ -153,7 +153,7 @@ const struct temp_sensor_t temp_sensors[] = {
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.driver = &anx7688_usb_mux_driver,
},
@@ -282,7 +282,7 @@ int board_set_active_charge_port(int charge_port)
{
/* charge port is a physical port */
int is_real_port = (charge_port >= 0 &&
- charge_port < CONFIG_USB_PD_PORT_COUNT);
+ charge_port < CONFIG_USB_PD_PORT_MAX_COUNT);
/* check if we are source VBUS on the port */
int source = gpio_get_level(GPIO_USB_C0_5V_EN);
diff --git a/board/rowan/board.h b/board/rowan/board.h
index 839dbdf262..f3da26ba21 100644
--- a/board/rowan/board.h
+++ b/board/rowan/board.h
@@ -96,7 +96,7 @@
#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_PORT_COUNT 1
+#define CONFIG_USB_PD_PORT_MAX_COUNT 1
#define CONFIG_USB_PD_TCPM_MUX
#define CONFIG_USB_PD_TCPM_ANX7688
#define CONFIG_USB_PD_TCPM_TCPCI
diff --git a/board/rowan/usb_pd_policy.c b/board/rowan/usb_pd_policy.c
index c83fb2835c..83c815ec50 100644
--- a/board/rowan/usb_pd_policy.c
+++ b/board/rowan/usb_pd_policy.c
@@ -209,9 +209,9 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
/* DP Status VDM as returned by UFP */
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
diff --git a/board/samus_pd/board.c b/board/samus_pd/board.c
index 3087b9ce03..c1d0ccff02 100644
--- a/board/samus_pd/board.c
+++ b/board/samus_pd/board.c
@@ -318,7 +318,7 @@ int board_set_active_charge_port(int charge_port)
{
/* charge port is a realy physical port */
int is_real_port = (charge_port >= 0 &&
- charge_port < CONFIG_USB_PD_PORT_COUNT);
+ charge_port < CONFIG_USB_PD_PORT_MAX_COUNT);
/* check if we are source vbus on that port */
if (is_real_port && usb_charger_port_is_sourcing_vbus(charge_port)) {
CPRINTS("Skip enable p%d", charge_port);
diff --git a/board/samus_pd/board.h b/board/samus_pd/board.h
index 2efeb35d56..48b5de5b4e 100644
--- a/board/samus_pd/board.h
+++ b/board/samus_pd/board.h
@@ -63,7 +63,7 @@
#define CONFIG_USB_PD_FLASH_ERASE_CHECK
#define CONFIG_USB_PD_INTERNAL_COMP
#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_TCPC
#define CONFIG_USB_PD_TCPM_STUB
#define CONFIG_USB_PD_VBUS_DETECT_GPIO
diff --git a/board/samus_pd/usb_mux.c b/board/samus_pd/usb_mux.c
index 268c0c5843..2c3a0b3a45 100644
--- a/board/samus_pd/usb_mux.c
+++ b/board/samus_pd/usb_mux.c
@@ -37,7 +37,7 @@ static const struct usb_port_mux mux_gpios[] = {
.ss2_dp_mode = GPIO_USB_C1_SS2_DP_MODE,
},
};
-BUILD_ASSERT(ARRAY_SIZE(mux_gpios) == CONFIG_USB_PD_PORT_COUNT);
+BUILD_ASSERT(ARRAY_SIZE(mux_gpios) == CONFIG_USB_PD_PORT_MAX_COUNT);
static int board_init_usb_mux(int port)
@@ -105,7 +105,7 @@ const struct usb_mux_driver board_custom_usb_mux_driver = {
.get = board_get_usb_mux,
};
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.driver = &board_custom_usb_mux_driver,
},
diff --git a/board/samus_pd/usb_pd_policy.c b/board/samus_pd/usb_pd_policy.c
index e7cf6e4a50..477288f2c8 100644
--- a/board/samus_pd/usb_pd_policy.c
+++ b/board/samus_pd/usb_pd_policy.c
@@ -214,9 +214,9 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
return 0;
}
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
/* DP Status VDM as returned by UFP */
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
diff --git a/board/scarlet/board.c b/board/scarlet/board.c
index 7f217bcd80..fecd257b1a 100644
--- a/board/scarlet/board.c
+++ b/board/scarlet/board.c
@@ -122,11 +122,11 @@ const struct spi_device_t spi_devices[] = {
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{I2C_PORT_TCPC0, FUSB302_I2C_SLAVE_ADDR, &fusb302_tcpm_drv},
};
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.driver = &virtual_usb_mux_driver,
.hpd_update = &virtual_hpd_update,
diff --git a/board/scarlet/board.h b/board/scarlet/board.h
index fdb262ad63..0906eb919a 100644
--- a/board/scarlet/board.h
+++ b/board/scarlet/board.h
@@ -111,7 +111,7 @@
#define CONFIG_USB_PD_DISCHARGE_GPIO
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_PORT_COUNT 1
+#define CONFIG_USB_PD_PORT_MAX_COUNT 1
#define CONFIG_USB_PD_TCPM_FUSB302
#define CONFIG_USB_PD_TCPM_TCPCI
#define CONFIG_USB_PD_VBUS_DETECT_TCPC
diff --git a/board/scarlet/usb_pd_policy.c b/board/scarlet/usb_pd_policy.c
index e75e99f01c..b062b1551b 100644
--- a/board/scarlet/usb_pd_policy.c
+++ b/board/scarlet/usb_pd_policy.c
@@ -216,9 +216,9 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static int dp_flags[CONFIG_USB_PD_PORT_COUNT];
+static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
/* DP Status VDM as returned by UFP */
-static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
+static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_safe_dp_mode(int port)
{
diff --git a/board/servo_v4/board.h b/board/servo_v4/board.h
index 1c41366352..1c5eb8d7a8 100644
--- a/board/servo_v4/board.h
+++ b/board/servo_v4/board.h
@@ -96,7 +96,7 @@
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_DYNAMIC_SRC_CAP
#define CONFIG_USB_PD_INTERNAL_COMP
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_TCPC
#define CONFIG_USB_PD_TCPM_STUB
#undef CONFIG_USB_PD_PULLUP
diff --git a/board/servo_v4/usb_pd_policy.c b/board/servo_v4/usb_pd_policy.c
index f874e4dbe9..cccb61a772 100644
--- a/board/servo_v4/usb_pd_policy.c
+++ b/board/servo_v4/usb_pd_policy.c
@@ -56,7 +56,7 @@ struct vbus_prop {
int mv;
int ma;
};
-static struct vbus_prop vbus[CONFIG_USB_PD_PORT_COUNT];
+static struct vbus_prop vbus[CONFIG_USB_PD_PORT_MAX_COUNT];
static int active_charge_port = CHARGE_PORT_NONE;
static enum charge_supplier active_charge_supplier;
static uint8_t vbus_rp = TYPEC_RP_RESERVED;
diff --git a/board/strago/board.c b/board/strago/board.c
index 7b7304e374..d577da937f 100644
--- a/board/strago/board.c
+++ b/board/strago/board.c
@@ -105,7 +105,7 @@ const struct i2c_port_t i2c_ports[] = {
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR, &tcpci_tcpm_drv},
};
@@ -132,7 +132,7 @@ struct pi3usb9281_config pi3usb9281_chips[] = {
BUILD_ASSERT(ARRAY_SIZE(pi3usb9281_chips) ==
CONFIG_BC12_DETECT_PI3USB9281_CHIP_COUNT);
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.port_addr = 0xaa,
.driver = &pi3usb30532_usb_mux_driver,
@@ -276,7 +276,7 @@ int board_set_active_charge_port(int charge_port)
{
/* charge port is a realy physical port */
int is_real_port = (charge_port >= 0 &&
- charge_port < CONFIG_USB_PD_PORT_COUNT);
+ charge_port < CONFIG_USB_PD_PORT_MAX_COUNT);
/* check if we are source vbus on that port */
int source = gpio_get_level(GPIO_USB_C0_5V_EN);
diff --git a/board/strago/board.h b/board/strago/board.h
index 64721ca95f..6563485f09 100644
--- a/board/strago/board.h
+++ b/board/strago/board.h
@@ -39,7 +39,7 @@
#define CONFIG_USB_PD_ALT_MODE
#define CONFIG_USB_PD_ALT_MODE_DFP
#define CONFIG_USB_PD_DUAL_ROLE
-#define CONFIG_USB_PD_PORT_COUNT 1
+#define CONFIG_USB_PD_PORT_MAX_COUNT 1
#define CONFIG_USB_PD_TCPM_TCPCI
#define CONFIG_USB_PD_TRY_SRC
#define CONFIG_USB_PD_VBUS_DETECT_GPIO
diff --git a/board/strago/usb_pd_policy.c b/board/strago/usb_pd_policy.c
index 748e08a40e..0a12fec103 100644
--- a/board/strago/usb_pd_policy.c
+++ b/board/strago/usb_pd_policy.c
@@ -245,7 +245,7 @@ static int svdm_dp_config(int port, uint32_t *payload)
* timestamp of the next possible toggle to ensure the 2-ms spacing
* between IRQ_HPD.
*/
-static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_COUNT];
+static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_MAX_COUNT];
static void svdm_dp_post_config(int port)
{
diff --git a/board/twinkie/board.h b/board/twinkie/board.h
index be12550137..b1cb4aa444 100644
--- a/board/twinkie/board.h
+++ b/board/twinkie/board.h
@@ -23,7 +23,7 @@
#define CONFIG_USB_POWER_DELIVERY
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_INTERNAL_COMP
-#define CONFIG_USB_PD_PORT_COUNT 1
+#define CONFIG_USB_PD_PORT_MAX_COUNT 1
#define CONFIG_USB_PD_TCPC
#define CONFIG_USB_PD_TCPM_STUB
#define CONFIG_USB_PD_VBUS_DETECT_GPIO
diff --git a/board/yorp/board.c b/board/yorp/board.c
index 3a9091aef4..2c69629779 100644
--- a/board/yorp/board.c
+++ b/board/yorp/board.c
@@ -245,7 +245,7 @@ DECLARE_HOOK(HOOK_INIT, post_old_board_warning, HOOK_PRIO_INIT_I2C + 1);
void board_overcurrent_event(int port, int is_overcurrented)
{
/* Sanity check the port. */
- if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT))
+ if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT))
return;
/* Note that the level is inverted because the pin is active low. */
diff --git a/board/zinger/board.h b/board/zinger/board.h
index 940eaf7a57..1b5c0febcd 100644
--- a/board/zinger/board.h
+++ b/board/zinger/board.h
@@ -60,7 +60,7 @@
#undef CONFIG_EVENT_LOG_SIZE
#define CONFIG_EVENT_LOG_SIZE 256
#define CONFIG_USB_PD_LOW_POWER_IDLE_WHEN_CONNECTED
-#define CONFIG_USB_PD_PORT_COUNT 1
+#define CONFIG_USB_PD_PORT_MAX_COUNT 1
#define CONFIG_USB_PD_TCPC
#define CONFIG_USB_PD_TCPM_STUB
#undef CONFIG_USB_PD_RX_COMP_IRQ
diff --git a/chip/host/usb_pd_phy.c b/chip/host/usb_pd_phy.c
index 96d7f06ea8..c0d6fe22d7 100644
--- a/chip/host/usb_pd_phy.c
+++ b/chip/host/usb_pd_phy.c
@@ -35,7 +35,7 @@ static struct pd_physical {
int last_edge_written;
uint8_t out_msg[PD_BIT_LEN / 5];
int verified_idx;
-} pd_phy[CONFIG_USB_PD_PORT_COUNT];
+} pd_phy[CONFIG_USB_PD_PORT_MAX_COUNT];
static const uint16_t enc4b5b[] = {
0x1E, 0x09, 0x14, 0x15, 0x0A, 0x0B, 0x0E, 0x0F, 0x12, 0x13, 0x16,
diff --git a/chip/mec1322/system.c b/chip/mec1322/system.c
index 449d234343..db5e0934c3 100644
--- a/chip/mec1322/system.c
+++ b/chip/mec1322/system.c
@@ -291,20 +291,20 @@ void system_hibernate(uint32_t seconds, uint32_t microseconds)
if (board_hibernate_late)
board_hibernate_late();
-#ifdef CONFIG_USB_PD_PORT_COUNT
+#ifdef CONFIG_USB_PD_PORT_MAX_COUNT
/*
* Leave USB-C charging enabled in hibernate, in order to
* allow wake-on-plug. 5V enable must be pulled low.
*/
-#if CONFIG_USB_PD_PORT_COUNT > 0
+#if CONFIG_USB_PD_PORT_MAX_COUNT > 0
gpio_set_flags(GPIO_USB_C0_5V_EN, GPIO_PULL_DOWN | GPIO_INPUT);
gpio_set_level(GPIO_USB_C0_CHARGE_EN_L, 0);
#endif
-#if CONFIG_USB_PD_PORT_COUNT > 1
+#if CONFIG_USB_PD_PORT_MAX_COUNT > 1
gpio_set_flags(GPIO_USB_C1_5V_EN, GPIO_PULL_DOWN | GPIO_INPUT);
gpio_set_level(GPIO_USB_C1_CHARGE_EN_L, 0);
#endif
-#endif /* CONFIG_USB_PD_PORT_COUNT */
+#endif /* CONFIG_USB_PD_PORT_MAX_COUNT */
if (hibernate_wake_pins_used > 0) {
for (i = 0; i < hibernate_wake_pins_used; ++i) {
diff --git a/chip/npcx/system.c b/chip/npcx/system.c
index 946072e200..0ae6aac009 100644
--- a/chip/npcx/system.c
+++ b/chip/npcx/system.c
@@ -188,10 +188,10 @@ static int bbram_idx_lookup(enum system_bbram_idx idx)
return BBRM_DATA_INDEX_PD0;
if (idx == SYSTEM_BBRAM_IDX_PD1)
return BBRM_DATA_INDEX_PD1;
-#if CONFIG_USB_PD_PORT_COUNT >= 3
+#if CONFIG_USB_PD_PORT_MAX_COUNT >= 3
if (idx == SYSTEM_BBRAM_IDX_PD2)
return BBRM_DATA_INDEX_PD2;
-#endif /* CONFIG_USB_PD_PORT_COUNT >= 3 */
+#endif /* CONFIG_USB_PD_PORT_MAX_COUNT >= 3 */
#endif /* defined(CONFIG_USB_PD_DUAL_ROLE) */
#ifdef CONFIG_VBOOT_EFS
if (idx == SYSTEM_BBRAM_IDX_TRY_SLOT)
diff --git a/chip/stm32/system.c b/chip/stm32/system.c
index c7ff4f23d9..b4d11b0349 100644
--- a/chip/stm32/system.c
+++ b/chip/stm32/system.c
@@ -77,7 +77,7 @@ enum bkpdata_index {
BUILD_ASSERT(STM32_BKP_ENTRIES >= BKPDATA_COUNT);
#ifdef CONFIG_USB_PD_DUAL_ROLE
-BUILD_ASSERT(CONFIG_USB_PD_PORT_COUNT <= 2);
+BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT <= 2);
#endif
/**
diff --git a/chip/stm32/usb_pd_phy.c b/chip/stm32/usb_pd_phy.c
index 8c6ecca110..43e0b923e8 100644
--- a/chip/stm32/usb_pd_phy.c
+++ b/chip/stm32/usb_pd_phy.c
@@ -70,14 +70,14 @@ static struct pd_physical {
/* Pointers to timer register for each port */
timer_ctlr_t *tim_tx;
timer_ctlr_t *tim_rx;
-} pd_phy[CONFIG_USB_PD_PORT_COUNT];
+} pd_phy[CONFIG_USB_PD_PORT_MAX_COUNT];
/* keep track of RX edge timing in order to trigger receive */
-static timestamp_t rx_edge_ts[CONFIG_USB_PD_PORT_COUNT][PD_RX_TRANSITION_COUNT];
-static int rx_edge_ts_idx[CONFIG_USB_PD_PORT_COUNT];
+static timestamp_t rx_edge_ts[CONFIG_USB_PD_PORT_MAX_COUNT][PD_RX_TRANSITION_COUNT];
+static int rx_edge_ts_idx[CONFIG_USB_PD_PORT_MAX_COUNT];
/* keep track of transmit polarity for DMA interrupt */
-static int tx_dma_polarities[CONFIG_USB_PD_PORT_COUNT];
+static int tx_dma_polarities[CONFIG_USB_PD_PORT_MAX_COUNT];
void pd_init_dequeue(int port)
{
@@ -452,7 +452,7 @@ void pd_rx_handler(void)
int next_idx;
pending = STM32_EXTI_PR;
- for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) {
+ for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) {
if (pending & EXTI_COMP_MASK(i)) {
rx_edge_ts[i][rx_edge_ts_idx[i]].val = get_time().val;
next_idx = (rx_edge_ts_idx[i] ==
diff --git a/common/charge_manager.c b/common/charge_manager.c
index 6793b095b4..1ccc6b8b71 100644
--- a/common/charge_manager.c
+++ b/common/charge_manager.c
@@ -84,13 +84,13 @@ static timestamp_t delayed_override_deadline;
#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
/* 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);
#endif
-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
@@ -123,7 +123,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)
@@ -723,7 +723,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
@@ -1073,7 +1073,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] ==
@@ -1101,7 +1101,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;
@@ -1243,7 +1243,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 d572115043..817ebbec95 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 */
@@ -162,7 +162,7 @@ void chg_ramp_task(void *u)
static uint8_t values_have_changed_at_least_once;
/* 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;
while (1) {
@@ -367,7 +367,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 a21ee33b94..3e51943311 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 fb6ed6c4c0..f86e5aafa3 100644
--- a/common/i2c_master.c
+++ b/common/i2c_master.c
@@ -772,7 +772,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;
/*
@@ -784,7 +784,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 (!tcpc_config[i].i2c_slave_addr)
continue;
diff --git a/common/pd_log.c b/common/pd_log.c
index 39a4edd207..72bf8e7765 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 int 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 103a32206e..0a76e3a0df 100644
--- a/common/peripheral.c
+++ b/common/peripheral.c
@@ -30,8 +30,8 @@ static int 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 = EC_BUS_TYPE_I2C;
resp->i2c_info.port = tcpc_config[params->index].i2c_host_port;
@@ -39,7 +39,7 @@ static int hc_locate_chip(struct host_cmd_handler_args *args)
tcpc_config[params->index].i2c_slave_addr >> 1;
#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 5f48466420..454f0daebf 100644
--- a/common/system.c
+++ b/common/system.c
@@ -916,7 +916,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 361d019a52..aba3c92134 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
@@ -86,7 +86,7 @@ static void usb_charger_init(void)
int i;
/* Initialize all charge suppliers */
- for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) {
+ for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) {
charge_manager_update_charge(CHARGE_SUPPLIER_PROPRIETARY,
i, NULL);
charge_manager_update_charge(CHARGE_SUPPLIER_BC12_CDP,
diff --git a/common/usb_pd_policy.c b/common/usb_pd_policy.c
index 25949289ee..e38195bf14 100644
--- a/common/usb_pd_policy.c
+++ b/common/usb_pd_policy.c
@@ -81,8 +81,8 @@ __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 */
@@ -276,7 +276,7 @@ int pd_charge_from_device(uint16_t vid, uint16_t pid)
#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];
void pd_dfp_pe_init(int port)
{
@@ -654,7 +654,7 @@ static int command_pe(int argc, char **argv)
return EC_ERROR_PARAM_COUNT;
/* command: pe <port> <subcmd> <args> */
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);
@@ -871,7 +871,7 @@ static int 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);
@@ -893,7 +893,7 @@ static int 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 */
@@ -1022,17 +1022,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 018894eb15..38845c287a 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -34,7 +34,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
@@ -67,7 +67,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...)
@@ -115,8 +115,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 */
@@ -249,7 +249,7 @@ static struct pd_protocol {
* of our own.
*/
uint64_t ready_state_holdoff_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[] = {
@@ -760,11 +760,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);
@@ -1350,7 +1350,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));
@@ -2219,7 +2219,7 @@ static void pd_update_try_source(void)
int batt_soc = 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;
/*
@@ -2243,7 +2243,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;
}
@@ -2258,7 +2258,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
@@ -2467,7 +2467,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 */
@@ -2579,13 +2579,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
@@ -2600,7 +2600,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");
@@ -2629,7 +2629,7 @@ static int pd_restart_tcpc(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)
{
@@ -2657,9 +2657,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();
@@ -4438,7 +4438,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
@@ -4455,7 +4455,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");
}
@@ -4465,7 +4465,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;
task_set_event(PD_PORT_TO_TASK_ID(i),
@@ -4481,7 +4481,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 |
@@ -4600,13 +4600,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;
@@ -4848,7 +4848,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)
@@ -5035,7 +5035,7 @@ DECLARE_CONSOLE_COMMAND(pd, command_pd,
static int 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;
@@ -5070,7 +5070,7 @@ static int 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 ||
@@ -5151,7 +5151,7 @@ static int 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)
@@ -5276,7 +5276,7 @@ static int 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;
@@ -5303,7 +5303,7 @@ static int 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))
@@ -5332,7 +5332,8 @@ static int 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) {
@@ -5366,11 +5367,11 @@ DECLARE_HOST_COMMAND(EC_CMD_USB_PD_SET_AMODE,
static int 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 d50b39baa3..0d53901acf 100644
--- a/common/usb_pd_tcpc.c
+++ b/common/usb_pd_tcpc.c
@@ -257,7 +257,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)
{
@@ -1047,11 +1047,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);
@@ -1099,7 +1099,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;
}
@@ -1130,13 +1130,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 */
@@ -1155,7 +1155,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),
@@ -1359,7 +1359,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_ppc.c b/common/usbc_ppc.c
index 9ec33a3ec1..5c3dfd47c3 100644
--- a/common/usbc_ppc.c
+++ b/common/usbc_ppc.c
@@ -21,7 +21,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;
diff --git a/driver/bc12/max14637.c b/driver/bc12/max14637.c
index 1990ad268f..0eb449cacf 100644
--- a/driver/bc12/max14637.c
+++ b/driver/bc12/max14637.c
@@ -150,7 +150,7 @@ void usb_charger_task(void *u)
const int port = (intptr_t)u;
uint32_t evt;
- ASSERT(port >= 0 && port < CONFIG_USB_PD_PORT_COUNT);
+ ASSERT(port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
detect_or_power_down_ic(port);
diff --git a/driver/bc12/max14637.h b/driver/bc12/max14637.h
index 7013e46fb1..eb4f6dc3c6 100644
--- a/driver/bc12/max14637.h
+++ b/driver/bc12/max14637.h
@@ -28,4 +28,4 @@ struct max14637_config_t {
/*
* Array that contains boards-specific configuration for BC 1.2 charging chips.
*/
-extern const struct max14637_config_t max14637_config[CONFIG_USB_PD_PORT_COUNT];
+extern const struct max14637_config_t max14637_config[CONFIG_USB_PD_PORT_MAX_COUNT];
diff --git a/driver/bc12/pi3usb9281.c b/driver/bc12/pi3usb9281.c
index f1bd3ce8d4..6ea4ca344f 100644
--- a/driver/bc12/pi3usb9281.c
+++ b/driver/bc12/pi3usb9281.c
@@ -38,8 +38,8 @@
#define PI3USB9281_RESET_DEBOUNCE_DELAY_MS 100
/* Store the state of our USB data switches so that they can be restored. */
-static int usb_switch_state[CONFIG_USB_PD_PORT_COUNT];
-static struct mutex usb_switch_lock[CONFIG_USB_PD_PORT_COUNT];
+static int usb_switch_state[CONFIG_USB_PD_PORT_MAX_COUNT];
+static struct mutex usb_switch_lock[CONFIG_USB_PD_PORT_MAX_COUNT];
static int pi3usb9281_reset(int port);
static int pi3usb9281_get_interrupts(int port);
diff --git a/driver/charger/bd9995x.c b/driver/charger/bd9995x.c
index 9ab69a7c38..4eea28b506 100644
--- a/driver/charger/bd9995x.c
+++ b/driver/charger/bd9995x.c
@@ -343,7 +343,7 @@ static int bd9995x_get_charger_op_status(int *status)
}
#ifdef HAS_TASK_USB_CHG
-static int bc12_detected_type[CONFIG_USB_PD_PORT_COUNT];
+static int bc12_detected_type[CONFIG_USB_PD_PORT_MAX_COUNT];
/* Mutex for UCD_SET regsiters, lock before read / mask / write. */
static struct mutex ucd_set_mutex[BD9995X_CHARGE_PORT_COUNT];
@@ -1261,7 +1261,7 @@ void usb_charger_task(void *u)
static int initialized;
int changed, port, interrupts;
int sleep_usec;
- uint64_t bc12_det_mark[CONFIG_USB_PD_PORT_COUNT];
+ uint64_t bc12_det_mark[CONFIG_USB_PD_PORT_MAX_COUNT];
#ifdef CONFIG_USB_PD_DISCHARGE
int vbus_reg, voltage;
#endif
@@ -1271,7 +1271,7 @@ void usb_charger_task(void *u)
vbus_voltage = 0;
#endif
- for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) {
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) {
bc12_detected_type[port] = CHARGE_SUPPLIER_NONE;
bd9995x_enable_vbus_detect_interrupts(port, 1);
bc12_det_mark[port] = 0;
@@ -1280,7 +1280,7 @@ void usb_charger_task(void *u)
while (1) {
sleep_usec = -1;
changed = 0;
- for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) {
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) {
/* Get port interrupts */
interrupts = bd9995x_get_interrupts(port);
if (interrupts & BD9995X_CMD_INT_VBUS_DET ||
diff --git a/driver/ppc/nx20p348x.c b/driver/ppc/nx20p348x.c
index 4aa6700509..6836e336d3 100644
--- a/driver/ppc/nx20p348x.c
+++ b/driver/ppc/nx20p348x.c
@@ -25,10 +25,10 @@
static uint32_t irq_pending; /* Bitmask of ports signaling an interrupt. */
#define NX20P348X_DB_EXIT_FAIL_THRESHOLD 10
-static int db_exit_fail_count[CONFIG_USB_PD_PORT_COUNT];
+static int db_exit_fail_count[CONFIG_USB_PD_PORT_MAX_COUNT];
#define NX20P348X_FLAGS_SOURCE_ENABLED (1 << 0)
-static uint8_t flags[CONFIG_USB_PD_PORT_COUNT];
+static uint8_t flags[CONFIG_USB_PD_PORT_MAX_COUNT];
static int read_reg(uint8_t port, int reg, int *regval)
{
@@ -384,7 +384,7 @@ static void nx20p348x_irq_deferred(void)
int i;
uint32_t pending = atomic_read_clear(&irq_pending);
- for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++)
+ for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++)
if ((1 << i) & pending)
nx20p348x_handle_interrupt(i);
}
diff --git a/driver/ppc/sn5s330.c b/driver/ppc/sn5s330.c
index 6b48c8650b..5f5e877ae2 100644
--- a/driver/ppc/sn5s330.c
+++ b/driver/ppc/sn5s330.c
@@ -27,7 +27,7 @@
#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
static uint32_t irq_pending; /* Bitmask of ports signaling an interrupt. */
-static int source_enabled[CONFIG_USB_PD_PORT_COUNT];
+static int source_enabled[CONFIG_USB_PD_PORT_MAX_COUNT];
static int read_reg(uint8_t port, int reg, int *regval)
{
@@ -672,7 +672,7 @@ static void sn5s330_irq_deferred(void)
int i;
uint32_t pending = atomic_read_clear(&irq_pending);
- for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++)
+ for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++)
if ((1 << i) & pending)
sn5s330_handle_interrupt(i);
}
diff --git a/driver/ppc/syv682x.c b/driver/ppc/syv682x.c
index d7c050cbce..c69c984e46 100644
--- a/driver/ppc/syv682x.c
+++ b/driver/ppc/syv682x.c
@@ -17,7 +17,7 @@
/* 0 -> CC1, 1 -> CC2 */
#define SYV682X_FLAGS_CC_POLARITY (1 << 1)
#define SYV682X_FLAGS_VBUS_PRESENT (1 << 2)
-static uint8_t flags[CONFIG_USB_PD_PORT_COUNT];
+static uint8_t flags[CONFIG_USB_PD_PORT_MAX_COUNT];
#define SYV682X_VBUS_DET_THRESH_MV 4000
diff --git a/driver/tcpm/anx7447.c b/driver/tcpm/anx7447.c
index eae3b94c54..3df6109a0e 100644
--- a/driver/tcpm/anx7447.c
+++ b/driver/tcpm/anx7447.c
@@ -47,7 +47,7 @@ struct anx_state {
static int anx7447_mux_set(int port, mux_state_t mux_state);
-static struct anx_state anx[CONFIG_USB_PD_PORT_COUNT];
+static struct anx_state anx[CONFIG_USB_PD_PORT_MAX_COUNT];
/*
* ANX7447 has two co-existence I2C slave addresses, TCPC slave address and
@@ -438,7 +438,7 @@ static void anx7447_tcpc_alert(int port)
* timestamp of the next possible toggle to ensure the 2-ms spacing
* between IRQ_HPD.
*/
-static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_COUNT];
+static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_MAX_COUNT];
void anx7447_tcpc_update_hpd_status(int port, int hpd_lvl, int hpd_irq)
{
diff --git a/driver/tcpm/anx74xx.c b/driver/tcpm/anx74xx.c
index 94d1b292a2..c23174206a 100644
--- a/driver/tcpm/anx74xx.c
+++ b/driver/tcpm/anx74xx.c
@@ -43,10 +43,10 @@ struct anx_state {
reg | 0x01); \
} while (0)
-static struct anx_state anx[CONFIG_USB_PD_PORT_COUNT];
+static struct anx_state anx[CONFIG_USB_PD_PORT_MAX_COUNT];
/* Save the selected rp value */
-static int selected_rp[CONFIG_USB_PD_PORT_COUNT];
+static int selected_rp[CONFIG_USB_PD_PORT_MAX_COUNT];
static int anx74xx_tcpm_init(int port);
@@ -207,7 +207,7 @@ static void anx74xx_tcpc_discharge_vbus(int port, int enable)
* timestamp of the next possible toggle to ensure the 2-ms spacing
* between IRQ_HPD.
*/
-static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_COUNT];
+static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_MAX_COUNT];
void anx74xx_tcpc_update_hpd_status(int port, int hpd_lvl, int hpd_irq)
{
diff --git a/driver/tcpm/fusb302.c b/driver/tcpm/fusb302.c
index 7b736e5b23..18066f78d4 100644
--- a/driver/tcpm/fusb302.c
+++ b/driver/tcpm/fusb302.c
@@ -29,7 +29,7 @@ static struct fusb302_chip_state {
int rx_enable;
uint8_t mdac_vnc;
uint8_t mdac_rd;
-} state[CONFIG_USB_PD_PORT_COUNT];
+} state[CONFIG_USB_PD_PORT_MAX_COUNT];
/*
* Bring the FUSB302 out of reset after Hard Reset signaling. This will
diff --git a/driver/tcpm/it83xx.c b/driver/tcpm/it83xx.c
index d34505e641..faa0859e56 100644
--- a/driver/tcpm/it83xx.c
+++ b/driver/tcpm/it83xx.c
@@ -527,11 +527,11 @@ static int it83xx_tcpm_set_rx_enable(int port, int enable)
}
/* 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 (IT83XX_USBPD_GCR(i) | USBPD_REG_MASK_BMC_PHY)
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);
diff --git a/driver/tcpm/ps8xxx.c b/driver/tcpm/ps8xxx.c
index e95a70191a..bbdf8f1a82 100644
--- a/driver/tcpm/ps8xxx.c
+++ b/driver/tcpm/ps8xxx.c
@@ -36,7 +36,7 @@
* timestamp of the next possible toggle to ensure the 2-ms spacing
* between IRQ_HPD.
*/
-static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_COUNT];
+static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_MAX_COUNT];
static int dp_set_hpd(int port, int enable)
{
diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c
index c9e6c3c7a1..a20601a958 100644
--- a/driver/tcpm/tcpci.c
+++ b/driver/tcpm/tcpci.c
@@ -23,10 +23,10 @@
#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
-static int tcpc_vbus[CONFIG_USB_PD_PORT_COUNT];
+static int tcpc_vbus[CONFIG_USB_PD_PORT_MAX_COUNT];
/* Save the selected rp value */
-static int selected_rp[CONFIG_USB_PD_PORT_COUNT];
+static int selected_rp[CONFIG_USB_PD_PORT_MAX_COUNT];
#ifdef CONFIG_USB_PD_TCPC_LOW_POWER
@@ -382,7 +382,7 @@ struct queue {
uint32_t tail;
struct cached_tcpm_message buffer[CACHE_DEPTH];
};
-static struct queue cached_messages[CONFIG_USB_PD_PORT_COUNT];
+static struct queue cached_messages[CONFIG_USB_PD_PORT_MAX_COUNT];
/* Note this method can be called from an interrupt context. */
int tcpm_enqueue_message(const int port)
@@ -610,12 +610,12 @@ int tcpci_get_chip_info(int port, int live,
struct ec_response_pd_chip_info_v1 **chip_info)
{
static struct ec_response_pd_chip_info_v1
- info[CONFIG_USB_PD_PORT_COUNT];
+ info[CONFIG_USB_PD_PORT_MAX_COUNT];
struct ec_response_pd_chip_info_v1 *i;
int error;
int val;
- if (port >= CONFIG_USB_PD_PORT_COUNT)
+ if (port >= CONFIG_USB_PD_PORT_MAX_COUNT)
return EC_ERROR_INVAL;
i = &info[port];
diff --git a/driver/usb_mux.c b/driver/usb_mux.c
index f1b687e24a..ba683e98dd 100644
--- a/driver/usb_mux.c
+++ b/driver/usb_mux.c
@@ -20,7 +20,7 @@ static int enable_debug_prints;
* Flags will reset to 0 after sysjump; This works for current flags as LPM will
* get reset in the init method which is called during PD task startup.
*/
-static uint8_t flags[CONFIG_USB_PD_PORT_COUNT];
+static uint8_t flags[CONFIG_USB_PD_PORT_MAX_COUNT];
#define USB_MUX_FLAG_IN_LPM (1 << 0) /* Device is in low power mode. */
@@ -59,7 +59,7 @@ void usb_mux_init(int port)
const struct usb_mux *mux = &usb_muxes[port];
int res;
- ASSERT(port >= 0 && port < CONFIG_USB_PD_PORT_COUNT);
+ ASSERT(port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
res = mux->driver->init(port);
if (res) {
@@ -194,7 +194,7 @@ static int command_typec(int argc, char **argv)
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_PARAM1;
if (argc < 3) {
@@ -233,7 +233,7 @@ static int hc_usb_pd_mux_info(struct host_cmd_handler_args *args)
int port = p->port;
const struct usb_mux *mux;
- if (port >= CONFIG_USB_PD_PORT_COUNT)
+ if (port >= CONFIG_USB_PD_PORT_MAX_COUNT)
return EC_RES_INVALID_PARAM;
mux = &usb_muxes[port];
diff --git a/driver/usb_mux_virtual.c b/driver/usb_mux_virtual.c
index 433c5bcdbe..b1356caac6 100644
--- a/driver/usb_mux_virtual.c
+++ b/driver/usb_mux_virtual.c
@@ -11,8 +11,8 @@
#include "usb_mux.h"
#include "util.h"
-static mux_state_t virtual_mux_state[CONFIG_USB_PD_PORT_COUNT];
-static int hpd_irq_state[CONFIG_USB_PD_PORT_COUNT];
+static mux_state_t virtual_mux_state[CONFIG_USB_PD_PORT_MAX_COUNT];
+static int hpd_irq_state[CONFIG_USB_PD_PORT_MAX_COUNT];
static int virtual_init(int port)
{
diff --git a/fuzz/fuzz_config.h b/fuzz/fuzz_config.h
index 362df69c56..161edc80cb 100644
--- a/fuzz/fuzz_config.h
+++ b/fuzz/fuzz_config.h
@@ -88,7 +88,7 @@ enum nvmem_users {
#if defined(TEST_USB_PD_FUZZ)
#define CONFIG_USB_POWER_DELIVERY
#define CONFIG_USB_PD_DUAL_ROLE
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_SHA256
#define CONFIG_SW_CRC
#endif /* TEST_USB_PD_FUZZ */
diff --git a/fuzz/usb_pd_fuzz.c b/fuzz/usb_pd_fuzz.c
index 2d8d0a178e..9b2c9276d2 100644
--- a/fuzz/usb_pd_fuzz.c
+++ b/fuzz/usb_pd_fuzz.c
@@ -56,7 +56,7 @@ struct tcpc_state {
struct message message;
};
-static struct tcpc_state mock_tcpc_state[CONFIG_USB_PD_PORT_COUNT];
+static struct tcpc_state mock_tcpc_state[CONFIG_USB_PD_PORT_MAX_COUNT];
static int mock_tcpm_get_cc(int port, int *cc1, int *cc2)
{
@@ -126,7 +126,7 @@ static const struct tcpm_drv mock_tcpm_drv = {
};
/* TCPC mux configuration */
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.drv = &mock_tcpm_drv,
},
diff --git a/include/charge_manager.h b/include/charge_manager.h
index 41ba9bcb59..93a4a77c2f 100644
--- a/include/charge_manager.h
+++ b/include/charge_manager.h
@@ -101,7 +101,7 @@ enum ceil_requestor {
};
#define CHARGE_PORT_COUNT \
- (CONFIG_USB_PD_PORT_COUNT + CONFIG_DEDICATED_CHARGE_PORT_COUNT)
+ (CONFIG_USB_PD_PORT_MAX_COUNT + CONFIG_DEDICATED_CHARGE_PORT_COUNT)
#if (CONFIG_DEDICATED_CHARGE_PORT_COUNT > 0) && !defined(DEDICATED_CHARGE_PORT)
#error "DEDICATED_CHARGE_PORT must be defined"
#endif
diff --git a/include/config.h b/include/config.h
index acb9f991f8..c25e56c31f 100644
--- a/include/config.h
+++ b/include/config.h
@@ -3280,7 +3280,7 @@
#undef CONFIG_USB_PD_LOW_POWER_IDLE_WHEN_CONNECTED
/* Number of USB PD ports */
-#undef CONFIG_USB_PD_PORT_COUNT
+#undef CONFIG_USB_PD_PORT_MAX_COUNT
/* Simple DFP, such as power adapter, will not send discovery VDM on connect */
#undef CONFIG_USB_PD_SIMPLE_DFP
diff --git a/include/ec_commands.h b/include/ec_commands.h
index e86129db8e..69a78ac47f 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -4792,7 +4792,7 @@ struct ec_params_usb_pd_discovery_entry {
enum usb_pd_override_ports {
OVERRIDE_DONT_CHARGE = -2,
OVERRIDE_OFF = -1,
- /* [0, CONFIG_USB_PD_PORT_COUNT): Port# */
+ /* [0, CONFIG_USB_PD_PORT_MAX_COUNT): Port# */
};
struct ec_params_charge_port_override {
diff --git a/include/usb_pd.h b/include/usb_pd.h
index 20198015f7..e8c196d897 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -13,7 +13,7 @@
/* PD Host command timeout */
#define PD_HOST_COMMAND_TIMEOUT_US SECOND
-#ifdef CONFIG_USB_PD_PORT_COUNT
+#ifdef CONFIG_USB_PD_PORT_MAX_COUNT
/*
* Define PD_PORT_TO_TASK_ID() and TASK_ID_TO_PD_PORT() macros to
* go between PD port number and task ID. Assume that TASK_ID_PD_C0 is the
@@ -26,7 +26,7 @@
#define PD_PORT_TO_TASK_ID(port) -1 /* dummy task ID */
#define TASK_ID_TO_PD_PORT(id) 0
#endif /* CONFIG_COMMON_RUNTIME */
-#endif /* CONFIG_USB_PD_PORT_COUNT */
+#endif /* CONFIG_USB_PD_PORT_MAX_COUNT */
enum pd_rx_errors {
PD_RX_ERR_INVAL = -1, /* Invalid packet */
diff --git a/test/charge_manager.c b/test/charge_manager.c
index 90bdf37a66..f58850fe50 100644
--- a/test/charge_manager.c
+++ b/test/charge_manager.c
@@ -34,8 +34,8 @@ BUILD_ASSERT(ARRAY_SIZE(supplier_priority) == CHARGE_SUPPLIER_COUNT);
static unsigned int active_charge_limit = CHARGE_SUPPLIER_NONE;
static unsigned int active_charge_port = CHARGE_PORT_NONE;
static unsigned int charge_port_to_reject = CHARGE_PORT_NONE;
-static int new_power_request[CONFIG_USB_PD_PORT_COUNT];
-static int power_role[CONFIG_USB_PD_PORT_COUNT];
+static int new_power_request[CONFIG_USB_PD_PORT_MAX_COUNT];
+static int power_role[CONFIG_USB_PD_PORT_MAX_COUNT];
/* Callback functions called by CM on state change */
void board_set_charge_limit(int port, int supplier, int charge_ma,
@@ -77,7 +77,7 @@ enum battery_present battery_is_present(void)
static void clear_new_power_requests(void)
{
int i;
- for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; ++i)
+ for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; ++i)
new_power_request[i] = 0;
}
@@ -114,7 +114,7 @@ static void initialize_charge_table(int current, int voltage, int ceil)
charge.current = current;
charge.voltage = voltage;
- for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; ++i) {
+ for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; ++i) {
for (j = 0; j < CEIL_REQUESTOR_COUNT; ++j)
charge_manager_set_ceil(i, j, ceil);
charge_manager_update_dualrole(i, CAP_DEDICATED);
@@ -140,12 +140,12 @@ static int test_initialization(void)
/* Initialize all supplier/port pairs, except for the last one */
for (i = 0; i < CHARGE_SUPPLIER_COUNT; ++i)
- for (j = 0; j < CONFIG_USB_PD_PORT_COUNT; ++j) {
+ for (j = 0; j < CONFIG_USB_PD_PORT_MAX_COUNT; ++j) {
if (i == 0)
charge_manager_update_dualrole(j,
CAP_DEDICATED);
if (i == CHARGE_SUPPLIER_COUNT - 1 &&
- j == CONFIG_USB_PD_PORT_COUNT - 1)
+ j == CONFIG_USB_PD_PORT_MAX_COUNT - 1)
break;
charge_manager_update_charge(i, j, &charge);
}
@@ -156,7 +156,7 @@ static int test_initialization(void)
/* Update last pair and verify a charge port has been selected */
charge_manager_update_charge(CHARGE_SUPPLIER_COUNT-1,
- CONFIG_USB_PD_PORT_COUNT-1,
+ CONFIG_USB_PD_PORT_MAX_COUNT-1,
&charge);
wait_for_charge_manager_refresh();
TEST_ASSERT(active_charge_port != CHARGE_PORT_NONE);
diff --git a/test/test_config.h b/test/test_config.h
index 1dfe0a2ffd..b7772e841d 100644
--- a/test/test_config.h
+++ b/test/test_config.h
@@ -195,7 +195,7 @@ int ncp15wb_calculate_temp(uint16_t adc);
defined(TEST_USB_PD_REV30)
#define CONFIG_USB_POWER_DELIVERY
#define CONFIG_USB_PD_DUAL_ROLE
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_TCPC
#define CONFIG_USB_PD_TCPM_STUB
#define CONFIG_SHA256
@@ -212,7 +212,7 @@ int ncp15wb_calculate_temp(uint16_t adc);
#if defined(TEST_CHARGE_MANAGER) || defined(TEST_CHARGE_MANAGER_DRP_CHARGING)
#define CONFIG_CHARGE_MANAGER
#define CONFIG_USB_PD_DUAL_ROLE
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_BATTERY
#define CONFIG_BATTERY_SMART
#define CONFIG_I2C
@@ -228,7 +228,7 @@ int ncp15wb_calculate_temp(uint16_t adc);
#ifdef TEST_CHARGE_RAMP
#define CONFIG_CHARGE_RAMP_SW
-#define CONFIG_USB_PD_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#endif
#ifdef TEST_NVMEM
diff --git a/test/usb_pd.c b/test/usb_pd.c
index 9365983b35..bc6a3072f1 100644
--- a/test/usb_pd.c
+++ b/test/usb_pd.c
@@ -31,7 +31,7 @@ struct pd_port_t {
int partner_role; /* -1 for none */
int partner_polarity;
int rev;
-} pd_port[CONFIG_USB_PD_PORT_COUNT];
+} pd_port[CONFIG_USB_PD_PORT_MAX_COUNT];
static int give_back_called;
@@ -147,7 +147,7 @@ static void init_ports(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_port[i].host_mode = 0;
pd_port[i].partner_role = -1;
pd_port[i].has_vbus = 0;