From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1035200AbcIWV1n (ORCPT ); Fri, 23 Sep 2016 17:27:43 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:36609 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1034422AbcIWV1k (ORCPT ); Fri, 23 Sep 2016 17:27:40 -0400 Date: Fri, 23 Sep 2016 16:27:37 -0500 From: Rob Herring To: Xing Zheng Cc: linux-rockchip@lists.infradead.org, woojoo.lee@samsung.com, cychiang@google.com, hychao@google.com, smbarber@google.com, heiko@sntech.de, dianders@google.com, Liam Girdwood , Mark Brown , Mark Rutland , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] ASoC: rk3399_gru_sound: fix recording pop at first attempt Message-ID: <20160923212737.GA17658@rob-hp-laptop> References: <1474552206-31742-1-git-send-email-zhengxing@rock-chips.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1474552206-31742-1-git-send-email-zhengxing@rock-chips.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 22, 2016 at 09:50:06PM +0800, Xing Zheng wrote: > From: Wonjoon Lee > > Pop happens when mclk applied but dmic's own boot-time This statement doesn't make sense. > Specify dmic delay times in dt to make sure > clocks are ready earlier than dmic working I don't think this really belongs in DT. Seems like better control of the init order is needed. Or why not just a fixed delay in the driver? > > Signed-off-by: Wonjoon Lee > Signed-off-by: Xing Zheng > --- > > Changes in v2: > - rename dmic-delay to dmic-wakeup-delay-ms > > .../bindings/sound/rockchip,rk3399-gru-sound.txt | 7 +++++++ > sound/soc/rockchip/rk3399_gru_sound.c | 14 ++++++++++++++ > 2 files changed, 21 insertions(+) > > diff --git a/Documentation/devicetree/bindings/sound/rockchip,rk3399-gru-sound.txt b/Documentation/devicetree/bindings/sound/rockchip,rk3399-gru-sound.txt > index f19b6c8..eac91db 100644 > --- a/Documentation/devicetree/bindings/sound/rockchip,rk3399-gru-sound.txt > +++ b/Documentation/devicetree/bindings/sound/rockchip,rk3399-gru-sound.txt > @@ -6,10 +6,17 @@ Required properties: > connected to the codecs > - rockchip,codec: The phandle of the MAX98357A/RT5514/DA7219 codecs > > +Optional properties: > +- dmic-wakeup-delay-ms : specify delay time (ms) for DMIC ready. > + If this option is specified, which means it's required dmic need > + delay for DMIC to ready so that rt5514 can avoid recording before > + DMIC send valid data > + > Example: > > sound { > compatible = "rockchip,rk3399-gru-sound"; > rockchip,cpu = <&i2s0>; > rockchip,codec = <&max98357a &rt5514 &da7219>; > + dmic-wakeup-delay-ms = <20>; > }; > diff --git a/sound/soc/rockchip/rk3399_gru_sound.c b/sound/soc/rockchip/rk3399_gru_sound.c > index ee06489..9ed735a 100644 > --- a/sound/soc/rockchip/rk3399_gru_sound.c > +++ b/sound/soc/rockchip/rk3399_gru_sound.c > @@ -38,6 +38,8 @@ > > #define SOUND_FS 256 > > +unsigned int rt5514_dmic_delay; > + > static struct snd_soc_jack rockchip_sound_jack; > > static const struct snd_soc_dapm_widget rockchip_dapm_widgets[] = { > @@ -123,6 +125,9 @@ static int rockchip_sound_rt5514_hw_params(struct snd_pcm_substream *substream, > return ret; > } > > + /* Wait for DMIC stable */ > + msleep(rt5514_dmic_delay); > + > return 0; > } > > @@ -343,6 +348,15 @@ static int rockchip_sound_probe(struct platform_device *pdev) > return -ENODEV; > } > > + /* Set DMIC delay */ > + ret = device_property_read_u32(&pdev->dev, "dmic-delay", Obviously, this doesn't work now... > + &rt5514_dmic_delay); > + if (ret) { > + rt5514_dmic_delay = 0; > + dev_dbg(&pdev->dev, > + "no optional property 'dmic-delay' found, default: no delay\n"); > + } > + > rockchip_dailinks[DAILINK_RT5514_DSP].cpu_name = kstrdup_const(dev_name(dev), GFP_KERNEL); > rockchip_dailinks[DAILINK_RT5514_DSP].cpu_dai_name = kstrdup_const(dev_name(dev), GFP_KERNEL); > rockchip_dailinks[DAILINK_RT5514_DSP].platform_name = kstrdup_const(dev_name(dev), GFP_KERNEL); > -- > 1.9.1 > >