summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-08-26 10:23:26 +0200
committerTakashi Iwai <tiwai@suse.de>2015-08-26 16:12:25 +0200
commit0662292aec0528363df037ad7c66bf9949c7ce46 (patch)
tree7d6a539c9372652306bc244a9041b037d57a935d
parenta6da499b76b1a75412f047ac388e9ffd69a5c55b (diff)
downloadlinux-0662292aec0528363df037ad7c66bf9949c7ce46.tar.gz
linux-0662292aec0528363df037ad7c66bf9949c7ce46.tar.bz2
linux-0662292aec0528363df037ad7c66bf9949c7ce46.zip
ALSA: usb-audio: Handle normal and auto-suspend equally
In theory, the device may get suspended even at runtime PM suspend. Currently we don't save the mixer state for autopm, and it may bring inconsistency. This patch removes the special handling for autosuspend. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/usb/card.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 73c5833e7657..18f56646ce86 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -689,30 +689,20 @@ static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message)
if (chip == (void *)-1L)
return 0;
- if (!PMSG_IS_AUTO(message)) {
+ chip->autosuspended = !!PMSG_IS_AUTO(message);
+ if (!chip->autosuspended)
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_pcm_suspend_all(as->pcm);
- as->substream[0].need_setup_ep =
- as->substream[1].need_setup_ep = true;
- }
- list_for_each(p, &chip->midi_list) {
- snd_usbmidi_suspend(p);
- }
+ if (!chip->num_suspended_intf++) {
+ list_for_each_entry(as, &chip->pcm_list, list) {
+ snd_pcm_suspend_all(as->pcm);
+ as->substream[0].need_setup_ep =
+ as->substream[1].need_setup_ep = true;
}
- } else {
- /*
- * otherwise we keep the rest of the system in the dark
- * to keep this transparent
- */
- if (!chip->num_suspended_intf++)
- chip->autosuspended = 1;
- }
-
- if (chip->num_suspended_intf == 1)
+ list_for_each(p, &chip->midi_list)
+ snd_usbmidi_suspend(p);
list_for_each_entry(mixer, &chip->mixer_list, list)
snd_usb_mixer_suspend(mixer);
+ }
return 0;
}