summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/amenia/board.h1
-rw-r--r--board/chell/board.h1
-rw-r--r--board/dingdong/board.h2
-rw-r--r--board/elm/board.h1
-rw-r--r--board/glados/board.h1
-rw-r--r--board/glados_pd/board.h2
-rw-r--r--board/hoho/board.h2
-rw-r--r--board/honeybuns/board.h1
-rw-r--r--board/it83xx_evb/board.h1
-rw-r--r--board/kevin/board.h2
-rw-r--r--board/lucid/board.h1
-rw-r--r--board/oak/board.h2
-rw-r--r--board/plankton/board.h1
-rw-r--r--board/reef/board.h2
-rw-r--r--board/ryu/board.h1
-rw-r--r--board/samus_pd/board.h1
-rw-r--r--board/strago/board.h1
-rw-r--r--board/twinkie/board.h1
-rw-r--r--board/wheatley/board.h1
-rw-r--r--board/zinger/board.h1
-rw-r--r--common/usb_charger.c8
-rw-r--r--common/usb_pd_protocol.c8
-rw-r--r--common/usb_pd_tcpc.c12
-rw-r--r--driver/tcpm/anx74xx.c4
-rw-r--r--driver/tcpm/fusb302.c4
-rw-r--r--driver/tcpm/it83xx.c2
-rw-r--r--driver/tcpm/tcpci.c12
-rw-r--r--driver/usb_switch_pi3usb9281.c2
-rw-r--r--include/config.h28
29 files changed, 69 insertions, 37 deletions
diff --git a/board/amenia/board.h b/board/amenia/board.h
index b6117d23cd..d4dfd2b705 100644
--- a/board/amenia/board.h
+++ b/board/amenia/board.h
@@ -86,6 +86,7 @@
#define TCPC1_I2C_ADDR 0x16
#define CONFIG_USB_PD_TCPM_MUX
#define CONFIG_USB_PD_TRY_SRC
+#define CONFIG_USB_PD_VBUS_DETECT_GPIO
#define CONFIG_USB_PORT_POWER_SMART
#define GPIO_USB1_CTL1 GPIO_USB_CTL1
#define GPIO_USB1_CTL2 GPIO_UNIMPLEMENTED
diff --git a/board/chell/board.h b/board/chell/board.h
index 8f34a955d4..d4c51058a3 100644
--- a/board/chell/board.h
+++ b/board/chell/board.h
@@ -79,6 +79,7 @@
#define CONFIG_USB_PD_PORT_COUNT 2
#define CONFIG_USB_PD_TCPM_TCPCI
#define CONFIG_USB_PD_TRY_SRC
+#define CONFIG_USB_PD_VBUS_DETECT_GPIO
#define CONFIG_USB_SWITCH_PI3USB9281
#define CONFIG_USB_SWITCH_PI3USB9281_CHIP_COUNT 2
#define CONFIG_USBC_SS_MUX
diff --git a/board/dingdong/board.h b/board/dingdong/board.h
index ab55e0aa2e..91a8c8b2ea 100644
--- a/board/dingdong/board.h
+++ b/board/dingdong/board.h
@@ -35,7 +35,7 @@
#define CONFIG_USB_PD_INTERNAL_COMP
#define CONFIG_USB_PD_IDENTITY_HW_VERS 1
#define CONFIG_USB_PD_IDENTITY_SW_VERS 1
-#define CONFIG_USB_PD_NO_VBUS_DETECT
+#define CONFIG_USB_PD_VBUS_DETECT_NONE
#define CONFIG_USB_PD_LOGGING
#define CONFIG_USB_PD_LOG_SIZE 256
#define CONFIG_USB_PD_PORT_COUNT 1
diff --git a/board/elm/board.h b/board/elm/board.h
index 6c54a280aa..702f2d7864 100644
--- a/board/elm/board.h
+++ b/board/elm/board.h
@@ -95,6 +95,7 @@
#define CONFIG_USB_PD_TCPM_MUX
#define CONFIG_USB_PD_TCPM_TCPCI
#define CONFIG_USB_PD_TRY_SRC
+#define CONFIG_USB_PD_VBUS_DETECT_GPIO
#undef CONFIG_TCPC_I2C_BASE_ADDR
#define CONFIG_TCPC_I2C_BASE_ADDR 0x58
#define CONFIG_USB_PD_ANX7688
diff --git a/board/glados/board.h b/board/glados/board.h
index 88efe47cdf..dbe1fd614c 100644
--- a/board/glados/board.h
+++ b/board/glados/board.h
@@ -82,6 +82,7 @@
#define CONFIG_USB_PD_PORT_COUNT 2
#define CONFIG_USB_PD_TCPM_TCPCI
#define CONFIG_USB_PD_TRY_SRC
+#define CONFIG_USB_PD_VBUS_DETECT_GPIO
#define CONFIG_USB_SWITCH_PI3USB9281
#define CONFIG_USB_SWITCH_PI3USB9281_CHIP_COUNT 2
#define CONFIG_USBC_SS_MUX
diff --git a/board/glados_pd/board.h b/board/glados_pd/board.h
index d4924b189b..9310ee8715 100644
--- a/board/glados_pd/board.h
+++ b/board/glados_pd/board.h
@@ -63,7 +63,7 @@
#define CONFIG_USB_PD_INTERNAL_COMP
#define CONFIG_USB_PD_PORT_COUNT 2
#define CONFIG_USB_PD_TCPC
-#define CONFIG_USB_PD_TCPM_VBUS
+#define CONFIG_USB_PD_TCPC_TRACK_VBUS
#define CONFIG_USBC_VCONN
#define CONFIG_VBOOT_HASH
#define CONFIG_WATCHDOG
diff --git a/board/hoho/board.h b/board/hoho/board.h
index eaa1803f61..2e02744cf3 100644
--- a/board/hoho/board.h
+++ b/board/hoho/board.h
@@ -46,7 +46,7 @@
#define CONFIG_USB_PD_PORT_COUNT 1
#define CONFIG_USB_PD_TCPC
#define CONFIG_USB_PD_TCPM_STUB
-#define CONFIG_USB_PD_NO_VBUS_DETECT
+#define CONFIG_USB_PD_VBUS_DETECT_NONE
/* mcdp2850 serial interface */
#define CONFIG_MCDP28X0 usart3_hw
#define CONFIG_STREAM_USART
diff --git a/board/honeybuns/board.h b/board/honeybuns/board.h
index 14c87b32bc..3903623a70 100644
--- a/board/honeybuns/board.h
+++ b/board/honeybuns/board.h
@@ -40,6 +40,7 @@
#define CONFIG_USB_PD_PORT_COUNT 1
#define CONFIG_USB_PD_TCPC
#define CONFIG_USB_PD_TCPM_STUB
+#define CONFIG_USB_PD_VBUS_DETECT_GPIO
#define CONFIG_USBC_SS_MUX
#define CONFIG_USBC_VCONN
#undef CONFIG_WATCHDOG_HELP
diff --git a/board/it83xx_evb/board.h b/board/it83xx_evb/board.h
index cf0ea16b94..c82ff9f5ba 100644
--- a/board/it83xx_evb/board.h
+++ b/board/it83xx_evb/board.h
@@ -38,6 +38,7 @@
#define CONFIG_USB_PD_PORT_COUNT 2
#define CONFIG_USB_PD_TCPM_ITE83XX
#define CONFIG_USB_PD_TRY_SRC
+#define CONFIG_USB_PD_VBUS_DETECT_GPIO
#define CONFIG_USB_POWER_DELIVERY
#define CONFIG_USBC_VCONN
#define CONFIG_USBC_VCONN_SWAP
diff --git a/board/kevin/board.h b/board/kevin/board.h
index 3df4f62c04..a388545d94 100644
--- a/board/kevin/board.h
+++ b/board/kevin/board.h
@@ -73,7 +73,7 @@
#define CONFIG_USB_PD_LOG_SIZE 512
#define CONFIG_USB_PD_PORT_COUNT 2
#define CONFIG_USB_PD_TCPM_FUSB302
-#define CONFIG_USB_PD_TCPM_VBUS
+#define CONFIG_USB_PD_VBUS_DETECT_TCPC
/* TODO: Enable TRY_SRC */
#undef CONFIG_USB_PD_TRY_SRC
diff --git a/board/lucid/board.h b/board/lucid/board.h
index f063ad9c7c..b583e32ae5 100644
--- a/board/lucid/board.h
+++ b/board/lucid/board.h
@@ -61,6 +61,7 @@
#define CONFIG_USB_PD_PORT_COUNT 1
#define CONFIG_USB_PD_TCPC
#define CONFIG_USB_PD_TCPM_STUB
+#define CONFIG_USB_PD_VBUS_DETECT_GPIO
#undef CONFIG_WATCHDOG_HELP
/* Use PSTATE embedded in the RO image, not in its own erase block */
diff --git a/board/oak/board.h b/board/oak/board.h
index 6480c0e8c4..da022f48f0 100644
--- a/board/oak/board.h
+++ b/board/oak/board.h
@@ -101,7 +101,7 @@
#define CONFIG_USB_PD_PORT_COUNT 2
#define CONFIG_USB_PD_TCPM_TCPCI
#define CONFIG_USB_PD_TRY_SRC
-#define CONFIG_USB_PD_TCPM_VBUS
+#define CONFIG_USB_PD_VBUS_DETECT_TCPC
#define CONFIG_SPI
#define CONFIG_SPI_MASTER
#define CONFIG_STM_HWTIMER32
diff --git a/board/plankton/board.h b/board/plankton/board.h
index 1c900d4851..749a3e8cd6 100644
--- a/board/plankton/board.h
+++ b/board/plankton/board.h
@@ -29,6 +29,7 @@
#define CONFIG_USB_PD_PORT_COUNT 1
#define CONFIG_USB_PD_TCPC
#define CONFIG_USB_PD_TCPM_STUB
+#define CONFIG_USB_PD_VBUS_DETECT_GPIO
#define CONFIG_ADC
#define CONFIG_HW_CRC
#define CONFIG_I2C
diff --git a/board/reef/board.h b/board/reef/board.h
index bda2786cd3..c8fd12ac5d 100644
--- a/board/reef/board.h
+++ b/board/reef/board.h
@@ -38,7 +38,7 @@
#define CONFIG_USB_PD_LOGGING
#define CONFIG_USB_PD_LOG_SIZE 512
#define CONFIG_USB_PD_PORT_COUNT 2
-#define CONFIG_USB_PD_TCPM_VBUS
+#define CONFIG_USB_PD_VBUS_DETECT_TCPC
#define CONFIG_USB_PD_TCPM_MUX /* for both PS8751 and ANX3429 */
#define CONFIG_USB_PD_TCPM_TCPCI
#define CONFIG_USB_PD_TCPM_ANX74XX
diff --git a/board/ryu/board.h b/board/ryu/board.h
index a0a20f6479..dea35aecc4 100644
--- a/board/ryu/board.h
+++ b/board/ryu/board.h
@@ -47,6 +47,7 @@
#define CONFIG_USB_PD_PORT_COUNT 1
#define CONFIG_USB_PD_TCPC
#define CONFIG_USB_PD_TCPM_STUB
+#define CONFIG_USB_PD_VBUS_DETECT_GPIO
#define CONFIG_USB_SWITCH_PI3USB9281
#define CONFIG_USB_SWITCH_PI3USB9281_CHIP_COUNT 1
#define CONFIG_USBC_SS_MUX
diff --git a/board/samus_pd/board.h b/board/samus_pd/board.h
index 6d1859db50..a45d7d9264 100644
--- a/board/samus_pd/board.h
+++ b/board/samus_pd/board.h
@@ -63,6 +63,7 @@
#define CONFIG_USB_PD_PORT_COUNT 2
#define CONFIG_USB_PD_TCPC
#define CONFIG_USB_PD_TCPM_STUB
+#define CONFIG_USB_PD_VBUS_DETECT_GPIO
#define CONFIG_USB_SWITCH_PI3USB9281
#define CONFIG_USB_SWITCH_PI3USB9281_CHIP_COUNT 2
#define CONFIG_USBC_SS_MUX_DFP_ONLY
diff --git a/board/strago/board.h b/board/strago/board.h
index aa3d6d57c8..bcaab82188 100644
--- a/board/strago/board.h
+++ b/board/strago/board.h
@@ -43,6 +43,7 @@
#define CONFIG_USB_PD_PORT_COUNT 1
#define CONFIG_USB_PD_TCPM_TCPCI
#define CONFIG_USB_PD_TRY_SRC
+#define CONFIG_USB_PD_VBUS_DETECT_GPIO
#define CONFIG_USB_SWITCH_PI3USB9281
#define CONFIG_USB_SWITCH_PI3USB9281_CHIP_COUNT 1
#define CONFIG_USBC_SS_MUX
diff --git a/board/twinkie/board.h b/board/twinkie/board.h
index e9c2466aa9..676e9a337f 100644
--- a/board/twinkie/board.h
+++ b/board/twinkie/board.h
@@ -24,6 +24,7 @@
#define CONFIG_USB_PD_PORT_COUNT 1
#define CONFIG_USB_PD_TCPC
#define CONFIG_USB_PD_TCPM_STUB
+#define CONFIG_USB_PD_VBUS_DETECT_GPIO
#define CONFIG_PD_USE_DAC_AS_REF
/*
* use #define CONFIG_USBC_SNIFFER_HEADER_V1
diff --git a/board/wheatley/board.h b/board/wheatley/board.h
index 62b4efa777..70e627347d 100644
--- a/board/wheatley/board.h
+++ b/board/wheatley/board.h
@@ -81,6 +81,7 @@
#define CONFIG_USB_PD_PORT_COUNT 2
#define CONFIG_USB_PD_TCPM_TCPCI
#define CONFIG_USB_PD_TRY_SRC
+#define CONFIG_USB_PD_VBUS_DETECT_GPIO
#define CONFIG_USB_SWITCH_PI3USB9281
#define CONFIG_USB_SWITCH_PI3USB9281_CHIP_COUNT 2
#define CONFIG_USBC_SS_MUX
diff --git a/board/zinger/board.h b/board/zinger/board.h
index 64893bc1b0..dcd1f8bcc1 100644
--- a/board/zinger/board.h
+++ b/board/zinger/board.h
@@ -63,6 +63,7 @@
#define CONFIG_USB_PD_TCPM_STUB
#undef CONFIG_USB_PD_RX_COMP_IRQ
#define CONFIG_USB_PD_SIMPLE_DFP
+#define CONFIG_USB_PD_VBUS_DETECT_GPIO
#define CONFIG_USBC_BACKWARDS_COMPATIBLE_DFP
#undef CONFIG_WATCHDOG_HELP
#undef CONFIG_WATCHDOG_PERIOD_MS
diff --git a/common/usb_charger.c b/common/usb_charger.c
index 2b9c505f2e..67dd612e36 100644
--- a/common/usb_charger.c
+++ b/common/usb_charger.c
@@ -89,8 +89,12 @@ static void usb_charger_init(void)
i,
&charge_none);
-#ifndef CONFIG_USB_PD_TCPM_VBUS
- /* Initialize VBUS supplier based on whether VBUS is present */
+#ifndef CONFIG_USB_PD_VBUS_DETECT_TCPC
+ /*
+ * Initialize VBUS supplier based on whether VBUS is present.
+ * For CONFIG_USB_PD_VBUS_DETECT_TCPC, usb_charger_vbus_change()
+ * will be called directly from TCPC alert.
+ */
update_vbus_supplier(i, pd_snk_is_vbus_provided(i));
#endif
}
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index 276698710d..1de29a184f 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -224,7 +224,7 @@ void pd_vbus_low(int port)
static inline int pd_is_vbus_present(int port)
{
-#ifdef CONFIG_USB_PD_TCPM_VBUS
+#ifdef CONFIG_USB_PD_VBUS_DETECT_TCPC
return tcpm_get_vbus_level(port);
#else
return pd_snk_is_vbus_provided(port);
@@ -704,7 +704,7 @@ static void handle_data_request(int port, uint16_t head,
case PD_DATA_SOURCE_CAP:
if ((pd[port].task_state == PD_STATE_SNK_DISCOVERY)
|| (pd[port].task_state == PD_STATE_SNK_TRANSITION)
-#ifdef CONFIG_USB_PD_NO_VBUS_DETECT
+#ifdef CONFIG_USB_PD_VBUS_DETECT_NONE
|| (pd[port].task_state ==
PD_STATE_SNK_HARD_RESET_RECOVER)
#endif
@@ -1393,7 +1393,7 @@ void pd_task(void)
int hard_reset_count = 0;
#ifdef CONFIG_USB_PD_DUAL_ROLE
uint64_t next_role_swap = PD_T_DRP_SNK;
-#ifndef CONFIG_USB_PD_NO_VBUS_DETECT
+#ifndef CONFIG_USB_PD_VBUS_DETECT_NONE
int snk_hard_reset_vbus_off = 0;
#endif
#ifdef CONFIG_CHARGE_MANAGER
@@ -2101,7 +2101,7 @@ void pd_task(void)
case PD_STATE_SNK_HARD_RESET_RECOVER:
if (pd[port].last_state != pd[port].task_state)
pd[port].flags |= PD_FLAGS_DATA_SWAPPED;
-#ifdef CONFIG_USB_PD_NO_VBUS_DETECT
+#ifdef CONFIG_USB_PD_VBUS_DETECT_NONE
/*
* Can't measure vbus state so this is the maximum
* recovery time for the source.
diff --git a/common/usb_pd_tcpc.c b/common/usb_pd_tcpc.c
index 8e6b9dda5e..644f27dcd1 100644
--- a/common/usb_pd_tcpc.c
+++ b/common/usb_pd_tcpc.c
@@ -978,7 +978,7 @@ int tcpc_set_polarity(int port, int polarity)
return EC_SUCCESS;
}
-#ifdef CONFIG_USB_PD_TCPM_VBUS
+#ifdef CONFIG_USB_PD_TCPC_TRACK_VBUS
static int tcpc_set_power_status(int port, int vbus_present)
{
/* Update VBUS present bit */
@@ -993,7 +993,7 @@ static int tcpc_set_power_status(int port, int vbus_present)
return EC_SUCCESS;
}
-#endif /* CONFIG_USB_PD_TCPM_VBUS */
+#endif /* CONFIG_USB_PD_TCPC_TRACK_VBUS */
int tcpc_set_power_status_mask(int port, uint8_t mask)
{
@@ -1102,7 +1102,7 @@ void tcpc_init(int port)
pd_adc_read(port, i));
}
-#ifdef CONFIG_USB_PD_TCPM_VBUS
+#ifdef CONFIG_USB_PD_TCPC_TRACK_VBUS
#if CONFIG_USB_PD_PORT_COUNT >= 2
tcpc_set_power_status(port, !gpio_get_level(port ?
GPIO_USB_C1_VBUS_WAKE_L :
@@ -1110,7 +1110,7 @@ void tcpc_init(int port)
#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_TCPM_VBUS */
+#endif /* CONFIG_USB_PD_TCPC_TRACK_VBUS */
/* set default alert and power mask register values */
pd[port].alert_mask = TCPC_REG_ALERT_MASK_ALL;
@@ -1120,7 +1120,7 @@ void tcpc_init(int port)
alert(port, TCPC_REG_ALERT_POWER_STATUS);
}
-#ifdef CONFIG_USB_PD_TCPM_VBUS
+#ifdef CONFIG_USB_PD_TCPC_TRACK_VBUS
void pd_vbus_evt_p0(enum gpio_signal signal)
{
tcpc_set_power_status(TASK_ID_TO_PD_PORT(TASK_ID_PD_C0),
@@ -1136,7 +1136,7 @@ void pd_vbus_evt_p1(enum gpio_signal signal)
task_wake(TASK_ID_PD_C1);
}
#endif /* PD_PORT_COUNT >= 2 */
-#endif /* CONFIG_USB_PD_TCPM_VBUS */
+#endif /* CONFIG_USB_PD_TCPC_TRACK_VBUS */
#ifndef CONFIG_USB_POWER_DELIVERY
static void tcpc_i2c_write(int port, int reg, int len, uint8_t *payload)
diff --git a/driver/tcpm/anx74xx.c b/driver/tcpm/anx74xx.c
index b2b33e8576..13d1bb1c07 100644
--- a/driver/tcpm/anx74xx.c
+++ b/driver/tcpm/anx74xx.c
@@ -592,7 +592,7 @@ static int anx74xx_tcpm_set_rx_enable(int port, int enable)
return rv;
}
-#ifdef CONFIG_USB_PD_TCPM_VBUS
+#ifdef CONFIG_USB_PD_VBUS_DETECT_TCPC
static int anx74xx_tcpm_get_vbus_level(int port)
{
int reg = 0;
@@ -785,7 +785,7 @@ int anx74xx_tcpm_init(int port)
const struct tcpm_drv anx74xx_tcpm_drv = {
.init = &anx74xx_tcpm_init,
.get_cc = &anx74xx_tcpm_get_cc,
-#ifdef CONFIG_USB_PD_TCPM_VBUS
+#ifdef CONFIG_USB_PD_VBUS_DETECT_TCPC
.get_vbus_level = &anx74xx_tcpm_get_vbus_level,
#endif
.set_cc = &anx74xx_tcpm_set_cc,
diff --git a/driver/tcpm/fusb302.c b/driver/tcpm/fusb302.c
index 2b84f31b3f..ac9c0f3ac2 100644
--- a/driver/tcpm/fusb302.c
+++ b/driver/tcpm/fusb302.c
@@ -807,7 +807,7 @@ static int fusb302_tcpm_transmit(int port, enum tcpm_transmit_type type,
return 0;
}
-#ifdef CONFIG_USB_PD_TCPM_VBUS
+#ifdef CONFIG_USB_PD_VBUS_DETECT_TCPC
static int fusb302_tcpm_get_vbus_level(int port)
{
int reg;
@@ -990,7 +990,7 @@ void tcpm_set_bist_test_data(int port)
const struct tcpm_drv fusb302_tcpm_drv = {
.init = &fusb302_tcpm_init,
.get_cc = &fusb302_tcpm_get_cc,
-#ifdef CONFIG_USB_PD_TCPM_VBUS
+#ifdef CONFIG_USB_PD_VBUS_DETECT_TCPC
.get_vbus_level = &fusb302_tcpm_get_vbus_level,
#endif
.set_cc = &fusb302_tcpm_set_cc,
diff --git a/driver/tcpm/it83xx.c b/driver/tcpm/it83xx.c
index dadfc2393b..3bc0c0db32 100644
--- a/driver/tcpm/it83xx.c
+++ b/driver/tcpm/it83xx.c
@@ -442,7 +442,7 @@ static int it83xx_tcpm_transmit(int port,
const struct tcpm_drv it83xx_tcpm_drv = {
.init = &it83xx_tcpm_init,
.get_cc = &it83xx_tcpm_get_cc,
-#ifdef CONFIG_USB_PD_TCPM_VBUS
+#ifdef CONFIG_USB_PD_VBUS_DETECT_TCPC
.get_vbus_level = NULL,
#endif
.set_cc = &it83xx_tcpm_set_cc,
diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c
index 09e8e291b3..9a32dd5e19 100644
--- a/driver/tcpm/tcpci.c
+++ b/driver/tcpm/tcpci.c
@@ -29,7 +29,7 @@ static int init_alert_mask(int port)
mask = TCPC_REG_ALERT_TX_SUCCESS | TCPC_REG_ALERT_TX_FAILED |
TCPC_REG_ALERT_TX_DISCARDED | TCPC_REG_ALERT_RX_STATUS |
TCPC_REG_ALERT_RX_HARD_RST | TCPC_REG_ALERT_CC_STATUS
-#ifdef CONFIG_USB_PD_TCPM_VBUS
+#ifdef CONFIG_USB_PD_VBUS_DETECT_TCPC
| TCPC_REG_ALERT_POWER_STATUS
#endif
;
@@ -44,7 +44,7 @@ static int init_power_status_mask(int port)
uint8_t mask;
int rv;
-#ifdef CONFIG_USB_PD_TCPM_VBUS
+#ifdef CONFIG_USB_PD_VBUS_DETECT_TCPC
mask = TCPC_REG_POWER_STATUS_VBUS_PRES;
#else
mask = 0;
@@ -127,7 +127,7 @@ static int tcpci_tcpm_set_rx_enable(int port, int enable)
enable ? TCPC_REG_RX_DETECT_SOP_HRST_MASK : 0);
}
-#ifdef CONFIG_USB_PD_TCPM_VBUS
+#ifdef CONFIG_USB_PD_VBUS_DETECT_TCPC
static int tcpci_tcpm_get_vbus_level(int port)
{
return tcpc_vbus[port];
@@ -226,11 +226,11 @@ void tcpci_tcpc_alert(int port)
/* Update VBUS status */
tcpc_vbus[port] = reg &
TCPC_REG_POWER_STATUS_VBUS_PRES ? 1 : 0;
-#if defined(CONFIG_USB_PD_TCPM_VBUS) && defined(CONFIG_USB_CHARGER)
+#if defined(CONFIG_USB_PD_VBUS_DETECT_TCPC) && defined(CONFIG_USB_CHARGER)
/* Update charge manager with new VBUS state */
usb_charger_vbus_change(port, tcpc_vbus[port]);
task_wake(PD_PORT_TO_TASK_ID(port));
-#endif /* CONFIG_USB_PD_TCPM_VBUS && CONFIG_USB_CHARGER */
+#endif /* CONFIG_USB_PD_VBUS_DETECT_TCPC && CONFIG_USB_CHARGER */
}
}
if (status & TCPC_REG_ALERT_RX_STATUS) {
@@ -336,7 +336,7 @@ const struct usb_mux_driver tcpci_tcpm_usb_mux_driver = {
const struct tcpm_drv tcpci_tcpm_drv = {
.init = &tcpci_tcpm_init,
.get_cc = &tcpci_tcpm_get_cc,
-#ifdef CONFIG_USB_PD_TCPM_VBUS
+#ifdef CONFIG_USB_PD_VBUS_DETECT_TCPC
.get_vbus_level = &tcpci_tcpm_get_vbus_level,
#endif
.set_cc = &tcpci_tcpm_set_cc,
diff --git a/driver/usb_switch_pi3usb9281.c b/driver/usb_switch_pi3usb9281.c
index 569438b761..340df9df11 100644
--- a/driver/usb_switch_pi3usb9281.c
+++ b/driver/usb_switch_pi3usb9281.c
@@ -383,7 +383,7 @@ void usb_charger_task(void)
*/
if (evt & USB_CHG_EVENT_VBUS) {
pi3usb9281_enable_interrupts(port);
-#ifndef CONFIG_USB_PD_TCPM_VBUS
+#ifndef CONFIG_USB_PD_VBUS_DETECT_TCPC
CPRINTS("VBUS p%d %d", port,
pd_snk_is_vbus_provided(port));
#endif
diff --git a/include/config.h b/include/config.h
index e360745b41..a0caa9d5c3 100644
--- a/include/config.h
+++ b/include/config.h
@@ -1869,9 +1869,6 @@
/* Allow chip to go into low power idle even when a PD device is attached */
#undef CONFIG_USB_PD_LOW_POWER_IDLE_WHEN_CONNECTED
-/* Define if USB-PD device has no way of detecting USB VBUS */
-#undef CONFIG_USB_PD_NO_VBUS_DETECT
-
/* Number of USB PD ports */
#undef CONFIG_USB_PD_PORT_COUNT
@@ -1885,6 +1882,12 @@
#undef CONFIG_USB_PD_TCPC
/*
+ * Track VBUS level in TCPC module. This will only be needed if we're acting
+ * as an external TCPC.
+ */
+#undef CONFIG_USB_PD_TCPC_TRACK_VBUS
+
+/*
* Choose one of the following TCPMs (type-C port manager) to manage TCPC. The
* TCPM stub is used to make direct function calls to TCPC when TCPC is on
* the same MCU. The TCPCI TCPM uses the standard TCPCI i2c interface to TCPC.
@@ -1902,11 +1905,22 @@
#undef CONFIG_USB_PD_TCPM_MUX
/*
- * Use this option if the TCPC port controller is on a seperate chip from
- * the TCPM layer and if VUBS detect GPIO is not available on the TCPM
- * mcu.
+ * The TCPM must know whether VBUS is present in order to make proper state
+ * transitions. In addition, charge_manager must know about VBUS presence in
+ * order to make charging decisions. VBUS state can be determined by various
+ * methods:
+ * - Some TCPCs can detect and report the presence of VBUS.
+ * - In some configurations, charger ICs can report the presence of VBUS.
+ * - On some boards, dedicated VBUS interrupt pins are available.
+ *
+ * Exactly one of these should be defined for all boards that run the PD
+ * state machine.
*/
-#undef CONFIG_USB_PD_TCPM_VBUS
+#undef CONFIG_USB_PD_VBUS_DETECT_TCPC
+#undef CONFIG_USB_PD_VBUS_DETECT_CHARGER
+#undef CONFIG_USB_PD_VBUS_DETECT_GPIO
+#undef CONFIG_USB_PD_VBUS_DETECT_NONE
+
/* Define the type-c port controller I2C base address. */
#define CONFIG_TCPC_I2C_BASE_ADDR 0x9c