From 6e3531cfc50716adc33a33ea18485ce01e7b6e47 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 3 May 2013 13:29:39 -0700 Subject: [PATCH] 3.0-stable patches added patches: alsa-usb-audio-disable-autopm-for-midi-devices.patch alsa-usb-audio-fix-autopm-error-during-probing.patch --- ...udio-disable-autopm-for-midi-devices.patch | 87 +++++++++++++++++++ ...udio-fix-autopm-error-during-probing.patch | 43 +++++++++ queue-3.0/series | 2 + 3 files changed, 132 insertions(+) create mode 100644 queue-3.0/alsa-usb-audio-disable-autopm-for-midi-devices.patch create mode 100644 queue-3.0/alsa-usb-audio-fix-autopm-error-during-probing.patch diff --git a/queue-3.0/alsa-usb-audio-disable-autopm-for-midi-devices.patch b/queue-3.0/alsa-usb-audio-disable-autopm-for-midi-devices.patch new file mode 100644 index 00000000000..022a0c7d6ed --- /dev/null +++ b/queue-3.0/alsa-usb-audio-disable-autopm-for-midi-devices.patch @@ -0,0 +1,87 @@ +From cbc200bca4b51a8e2406d4b654d978f8503d430b Mon Sep 17 00:00:00 2001 +From: Clemens Ladisch +Date: Mon, 15 Apr 2013 15:59:51 +0200 +Subject: ALSA: usb-audio: disable autopm for MIDI devices + +From: Clemens Ladisch + +commit cbc200bca4b51a8e2406d4b654d978f8503d430b upstream. + +Commit 88a8516a2128 (ALSA: usbaudio: implement USB autosuspend) +introduced autopm for all USB audio/MIDI devices. However, many MIDI +devices, such as synthesizers, do not merely transmit MIDI messages but +use their MIDI inputs to control other functions. With autopm, these +devices would get powered down as soon as the last MIDI port device is +closed on the host. + +Even some plain MIDI interfaces could get broken: they automatically +send Active Sensing messages while powered up, but as soon as these +messages cease, the receiving device would interpret this as an +accidental disconnection. + +Commit f5f165418cab (ALSA: usb-audio: Fix missing autopm for MIDI input) +introduced another regression: some devices (e.g. the Roland GAIA SH-01) +are self-powered but do a reset whenever the USB interface's power state +changes. + +To work around all this, just disable autopm for all USB MIDI devices. + +Reported-by: Laurens Holst +Signed-off-by: Clemens Ladisch +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/usb/midi.c | 13 ++----------- + 1 file changed, 2 insertions(+), 11 deletions(-) + +--- a/sound/usb/midi.c ++++ b/sound/usb/midi.c +@@ -125,7 +125,6 @@ struct snd_usb_midi { + struct snd_usb_midi_in_endpoint *in; + } endpoints[MIDI_MAX_ENDPOINTS]; + unsigned long input_triggered; +- bool autopm_reference; + unsigned int opened[2]; + unsigned char disconnected; + unsigned char input_running; +@@ -1023,7 +1022,6 @@ static int substream_open(struct snd_raw + { + struct snd_usb_midi* umidi = substream->rmidi->private_data; + struct snd_kcontrol *ctl; +- int err; + + down_read(&umidi->disc_rwsem); + if (umidi->disconnected) { +@@ -1034,13 +1032,6 @@ static int substream_open(struct snd_raw + mutex_lock(&umidi->mutex); + if (open) { + if (!umidi->opened[0] && !umidi->opened[1]) { +- err = usb_autopm_get_interface(umidi->iface); +- umidi->autopm_reference = err >= 0; +- if (err < 0 && err != -EACCES) { +- mutex_unlock(&umidi->mutex); +- up_read(&umidi->disc_rwsem); +- return -EIO; +- } + if (umidi->roland_load_ctl) { + ctl = umidi->roland_load_ctl; + ctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE; +@@ -1063,8 +1054,6 @@ static int substream_open(struct snd_raw + snd_ctl_notify(umidi->card, + SNDRV_CTL_EVENT_MASK_INFO, &ctl->id); + } +- if (umidi->autopm_reference) +- usb_autopm_put_interface(umidi->iface); + } + } + mutex_unlock(&umidi->mutex); +@@ -2228,6 +2217,8 @@ int snd_usbmidi_create(struct snd_card * + return err; + } + ++ usb_autopm_get_interface_no_resume(umidi->iface); ++ + list_add_tail(&umidi->list, midi_list); + return 0; + } diff --git a/queue-3.0/alsa-usb-audio-fix-autopm-error-during-probing.patch b/queue-3.0/alsa-usb-audio-fix-autopm-error-during-probing.patch new file mode 100644 index 00000000000..0ca1a15147a --- /dev/null +++ b/queue-3.0/alsa-usb-audio-fix-autopm-error-during-probing.patch @@ -0,0 +1,43 @@ +From 60af3d037eb8c670dcce31401501d1271e7c5d95 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Thu, 25 Apr 2013 07:38:15 +0200 +Subject: ALSA: usb-audio: Fix autopm error during probing + +From: Takashi Iwai + +commit 60af3d037eb8c670dcce31401501d1271e7c5d95 upstream. + +We've got strange errors in get_ctl_value() in mixer.c during +probing, e.g. on Hercules RMX2 DJ Controller: + + ALSA mixer.c:352 cannot get ctl value: req = 0x83, wValue = 0x201, wIndex = 0xa00, type = 4 + ALSA mixer.c:352 cannot get ctl value: req = 0x83, wValue = 0x200, wIndex = 0xa00, type = 4 + .... + +It turned out that the culprit is autopm: snd_usb_autoresume() returns +-ENODEV when called during card->probing = 1. + +Since the call itself during card->probing = 1 is valid, let's fix the +return value of snd_usb_autoresume() as success. + +Reported-and-tested-by: Daniel Schürmann +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/usb/card.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/sound/usb/card.c ++++ b/sound/usb/card.c +@@ -610,7 +610,9 @@ int snd_usb_autoresume(struct snd_usb_au + int err = -ENODEV; + + down_read(&chip->shutdown_rwsem); +- if (!chip->shutdown && !chip->probing) ++ if (chip->probing) ++ err = 0; ++ else if (!chip->shutdown) + err = usb_autopm_get_interface(chip->pm_intf); + up_read(&chip->shutdown_rwsem); + diff --git a/queue-3.0/series b/queue-3.0/series index d05dc1ad64d..e3a656304a7 100644 --- a/queue-3.0/series +++ b/queue-3.0/series @@ -24,3 +24,5 @@ pci-acpi-don-t-query-osc-support-with-all-possible-controls.patch wrong-asm-register-contraints-in-the-futex-implementation.patch wrong-asm-register-contraints-in-the-kvm-implementation.patch fs-fscache-stats.c-fix-memory-leak.patch +alsa-usb-audio-disable-autopm-for-midi-devices.patch +alsa-usb-audio-fix-autopm-error-during-probing.patch -- 2.47.3