Commit c0ff26f2 authored by Jaroslav Kysela's avatar Jaroslav Kysela

[ALSA] Fix rate setting on multiple codecs

AC97 Codec
From Ron Cococcia <ron.cococcia@request.com>:

Fixed the PCM rate setting on multiple AC97 codecs.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 3bac07c8
...@@ -553,7 +553,7 @@ int snd_ac97_pcm_open(struct ac97_pcm *pcm, unsigned int rate, ...@@ -553,7 +553,7 @@ int snd_ac97_pcm_open(struct ac97_pcm *pcm, unsigned int rate,
{ {
ac97_bus_t *bus; ac97_bus_t *bus;
int i, cidx, r, ok_flag; int i, cidx, r, ok_flag;
unsigned int reg_ok = 0; unsigned int reg_ok[4] = {0,0,0,0};
unsigned char reg; unsigned char reg;
int err = 0; int err = 0;
...@@ -602,14 +602,14 @@ int snd_ac97_pcm_open(struct ac97_pcm *pcm, unsigned int rate, ...@@ -602,14 +602,14 @@ int snd_ac97_pcm_open(struct ac97_pcm *pcm, unsigned int rate,
snd_printk(KERN_ERR "invalid AC97 slot %i?\n", i); snd_printk(KERN_ERR "invalid AC97 slot %i?\n", i);
continue; continue;
} }
if (reg_ok & (1 << (reg - AC97_PCM_FRONT_DAC_RATE))) if (reg_ok[cidx] & (1 << (reg - AC97_PCM_FRONT_DAC_RATE)))
continue; continue;
//printk(KERN_DEBUG "setting ac97 reg 0x%x to rate %d\n", reg, rate); //printk(KERN_DEBUG "setting ac97 reg 0x%x to rate %d\n", reg, rate);
err = snd_ac97_set_rate(pcm->r[r].codec[cidx], reg, rate); err = snd_ac97_set_rate(pcm->r[r].codec[cidx], reg, rate);
if (err < 0) if (err < 0)
snd_printk(KERN_ERR "error in snd_ac97_set_rate: cidx=%d, reg=0x%x, rate=%d, err=%d\n", cidx, reg, rate, err); snd_printk(KERN_ERR "error in snd_ac97_set_rate: cidx=%d, reg=0x%x, rate=%d, err=%d\n", cidx, reg, rate, err);
else else
reg_ok |= (1 << (reg - AC97_PCM_FRONT_DAC_RATE)); reg_ok[cidx] |= (1 << (reg - AC97_PCM_FRONT_DAC_RATE));
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment