Re: [PATCH v2 3/4] ALSA: usb-audio: Add UAC3 Power Domains to suspend/resume

From: Takashi Iwai
Date: Mon Jul 30 2018 - 09:07:58 EST


On Mon, 30 Jul 2018 11:23:35 +0200,
Jorge Sanjuan wrote:
>
> Set the UAC3 Power Domain state for an Audio Streaming interface
> to D2 state before suspending the device (usb_driver callback).
> This lets the device know there is no intention to use any of the
> Units in the Audio Function and that the host is not going to
> even listen for wake-up events (interrupts) on the units.
>
> When the usb_driver gets resumed, the state D0 (fully powered) will
> be set. This ties up the UAC3 Power Domains to the runtime PM.
>
> Signed-off-by: Jorge Sanjuan <jorge.sanjuan@xxxxxxxxxxxxxxx>
> ---
> sound/usb/card.c | 9 +++++++++
> sound/usb/pcm.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
> sound/usb/pcm.h | 2 ++
> 3 files changed, 59 insertions(+)
>
> diff --git a/sound/usb/card.c b/sound/usb/card.c
> index a1ed798a1c6b..9c2a15b805c3 100644
> --- a/sound/usb/card.c
> +++ b/sound/usb/card.c
> @@ -808,6 +808,7 @@ static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message)
> snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot);
> if (!chip->num_suspended_intf++) {
> list_for_each_entry(as, &chip->pcm_list, list) {
> + snd_usb_pcm_suspend(as);
> snd_pcm_suspend_all(as->pcm);

The order of the call is doubtful. Supposing that
snd_usb_pcm_suspend() makes the stream in D2 state, it should be done
after actually stopping the stream. That is, it should be done after
snd_pcm_suspend_all().


thanks,

Takashi