ANDROID: usb: typec: tcpci: Add vendor hooks for tcpci interface
Needed to implement chip specific features that are not defined in the Type-C spec. OOT_bug: Bug: 169213252 Bug: 168245874 Bug: 173252019 Signed-off-by: Badhri Jagan Sridharan <badhri@google.com> Change-Id: I36fe75dddd8cd4e2054db01ed4fee7ea08dd8702 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
892e618852
commit
08879ea0d6
@@ -45,6 +45,7 @@
|
||||
#include <trace/hooks/creds.h>
|
||||
#include <trace/hooks/module.h>
|
||||
#include <trace/hooks/memory.h>
|
||||
#include <trace/hooks/typec.h>
|
||||
|
||||
/*
|
||||
* 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);
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include <linux/usb/pd.h>
|
||||
#include <linux/usb/tcpm.h>
|
||||
#include <linux/usb/typec.h>
|
||||
#include <trace/hooks/typec.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
|
22
include/trace/hooks/typec.h
Normal file
22
include/trace/hooks/typec.h
Normal file
@@ -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 <linux/tracepoint.h>
|
||||
#include <trace/hooks/vendor_hooks.h>
|
||||
/*
|
||||
* 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 <trace/define_trace.h>
|
Reference in New Issue
Block a user