aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorOliver Neukum <oneukum@suse.de>2011-03-11 07:19:43 -0500
committerTakashi Iwai <tiwai@suse.de>2011-03-11 08:51:51 -0500
commitedf7de31c25ce72f163bf7d1fc0d2711869d073c (patch)
tree4b3b7946c6f97ebf9592d525fd1ce9e07fbb8148 /sound
parentcc99a0861fa1c72335dc91a2e06d0b431911d55e (diff)
ALSA: usbaudio: fix suspend/resume
- ESHUTDOWN must be correctly handled - the optional interrupt endpoint's URB must be stopped and restarted Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/usb/card.c10
-rw-r--r--sound/usb/mixer.c25
-rw-r--r--sound/usb/mixer.h2
3 files changed, 34 insertions, 3 deletions
diff --git a/sound/usb/card.c b/sound/usb/card.c
index c0f8270bc199..7fa53d91e73b 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -586,6 +586,7 @@ static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message)
586 struct snd_usb_audio *chip = usb_get_intfdata(intf); 586 struct snd_usb_audio *chip = usb_get_intfdata(intf);
587 struct list_head *p; 587 struct list_head *p;
588 struct snd_usb_stream *as; 588 struct snd_usb_stream *as;
589 struct usb_mixer_interface *mixer;
589 590
590 if (chip == (void *)-1L) 591 if (chip == (void *)-1L)
591 return 0; 592 return 0;
@@ -596,6 +597,10 @@ static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message)
596 as = list_entry(p, struct snd_usb_stream, list); 597 as = list_entry(p, struct snd_usb_stream, list);
597 snd_pcm_suspend_all(as->pcm); 598 snd_pcm_suspend_all(as->pcm);
598 } 599 }
600
601 list_for_each_entry(mixer, &chip->mixer_list, list) {
602 snd_usb_mixer_inactivate(mixer);
603 }
599 } 604 }
600 605
601 return 0; 606 return 0;
@@ -604,6 +609,7 @@ static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message)
604static int usb_audio_resume(struct usb_interface *intf) 609static int usb_audio_resume(struct usb_interface *intf)
605{ 610{
606 struct snd_usb_audio *chip = usb_get_intfdata(intf); 611 struct snd_usb_audio *chip = usb_get_intfdata(intf);
612 struct usb_mixer_interface *mixer;
607 613
608 if (chip == (void *)-1L) 614 if (chip == (void *)-1L)
609 return 0; 615 return 0;
@@ -611,8 +617,10 @@ static int usb_audio_resume(struct usb_interface *intf)
611 return 0; 617 return 0;
612 /* 618 /*
613 * ALSA leaves material resumption to user space 619 * ALSA leaves material resumption to user space
614 * we just notify 620 * we just notify and restart the mixers
615 */ 621 */
622 list_for_each_entry(mixer, &chip->mixer_list, list)
623 snd_usb_mixer_activate(mixer);
616 624
617 snd_power_change_state(chip->card, SNDRV_CTL_POWER_D0); 625 snd_power_change_state(chip->card, SNDRV_CTL_POWER_D0);
618 626
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 675a4f1b5de1..09e59345bb6d 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -2075,8 +2075,9 @@ static void snd_usb_mixer_interrupt(struct urb *urb)
2075{ 2075{
2076 struct usb_mixer_interface *mixer = urb->context; 2076 struct usb_mixer_interface *mixer = urb->context;
2077 int len = urb->actual_length; 2077 int len = urb->actual_length;
2078 int ustatus = urb->status;
2078 2079
2079 if (urb->status != 0) 2080 if (ustatus != 0)
2080 goto requeue; 2081 goto requeue;
2081 2082
2082 if (mixer->protocol == UAC_VERSION_1) { 2083 if (mixer->protocol == UAC_VERSION_1) {
@@ -2117,12 +2118,32 @@ static void snd_usb_mixer_interrupt(struct urb *urb)
2117 } 2118 }
2118 2119
2119requeue: 2120requeue:
2120 if (urb->status != -ENOENT && urb->status != -ECONNRESET) { 2121 if (ustatus != -ENOENT && ustatus != -ECONNRESET && ustatus != -ESHUTDOWN) {
2121 urb->dev = mixer->chip->dev; 2122 urb->dev = mixer->chip->dev;
2122 usb_submit_urb(urb, GFP_ATOMIC); 2123 usb_submit_urb(urb, GFP_ATOMIC);
2123 } 2124 }
2124} 2125}
2125 2126
2127/* stop any bus activity of a mixer */
2128void snd_usb_mixer_inactivate(struct usb_mixer_interface *mixer)
2129{
2130 usb_kill_urb(mixer->urb);
2131 usb_kill_urb(mixer->rc_urb);
2132}
2133
2134int snd_usb_mixer_activate(struct usb_mixer_interface *mixer)
2135{
2136 int err;
2137
2138 if (mixer->urb) {
2139 err = usb_submit_urb(mixer->urb, GFP_NOIO);
2140 if (err < 0)
2141 return err;
2142 }
2143
2144 return 0;
2145}
2146
2126/* create the handler for the optional status interrupt endpoint */ 2147/* create the handler for the optional status interrupt endpoint */
2127static int snd_usb_mixer_status_create(struct usb_mixer_interface *mixer) 2148static int snd_usb_mixer_status_create(struct usb_mixer_interface *mixer)
2128{ 2149{
diff --git a/sound/usb/mixer.h b/sound/usb/mixer.h
index 26c636c5c93a..b4a2c8165e4b 100644
--- a/sound/usb/mixer.h
+++ b/sound/usb/mixer.h
@@ -52,5 +52,7 @@ void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid);
52 52
53int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval, 53int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
54 int request, int validx, int value_set); 54 int request, int validx, int value_set);
55void snd_usb_mixer_inactivate(struct usb_mixer_interface *mixer);
56int snd_usb_mixer_activate(struct usb_mixer_interface *mixer);
55 57
56#endif /* __USBMIXER_H */ 58#endif /* __USBMIXER_H */