aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Schaefer <fschaefer.oss@googlemail.com>2014-01-13 17:02:07 -0500
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-01-14 16:25:17 -0500
commit0191a2a28cdc34a57fee2c027c101a023f9a61f9 (patch)
treec60c2e42b6897b16414d74d61c01a7dae15249dd
parent961717b41bc1103dcd30d293fd689a614fbfa90c (diff)
[media] em28xx: fix check for audio only usb interfaces when changing the usb alternate setting
Previously, we've been assuming that the video endpoints are always at usb interface 0. Hence, if vendor audio endpoints are provided at a separate interface, they were supposed to be at interface number > 0. Instead of checking for (interface number > 0) to determine if an interface is a pure audio interface, dev->is_audio_only should be checked. Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r--drivers/media/usb/em28xx/em28xx-audio.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-audio.c b/drivers/media/usb/em28xx/em28xx-audio.c
index 50c4ab49a276..332abf7b32f8 100644
--- a/drivers/media/usb/em28xx/em28xx-audio.c
+++ b/drivers/media/usb/em28xx/em28xx-audio.c
@@ -266,7 +266,7 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream *substream)
266 dprintk("opening device and trying to acquire exclusive lock\n"); 266 dprintk("opening device and trying to acquire exclusive lock\n");
267 267
268 runtime->hw = snd_em28xx_hw_capture; 268 runtime->hw = snd_em28xx_hw_capture;
269 if ((dev->alt == 0 || dev->ifnum) && dev->adev.users == 0) { 269 if ((dev->alt == 0 || dev->is_audio_only) && dev->adev.users == 0) {
270 int nonblock = !!(substream->f_flags & O_NONBLOCK); 270 int nonblock = !!(substream->f_flags & O_NONBLOCK);
271 271
272 if (nonblock) { 272 if (nonblock) {
@@ -274,10 +274,21 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream *substream)
274 return -EAGAIN; 274 return -EAGAIN;
275 } else 275 } else
276 mutex_lock(&dev->lock); 276 mutex_lock(&dev->lock);
277 if (dev->ifnum) 277 if (dev->is_audio_only)
278 /* vendor audio is on a separate interface */
278 dev->alt = 1; 279 dev->alt = 1;
279 else 280 else
281 /* vendor audio is on the same interface as video */
280 dev->alt = 7; 282 dev->alt = 7;
283 /*
284 * FIXME: The intention seems to be to select the alt
285 * setting with the largest wMaxPacketSize for the video
286 * endpoint.
287 * At least dev->alt should be used instead, but we
288 * should probably not touch it at all if it is
289 * already >0, because wMaxPacketSize of the audio
290 * endpoints seems to be the same for all.
291 */
281 292
282 dprintk("changing alternate number on interface %d to %d\n", 293 dprintk("changing alternate number on interface %d to %d\n",
283 dev->ifnum, dev->alt); 294 dev->ifnum, dev->alt);