diff options
author | Karthikeyan Ramasubramanian <kramasub@google.com> | 2019-10-02 14:27:47 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-11-01 18:43:42 +0000 |
commit | 9577704f30c7e824c0590264df22d95a2c706575 (patch) | |
tree | 566b5beeeae8b343803718101ba0b00c940506cb /driver | |
parent | e8121e83e478fef2d5a29304be900311f3f020c4 (diff) | |
download | chrome-ec-9577704f30c7e824c0590264df22d95a2c706575.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/+/1879337
Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Commit-Queue: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r-- | driver/bc12/max14637.c | 2 | ||||
-rw-r--r-- | driver/bc12/max14637.h | 3 | ||||
-rw-r--r-- | driver/bc12/pi3usb9201.c | 4 | ||||
-rw-r--r-- | driver/bc12/pi3usb9281.c | 2 | ||||
-rw-r--r-- | driver/charger/bd9995x.c | 8 | ||||
-rw-r--r-- | driver/ppc/aoz1380.c | 4 | ||||
-rw-r--r-- | driver/ppc/nx20p348x.c | 6 | ||||
-rw-r--r-- | driver/ppc/sn5s330.c | 4 | ||||
-rw-r--r-- | driver/ppc/syv682x.c | 2 | ||||
-rw-r--r-- | driver/retimer/bb_retimer.c | 2 | ||||
-rw-r--r-- | driver/tcpm/anx7447.c | 10 | ||||
-rw-r--r-- | driver/tcpm/anx74xx.c | 8 | ||||
-rw-r--r-- | driver/tcpm/fusb302.c | 2 | ||||
-rw-r--r-- | driver/tcpm/it83xx.c | 4 | ||||
-rw-r--r-- | driver/tcpm/nct38xx.c | 4 | ||||
-rw-r--r-- | driver/tcpm/ps8xxx.c | 2 | ||||
-rw-r--r-- | driver/tcpm/tcpci.c | 14 | ||||
-rw-r--r-- | driver/usb_mux/usb_mux.c | 8 | ||||
-rw-r--r-- | driver/usb_mux/virtual.c | 2 |
19 files changed, 46 insertions, 45 deletions
diff --git a/driver/bc12/max14637.c b/driver/bc12/max14637.c index 26156480be..ca06b26aeb 100644 --- a/driver/bc12/max14637.c +++ b/driver/bc12/max14637.c @@ -152,7 +152,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 38e88b4ee2..789504b1eb 100644 --- a/driver/bc12/max14637.h +++ b/driver/bc12/max14637.h @@ -28,4 +28,5 @@ 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/pi3usb9201.c b/driver/bc12/pi3usb9201.c index 0facefdced..be2844e3e3 100644 --- a/driver/bc12/pi3usb9201.c +++ b/driver/bc12/pi3usb9201.c @@ -38,7 +38,7 @@ struct bc12_status { }; /* Used to store last BC1.2 detection result */ -static enum charge_supplier bc12_supplier[CONFIG_USB_PD_PORT_COUNT]; +static enum charge_supplier bc12_supplier[CONFIG_USB_PD_PORT_MAX_COUNT]; static const struct bc12_status bc12_chg_limits[] = { [CHG_OTHER] = {CHARGE_SUPPLIER_OTHER, 500}, @@ -244,7 +244,7 @@ void usb_charger_task(void *u) * Set most recent bc1.2 detection supplier result to * CHARGE_SUPPLIER_NONE for all ports. */ - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) bc12_supplier[port] = CHARGE_SUPPLIER_NONE; /* diff --git a/driver/bc12/pi3usb9281.c b/driver/bc12/pi3usb9281.c index b0610f693b..db5d039fd9 100644 --- a/driver/bc12/pi3usb9281.c +++ b/driver/bc12/pi3usb9281.c @@ -36,7 +36,7 @@ #define PI3USB9281_RESET_STARTUP_DELAY_INTERVAL_MS 40 /* 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 int usb_switch_state[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 f121b858dd..dc3125928f 100644 --- a/driver/charger/bd9995x.c +++ b/driver/charger/bd9995x.c @@ -345,7 +345,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]; @@ -1263,7 +1263,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 @@ -1273,7 +1273,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; @@ -1282,7 +1282,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/aoz1380.c b/driver/ppc/aoz1380.c index 8ac81daed3..f077a5e07d 100644 --- a/driver/ppc/aoz1380.c +++ b/driver/ppc/aoz1380.c @@ -27,7 +27,7 @@ static uint32_t irq_pending; /* Bitmask of ports signaling an interrupt. */ #define AOZ1380_FLAGS_SOURCE_ENABLED BIT(0) -static uint8_t flags[CONFIG_USB_PD_PORT_COUNT]; +static uint8_t flags[CONFIG_USB_PD_PORT_MAX_COUNT]; static int aoz1380_init(int port) { @@ -93,7 +93,7 @@ static void aoz1380_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 (BIT(i) & pending) aoz1380_handle_interrupt(i); } diff --git a/driver/ppc/nx20p348x.c b/driver/ppc/nx20p348x.c index d7596d5c37..bdbd02d6b2 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 BIT(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 (BIT(i) & pending) nx20p348x_handle_interrupt(i); } diff --git a/driver/ppc/sn5s330.c b/driver/ppc/sn5s330.c index 3f3423b058..6a877b0808 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) { @@ -750,7 +750,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 (BIT(i) & pending) sn5s330_handle_interrupt(i); } diff --git a/driver/ppc/syv682x.c b/driver/ppc/syv682x.c index 5f80dd3d90..9e0ff28388 100644 --- a/driver/ppc/syv682x.c +++ b/driver/ppc/syv682x.c @@ -17,7 +17,7 @@ /* 0 -> CC1, 1 -> CC2 */ #define SYV682X_FLAGS_CC_POLARITY BIT(1) #define SYV682X_FLAGS_VBUS_PRESENT BIT(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/retimer/bb_retimer.c b/driver/retimer/bb_retimer.c index c89ae925f3..e211c10d58 100644 --- a/driver/retimer/bb_retimer.c +++ b/driver/retimer/bb_retimer.c @@ -235,7 +235,7 @@ static int console_command_bb_retimer(int argc, char **argv) /* Get port number */ port = strtoi(argv[1], &e, 0); - if (*e || port < 0 || port > CONFIG_USB_PD_PORT_COUNT) + if (*e || port < 0 || port > CONFIG_USB_PD_PORT_MAX_COUNT) return EC_ERROR_PARAM1; /* Validate r/w selection */ diff --git a/driver/tcpm/anx7447.c b/driver/tcpm/anx7447.c index 59f8e59bfa..0af495251c 100644 --- a/driver/tcpm/anx7447.c +++ b/driver/tcpm/anx7447.c @@ -50,8 +50,8 @@ struct anx_usb_mux { 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_usb_mux mux[CONFIG_USB_PD_PORT_COUNT]; +static struct anx_state anx[CONFIG_USB_PD_PORT_MAX_COUNT]; +static struct anx_usb_mux mux[CONFIG_USB_PD_PORT_MAX_COUNT]; /* * ANX7447 has two co-existence I2C slave addresses, TCPC slave address and @@ -286,7 +286,7 @@ static int anx7447_init(int port) { int rv, reg, i; - ASSERT(port < CONFIG_USB_PD_PORT_COUNT); + ASSERT(port < CONFIG_USB_PD_PORT_MAX_COUNT); memset(&anx[port], 0, sizeof(struct anx_state)); @@ -451,7 +451,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) { @@ -494,7 +494,7 @@ void anx7447_tcpc_clear_hpd_status(int port) #ifdef CONFIG_USB_PD_TCPM_MUX static int anx7447_mux_init(int port) { - ASSERT(port < CONFIG_USB_PD_PORT_COUNT); + ASSERT(port < CONFIG_USB_PD_PORT_MAX_COUNT); memset(&mux[port], 0, sizeof(struct anx_usb_mux)); diff --git a/driver/tcpm/anx74xx.c b/driver/tcpm/anx74xx.c index 36c29f0701..0e7ec021d8 100644 --- a/driver/tcpm/anx74xx.c +++ b/driver/tcpm/anx74xx.c @@ -43,14 +43,14 @@ 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]; #ifdef CONFIG_USB_PD_DECODE_SOP /* Save the message address */ -static int msg_sop[CONFIG_USB_PD_PORT_COUNT]; +static int msg_sop[CONFIG_USB_PD_PORT_MAX_COUNT]; #endif static int anx74xx_tcpm_init(int port); @@ -227,7 +227,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 3e85fbe713..66c131fb37 100644 --- a/driver/tcpm/fusb302.c +++ b/driver/tcpm/fusb302.c @@ -34,7 +34,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 c805e445a2..4b2dc4fc6e 100644 --- a/driver/tcpm/it83xx.c +++ b/driver/tcpm/it83xx.c @@ -544,11 +544,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/nct38xx.c b/driver/tcpm/nct38xx.c index 1196621e71..9d91c21b30 100644 --- a/driver/tcpm/nct38xx.c +++ b/driver/tcpm/nct38xx.c @@ -24,11 +24,11 @@ #define POLARITY_FLIPPED 1 #define POLARITY_NONE 3 -static int cable_polarity[CONFIG_USB_PD_PORT_COUNT]; +static int cable_polarity[CONFIG_USB_PD_PORT_MAX_COUNT]; static unsigned char txBuf[33]; static unsigned char rxBuf[33]; /* 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 nct38xx_tcpm_init(int port) { diff --git a/driver/tcpm/ps8xxx.c b/driver/tcpm/ps8xxx.c index 9740933eeb..81117a5af1 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 2bb6a21c11..ba8e9f2f42 100644 --- a/driver/tcpm/tcpci.c +++ b/driver/tcpm/tcpci.c @@ -25,13 +25,13 @@ #define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args) #ifdef CONFIG_USB_PD_DECODE_SOP -static int vconn_en[CONFIG_USB_PD_PORT_COUNT]; -static int rx_en[CONFIG_USB_PD_PORT_COUNT]; +static int vconn_en[CONFIG_USB_PD_PORT_MAX_COUNT]; +static int rx_en[CONFIG_USB_PD_PORT_MAX_COUNT]; #endif -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 @@ -483,7 +483,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) @@ -739,12 +739,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/usb_mux.c b/driver/usb_mux/usb_mux.c index 122c206b98..0d08fbc99c 100644 --- a/driver/usb_mux/usb_mux.c +++ b/driver/usb_mux/usb_mux.c @@ -21,7 +21,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 BIT(0) /* Device is in low power mode. */ @@ -60,7 +60,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) { @@ -195,7 +195,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) { @@ -234,7 +234,7 @@ static enum ec_status 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 e012b943f0..70a51953ad 100644 --- a/driver/usb_mux/virtual.c +++ b/driver/usb_mux/virtual.c @@ -22,7 +22,7 @@ USB_PD_MUX_DP_ENABLED | USB_PD_MUX_POLARITY_INVERTED | \ USB_PD_MUX_SAFE_MODE) -static mux_state_t virtual_mux_state[CONFIG_USB_PD_PORT_COUNT]; +static mux_state_t virtual_mux_state[CONFIG_USB_PD_PORT_MAX_COUNT]; static inline void virtual_mux_update_state(int port, mux_state_t mux_state) { |