ANDROID: sound: usb: Add vendor hooks for connect & disconnect
Add vendor hooks to capture when a USB audio interface is probed and disconnected. These will allow for supporting offloading of audio device handling to a co-processor. The disconnect hook needs to be restricted as the additional vendor handling may need to perform operations (such as wait_for_completion) in non-atomic context. Upstream discussion ongoing https://lore.kernel.org/linux-usb/20230308235751.495-1-quic_wcheng@quicinc.com/ Add the previously used Android vendor hooks and exported symbol changes to android14-6.1 until official patches make it upstream. Bug: 255912822 Change-Id: Idf1da95556814e0ffbdc5f9fb5a25563ebee9be2 Signed-off-by: Jack Pham <quic_jackp@quicinc.com> Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
This commit is contained in:
parent
436cbc5a2e
commit
c3007a3231
@ -55,6 +55,7 @@
|
||||
#include <trace/hooks/fault.h>
|
||||
#include <trace/hooks/traps.h>
|
||||
#include <trace/hooks/thermal.h>
|
||||
#include <trace/hooks/audio_usboffload.h>
|
||||
|
||||
/*
|
||||
* Export tracepoints that act as a bare tracehook (ie: have no trace event
|
||||
@ -174,3 +175,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_panic_unhandled);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_arm64_serror_panic);
|
||||
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);
|
||||
|
25
include/trace/hooks/audio_usboffload.h
Normal file
25
include/trace/hooks/audio_usboffload.h
Normal file
@ -0,0 +1,25 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM audio_usboffload
|
||||
|
||||
#define TRACE_INCLUDE_PATH trace/hooks
|
||||
|
||||
#if !defined(_TRACE_HOOK_AUDIO_USBOFFLOAD_H) || defined(TRACE_HEADER_MULTI_READ)
|
||||
#define _TRACE_HOOK_AUDIO_USBOFFLOAD_H
|
||||
|
||||
#include <trace/hooks/vendor_hooks.h>
|
||||
|
||||
struct usb_interface;
|
||||
struct snd_usb_audio;
|
||||
|
||||
DECLARE_HOOK(android_vh_audio_usb_offload_connect,
|
||||
TP_PROTO(struct usb_interface *intf, struct snd_usb_audio *chip),
|
||||
TP_ARGS(intf, chip));
|
||||
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_audio_usb_offload_disconnect,
|
||||
TP_PROTO(struct usb_interface *intf),
|
||||
TP_ARGS(intf), 1);
|
||||
|
||||
#endif /* _TRACE_HOOK_AUDIO_USBOFFLOAD_H */
|
||||
/* This part must be outside protection */
|
||||
#include <trace/define_trace.h>
|
@ -55,6 +55,8 @@
|
||||
#include "stream.h"
|
||||
#include "media.h"
|
||||
|
||||
#include <trace/hooks/audio_usboffload.h>
|
||||
|
||||
MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>");
|
||||
MODULE_DESCRIPTION("USB Audio");
|
||||
MODULE_LICENSE("GPL");
|
||||
@ -859,6 +861,8 @@ static int usb_audio_probe(struct usb_interface *intf,
|
||||
if (chip->quirk_flags & QUIRK_FLAG_DISABLE_AUTOSUSPEND)
|
||||
usb_disable_autosuspend(interface_to_usbdev(intf));
|
||||
|
||||
trace_android_vh_audio_usb_offload_connect(intf, chip);
|
||||
|
||||
/*
|
||||
* For devices with more than one control interface, we assume the
|
||||
* first contains the audio controls. We might need a more specific
|
||||
@ -945,6 +949,8 @@ static void usb_audio_disconnect(struct usb_interface *intf)
|
||||
|
||||
card = chip->card;
|
||||
|
||||
trace_android_rvh_audio_usb_offload_disconnect(intf);
|
||||
|
||||
mutex_lock(®ister_mutex);
|
||||
if (atomic_inc_return(&chip->shutdown) == 1) {
|
||||
struct snd_usb_stream *as;
|
||||
|
Loading…
Reference in New Issue
Block a user