diff options
-rw-r--r-- | common/usbc/usb_pe_drp_sm.c | 6 | ||||
-rw-r--r-- | include/driver/tcpm/tcpm.h | 16 | ||||
-rw-r--r-- | include/usb_pd.h | 2 | ||||
-rw-r--r-- | include/usb_pd_tcpm.h | 2 |
4 files changed, 25 insertions, 1 deletions
diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c index 985a9ea531..b87c947c7d 100644 --- a/common/usbc/usb_pe_drp_sm.c +++ b/common/usbc/usb_pe_drp_sm.c @@ -4926,6 +4926,12 @@ static void pe_bist_tx_entry(int port) static void pe_bist_tx_run(int port) { if (pd_timer_is_expired(port, PE_TIMER_BIST_CONT_MODE)) { + /* + * Entry point to disable BIST in TCPC if that's not already + * handled automatically by the TCPC. Unless this method is + * implemented in a TCPM driver, this function does nothing. + */ + tcpm_reset_bist_type_2(port); if (pe[port].power_role == PD_ROLE_SOURCE) set_state_pe(port, PE_SRC_TRANSITION_TO_DEFAULT); diff --git a/include/driver/tcpm/tcpm.h b/include/driver/tcpm/tcpm.h index 3464ce04e1..7965684017 100644 --- a/include/driver/tcpm/tcpm.h +++ b/include/driver/tcpm/tcpm.h @@ -234,6 +234,14 @@ static inline void tcpm_enable_auto_discharge_disconnect(int port, int enable) tcpc->tcpc_enable_auto_discharge_disconnect(port, enable); } +static inline int tcpm_reset_bist_type_2(int port) +{ + if (tcpc_config[port].drv->reset_bist_type_2 != NULL) + return tcpc_config[port].drv->reset_bist_type_2(port); + else + return EC_SUCCESS; +} + /** * Reads a message using get_message_raw driver method and puts it into EC's * cache. @@ -568,4 +576,12 @@ static inline void tcpm_dump_registers(int port) } #endif /* defined(CONFIG_CMD_TCPC_DUMP) */ +/** + * Disable BIST type-2 mode + * + * @param port Type-C port number + * @return EC_SUCCESS on success, or an error + */ +int tcpm_reset_bist_type_2(int port); + #endif diff --git a/include/usb_pd.h b/include/usb_pd.h index 8c5da1c865..81dbc3220a 100644 --- a/include/usb_pd.h +++ b/include/usb_pd.h @@ -228,7 +228,7 @@ enum pd_rx_errors { #define PD_T_NO_RESPONSE (5500*MSEC) /* between 4.5s and 5.5s */ #define PD_T_BIST_TRANSMIT (50*MSEC) /* 50ms (for task_wait arg) */ #define PD_T_BIST_RECEIVE (60*MSEC) /* 60ms (time to process bist) */ -#define PD_T_BIST_CONT_MODE (60*MSEC) /* 30ms to 60ms */ +#define PD_T_BIST_CONT_MODE (55*MSEC) /* 30ms to 60ms */ #define PD_T_VCONN_SOURCE_ON (100*MSEC) /* 100ms */ #define PD_T_DRP_TRY (125*MSEC) /* between 75ms and 150ms */ #define PD_T_TRY_TIMEOUT (550*MSEC) /* between 550ms and 1100ms */ diff --git a/include/usb_pd_tcpm.h b/include/usb_pd_tcpm.h index 885ca24f71..8e461b43b6 100644 --- a/include/usb_pd_tcpm.h +++ b/include/usb_pd_tcpm.h @@ -465,6 +465,8 @@ struct tcpm_drv { */ void (*dump_registers)(int port); #endif /* defined(CONFIG_CMD_TCPC_DUMP) */ + + int (*reset_bist_type_2)(int port); }; /* |