summaryrefslogtreecommitdiff
path: root/sound/pci/bt87x.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2007-08-13 19:40:54 +0400
committerJaroslav Kysela <perex@perex.cz>2007-10-16 17:58:54 +0400
commit918f3a0e8cf67b5db966516f255eaf24d814fac0 (patch)
treeae4ac300f4ca93346d4b4ca9a22d760c87ab3072 /sound/pci/bt87x.c
parent7653d557606c7cae921557a6a0ebb7c510e458eb (diff)
downloadlinux-918f3a0e8cf67b5db966516f255eaf24d814fac0.tar.xz
[ALSA] pcm: add snd_pcm_rate_to_rate_bit() helper
Add a snd_pcm_rate_to_rate_bit() function to factor out common code used by several drivers. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/bt87x.c')
-rw-r--r--sound/pci/bt87x.c21
1 files changed, 1 insertions, 20 deletions
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c
index f0e12985dc29..85d50b64d2ba 100644
--- a/sound/pci/bt87x.c
+++ b/sound/pci/bt87x.c
@@ -340,28 +340,9 @@ static struct snd_pcm_hardware snd_bt87x_analog_hw = {
static int snd_bt87x_set_digital_hw(struct snd_bt87x *chip, struct snd_pcm_runtime *runtime)
{
- static struct {
- int rate;
- unsigned int bit;
- } ratebits[] = {
- {8000, SNDRV_PCM_RATE_8000},
- {11025, SNDRV_PCM_RATE_11025},
- {16000, SNDRV_PCM_RATE_16000},
- {22050, SNDRV_PCM_RATE_22050},
- {32000, SNDRV_PCM_RATE_32000},
- {44100, SNDRV_PCM_RATE_44100},
- {48000, SNDRV_PCM_RATE_48000}
- };
- int i;
-
chip->reg_control |= CTL_DA_IOM_DA;
runtime->hw = snd_bt87x_digital_hw;
- runtime->hw.rates = SNDRV_PCM_RATE_KNOT;
- for (i = 0; i < ARRAY_SIZE(ratebits); ++i)
- if (chip->dig_rate == ratebits[i].rate) {
- runtime->hw.rates = ratebits[i].bit;
- break;
- }
+ runtime->hw.rates = snd_pcm_rate_to_rate_bit(chip->dig_rate);
runtime->hw.rate_min = chip->dig_rate;
runtime->hw.rate_max = chip->dig_rate;
return 0;