All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rene Herman <rene.herman@gmail.com>
To: Krzysztof Helt <krzysztof.h1@gmail.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH] ad1848 and cs4231 busy loop replacement
Date: Mon, 10 Sep 2007 20:18:41 +0200	[thread overview]
Message-ID: <46E58A81.8050307@gmail.com> (raw)
In-Reply-To: <20070910190533.e5382668.krzysztof.h1@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1800 bytes --]

On 09/10/2007 07:05 PM, Krzysztof Helt wrote:

> Rene Herman <rene.herman@gmail.com> wrote:

>> No, waiting for calibration the be under way is what my 0/1 ms does.
>> You are waiting for it to be nearly done, which is complete nonsense.
>> One line below we are waiting for 250 ms (generally with _one_ pass
>> through the loop -- we only wake up through signals) anyway!
> 
> I don't buy your argument that it is complete nonsense.

You don't need to buy it -- I presented it to you for free on a fucking 
platter 4 times now. You are making me waste my time. Answer this or just 
bury this useles nonsense discussion: why do you insist on delaying for 7 ms 
when the specification says (and the hardware is confirming) that 1 ms is 
enough?

You are delaying 7 ms and then 250 ms when we are auto-calibrating. I delay 
1 ms and then 250 ms when we are auto-calibrating. Why do you delay longer 
than the hardware needs and make everyone who ever reads this code wonder 
why the hell that odd delay is in there? And make everyone who ever will be 
re-writing or porting this code drag it along on the notion that someone, 
somewhere probably once had a purpose for it?

Fix it up with a comment? Why? There's still not a single point to it.

Why 7? Or 2? Or whatever more time than needed for the calibration to start?

> Also comments like "my way or highway" (NAK) won't make you many friends.

Good, I don't need more friends. You are doing the generic newbie thing 
where you assume you obviously must know everything better than everyone 
else. Just shelve that dumb crap.

You also may want to take into account that I'm taking the time to review 
your code and dig trough datasheets while I had in fact different things to 
do and it's proving utterly useless.

Fixed patch attached.

Rene.

[-- Attachment #2: mce_down.diff --]
[-- Type: text/plain, Size: 2226 bytes --]

diff --git a/sound/isa/ad1848/ad1848_lib.c b/sound/isa/ad1848/ad1848_lib.c
index 8094282..dcd4435 100644
--- a/sound/isa/ad1848/ad1848_lib.c
+++ b/sound/isa/ad1848/ad1848_lib.c
@@ -227,16 +227,15 @@ static void snd_ad1848_mce_down(struct snd_ad1848 *chip)
 		spin_unlock_irqrestore(&chip->reg_lock, flags);
 		return;
 	}
-	/* calibration process */
 
-	for (timeout = 500; timeout > 0 && (snd_ad1848_in(chip, AD1848_TEST_INIT) & AD1848_CALIB_IN_PROGRESS) == 0; timeout--);
-	if ((snd_ad1848_in(chip, AD1848_TEST_INIT) & AD1848_CALIB_IN_PROGRESS) == 0) {
-		snd_printd("mce_down - auto calibration time out (1)\n");
-		spin_unlock_irqrestore(&chip->reg_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);
 #if 0
-	printk("(2) timeout = %i, jiffies = %li\n", timeout, jiffies);
+	printk("(2) jiffies = %li\n", jiffies);
 #endif
 	time = HZ / 4;
 	while (snd_ad1848_in(chip, AD1848_TEST_INIT) & AD1848_CALIB_IN_PROGRESS) {
diff --git a/sound/isa/cs423x/cs4231_lib.c b/sound/isa/cs423x/cs4231_lib.c
index 914d77b..9e8e0f1 100644
--- a/sound/isa/cs423x/cs4231_lib.c
+++ b/sound/isa/cs423x/cs4231_lib.c
@@ -346,16 +346,14 @@ void snd_cs4231_mce_down(struct snd_cs4231 *chip)
 	}
 	snd_cs4231_busy_wait(chip);
 
-	/* calibration process */
-
-	for (timeout = 500; timeout > 0 && (snd_cs4231_in(chip, CS4231_TEST_INIT) & CS4231_CALIB_IN_PROGRESS) == 0; timeout--)
-		udelay(10);
-	if ((snd_cs4231_in(chip, CS4231_TEST_INIT) & CS4231_CALIB_IN_PROGRESS) == 0) {
-		snd_printd("cs4231_mce_down - auto calibration time out (1)\n");
-		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);
 #if 0
-	printk("(2) timeout = %i, jiffies = %li\n", timeout, jiffies);
+	printk("(2) jiffies = %li\n", jiffies);
 #endif
 	/* in 10 ms increments, check condition, up to 250 ms */
 	timeout = 25;

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

      reply	other threads:[~2007-09-10 18:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-08 22:12 [PATCH] ad1848 and cs4231 busy loop replacement Krzysztof Helt
2007-09-09 21:09 ` Rene Herman
2007-09-09 21:19   ` Rene Herman
2007-09-10 17:17     ` Krzysztof Helt
2007-09-10  7:08   ` Krzysztof Helt
2007-09-10 11:54     ` Rene Herman
2007-09-10 12:42       ` Krzysztof Helt
2007-09-10 13:13         ` Rene Herman
2007-09-10 17:05           ` Krzysztof Helt
2007-09-10 18:18             ` Rene Herman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46E58A81.8050307@gmail.com \
    --to=rene.herman@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=krzysztof.h1@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.