alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Sverdlin <subaparts@yandex.ru>
To: Ryan Mallon <ryan@bluewatersys.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH] ASoC: Improve EP93xx I2S clocks management.
Date: Mon, 07 Mar 2011 08:39:06 +0300	[thread overview]
Message-ID: <1299476346.27359.120.camel@r60e> (raw)
In-Reply-To: <4D740490.8060200@bluewatersys.com>

Dear Ryan,

On Mon, 2011-03-07 at 11:02 +1300, Ryan Mallon wrote:
> > +	sdiv = 4;
> > +	if (div > (256 + 512) / 2) {
> > +		lrdiv = 128;
> > +	} else {
> > +		lrdiv = 64;
> > +		if (div < (128 + 256) / 2)
> > +			sdiv = 2;
> > +	}
> 
> I don't understand where the magic numbers above come from? Does it work
> correctly for all rates? I think a comment is needed to explain how this
> works.

The Magic is simply centers between divisors. The loop produced only 3
variants of divisors. So do this code. But it's simpler and it prefers
LRDIV = 64. I do not know what do you mean by all rates, with fixed MCLK
there is no way to produce all the rates. With variable MCLK I'm having
full 8000-192000 range now.

> 
> An alternative would be to keep the existing loop form, but try and find
> the closest match rather than an exact match. Something like this
> (untested):

This is huge comparing to 2 ifs... But the main task of keeping LRCLK=64
where possible still can be achieved if we swap to lines:


> 	for (sdiv = 2; sdiv <= 4; sdiv += 2) {
> 		for (lrdiv = 64; lrdiv <= 128; lrdiv <<= 1) {

But I'm sure code proposed by me should work just like previous variant
for you. Could you try it with your configuration please?

      reply	other threads:[~2011-03-07  5:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-05  0:57 [PATCH] ASoC: Improve EP93xx I2S clocks management Alexander Sverdlin
2011-03-06 22:02 ` Ryan Mallon
2011-03-07  5:39   ` Alexander Sverdlin [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=1299476346.27359.120.camel@r60e \
    --to=subaparts@yandex.ru \
    --cc=alsa-devel@alsa-project.org \
    --cc=ryan@bluewatersys.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).