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 13:54:26 +0200	[thread overview]
Message-ID: <46E53072.2040404@gmail.com> (raw)
In-Reply-To: <8c74410a0709100008v5497e870j7495b3ea054ae00b@mail.gmail.com>

On 09/10/2007 09:08 AM, Krzysztof Helt wrote:

> Rene wrote:

>> Which seems to be saying that we should be waiting for only 5 cycles at
>> that point. With the slowest (!) possible sampling rate of 5.5125 kHz 
>> that would mean 907 us, or sligtly under 1 ms.
>> 
> It does not matter. If you have to wait for the start of the 
> auto-calibration then for the end of auto-calibration you may as well 
> wait for the end of the auto-calibration only (unless you want to follow 
> the auto-calibration to the very single clock pulse ;-). The delay here 
> is simple to assure that auto-calibration started (and probably is 
> already under way). It may be longer then the start but it should not be 
> longer than whole auto-calibration.
> 
> I simply tried to do as long msleep as possible to allow other tasks 
> using CPU and decrease number of waiting loop iterations.

Well, no, sorry, but I consider that to be completely breaking the logic of 
the code. One line after this bit, we're doing the "wait for calibration to 
finish" loop (and already schedule ourselves away while doing so, for 250ms 
no less) meaning that at this point we should only wait long enough to be 
guaranteed that the ACI bit reflects reality -- those 5 cycles.

Your: wait unconditionally until calibration _nearly_ done, then go wait for 
it for 250 ms to be really done.

Mine: wait unconditionally until calibration has started, then go wait for 
it for 250 ms to finish.

Really -- please just do the 1 ms delay for ad1848 and either no delay or 
the same 1 ms for cs4231 if you want to keep them in sync (and the comment 
explaining why it's 1 ms). I don't particularly care about mdelay versus 
msleep here (although a mere 1 ms fits mdelay better) but your setup is 
pointlessly obscuring the code-flow.

Rene.

  reply	other threads:[~2007-09-10 12:01 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 [this message]
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

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=46E53072.2040404@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.