From c8314fcb76b4e0484abeb4e2ea7da36898fc8653 Mon Sep 17 00:00:00 2001 From: Kyle Tso Date: Tue, 30 Mar 2021 22:48:50 +0800 Subject: [PATCH] ANDROID: usb: typec: tcpm: Add vendor hook to store partner source capabilities Add a hook after receiving the source capabilities from the partner port. Pass the address of the source capability array so that vendor code is able to access them. OOT bug: Bug: 181629276 Bug: 169215197 Bug: 271294543 Signed-off-by: Kyle Tso Change-Id: I11c4a7919c248690e63c3bfbebfa6b8d711175a6 (cherry picked from commit af7214914ab9ead9356652eed35004482265372d) --- drivers/android/vendor_hooks.c | 1 + drivers/usb/typec/tcpm/tcpm.c | 3 ++- include/trace/hooks/typec.h | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index d0f1ffffd8ec..8cca3108ff0a 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -172,4 +172,5 @@ 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); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_typec_tcpci_get_vbus); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_typec_store_partner_src_caps); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_typec_tcpm_get_timer); diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 4ed7043e1d4f..847fdc3a033c 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -2457,7 +2457,8 @@ static void tcpm_pd_data_request(struct tcpm_port *port, port->nr_source_caps); tcpm_register_source_caps(port); - + trace_android_vh_typec_store_partner_src_caps(&port->nr_source_caps, + &port->source_caps); /* * Adjust revision in subsequent message headers, as required, * to comply with 6.2.1.1.5 of the USB PD 3.0 spec. We don't diff --git a/include/trace/hooks/typec.h b/include/trace/hooks/typec.h index f7c832fca7cd..365d9b681a04 100644 --- a/include/trace/hooks/typec.h +++ b/include/trace/hooks/typec.h @@ -11,6 +11,7 @@ */ struct tcpci; struct tcpci_data; +struct tcpm_port; #ifndef TYPEC_TIMER #define TYPEC_TIMER @@ -41,6 +42,10 @@ DECLARE_HOOK(android_vh_typec_tcpm_get_timer, TP_PROTO(const char *state, enum typec_timer timer, unsigned int *msecs), TP_ARGS(state, timer, msecs)); +DECLARE_HOOK(android_vh_typec_store_partner_src_caps, + TP_PROTO(unsigned int *nr_source_caps, u32 (*source_caps)[]), + TP_ARGS(nr_source_caps, source_caps)); + #endif /* _TRACE_HOOK_UFSHCD_H */ /* This part must be outside protection */ #include