• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM typec
4 #define TRACE_INCLUDE_PATH trace/hooks
5 #if !defined(_TRACE_HOOK_TYPEC_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_HOOK_TYPEC_H
7 #include <linux/tracepoint.h>
8 #include <linux/usb/pd.h>
9 #include <linux/usb/tcpm.h>
10 #include <trace/hooks/vendor_hooks.h>
11 /*
12  * Following tracepoints are not exported in tracefs and provide a
13  * mechanism for vendor modules to hook and extend functionality
14  */
15 #if defined(__GENKSYMS__) || !IS_ENABLED(CONFIG_TYPEC_TCPCI)
16 struct tcpci_data;
17 #else
18 /* struct tcpci_data */
19 #include <../drivers/usb/typec/tcpm/tcpci.h>
20 #endif /* __GENKSYMS__ */
21 struct tcpci;
22 struct tcpm_port;
23 
24 #ifndef TYPEC_TIMER
25 #define TYPEC_TIMER
26 enum typec_timer {
27 	SINK_WAIT_CAP,
28 	SOURCE_OFF,
29 	CC_DEBOUNCE,
30 	SINK_DISCOVERY_BC12,
31 };
32 #endif
33 
34 DECLARE_HOOK(android_vh_typec_tcpci_override_toggling,
35 	TP_PROTO(struct tcpci *tcpci, struct tcpci_data *data, int *override_toggling),
36 	TP_ARGS(tcpci, data, override_toggling));
37 
38 DECLARE_RESTRICTED_HOOK(android_rvh_typec_tcpci_chk_contaminant,
39 	TP_PROTO(struct tcpci *tcpci, struct tcpci_data *data, int *ret),
40 	TP_ARGS(tcpci, data, ret), 1);
41 
42 /*
43  * This hook is for addressing hardware anomalies where TCPC_POWER_STATUS_VBUS_PRES bit can return 0
44  * even before falling below sSinkDisconnect threshold.
45  * Handler has to set bypass to override the value that would otherwise be returned by this
46  * function.
47  * Handler can set vbus or clear vbus to indicate vbus present or absent
48  */
49 DECLARE_RESTRICTED_HOOK(android_rvh_typec_tcpci_get_vbus,
50 	TP_PROTO(struct tcpci *tcpci, struct tcpci_data *data, int *vbus, int *bypass),
51 	TP_ARGS(tcpci, data, vbus, bypass), 1);
52 
53 DECLARE_HOOK(android_vh_typec_tcpm_get_timer,
54 	TP_PROTO(const char *state, enum typec_timer timer, unsigned int *msecs),
55 	TP_ARGS(state, timer, msecs));
56 
57 DECLARE_HOOK(android_vh_typec_store_partner_src_caps,
58 	TP_PROTO(struct tcpm_port *port, unsigned int *nr_source_caps,
59 		 u32 (*source_caps)[PDO_MAX_OBJECTS]),
60 	TP_ARGS(port, nr_source_caps, source_caps));
61 
62 DECLARE_HOOK(android_vh_typec_tcpm_adj_current_limit,
63 	TP_PROTO(const char *state, u32 port_current_limit, u32 port_voltage, bool pd_capable,
64 		  u32 *current_limit, bool *adjust),
65 	TP_ARGS(state, port_current_limit, port_voltage, pd_capable, current_limit, adjust));
66 
67 DECLARE_HOOK(android_vh_typec_tcpm_log,
68 	TP_PROTO(const char *log, bool *bypass),
69 	TP_ARGS(log, bypass));
70 
71 #endif /* _TRACE_HOOK_UFSHCD_H */
72 /* This part must be outside protection */
73 #include <trace/define_trace.h>
74