From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anatol Pomozov Subject: Re: [PATCH] ASoC: nau8825: support different clock source for FLL function Date: Wed, 16 Mar 2016 16:06:35 -0700 Message-ID: References: <1458014901-28049-1-git-send-email-KCHSU0@nuvoton.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-io0-f181.google.com (mail-io0-f181.google.com [209.85.223.181]) by alsa0.perex.cz (Postfix) with ESMTP id D79E22661BF for ; Thu, 17 Mar 2016 00:06:36 +0100 (CET) Received: by mail-io0-f181.google.com with SMTP id n190so78372797iof.0 for ; Wed, 16 Mar 2016 16:06:36 -0700 (PDT) In-Reply-To: <1458014901-28049-1-git-send-email-KCHSU0@nuvoton.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: John Hsu Cc: "alsa-devel@alsa-project.org" , YHCHuang@nuvoton.com, Liam Girdwood , Ben Zhang , Mark Brown , CTLIN0@nuvoton.com, mhkuo@nuvoton.com, Yong Zhi List-Id: alsa-devel@alsa-project.org Hi On Mon, Mar 14, 2016 at 9:08 PM, John Hsu wrote: > Extend FLL clock source selection. The source can be from MCLK, BCLK or FS. > > Signed-off-by: John Hsu > --- > 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; > + } > + } > +