[alsa-devel] [PATCH] ad1848 and cs4231 busy loop replacement

Krzysztof Helt krzysztof.h1 at gmail.com
Mon Sep 10 14:42:43 CEST 2007

On 9/10/07, Rene Herman <rene.herman at gmail.com> wrote:
> On 09/10/2007 09:08 AM, Krzysztof Helt wrote:
> > Rene wrote:

> Well, no, sorry, but I consider that to be completely breaking the logic of
> the code.

No I changed the logic of this code not to wait for specifically for
callibration "start" but into calibration "under way".

> 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.

This discussion get me amused. Look at the code:


msleep(7); /* or msleep(2) for CS4231 */

/*waiting loop 250ms*/
while ...

msleep(1); /* or msleep(1) for CS4231 */

/*waiting loop 250ms */
while ...

So the only difference is 6 (or 1) ms and this time will be spent in
the loop anyway. Are we arguing 1ms (for CS4231) in 250ms waiting
If you really want it can be substracted from the waiting loop 250ms
to be exactly the same as it was.

> 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

I don't understand "keep them in sync". After the patch they behave
the same but with different delay (they have different speed). It can
be 2ms (as for faster one) for both but I wanted to avoid doing many
loop iterations if possible.


More information about the Alsa-devel mailing list