aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2013-04-15 09:59:51 -0400
committerTakashi Iwai <tiwai@suse.de>2013-04-15 10:03:57 -0400
commitcbc200bca4b51a8e2406d4b654d978f8503d430b (patch)
treee016be39de0e9198f5c185756bcbf12590cb1f03 /sound/usb
parentd240d1dcd5b42df4680e65f637e71bbc954e4d74 (diff)
ALSA: usb-audio: disable autopm for MIDI devices
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 Cc: <stable@vger.kernel.org> Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/midi.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index 60c7aa7579cc..8e01fa4991c5 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -126,7 +126,6 @@ struct snd_usb_midi {
126 struct snd_usb_midi_in_endpoint *in; 126 struct snd_usb_midi_in_endpoint *in;
127 } endpoints[MIDI_MAX_ENDPOINTS]; 127 } endpoints[MIDI_MAX_ENDPOINTS];
128 unsigned long input_triggered; 128 unsigned long input_triggered;
129 bool autopm_reference;
130 unsigned int opened[2]; 129 unsigned int opened[2];
131 unsigned char disconnected; 130 unsigned char disconnected;
132 unsigned char input_running; 131 unsigned char input_running;
@@ -1040,7 +1039,6 @@ static int substream_open(struct snd_rawmidi_substream *substream, int dir,
1040{ 1039{
1041 struct snd_usb_midi* umidi = substream->rmidi->private_data; 1040 struct snd_usb_midi* umidi = substream->rmidi->private_data;
1042 struct snd_kcontrol *ctl; 1041 struct snd_kcontrol *ctl;
1043 int err;
1044 1042
1045 down_read(&umidi->disc_rwsem); 1043 down_read(&umidi->disc_rwsem);
1046 if (umidi->disconnected) { 1044 if (umidi->disconnected) {
@@ -1051,13 +1049,6 @@ static int substream_open(struct snd_rawmidi_substream *substream, int dir,
1051 mutex_lock(&umidi->mutex); 1049 mutex_lock(&umidi->mutex);
1052 if (open) { 1050 if (open) {
1053 if (!umidi->opened[0] && !umidi->opened[1]) { 1051 if (!umidi->opened[0] && !umidi->opened[1]) {
1054 err = usb_autopm_get_interface(umidi->iface);
1055 umidi->autopm_reference = err >= 0;
1056 if (err < 0 && err != -EACCES) {
1057 mutex_unlock(&umidi->mutex);
1058 up_read(&umidi->disc_rwsem);
1059 return -EIO;
1060 }
1061 if (umidi->roland_load_ctl) { 1052 if (umidi->roland_load_ctl) {
1062 ctl = umidi->roland_load_ctl; 1053 ctl = umidi->roland_load_ctl;
1063 ctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE; 1054 ctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE;
@@ -1080,8 +1071,6 @@ static int substream_open(struct snd_rawmidi_substream *substream, int dir,
1080 snd_ctl_notify(umidi->card, 1071 snd_ctl_notify(umidi->card,
1081 SNDRV_CTL_EVENT_MASK_INFO, &ctl->id); 1072 SNDRV_CTL_EVENT_MASK_INFO, &ctl->id);
1082 } 1073 }
1083 if (umidi->autopm_reference)
1084 usb_autopm_put_interface(umidi->iface);
1085 } 1074 }
1086 } 1075 }
1087 mutex_unlock(&umidi->mutex); 1076 mutex_unlock(&umidi->mutex);
@@ -2258,6 +2247,8 @@ int snd_usbmidi_create(struct snd_card *card,
2258 return err; 2247 return err;
2259 } 2248 }
2260 2249
2250 usb_autopm_get_interface_no_resume(umidi->iface);
2251
2261 list_add_tail(&umidi->list, midi_list); 2252 list_add_tail(&umidi->list, midi_list);
2262 return 0; 2253 return 0;
2263} 2254}