summaryrefslogtreecommitdiff
path: root/sound/usb/midi.c
diff options
context:
space:
mode:
authorAdam Goode <agoode@google.com>2014-08-05 12:44:50 -0400
committerTakashi Iwai <tiwai@suse.de>2014-08-05 20:08:00 +0200
commitf7881e5e8ef305e62084bf3d31b5b0d827fdf511 (patch)
tree8b9c547475e928678582f6892286310f3a53abe0 /sound/usb/midi.c
parent81cb6b6be54d160ac8feb61f1510f33a3cece1d3 (diff)
ALSA: usb-audio: Respond to suspend and resume callbacks for MIDI input
sound/usb/card.c registers USB suspend and resume but did not previously kill the input URBs. This means that USB MIDI devices left open across suspend/resume had non-functional input (output still usually worked, but it looks like that is another issue). Before this change, we would get ESHUTDOWN for each of the input URBs at suspend time, killing input. Signed-off-by: Adam Goode <agoode@google.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/midi.c')
-rw-r--r--sound/usb/midi.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index 9da74d2e8eee..9a4e82cf4ef9 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -2187,6 +2187,34 @@ void snd_usbmidi_input_start(struct list_head* p)
EXPORT_SYMBOL(snd_usbmidi_input_start);
/*
+ * Prepare for suspend. Typically called from the USB suspend callback.
+ */
+void snd_usbmidi_suspend(struct list_head *p)
+{
+ struct snd_usb_midi *umidi;
+
+ umidi = list_entry(p, struct snd_usb_midi, list);
+ mutex_lock(&umidi->mutex);
+ snd_usbmidi_input_stop(p);
+ mutex_unlock(&umidi->mutex);
+}
+EXPORT_SYMBOL(snd_usbmidi_suspend);
+
+/*
+ * Resume. Typically called from the USB resume callback.
+ */
+void snd_usbmidi_resume(struct list_head *p)
+{
+ struct snd_usb_midi *umidi;
+
+ umidi = list_entry(p, struct snd_usb_midi, list);
+ mutex_lock(&umidi->mutex);
+ snd_usbmidi_input_start(p);
+ mutex_unlock(&umidi->mutex);
+}
+EXPORT_SYMBOL(snd_usbmidi_resume);
+
+/*
* Creates and registers everything needed for a MIDI streaming interface.
*/
int snd_usbmidi_create(struct snd_card *card,