aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/pcm.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2010-03-04 13:46:15 -0500
committerTakashi Iwai <tiwai@suse.de>2010-03-05 02:18:32 -0500
commit015eb0b08150c6fef843efe22609589ead3d4fb8 (patch)
tree3ffcb8b5be54355761d94001a8c5415c965daccd /sound/usb/pcm.c
parente11b4e0e4f5ab40ec342dc07b7201c09a45f9574 (diff)
ALSA: usb-audio: use a format bitmask per alternate setting
In preparation for USB audio 2.0 support, change the audioformat structure so that it uses a bitmask to specify possible formats. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/pcm.c')
-rw-r--r--sound/usb/pcm.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index c3d5a977cfed..bd0f84f3a9d2 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -58,7 +58,9 @@ static struct audioformat *find_format(struct snd_usb_substream *subs, unsigned
58 list_for_each(p, &subs->fmt_list) { 58 list_for_each(p, &subs->fmt_list) {
59 struct audioformat *fp; 59 struct audioformat *fp;
60 fp = list_entry(p, struct audioformat, list); 60 fp = list_entry(p, struct audioformat, list);
61 if (fp->format != format || fp->channels != channels) 61 if (!(fp->formats & (1uLL << format)))
62 continue;
63 if (fp->channels != channels)
62 continue; 64 continue;
63 if (rate < fp->rate_min || rate > fp->rate_max) 65 if (rate < fp->rate_min || rate > fp->rate_max)
64 continue; 66 continue;
@@ -428,10 +430,15 @@ static int hw_check_valid_format(struct snd_usb_substream *subs,
428 struct snd_interval *ct = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); 430 struct snd_interval *ct = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
429 struct snd_mask *fmts = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); 431 struct snd_mask *fmts = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
430 struct snd_interval *pt = hw_param_interval(params, SNDRV_PCM_HW_PARAM_PERIOD_TIME); 432 struct snd_interval *pt = hw_param_interval(params, SNDRV_PCM_HW_PARAM_PERIOD_TIME);
433 struct snd_mask check_fmts;
431 unsigned int ptime; 434 unsigned int ptime;
432 435
433 /* check the format */ 436 /* check the format */
434 if (!snd_mask_test(fmts, fp->format)) { 437 snd_mask_none(&check_fmts);
438 check_fmts.bits[0] = (u32)fp->formats;
439 check_fmts.bits[1] = (u32)(fp->formats >> 32);
440 snd_mask_intersect(&check_fmts, fmts);
441 if (snd_mask_empty(&check_fmts)) {
435 hwc_debug(" > check: no supported format %d\n", fp->format); 442 hwc_debug(" > check: no supported format %d\n", fp->format);
436 return 0; 443 return 0;
437 } 444 }
@@ -584,7 +591,7 @@ static int hw_rule_format(struct snd_pcm_hw_params *params,
584 fp = list_entry(p, struct audioformat, list); 591 fp = list_entry(p, struct audioformat, list);
585 if (!hw_check_valid_format(subs, params, fp)) 592 if (!hw_check_valid_format(subs, params, fp))
586 continue; 593 continue;
587 fbits |= (1ULL << fp->format); 594 fbits |= fp->formats;
588 } 595 }
589 596
590 oldbits[0] = fmt->bits[0]; 597 oldbits[0] = fmt->bits[0];