Commit c9eab129 authored by James Courtier-Dutton's avatar James Courtier-Dutton Committed by Jaroslav Kysela

[ALSA] ac97: Fix volume control bit size detection for STAC9704.

AC97 Codec
Signed-off-by: default avatarJames Courtier-Dutton <James@superbug.co.uk>
parent 7c1d549a
...@@ -1078,6 +1078,11 @@ static void check_volume_resolution(ac97_t *ac97, int reg, unsigned char *lo_max ...@@ -1078,6 +1078,11 @@ static void check_volume_resolution(ac97_t *ac97, int reg, unsigned char *lo_max
for (i = 0 ; i < ARRAY_SIZE(cbit); i++) { for (i = 0 ; i < ARRAY_SIZE(cbit); i++) {
unsigned short val; unsigned short val;
snd_ac97_write(ac97, reg, 0x8080 | cbit[i] | (cbit[i] << 8)); snd_ac97_write(ac97, reg, 0x8080 | cbit[i] | (cbit[i] << 8));
/* Do the read twice due to buffers on some ac97 codecs.
* e.g. The STAC9704 returns exactly what you wrote the the register
* if you read it immediately. This causes the detect routine to fail.
*/
val = snd_ac97_read(ac97, reg);
val = snd_ac97_read(ac97, reg); val = snd_ac97_read(ac97, reg);
if (! *lo_max && (val & 0x7f) == cbit[i]) if (! *lo_max && (val & 0x7f) == cbit[i])
*lo_max = max[i]; *lo_max = max[i];
......
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