static void snd_nm256_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val) { struct nm256 *chip = ac97->private_data; int tries = 2; int idx = nm256_ac97_idx(reg); u32 base; if (idx < 0) return; base = chip->mixer_base; snd_nm256_ac97_ready(chip); /* Wait for the write to take, too. */ while (tries-- > 0) { snd_nm256_writew(chip, base + reg, val); msleep(1); /* a little delay here seems better.. */ if (snd_nm256_ac97_ready(chip)) { /* successful write: set cache */ chip->ac97_regs[idx] = val; return; } } snd_printd("nm256: ac97 codec not ready..\n"); }
static void snd_nm256_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val) { struct nm256 *chip = ac97->private_data; int tries = 2; int idx = nm256_ac97_idx(reg); u32 base; if (idx < 0) return; base = chip->mixer_base; snd_nm256_ac97_ready(chip); while (tries-- > 0) { snd_nm256_writew(chip, base + reg, val); msleep(1); if (snd_nm256_ac97_ready(chip)) { chip->ac97_regs[idx] = val; return; } } snd_printd("nm256: ac97 codec not ready..\n"); }
/* * some nm256 easily crash when reading from mixer registers * thus we're treating it as a write-only mixer and cache the * written values */ static unsigned short snd_nm256_ac97_read(struct snd_ac97 *ac97, unsigned short reg) { struct nm256 *chip = ac97->private_data; int idx = nm256_ac97_idx(reg); if (idx < 0) return 0; return chip->ac97_regs[idx]; }