struct snd_usb_audio *chip = usb_get_intfdata(intf);
struct snd_usb_stream *as;
struct usb_mixer_interface *mixer;
+ struct list_head *p;
if (chip == (void *)-1L)
return 0;
as->substream[0].need_setup_ep =
as->substream[1].need_setup_ep = true;
}
+ list_for_each(p, &chip->midi_list) {
+ snd_usbmidi_suspend(p);
+ }
}
} else {
/*
{
struct snd_usb_audio *chip = usb_get_intfdata(intf);
struct usb_mixer_interface *mixer;
+ struct list_head *p;
int err = 0;
if (chip == (void *)-1L)
goto err_out;
}
+ list_for_each(p, &chip->midi_list) {
+ snd_usbmidi_resume(p);
+ }
+
if (!chip->autosuspended)
snd_power_change_state(chip->card, SNDRV_CTL_POWER_D0);
chip->autosuspended = 0;
}
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.
*/
void snd_usbmidi_input_stop(struct list_head* p);
void snd_usbmidi_input_start(struct list_head* p);
void snd_usbmidi_disconnect(struct list_head *p);
+void snd_usbmidi_suspend(struct list_head *p);
+void snd_usbmidi_resume(struct list_head *p);
#endif /* __USBMIDI_H */