All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Hsu <KCHSU0@nuvoton.com>
To: Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org, anatol.pomozov@gmail.com,
	YHCHuang@nuvoton.com, lgirdwood@gmail.com, benzh@chromium.org,
	CTLIN0@nuvoton.com, mhkuo@nuvoton.com, yong.zhi@intel.com
Subject: Re: [PATCH] ASoC: nau8825: extend FLL function
Date: Tue, 8 Mar 2016 19:58:53 +0800	[thread overview]
Message-ID: <56DEBE7D.70100@nuvoton.com> (raw)
In-Reply-To: <20160301032316.GG18327@sirena.org.uk>

Hi,

On 3/1/2016 11:23 AM, Mark Brown wrote:
> On Mon, Feb 29, 2016 at 02:23:47AM +0800, John Hsu wrote:
>   
>> Extend FLL clock source from MCLK/BCLK/FS.
>> Modify FLL calculation and parameter setting.
>>     
>
> I'm sorry but this really doesn't tell me very much about what this is
> supposed to do so it's very hard to tell if the change does it or not.
> It also sounds like there's multiple different changes going on here, if
> nothing else it sounds like there's the addition of some new sources for
> the FLL and also some unspecified changes to the calculations.  Separate
> changes should be in separate patches.
>
>   
In the patch, we add FLL clock source selection. The source can be from 
MCLK, BCLK or FS.
Besides, driver extend higher frequency for better performance in FLL 
calculation,
and has different register apply if fraction or not. Just separate it. 
Right?

>> +	/* We selected MCLK source but the clock itself managed externally */
>> +	if (!nau8825->mclk)
>> +		return 0;
>> +
>>     
>
> That comment sounds *very* suspicous, if we are using MCLK we should
> manage it via the clock API.  If the platform doesn't have good clock
> support we should fix the platform.
>
>   
In initiation, we get mclk object from platform as the following code.
If the mclk is not found, we don't need to prepare it in the driver.

    nau8825->mclk = devm_clk_get(dev, "mclk");
    ...
    } else if (PTR_ERR(nau8825->mclk) == -ENOENT) {
        /* The MCLK is managed externally or not used at all */
        nau8825->mclk = NULL;
        dev_info(dev, "No 'mclk' clock found, assume MCLK is managed 
externally");


>> +	if (nau8825->mclk_freq != freq) {
>> +		nau8825->mclk_freq = freq;
>> +
>> +		freq = clk_round_rate(nau8825->mclk, freq);
>> +		ret = clk_set_rate(nau8825->mclk, freq);
>> +		if (ret) {
>> +			dev_err(nau8825->dev, "Unable to set mclk rate\n");
>> +			return ret;
>> +		}
>>     
>
> We store the frequency even if we failed to set it.  This means that if
> we retry we'll skip over setting which is buggy.
>   
Yes, it's better to store it when everything get done correctly.

  reply	other threads:[~2016-03-08 11:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-28 18:23 [PATCH] ASoC: nau8825: extend FLL function John Hsu
2016-03-01  3:23 ` Mark Brown
2016-03-08 11:58   ` John Hsu [this message]
2016-03-09  2:40     ` Mark Brown
2016-03-10  4:31       ` John Hsu
2016-03-10  5:24         ` Mark Brown

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=56DEBE7D.70100@nuvoton.com \
    --to=kchsu0@nuvoton.com \
    --cc=CTLIN0@nuvoton.com \
    --cc=YHCHuang@nuvoton.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=anatol.pomozov@gmail.com \
    --cc=benzh@chromium.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=mhkuo@nuvoton.com \
    --cc=yong.zhi@intel.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.