[alsa-devel] [PATCH] ASoC: nau8825: support different clock source for FLL function

Anatol Pomozov anatol.pomozov at gmail.com
Thu Mar 17 00:06:35 CET 2016


Hi

On Mon, Mar 14, 2016 at 9:08 PM, John Hsu <KCHSU0 at nuvoton.com> wrote:
> Extend FLL clock source selection. The source can be from MCLK, BCLK or FS.
>
> Signed-off-by: John Hsu <KCHSU0 at nuvoton.com>
> ---
>  sound/soc/codecs/nau8825.c | 82 +++++++++++++++++++++++++++++++++-------------
>  sound/soc/codecs/nau8825.h |  8 +++++
>  2 files changed, 67 insertions(+), 23 deletions(-)
>
> diff --git a/sound/soc/codecs/nau8825.c b/sound/soc/codecs/nau8825.c
> index 1c87299..ac264ec 100644
> --- a/sound/soc/codecs/nau8825.c
> +++ b/sound/soc/codecs/nau8825.c
> @@ -1053,6 +1053,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;
> +
> +       nau8825->mclk = devm_clk_get(nau8825->dev, "mclk");
> +       if (IS_ERR(nau8825->mclk)) {

Is it possible that clock system is not ready at this point and the
method returns -EPROBE_DEFER? If so it matches IS_ERR() but not a real
error and the nua8825 driver should backoff and wait a little before
clocks are ready.

> +               dev_info(nau8825->dev, "No 'mclk' clock found, assume MCLK is managed externally");
> +               return 0;
> +       }
> +
> +       if (!nau8825->mclk_freq) {
> +               ret = clk_prepare_enable(nau8825->mclk);
> +               if (ret) {
> +                       dev_err(nau8825->dev, "Unable to prepare codec mclk\n");
> +                       return ret;
> +               }
> +       }
> +


More information about the Alsa-devel mailing list