···1078 for (i = 0 ; i < ARRAY_SIZE(cbit); i++) {1079 unsigned short val;1080 snd_ac97_write(ac97, reg, 0x8080 | cbit[i] | (cbit[i] << 8));000001081 val = snd_ac97_read(ac97, reg);1082 if (! *lo_max && (val & 0x7f) == cbit[i])1083 *lo_max = max[i];
···1078 for (i = 0 ; i < ARRAY_SIZE(cbit); i++) {1079 unsigned short val;1080 snd_ac97_write(ac97, reg, 0x8080 | cbit[i] | (cbit[i] << 8));1081+ /* Do the read twice due to buffers on some ac97 codecs.1082+ * e.g. The STAC9704 returns exactly what you wrote the the register1083+ * if you read it immediately. This causes the detect routine to fail.1084+ */1085+ val = snd_ac97_read(ac97, reg);1086 val = snd_ac97_read(ac97, reg);1087 if (! *lo_max && (val & 0x7f) == cbit[i])1088 *lo_max = max[i];