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"); }
static void snd_nm256_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short val) { nm256_t *chip = ac97->private_data; int tries = 2; u32 base; 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)) return; } snd_printd("nm256: ac97 codec not ready..\n"); }
static unsigned short snd_nm256_ac97_read(ac97_t *ac97, unsigned short reg) { nm256_t *chip = ac97->private_data; int res; if (reg >= 128) return 0; if (! snd_nm256_ac97_ready(chip)) return 0; res = snd_nm256_readw(chip, chip->mixer_base + reg); /* Magic delay. Bleah yucky. */ msleep(1); return res; }