Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=56f91585b48bb3ca8ec38b84c92d3df2a2f2bf66
Commit:     56f91585b48bb3ca8ec38b84c92d3df2a2f2bf66
Parent:     7e52f3dac7fe08ae7c3e82178c95a43aa0911c33
Author:     Krzysztof Helt <[EMAIL PROTECTED]>
AuthorDate: Tue Sep 11 00:55:46 2007 +0200
Committer:  Jaroslav Kysela <[EMAIL PROTECTED]>
CommitDate: Tue Oct 16 16:52:05 2007 +0200

    [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 <[EMAIL PROTECTED]>
    Signed-off-by: Takashi Iwai <[EMAIL PROTECTED]>
    Signed-off-by: Jaroslav Kysela <[EMAIL PROTECTED]>
---
 sound/sparc/cs4231.c |   33 ++++++++++++++-------------------
 1 files changed, 14 insertions(+), 19 deletions(-)

diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c
index 4f515a6..ab39860 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)
                spin_unlock_irqrestore(&chip->lock, flags);
                return;
        }
-       snd_cs4231_busy_wait(chip);
-
-       /* calibration process */
 
-       snd_cs4231_ready(chip);
-       snd_cs4231_ready(chip);
-       timeout = snd_cs4231_in(chip, CS4231_TEST_INIT);
-       if ((timeout & CS4231_CALIB_IN_PROGRESS) == 0) {
-               snd_printd("cs4231_mce_down - auto calibration time out (1)\n");
-               spin_unlock_irqrestore(&chip->lock, flags);
-               return;
-       }
+       /*
+        * Wait for (possible -- during init auto-calibration may not be set)
+        * calibration process to start. Needs upto 5 sample periods on AD1848
+        * which at the slowest possible rate of 5.5125 kHz means 907 us.
+        */
+       msleep(1);
 
-       /* in 10ms increments, check condition, up to 250ms */
-       timeout = 25;
+       /* check condition up to 250ms */
+       timeout = msecs_to_jiffies(250);
        while (snd_cs4231_in(chip, CS4231_TEST_INIT) &
                CS4231_CALIB_IN_PROGRESS) {
 
                spin_unlock_irqrestore(&chip->lock, flags);
-               if (--timeout < 0) {
+               if (timeout <= 0) {
                        snd_printk("mce_down - "
                                   "auto calibration time out (2)\n");
                        return;
                }
-               msleep(10);
+               timeout = schedule_timeout(timeout);
                spin_lock_irqsave(&chip->lock, flags);
        }
 
-       /* in 10ms increments, check condition, up to 100ms */
-       timeout = 10;
+       /* check condition up to 100ms */
+       timeout = msecs_to_jiffies(100);
        while (__cs4231_readb(chip, CS4231U(chip, REGSEL)) & CS4231_INIT) {
                spin_unlock_irqrestore(&chip->lock, flags);
-               if (--timeout < 0) {
+               if (timeout <= 0) {
                        snd_printk("mce_down - "
                                   "auto calibration time out (3)\n");
                        return;
                }
-               msleep(10);
+               timeout = schedule_timeout(timeout);
                spin_lock_irqsave(&chip->lock, flags);
        }
        spin_unlock_irqrestore(&chip->lock, flags);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to