aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorKrzysztof Helt <krzysztof.h1@wp.pl>2007-09-10 18:55:46 -0400
committerJaroslav Kysela <perex@perex.cz>2007-10-16 10:52:05 -0400
commit56f91585b48bb3ca8ec38b84c92d3df2a2f2bf66 (patch)
tree93032e199ed4bcb11146effb1ec59c5025e1c9d1 /sound
parent7e52f3dac7fe08ae7c3e82178c95a43aa0911c33 (diff)
[ALSA] sun-cs4231: improved waiting after MCE down
This patch sync sparc driver with x86 isa cs4231 driver patches. It fixes wrong waiting for the auto calibration bit and makes further waiting use much finer granularity. Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound')
-rw-r--r--sound/sparc/cs4231.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c
index 4f515a64e03f..ab39860e2404 100644
--- a/sound/sparc/cs4231.c
+++ b/sound/sparc/cs4231.c
@@ -422,44 +422,39 @@ static void snd_cs4231_mce_down(struct snd_cs4231 *chip)
422 spin_unlock_irqrestore(&chip->lock, flags); 422 spin_unlock_irqrestore(&chip->lock, flags);
423 return; 423 return;
424 } 424 }
425 snd_cs4231_busy_wait(chip);
426
427 /* calibration process */
428 425
429 snd_cs4231_ready(chip); 426 /*
430 snd_cs4231_ready(chip); 427 * Wait for (possible -- during init auto-calibration may not be set)
431 timeout = snd_cs4231_in(chip, CS4231_TEST_INIT); 428 * calibration process to start. Needs upto 5 sample periods on AD1848
432 if ((timeout & CS4231_CALIB_IN_PROGRESS) == 0) { 429 * which at the slowest possible rate of 5.5125 kHz means 907 us.
433 snd_printd("cs4231_mce_down - auto calibration time out (1)\n"); 430 */
434 spin_unlock_irqrestore(&chip->lock, flags); 431 msleep(1);
435 return;
436 }
437 432
438 /* in 10ms increments, check condition, up to 250ms */ 433 /* check condition up to 250ms */
439 timeout = 25; 434 timeout = msecs_to_jiffies(250);
440 while (snd_cs4231_in(chip, CS4231_TEST_INIT) & 435 while (snd_cs4231_in(chip, CS4231_TEST_INIT) &
441 CS4231_CALIB_IN_PROGRESS) { 436 CS4231_CALIB_IN_PROGRESS) {
442 437
443 spin_unlock_irqrestore(&chip->lock, flags); 438 spin_unlock_irqrestore(&chip->lock, flags);
444 if (--timeout < 0) { 439 if (timeout <= 0) {
445 snd_printk("mce_down - " 440 snd_printk("mce_down - "
446 "auto calibration time out (2)\n"); 441 "auto calibration time out (2)\n");
447 return; 442 return;
448 } 443 }
449 msleep(10); 444 timeout = schedule_timeout(timeout);
450 spin_lock_irqsave(&chip->lock, flags); 445 spin_lock_irqsave(&chip->lock, flags);
451 } 446 }
452 447
453 /* in 10ms increments, check condition, up to 100ms */ 448 /* check condition up to 100ms */
454 timeout = 10; 449 timeout = msecs_to_jiffies(100);
455 while (__cs4231_readb(chip, CS4231U(chip, REGSEL)) & CS4231_INIT) { 450 while (__cs4231_readb(chip, CS4231U(chip, REGSEL)) & CS4231_INIT) {
456 spin_unlock_irqrestore(&chip->lock, flags); 451 spin_unlock_irqrestore(&chip->lock, flags);
457 if (--timeout < 0) { 452 if (timeout <= 0) {
458 snd_printk("mce_down - " 453 snd_printk("mce_down - "
459 "auto calibration time out (3)\n"); 454 "auto calibration time out (3)\n");
460 return; 455 return;
461 } 456 }
462 msleep(10); 457 timeout = schedule_timeout(timeout);
463 spin_lock_irqsave(&chip->lock, flags); 458 spin_lock_irqsave(&chip->lock, flags);
464 } 459 }
465 spin_unlock_irqrestore(&chip->lock, flags); 460 spin_unlock_irqrestore(&chip->lock, flags);