diff options
author | Karthikeyan Ramasubramanian <kramasub@google.com> | 2019-11-15 14:01:11 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-11-18 18:50:28 +0000 |
commit | 737737e711786d69555825291e0f0f6a1779073c (patch) | |
tree | d82ac2deb40ca2781487178b74485c6710b2814d /driver | |
parent | dc3d384f983c46285531c3e424d253133814ec3d (diff) | |
download | chrome-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>
Diffstat (limited to 'driver')
-rw-r--r-- | driver/bc12/max14637.c | 2 | ||||
-rw-r--r-- | driver/bc12/max14637.h | 2 | ||||
-rw-r--r-- | driver/bc12/pi3usb9281.c | 4 | ||||
-rw-r--r-- | driver/charger/bd9995x.c | 8 | ||||
-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/tcpm/anx7447.c | 4 | ||||
-rw-r--r-- | driver/tcpm/anx74xx.c | 6 | ||||
-rw-r--r-- | driver/tcpm/fusb302.c | 2 | ||||
-rw-r--r-- | driver/tcpm/it83xx.c | 4 | ||||
-rw-r--r-- | driver/tcpm/ps8xxx.c | 2 | ||||
-rw-r--r-- | driver/tcpm/tcpci.c | 10 | ||||
-rw-r--r-- | driver/usb_mux.c | 8 | ||||
-rw-r--r-- | driver/usb_mux_virtual.c | 4 |
15 files changed, 34 insertions, 34 deletions
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) { |