All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <mka@chromium.org>
To: Brian Norris <briannorris@chromium.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Peter Ujfalusi <peter.ujfalusi@ti.com>,
	alsa-devel@alsa-project.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, Dylan Reid <dgreid@chromium.org>,
	huang lin <hl@rock-chips.com>
Subject: Re: [PATCH v2] ASoC: dmic: Add optional wakeup delay
Date: Fri, 16 Feb 2018 08:47:45 -0800	[thread overview]
Message-ID: <20180216164745.GC99727@google.com> (raw)
In-Reply-To: <20180216024728.GA93733@rodete-desktop-imager.corp.google.com>

El Thu, Feb 15, 2018 at 06:47:29PM -0800 Brian Norris ha dit:

> Hi,
> 
> On Thu, Feb 15, 2018 at 06:24:16PM -0800, Matthias Kaehlcke wrote:
> > On some systems a delay is needed after switching on the clocks, to allow
> > the output to stabilize and avoid a popping noise at the beginning of
> > the recording. Add the optional device tree property 'wakeup-delay-ms'
> > and apply the specified delay after enabling the mic. A blocking delay
> > can't be applied in dmic_daiops_trigger() since the function is called
> > in atomic context. Instead use a DAPM event handler to set the enable
> > GPIO and apply the delay in the handler.
> > 
> > Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> > ---
> > Changes in v2:
> > - use DAPM event handler instead of _prepare() and get rid of
> >   _trigger()
> > - skip error check for optional 'wakeup-delay-ms' property
> > - updated commit message
> 
> Looks good to me in general:
> 
> Brian Norris <briannorris@chromium.org>
> 
> But I don't know much about the audio subsystem. One comment below.
> 
> > 
> >  .../devicetree/bindings/sound/dmic.txt        |  2 +
> >  sound/soc/codecs/dmic.c                       | 63 ++++++++++---------
> >  2 files changed, 37 insertions(+), 28 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/sound/dmic.txt b/Documentation/devicetree/bindings/sound/dmic.txt
> > index f7bf65611453..e957b4136716 100644
> > --- a/Documentation/devicetree/bindings/sound/dmic.txt
> > +++ b/Documentation/devicetree/bindings/sound/dmic.txt
> > @@ -8,6 +8,7 @@ Required properties:
> >  Optional properties:
> >  	- dmicen-gpios: GPIO specifier for dmic to control start and stop
> >  	- num-channels: Number of microphones on this DAI
> > +	- wakeup-delay-ms: Delay (in ms) after enabling the DMIC
> >  
> >  Example node:
> >  
> > @@ -15,4 +16,5 @@ Example node:
> >  		compatible = "dmic-codec";
> >  		dmicen-gpios = <&gpio4 3 GPIO_ACTIVE_HIGH>;
> >  		num-channels = <1>;
> > +		wakeup-delay-ms <50>;
> >  	};
> > diff --git a/sound/soc/codecs/dmic.c b/sound/soc/codecs/dmic.c
> > index cf83c423394d..b5f60ac22ace 100644
> > --- a/sound/soc/codecs/dmic.c
> > +++ b/sound/soc/codecs/dmic.c
> [...]
> 
> >  static const struct snd_soc_dapm_widget dmic_dapm_widgets[] = {
> > -	SND_SOC_DAPM_AIF_OUT("DMIC AIF", "Capture", 0,
> > -			     SND_SOC_NOPM, 0, 0),
> > +	SND_SOC_DAPM_AIF_OUT_E("DMIC AIF", "Capture", 0,
> > +			       SND_SOC_NOPM, 0, 0, dmic_aif_event,
> > +			       SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
> 
> Any good reason both are _POST_? It seems like you'd want them to be
> inverses (e.g., power-power-up, and pre-power-down).

Post-power-up is needed to avoid a popping noise when the clock is
enabled (see 3a6f9dce6116 ("ASoC: rk3399_gru_sound: fix recording pop
at first attempt") and disabling the mic before switching off the
clock (pre-power-down) could cause noise at the end of the recording.

  reply	other threads:[~2018-02-16 16:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-16  2:24 [PATCH v2] ASoC: dmic: Add optional wakeup delay Matthias Kaehlcke
2018-02-16  2:24 ` Matthias Kaehlcke
     [not found] ` <20180216022416.208265-1-mka-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2018-02-16  2:47   ` Brian Norris
2018-02-16  2:47     ` Brian Norris
2018-02-16 16:47     ` Matthias Kaehlcke [this message]
2018-02-16 11:28   ` Mark Brown
2018-02-16 11:28     ` Mark Brown
2018-02-16 17:09     ` Matthias Kaehlcke

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=20180216164745.GC99727@google.com \
    --to=mka@chromium.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=briannorris@chromium.org \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dgreid@chromium.org \
    --cc=hl@rock-chips.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=perex@perex.cz \
    --cc=peter.ujfalusi@ti.com \
    --cc=robh+dt@kernel.org \
    --cc=tiwai@suse.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.