ANDROID: sound: usb: add vendor hook for cpu suspend support
Add vendor hook android_vh_sound_check_support_cpu_suspend to allow ACPU to suspend during USB playback/capture, if this is supported. Bug: 329345852 Bug: 192206510 Change-Id: Ia8d4c335db27de5fcefab13cab653fd1ae34f691 Signed-off-by: JJ Lee <leejj@google.com> (cherry picked from commit e8516fd3af3f81a65eedb751716e886733d8fcf3) (cherry picked from commit 4cbf19a6f8635cd0227ab790ce570d8da7b1564a)
This commit is contained in:
parent
41292928f9
commit
326690739d
3 changed files with 34 additions and 0 deletions
|
|
@ -72,6 +72,8 @@
|
|||
#include <trace/hooks/suspend.h>
|
||||
#include <trace/hooks/delayacct.h>
|
||||
#include <trace/hooks/usb.h>
|
||||
#include <trace/hooks/sound.h>
|
||||
|
||||
/*
|
||||
* Export tracepoints that act as a bare tracehook (ie: have no trace event
|
||||
* associated with them) to allow external modules to probe them.
|
||||
|
|
@ -401,3 +403,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_delayacct_wpcopy_start);
|
|||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_delayacct_wpcopy_end);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_usb_dev_suspend);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_usb_dev_resume);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sound_usb_support_cpu_suspend);
|
||||
|
|
|
|||
18
include/trace/hooks/sound.h
Normal file
18
include/trace/hooks/sound.h
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM sound
|
||||
#undef TRACE_INCLUDE_PATH
|
||||
#define TRACE_INCLUDE_PATH trace/hooks
|
||||
#if !defined(_TRACE_HOOK_SOUND_H) || defined(TRACE_HEADER_MULTI_READ)
|
||||
#define _TRACE_HOOK_SOUND_H
|
||||
#include <trace/hooks/vendor_hooks.h>
|
||||
|
||||
DECLARE_HOOK(android_vh_sound_usb_support_cpu_suspend,
|
||||
TP_PROTO(struct usb_device *udev,
|
||||
int direction,
|
||||
bool *is_support),
|
||||
TP_ARGS(udev, direction, is_support));
|
||||
|
||||
#endif /* _TRACE_HOOK_SOUND_H */
|
||||
/* This part must be outside protection */
|
||||
#include <trace/define_trace.h>
|
||||
|
|
@ -14,6 +14,8 @@
|
|||
#include <sound/pcm.h>
|
||||
#include <sound/pcm_params.h>
|
||||
|
||||
#include <trace/hooks/sound.h>
|
||||
|
||||
#include "usbaudio.h"
|
||||
#include "card.h"
|
||||
#include "quirks.h"
|
||||
|
|
@ -1175,6 +1177,7 @@ static int snd_usb_pcm_open(struct snd_pcm_substream *substream)
|
|||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct snd_usb_substream *subs = &as->substream[direction];
|
||||
int ret;
|
||||
bool is_support = false;
|
||||
|
||||
ret = snd_vendor_set_pcm_connection(subs->dev, SOUND_PCM_OPEN,
|
||||
direction);
|
||||
|
|
@ -1204,6 +1207,11 @@ static int snd_usb_pcm_open(struct snd_pcm_substream *substream)
|
|||
ret = snd_media_stream_init(subs, as->pcm, direction);
|
||||
if (ret < 0)
|
||||
snd_usb_autosuspend(subs->stream->chip);
|
||||
|
||||
trace_android_vh_sound_usb_support_cpu_suspend(subs->dev, direction, &is_support);
|
||||
if (!ret && is_support)
|
||||
snd_usb_autosuspend(subs->stream->chip);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1213,6 +1221,11 @@ static int snd_usb_pcm_close(struct snd_pcm_substream *substream)
|
|||
struct snd_usb_stream *as = snd_pcm_substream_chip(substream);
|
||||
struct snd_usb_substream *subs = &as->substream[direction];
|
||||
int ret;
|
||||
bool is_support = false;
|
||||
|
||||
trace_android_vh_sound_usb_support_cpu_suspend(subs->dev, direction, &is_support);
|
||||
if (is_support)
|
||||
snd_usb_autoresume(subs->stream->chip);
|
||||
|
||||
ret = snd_vendor_set_pcm_connection(subs->dev, SOUND_PCM_CLOSE,
|
||||
direction);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue