diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index bea6798d94f6..2b1e02bb16f7 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -45,6 +45,7 @@ #include #include #include +#include /* * Export tracepoints that act as a bare tracehook (ie: have no trace event @@ -211,3 +212,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_slowpath); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_mem); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_print_slabinfo_header); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cache_show); +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 25b480752266..a78514c83902 100644 --- a/drivers/usb/typec/tcpm/tcpci.c +++ b/drivers/usb/typec/tcpm/tcpci.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "tcpci.h" @@ -122,14 +123,17 @@ static int tcpci_start_toggling(struct tcpc_dev *tcpc, int ret; struct tcpci *tcpci = tcpc_to_tcpci(tcpc); unsigned int reg = TCPC_ROLE_CTRL_DRP; + int override_toggling = 0; if (port_type != TYPEC_PORT_DRP) return -EOPNOTSUPP; /* Handle vendor drp toggling */ if (tcpci->data->start_drp_toggling) { + 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..748b800796f8 --- /dev/null +++ b/include/trace/hooks/typec.h @@ -0,0 +1,22 @@ +/* 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 +#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