diff options
author | Manuel Lauss <manuel.lauss@googlemail.com> | 2009-10-19 16:10:58 +0200 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-10-19 16:12:30 +0100 |
commit | e697cd410a0c3aaea697c9915837e99933d8935b (patch) | |
tree | 2a256534586e35cdb49c476f3446eac609de3daf /sound/soc | |
parent | d8707cecdf396bdb506252829d03837b2c67c939 (diff) | |
download | op-kernel-dev-e697cd410a0c3aaea697c9915837e99933d8935b.zip op-kernel-dev-e697cd410a0c3aaea697c9915837e99933d8935b.tar.gz |
ASoC: au1x: psc-ac97: verify correct codec register was read
Verify that the correct register has been received from the codec.
Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/au1x/psc-ac97.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sound/soc/au1x/psc-ac97.c b/sound/soc/au1x/psc-ac97.c index a521aa9..efe2afd 100644 --- a/sound/soc/au1x/psc-ac97.c +++ b/sound/soc/au1x/psc-ac97.c @@ -61,7 +61,8 @@ static unsigned short au1xpsc_ac97_read(struct snd_ac97 *ac97, { /* FIXME */ struct au1xpsc_audio_data *pscdata = au1xpsc_ac97_workdata; - unsigned short data, retry, tmo; + unsigned short retry, tmo; + unsigned long data; au_writel(PSC_AC97EVNT_CD, AC97_EVNT(pscdata)); au_sync(); @@ -79,15 +80,19 @@ static unsigned short au1xpsc_ac97_read(struct snd_ac97 *ac97, && --tmo) udelay(2); - data = au_readl(AC97_CDC(pscdata)) & 0xffff; + data = au_readl(AC97_CDC(pscdata)); au_writel(PSC_AC97EVNT_CD, AC97_EVNT(pscdata)); au_sync(); mutex_unlock(&pscdata->lock); + + if (reg != ((data >> 16) & 0x7f)) + tmo = 1; /* wrong register, try again */ + } while (--retry && !tmo); - return retry ? data : 0xffff; + return retry ? data & 0xffff : 0xffff; } /* AC97 controller writes to codec register */ |