aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Lauss <manuel.lauss@googlemail.com>2009-10-19 10:10:58 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-10-19 11:12:30 -0400
commite697cd410a0c3aaea697c9915837e99933d8935b (patch)
tree2a256534586e35cdb49c476f3446eac609de3daf
parentd8707cecdf396bdb506252829d03837b2c67c939 (diff)
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>
-rw-r--r--sound/soc/au1x/psc-ac97.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sound/soc/au1x/psc-ac97.c b/sound/soc/au1x/psc-ac97.c
index a521aa90dde..efe2afd4fe2 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,
61{ 61{
62 /* FIXME */ 62 /* FIXME */
63 struct au1xpsc_audio_data *pscdata = au1xpsc_ac97_workdata; 63 struct au1xpsc_audio_data *pscdata = au1xpsc_ac97_workdata;
64 unsigned short data, retry, tmo; 64 unsigned short retry, tmo;
65 unsigned long data;
65 66
66 au_writel(PSC_AC97EVNT_CD, AC97_EVNT(pscdata)); 67 au_writel(PSC_AC97EVNT_CD, AC97_EVNT(pscdata));
67 au_sync(); 68 au_sync();
@@ -79,15 +80,19 @@ static unsigned short au1xpsc_ac97_read(struct snd_ac97 *ac97,
79 && --tmo) 80 && --tmo)
80 udelay(2); 81 udelay(2);
81 82
82 data = au_readl(AC97_CDC(pscdata)) & 0xffff; 83 data = au_readl(AC97_CDC(pscdata));
83 84
84 au_writel(PSC_AC97EVNT_CD, AC97_EVNT(pscdata)); 85 au_writel(PSC_AC97EVNT_CD, AC97_EVNT(pscdata));
85 au_sync(); 86 au_sync();
86 87
87 mutex_unlock(&pscdata->lock); 88 mutex_unlock(&pscdata->lock);
89
90 if (reg != ((data >> 16) & 0x7f))
91 tmo = 1; /* wrong register, try again */
92
88 } while (--retry && !tmo); 93 } while (--retry && !tmo);
89 94
90 return retry ? data : 0xffff; 95 return retry ? data & 0xffff : 0xffff;
91} 96}
92 97
93/* AC97 controller writes to codec register */ 98/* AC97 controller writes to codec register */