Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 170178
b: refs/heads/master
c: 8d567b6
h: refs/heads/master
v: v3
  • Loading branch information
Manuel Lauss authored and Mark Brown committed Oct 19, 2009
1 parent 99dd109 commit a6e9892
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e697cd410a0c3aaea697c9915837e99933d8935b
refs/heads/master: 8d567b6b441bfcc20e8cbebc0dc376b2e280cd88
38 changes: 25 additions & 13 deletions trunk/sound/soc/au1x/psc-ac97.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,12 @@ static unsigned short au1xpsc_ac97_read(struct snd_ac97 *ac97,
AC97_CDC(pscdata));
au_sync();

tmo = 2000;
while ((!(au_readl(AC97_EVNT(pscdata)) & PSC_AC97EVNT_CD))
&& --tmo)
udelay(2);
tmo = 20;
do {
udelay(21);
if (au_readl(AC97_EVNT(pscdata)) & PSC_AC97EVNT_CD)
break;
} while (--tmo);

data = au_readl(AC97_CDC(pscdata));

Expand Down Expand Up @@ -114,10 +116,12 @@ static void au1xpsc_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
AC97_CDC(pscdata));
au_sync();

tmo = 2000;
while ((!(au_readl(AC97_EVNT(pscdata)) & PSC_AC97EVNT_CD))
&& --tmo)
udelay(2);
tmo = 20;
do {
udelay(21);
if (au_readl(AC97_EVNT(pscdata)) & PSC_AC97EVNT_CD)
break;
} while (--tmo);

au_writel(PSC_AC97EVNT_CD, AC97_EVNT(pscdata));
au_sync();
Expand Down Expand Up @@ -200,7 +204,7 @@ static int au1xpsc_ac97_hw_params(struct snd_pcm_substream *substream,
/* FIXME */
struct au1xpsc_audio_data *pscdata = au1xpsc_ac97_workdata;
unsigned long r, ro, stat;
int chans, stype = SUBSTREAM_TYPE(substream);
int chans, t, stype = SUBSTREAM_TYPE(substream);

chans = params_channels(params);

Expand Down Expand Up @@ -242,8 +246,12 @@ static int au1xpsc_ac97_hw_params(struct snd_pcm_substream *substream,
au_sync();

/* ...wait for it... */
while (au_readl(AC97_STAT(pscdata)) & PSC_AC97STAT_DR)
asm volatile ("nop");
t = 100;
while ((au_readl(AC97_STAT(pscdata)) & PSC_AC97STAT_DR) && --t)
msleep(1);

if (!t)
printk(KERN_ERR "PSC-AC97: can't disable!\n");

/* ...write config... */
au_writel(r, AC97_CFG(pscdata));
Expand All @@ -254,8 +262,12 @@ static int au1xpsc_ac97_hw_params(struct snd_pcm_substream *substream,
au_sync();

/* ...and wait for ready bit */
while (!(au_readl(AC97_STAT(pscdata)) & PSC_AC97STAT_DR))
asm volatile ("nop");
t = 100;
while ((!(au_readl(AC97_STAT(pscdata)) & PSC_AC97STAT_DR)) && --t)
msleep(1);

if (!t)
printk(KERN_ERR "PSC-AC97: can't enable!\n");

mutex_unlock(&pscdata->lock);

Expand Down

0 comments on commit a6e9892

Please sign in to comment.