From 1a93d556d7b9129ee4a53f8c39f091cb6adee7cf Mon Sep 17 00:00:00 2001 From: Badhri Jagan Sridharan Date: Wed, 17 Mar 2021 20:42:37 -0700 Subject: [PATCH] ANDROID: usb: typce: tcpci: Add vendor hook for chip specific features 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 Change-Id: Ibd7b9171f105321c3010fb5b0a67d76a91224800 Signed-off-by: Greg Kroah-Hartman --- drivers/android/vendor_hooks.c | 1 + drivers/usb/typec/tcpm/tcpci.c | 10 ++++++++++ include/trace/hooks/typec.h | 3 +++ 3 files changed, 14 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 2b1e02bb16f7..acabd22047a4 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -213,3 +213,4 @@ 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); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_typec_tcpci_check_contaminant); diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c index a78514c83902..447e3de2f5f3 100644 --- a/drivers/usb/typec/tcpm/tcpci.c +++ b/drivers/usb/typec/tcpm/tcpci.c @@ -426,6 +426,15 @@ static int tcpci_get_vbus(struct tcpc_dev *tcpc) return !!(reg & TCPC_POWER_STATUS_VBUS_PRES); } +static int tcpci_check_contaminant(struct tcpc_dev *tcpc) +{ + struct tcpci *tcpci = tcpc_to_tcpci(tcpc); + int ret = 0; + + trace_android_vh_typec_tcpci_check_contaminant(tcpci, tcpci->data, &ret); + return ret; +} + static bool tcpci_is_vbus_vsafe0v(struct tcpc_dev *tcpc) { struct tcpci *tcpci = tcpc_to_tcpci(tcpc); @@ -744,6 +753,7 @@ struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data *data) tcpci->tcpc.enable_frs = tcpci_enable_frs; tcpci->tcpc.frs_sourcing_vbus = tcpci_frs_sourcing_vbus; tcpci->tcpc.set_partner_usb_comm_capable = tcpci_set_partner_usb_comm_capable; + tcpci->tcpc.check_contaminant = tcpci_check_contaminant; if (tcpci->data->auto_discharge_disconnect) { tcpci->tcpc.enable_auto_vbus_discharge = tcpci_enable_auto_vbus_discharge; diff --git a/include/trace/hooks/typec.h b/include/trace/hooks/typec.h index 748b800796f8..c922e8683fd8 100644 --- a/include/trace/hooks/typec.h +++ b/include/trace/hooks/typec.h @@ -17,6 +17,9 @@ 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)); +DECLARE_HOOK(android_vh_typec_tcpci_check_contaminant, + TP_PROTO(struct tcpci *tcpci, struct tcpci_data *data, int *ret), + TP_ARGS(tcpci, data, ret)); #endif /* _TRACE_HOOK_UFSHCD_H */ /* This part must be outside protection */ #include