All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jenny TC <jenny.tc@intel.com>
To: alsa-devel@alsa-project.org
Cc: Jairaj Arava <jairaj.arava@intel.com>,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	Harsha Priya <harshapriya.n@intel.com>,
	Takashi Iwai <tiwai@suse.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>,
	Matthias Kaehlcke <mka@chromium.org>,
	Jenny TC <jenny.tc@intel.com>
Subject: [PATCH 2/2] ASoC: dmic: Introduce mode switch delay
Date: Tue,  2 Oct 2018 11:27:31 +0530	[thread overview]
Message-ID: <1538459851-17066-3-git-send-email-jenny.tc@intel.com> (raw)
In-Reply-To: <1538459851-17066-1-git-send-email-jenny.tc@intel.com>

Some DMICs require delay before stream capture to complete the mode
switching. Different modes can be power off, sleep etc. The DMIC clock
for a specified duration is needed for the DMIC to complete the mode
switching and ready for stream capture.

Signed-off-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>
Signed-off-by: Jairaj Arava <jairaj.arava@intel.com>
Signed-off-by: Harsha Priya <harshapriya.n@intel.com>
---
 sound/soc/codecs/dmic.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/sound/soc/codecs/dmic.c b/sound/soc/codecs/dmic.c
index ab1aa01..38d41a2 100644
--- a/sound/soc/codecs/dmic.c
+++ b/sound/soc/codecs/dmic.c
@@ -34,6 +34,29 @@
 struct dmic {
 	struct gpio_desc *gpio_en;
 	int wakeup_delay;
+	/* Delay after DMIC mode switch */
+	int modeswitch_delay_ms;
+};
+
+int dmic_daiops_trigger(struct snd_pcm_substream *substream,
+		int cmd, struct snd_soc_dai *dai)
+{
+	struct snd_soc_component *component = dai->component;
+	struct dmic *dmic = snd_soc_component_get_drvdata(component);
+
+	switch (cmd) {
+	case SNDRV_PCM_TRIGGER_STOP:
+		if (dmic->modeswitch_delay_ms)
+			mdelay(dmic->modeswitch_delay_ms);
+
+		break;
+	}
+
+	return 0;
+}
+
+static const struct snd_soc_dai_ops dmic_dai_ops = {
+	.trigger	= dmic_daiops_trigger,
 };
 
 static int dmic_aif_event(struct snd_soc_dapm_widget *w,
@@ -69,6 +92,7 @@ static int dmic_aif_event(struct snd_soc_dapm_widget *w,
 			| SNDRV_PCM_FMTBIT_S24_LE
 			| SNDRV_PCM_FMTBIT_S16_LE,
 	},
+	.ops    = &dmic_dai_ops,
 };
 
 static int dmic_component_probe(struct snd_soc_component *component)
@@ -86,6 +110,8 @@ static int dmic_component_probe(struct snd_soc_component *component)
 
 	device_property_read_u32(component->dev, "wakeup-delay-ms",
 				 &dmic->wakeup_delay);
+	device_property_read_u32(component->dev, "modeswitch_delay_ms",
+				 &dmic->modeswitch_delay_ms);
 
 	snd_soc_component_set_drvdata(component, dmic);
 
-- 
1.9.1

  parent reply	other threads:[~2018-10-02  6:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-02  5:57 [PATCH 0/2] Introduce dmic mode switch delay parameter Jenny TC
2018-10-02  5:57 ` [PATCH 1/2] ASoC: dmic: Enable ACPI device entry Jenny TC
2018-10-02 15:00   ` Mark Brown
2018-10-02 17:12   ` Matthias Kaehlcke
2018-10-02  5:57 ` Jenny TC [this message]
2018-10-22  3:42 ` [PATCH 0/2] Introduce dmic mode switch delay parameter Pierre-Louis Bossart
2018-10-22 14:31   ` Pierre-Louis Bossart
2018-10-23 17:11     ` Tc, Jenny
2018-10-23 18:22       ` Pierre-Louis Bossart
2018-10-24 13:40         ` Mark Brown
2018-10-24 13:35       ` Mark Brown
2018-10-25 16:08   ` Vinod Koul

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=1538459851-17066-3-git-send-email-jenny.tc@intel.com \
    --to=jenny.tc@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=harshapriya.n@intel.com \
    --cc=jairaj.arava@intel.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lgirdwood@gmail.com \
    --cc=mka@chromium.org \
    --cc=sathyanarayana.nujella@intel.com \
    --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.