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