ANDROID: usb: typec: tcpci: Add vendor hooks for tcpci interface

Needed for controlling BC1.2 detection logic specific to the chip architecture.
Also, needed to implement additional logic to make debug accessorires
specifically designed for Pixel work. These are outside the purview of Type-C spec.

OOT_bug:
Bug: 169213252
Bug: 168245874
Bug: 173252019
Bug: 271294543
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Change-Id: I36fe75dddd8cd4e2054db01ed4fee7ea08dd8702
(cherry picked from commit 08879ea0d6)
This commit is contained in:
Badhri Jagan Sridharan
2021-03-17 15:02:21 -07:00
committed by Treehugger Robot
parent 9a6275b5a6
commit b6325c997c
3 changed files with 28 additions and 1 deletions

View File

@@ -55,6 +55,7 @@
#include <trace/hooks/traps.h>
#include <trace/hooks/thermal.h>
#include <trace/hooks/audio_usboffload.h>
#include <trace/hooks/typec.h>
/*
* Export tracepoints that act as a bare tracehook (ie: have no trace event
@@ -169,3 +170,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_disable_thermal_cooling_stats);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_gic_resume);
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);

View File

@@ -16,6 +16,7 @@
#include <linux/usb/tcpci.h>
#include <linux/usb/tcpm.h>
#include <linux/usb/typec.h>
#include <trace/hooks/typec.h>
#define PD_RETRY_COUNT_DEFAULT 3
#define PD_RETRY_COUNT_3_0_OR_HIGHER 2
@@ -179,8 +180,11 @@ static int tcpci_start_toggling(struct tcpc_dev *tcpc,
/* Handle vendor drp toggling */
if (tcpci->data->start_drp_toggling) {
int override_toggling = 0;
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;
}

View File

@@ -0,0 +1,21 @@
/* 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 <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>