diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 3fc5ac4f3dc1..2b79318a9a9c 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -55,6 +55,7 @@ #include #include #include +#include /* * Export tracepoints that act as a bare tracehook (ie: have no trace event @@ -169,3 +170,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_disable_thermal_cooling_stats); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_gic_resume); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_audio_usb_offload_connect); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_audio_usb_offload_disconnect); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_typec_tcpci_override_toggling); diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c index 28daef821974..a821761b0973 100644 --- a/drivers/usb/typec/tcpm/tcpci.c +++ b/drivers/usb/typec/tcpm/tcpci.c @@ -16,6 +16,7 @@ #include #include #include +#include #define PD_RETRY_COUNT_DEFAULT 3 #define PD_RETRY_COUNT_3_0_OR_HIGHER 2 @@ -179,8 +180,11 @@ static int tcpci_start_toggling(struct tcpc_dev *tcpc, /* Handle vendor drp toggling */ if (tcpci->data->start_drp_toggling) { + int override_toggling = 0; + trace_android_vh_typec_tcpci_override_toggling(tcpci, tcpci->data, + &override_toggling); ret = tcpci->data->start_drp_toggling(tcpci, tcpci->data, cc); - if (ret < 0) + if (ret < 0 || override_toggling) return ret; } diff --git a/include/trace/hooks/typec.h b/include/trace/hooks/typec.h new file mode 100644 index 000000000000..1f3cb079f9e8 --- /dev/null +++ b/include/trace/hooks/typec.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM typec +#define TRACE_INCLUDE_PATH trace/hooks +#if !defined(_TRACE_HOOK_TYPEC_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_HOOK_TYPEC_H +#include +/* + * Following tracepoints are not exported in tracefs and provide a + * mechanism for vendor modules to hook and extend functionality + */ +struct tcpci; +struct tcpci_data; + +DECLARE_HOOK(android_vh_typec_tcpci_override_toggling, + TP_PROTO(struct tcpci *tcpci, struct tcpci_data *data, int *override_toggling), + TP_ARGS(tcpci, data, override_toggling)); + +#endif /* _TRACE_HOOK_UFSHCD_H */ +/* This part must be outside protection */ +#include