All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Hsu <KCHSU0@nuvoton.com>
To: Anatol Pomozov <anatol.pomozov@gmail.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	Ben Zhang <benzh@chromium.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	YHCHuang@nuvoton.com, Mark Brown <broonie@kernel.org>,
	CTLIN0@nuvoton.com, Yong Zhi <yong.zhi@intel.com>
Subject: Re: [PATCH] ASoC: Extend FLL function
Date: Mon, 4 Jan 2016 18:04:12 +0800	[thread overview]
Message-ID: <568A439C.9070801@nuvoton.com> (raw)
In-Reply-To: <CAOMFOmX_fu94AYJpP5x4=r9GXb5CztxhMNNv7rHENO8fWbgjeg@mail.gmail.com>

Dear all,
Please check up in the following comment, and I cut off original mail.

On 12/31/2015 5:14 PM, Anatol Pomozov wrote:
>>  /* freq_out must be 256*Fs in order to achieve the best performance */
>> @@ -970,6 +981,37 @@ static int nau8825_set_pll(struct snd_soc_codec *codec, int pll_id, int source,
>>         return 0;
>>  }
>>
>> +static int nau8825_mclk_prepare(struct nau8825 *nau8825, unsigned int freq)
>> +{
>> +       int ret = 0;
>> +
>> +       /* We selected MCLK source but the clock itself managed externally */
>> +       if (!nau8825->mclk)
>> +               goto done;
>>     
>
> A nitpick.
>
> This "goto" style is used for recovering resources or something that
> should be restored in case of error. But in your case "done:" does not
> recover anything. It is cleaner remove "goto" and replace with "return
> 0" or "return err".
>
>   
OK, I'll change it.
>> +
>> +       if (!nau8825->mclk_freq) {
>> +               ret = clk_prepare_enable(nau8825->mclk);
>> +               if (ret) {
>> +                       dev_err(nau8825->dev, "Unable to prepare codec mclk\n");
>> +                       goto done;
>> +               }
>> +       }
>> +
>> +       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");
>> +                       goto done;
>> +               }
>> +       }
>> +
>> +done:
>> +       return ret;
>> +}
>> +
>>
>>                 break;
>>         case NAU8825_CLK_INTERNAL:
>> @@ -1018,6 +1040,30 @@ static int nau8825_configure_sysclk(struct nau8825 *nau8825, int clk_id,
>>                 }
>>
>>                 break;
>> +       case NAU8825_CLK_FLL_MCLK:
>> +               regmap_update_bits(regmap, NAU8825_REG_FLL3,
>> +                       NAU8825_FLL_CLK_SRC_MASK, NAU8825_FLL_CLK_SRC_MCLK);
>> +               ret = nau8825_mclk_prepare(nau8825, freq);
>> +               if (ret)
>> +                       return ret;
>> +
>> +               break;
>> +       case NAU8825_CLK_FLL_BLK:
>> +               regmap_update_bits(regmap, NAU8825_REG_FLL3,
>> +                       NAU8825_FLL_CLK_SRC_MASK, NAU8825_FLL_CLK_SRC_BLK);
>> +               ret = nau8825_mclk_prepare(nau8825, freq);
>>     
>
>
> Based on names for these constants I believe CODEC is going to use
> BCLK/FS signal of I2S bus as a clock signal reference.
>
> Do you still need MCLK signal in this case? If no then you should
> disable MCLK to save some power.
>
>   
Yes, the MCLK should disable when FLL reference to BCLK/FS for power saving.
I'll disable it like internal clock case.


BR.
John

  reply	other threads:[~2016-01-04 10:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-31  7:55 [PATCH] ASoC: Extend FLL function John Hsu
2015-12-31  9:14 ` Anatol Pomozov
2016-01-04 10:04   ` John Hsu [this message]
2016-02-24 22:51   ` John Hsu
2016-02-25  1:55     ` Mark Brown
2016-02-25 17:34       ` John Hsu
2016-02-26  1:34         ` Mark Brown
2016-02-26 16:16           ` John Hsu
  -- strict thread matches above, loose matches on Subject: below --
2016-01-06  7:27 [PATCH] ASoC: extend " John Hsu
2016-01-07  1:26 ` Anatol Pomozov

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=568A439C.9070801@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=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.