ANDROID: usb: typec: tcpci: Add vendor hook to mask vbus present
This hook is for addressing hardware anomalies where TCPC_POWER_STATUS_VBUS_PRES bit can return 0 even before falling below sSinkDisconnect threshold. Handler has to set bypass to override the value that would otherwise be returned by this function. Handler can set vbus or clear vbus to indicate vbus present or absent OOT_bug: Bug: 183149028 Bug: 168245874 Bug: 173252019 Signed-off-by: Badhri Jagan Sridharan <badhri@google.com> Change-Id: I2ca994d49b37bf8600c5913b892fde9acd0dc896 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
1a93d556d7
commit
ffacd097fc
@@ -214,3 +214,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_print_slabinfo_header);
|
|||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cache_show);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cache_show);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_typec_tcpci_override_toggling);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_typec_tcpci_override_toggling);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_typec_tcpci_check_contaminant);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_typec_tcpci_check_contaminant);
|
||||||
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_typec_tcpci_get_vbus);
|
||||||
|
@@ -417,7 +417,11 @@ static int tcpci_get_vbus(struct tcpc_dev *tcpc)
|
|||||||
{
|
{
|
||||||
struct tcpci *tcpci = tcpc_to_tcpci(tcpc);
|
struct tcpci *tcpci = tcpc_to_tcpci(tcpc);
|
||||||
unsigned int reg;
|
unsigned int reg;
|
||||||
int ret;
|
int ret, vbus, bypass = 0;
|
||||||
|
|
||||||
|
trace_android_vh_typec_tcpci_get_vbus(tcpci, tcpci->data, &vbus, &bypass);
|
||||||
|
if (bypass)
|
||||||
|
return vbus;
|
||||||
|
|
||||||
ret = regmap_read(tcpci->regmap, TCPC_POWER_STATUS, ®);
|
ret = regmap_read(tcpci->regmap, TCPC_POWER_STATUS, ®);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
@@ -20,6 +20,18 @@ DECLARE_HOOK(android_vh_typec_tcpci_override_toggling,
|
|||||||
DECLARE_HOOK(android_vh_typec_tcpci_check_contaminant,
|
DECLARE_HOOK(android_vh_typec_tcpci_check_contaminant,
|
||||||
TP_PROTO(struct tcpci *tcpci, struct tcpci_data *data, int *ret),
|
TP_PROTO(struct tcpci *tcpci, struct tcpci_data *data, int *ret),
|
||||||
TP_ARGS(tcpci, data, ret));
|
TP_ARGS(tcpci, data, ret));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This hook is for addressing hardware anomalies where TCPC_POWER_STATUS_VBUS_PRES bit can return 0
|
||||||
|
* even before falling below sSinkDisconnect threshold.
|
||||||
|
* Handler has to set bypass to override the value that would otherwise be returned by this
|
||||||
|
* function.
|
||||||
|
* Handler can set vbus or clear vbus to indicate vbus present or absent
|
||||||
|
*/
|
||||||
|
DECLARE_HOOK(android_vh_typec_tcpci_get_vbus,
|
||||||
|
TP_PROTO(struct tcpci *tcpci, struct tcpci_data *data, int *vbus, int *bypass),
|
||||||
|
TP_ARGS(tcpci, data, vbus, bypass));
|
||||||
|
|
||||||
#endif /* _TRACE_HOOK_UFSHCD_H */
|
#endif /* _TRACE_HOOK_UFSHCD_H */
|
||||||
/* This part must be outside protection */
|
/* This part must be outside protection */
|
||||||
#include <trace/define_trace.h>
|
#include <trace/define_trace.h>
|
||||||
|
Reference in New Issue
Block a user