diff options
author | Rene Herman <rene.herman@gmail.com> | 2007-09-10 17:19:55 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2007-10-16 10:49:24 -0400 |
commit | 90cf9b853281a39555cce8a42fc0fabad75b42a8 (patch) | |
tree | 45b1da8f46b35d5b7d3fd1e6fbf05518670ff920 /sound/isa/ad1848/ad1848_lib.c | |
parent | 51c80cb65ff9b7bdf172f9075138793c2bce6883 (diff) |
[ALSA] ad1838/cs4231 - fix MCE timeout upon initial load
When the ad1848/cs2431 is first being initialized, auto-calibration may not
be set causing a timeout waiting for it in snd_ad1848/cs4231_mce_down().
This has no dire consequences other than an alarming printk, but since what
we need to wait for is for the calibration to _finish_, let's just check for
that instead.
The early chips need a slight delay (as commented -- 5 sample periods) to be
sure that _if_ calibration is going to happen, it has started when we check
While the CS4231A datasheet implies it'll happen immediately on downing MCE,
some testing is showing that there's a window there as well, so just do the
delay everywhere.
Thanks to Krysztof Helt for pinpointing this problem.
Signed-off-by: Rene Herman <rene.herman@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/isa/ad1848/ad1848_lib.c')
-rw-r--r-- | sound/isa/ad1848/ad1848_lib.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/sound/isa/ad1848/ad1848_lib.c b/sound/isa/ad1848/ad1848_lib.c index f01e564b1238..d454d11989f0 100644 --- a/sound/isa/ad1848/ad1848_lib.c +++ b/sound/isa/ad1848/ad1848_lib.c | |||
@@ -229,16 +229,15 @@ static void snd_ad1848_mce_down(struct snd_ad1848 *chip) | |||
229 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 229 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
230 | return; | 230 | return; |
231 | } | 231 | } |
232 | /* calibration process */ | ||
233 | 232 | ||
234 | for (timeout = 500; timeout > 0 && (snd_ad1848_in(chip, AD1848_TEST_INIT) & AD1848_CALIB_IN_PROGRESS) == 0; timeout--); | 233 | /* |
235 | if ((snd_ad1848_in(chip, AD1848_TEST_INIT) & AD1848_CALIB_IN_PROGRESS) == 0) { | 234 | * Wait for (possible -- during init auto-calibration may not be set) |
236 | snd_printd("mce_down - auto calibration time out (1)\n"); | 235 | * calibration process to start. Needs upto 5 sample periods on AD1848 |
237 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 236 | * which at the slowest possible rate of 5.5125 kHz means 907 us. |
238 | return; | 237 | */ |
239 | } | 238 | msleep(1); |
240 | #if 0 | 239 | #if 0 |
241 | printk("(2) timeout = %i, jiffies = %li\n", timeout, jiffies); | 240 | printk("(2) jiffies = %li\n", jiffies); |
242 | #endif | 241 | #endif |
243 | time = HZ / 4; | 242 | time = HZ / 4; |
244 | while (snd_ad1848_in(chip, AD1848_TEST_INIT) & AD1848_CALIB_IN_PROGRESS) { | 243 | while (snd_ad1848_in(chip, AD1848_TEST_INIT) & AD1848_CALIB_IN_PROGRESS) { |