ALSA: fix a typo during snd_assert() removal
[safe/jmp/linux-2.6] / sound / core / pcm_misc.c
index afd1e49..89b7f54 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  PCM Interface - misc routines
- *  Copyright (c) 1998 by Jaroslav Kysela <perex@suse.cz>
+ *  Copyright (c) 1998 by Jaroslav Kysela <perex@perex.cz>
  *
  *
  *   This library is free software; you can redistribute it and/or modify
@@ -19,7 +19,6 @@
  *
  */
   
-#include <sound/driver.h>
 #include <linux/time.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
@@ -75,7 +74,7 @@ static struct pcm_format_data pcm_formats[SNDRV_PCM_FORMAT_LAST+1] = {
        },
        [SNDRV_PCM_FORMAT_U24_BE] = {
                .width = 24, .phys = 32, .le = 0, .signd = 0,
-               .silence = { 0x80, 0x00, 0x00 },
+               .silence = { 0x00, 0x80, 0x00, 0x00 },
        },
        [SNDRV_PCM_FORMAT_S32_LE] = {
                .width = 32, .phys = 32, .le = 1, .signd = 1,
@@ -450,3 +449,21 @@ int snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime)
 }
 
 EXPORT_SYMBOL(snd_pcm_limit_hw_rates);
+
+/**
+ * snd_pcm_rate_to_rate_bit - converts sample rate to SNDRV_PCM_RATE_xxx bit
+ * @rate: the sample rate to convert
+ *
+ * Returns the SNDRV_PCM_RATE_xxx flag that corresponds to the given rate, or
+ * SNDRV_PCM_RATE_KNOT for an unknown rate.
+ */
+unsigned int snd_pcm_rate_to_rate_bit(unsigned int rate)
+{
+       unsigned int i;
+
+       for (i = 0; i < snd_pcm_known_rates.count; i++)
+               if (snd_pcm_known_rates.list[i] == rate)
+                       return 1u << i;
+       return SNDRV_PCM_RATE_KNOT;
+}
+EXPORT_SYMBOL(snd_pcm_rate_to_rate_bit);