aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Mack <zonque@gmail.com>2012-08-30 12:52:31 -0400
committerTakashi Iwai <tiwai@suse.de>2012-08-31 15:04:53 -0400
commit2e4a263ca80a203ac6109f5932722a716c265395 (patch)
treea91f59190c940f6f005755ce39c15d61a22d8e83
parent245baf983cc39524cce39c24d01b276e6e653c9e (diff)
ALSA: snd-usb: fix cross-interface streaming devices
Commit 68e67f40b ("ALSA: snd-usb: move calls to usb_set_interface") saved us some unnecessary calls to snd_usb_set_interface() but ignored the fact that there is at least one device out there which operates on two endpoint in different interfaces simultaniously. Take care for this by catching the case where data and sync endpoints are located on different interfaces and calling snd_usb_set_interface() between the start of the two endpoints. Signed-off-by: Daniel Mack <zonque@gmail.com> Reported-by: Robert M. Albrecht <linux@romal.de> Cc: stable@kernel.org [v3.5+] Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/usb/pcm.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index e80b6687f43a..fd5e982fc98c 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -236,6 +236,21 @@ static int start_endpoints(struct snd_usb_substream *subs, int can_sleep)
236 !test_and_set_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags)) { 236 !test_and_set_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags)) {
237 struct snd_usb_endpoint *ep = subs->sync_endpoint; 237 struct snd_usb_endpoint *ep = subs->sync_endpoint;
238 238
239 if (subs->data_endpoint->iface != subs->sync_endpoint->iface ||
240 subs->data_endpoint->alt_idx != subs->sync_endpoint->alt_idx) {
241 err = usb_set_interface(subs->dev,
242 subs->sync_endpoint->iface,
243 subs->sync_endpoint->alt_idx);
244 if (err < 0) {
245 snd_printk(KERN_ERR
246 "%d:%d:%d: cannot set interface (%d)\n",
247 subs->dev->devnum,
248 subs->sync_endpoint->iface,
249 subs->sync_endpoint->alt_idx, err);
250 return -EIO;
251 }
252 }
253
239 snd_printdd(KERN_DEBUG "Starting sync EP @%p\n", ep); 254 snd_printdd(KERN_DEBUG "Starting sync EP @%p\n", ep);
240 255
241 ep->sync_slave = subs->data_endpoint; 256 ep->sync_slave = subs->data_endpoint;