Commit e697cd41 authored by Manuel Lauss's avatar Manuel Lauss Committed by Mark Brown

ASoC: au1x: psc-ac97: verify correct codec register was read

Verify that the correct register has been received from the codec.
Signed-off-by: default avatarManuel Lauss <manuel.lauss@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent d8707cec
...@@ -61,7 +61,8 @@ static unsigned short au1xpsc_ac97_read(struct snd_ac97 *ac97, ...@@ -61,7 +61,8 @@ static unsigned short au1xpsc_ac97_read(struct snd_ac97 *ac97,
{ {
/* FIXME */ /* FIXME */
struct au1xpsc_audio_data *pscdata = au1xpsc_ac97_workdata; 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_writel(PSC_AC97EVNT_CD, AC97_EVNT(pscdata));
au_sync(); au_sync();
...@@ -79,15 +80,19 @@ static unsigned short au1xpsc_ac97_read(struct snd_ac97 *ac97, ...@@ -79,15 +80,19 @@ static unsigned short au1xpsc_ac97_read(struct snd_ac97 *ac97,
&& --tmo) && --tmo)
udelay(2); udelay(2);
data = au_readl(AC97_CDC(pscdata)) & 0xffff; data = au_readl(AC97_CDC(pscdata));
au_writel(PSC_AC97EVNT_CD, AC97_EVNT(pscdata)); au_writel(PSC_AC97EVNT_CD, AC97_EVNT(pscdata));
au_sync(); au_sync();
mutex_unlock(&pscdata->lock); mutex_unlock(&pscdata->lock);
if (reg != ((data >> 16) & 0x7f))
tmo = 1; /* wrong register, try again */
} while (--retry && !tmo); } while (--retry && !tmo);
return retry ? data : 0xffff; return retry ? data & 0xffff : 0xffff;
} }
/* AC97 controller writes to codec register */ /* AC97 controller writes to codec register */
......
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