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
Signed-off-by: Kyle Tso <kyletso@google.com>
Change-Id: I11c4a7919c248690e63c3bfbebfa6b8d711175a6
This commit is contained in:
Kyle Tso
2021-03-30 22:48:50 +08:00
parent 73be6141e9
commit af7214914a
3 changed files with 11 additions and 0 deletions

View File

@@ -219,6 +219,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cache_show);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_typec_tcpci_override_toggling);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_typec_tcpci_chk_contaminant);
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_account_task_time);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_gpio_block_read);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ep_create_wakeup_source);

View File

@@ -2276,6 +2276,9 @@ static void tcpm_pd_data_request(struct tcpm_port *port,
tcpm_validate_caps(port, port->source_caps,
port->nr_source_caps);
trace_android_vh_typec_store_partner_src_caps(port, &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

View File

@@ -5,6 +5,7 @@
#if !defined(_TRACE_HOOK_TYPEC_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_TYPEC_H
#include <linux/tracepoint.h>
#include <linux/usb/pd.h>
#include <trace/hooks/vendor_hooks.h>
/*
* Following tracepoints are not exported in tracefs and provide a
@@ -12,6 +13,7 @@
*/
struct tcpci;
struct tcpci_data;
struct tcpm_port;
#ifndef TYPEC_TIMER
#define TYPEC_TIMER
@@ -46,6 +48,11 @@ 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(struct tcpm_port *port, unsigned int *nr_source_caps,
u32 (*source_caps)[PDO_MAX_OBJECTS]),
TP_ARGS(port, nr_source_caps, source_caps));
#endif /* _TRACE_HOOK_UFSHCD_H */
/* This part must be outside protection */
#include <trace/define_trace.h>