alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: jeeja.kp@intel.com
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, patches.audio@intel.com, broonie@kernel.org,
	liam.r.girdwood@intel.com, Jeeja KP <jeeja.kp@intel.com>
Subject: [PATCH 08/12] ASoC: Intel: Skylake: Add supply widget in skl_nau_max machine
Date: Fri,  2 Dec 2016 23:11:45 +0530	[thread overview]
Message-ID: <1480700509-23380-9-git-send-email-jeeja.kp@intel.com> (raw)
In-Reply-To: <1480700509-23380-1-git-send-email-jeeja.kp@intel.com>

From: Jeeja KP <jeeja.kp@intel.com>

Maxim codec needs clock to be configured before the SSP startup, so we
need to model the MLCK from SSP0 and turn it on before SSP port is
enabled, so model this in DSP widget parsing.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
---
 sound/soc/intel/boards/skl_nau88l25_max98357a.c | 34 +++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/sound/soc/intel/boards/skl_nau88l25_max98357a.c b/sound/soc/intel/boards/skl_nau88l25_max98357a.c
index 25db5be..06abdf1 100644
--- a/sound/soc/intel/boards/skl_nau88l25_max98357a.c
+++ b/sound/soc/intel/boards/skl_nau88l25_max98357a.c
@@ -100,6 +100,36 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
 	return ret;
 }
 
+static struct snd_soc_dai *skl_get_dai_widget(struct snd_soc_dapm_widget *w)
+{
+	struct snd_soc_dapm_path *p = NULL;
+
+	snd_soc_dapm_widget_for_each_sink_path(w, p) {
+		if (p->sink->id == snd_soc_dapm_dai_in)
+			return p->sink->priv;
+
+		return skl_get_dai_widget(p->sink);
+	}
+
+	return NULL;
+}
+
+static int ssp_set_clk(struct snd_soc_dapm_widget *w,
+		struct snd_kcontrol *k, int  event)
+{
+	struct snd_soc_dai *cpu_dai = NULL;
+
+	cpu_dai = skl_get_dai_widget(w);
+	if (!cpu_dai)
+		return -EIO;
+
+	/* Enable/Disable the SSP clk */
+	if (SND_SOC_DAPM_EVENT_ON(event))
+		return snd_soc_dai_set_tristate(cpu_dai, 0);
+	else
+		return snd_soc_dai_set_tristate(cpu_dai, 1);
+}
+
 static const struct snd_kcontrol_new skylake_controls[] = {
 	SOC_DAPM_PIN_SWITCH("Headphone Jack"),
 	SOC_DAPM_PIN_SWITCH("Headset Mic"),
@@ -113,6 +143,9 @@ static const struct snd_soc_dapm_widget skylake_widgets[] = {
 	SND_SOC_DAPM_MIC("SoC DMIC", NULL),
 	SND_SOC_DAPM_SPK("DP", NULL),
 	SND_SOC_DAPM_SPK("HDMI", NULL),
+	SND_SOC_DAPM_SUPPLY("ssp0 mclk", SND_SOC_NOPM, 0, 0,
+			ssp_set_clk, SND_SOC_DAPM_PRE_PMU |
+			SND_SOC_DAPM_POST_PMD),
 	SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0,
 			platform_clock_control, SND_SOC_DAPM_PRE_PMU |
 			SND_SOC_DAPM_POST_PMD),
@@ -136,6 +169,7 @@ static const struct snd_soc_dapm_route skylake_map[] = {
 	/* CODEC BE connections */
 	{ "HiFi Playback", NULL, "ssp0 Tx" },
 	{ "ssp0 Tx", NULL, "codec0_out" },
+	{ "codec0_out", NULL, "ssp0 mclk"},
 
 	{ "Playback", NULL, "ssp1 Tx" },
 	{ "ssp1 Tx", NULL, "codec1_out" },
-- 
2.5.0

  parent reply	other threads:[~2016-12-02 17:32 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-02 17:41 [PATCH 00/12] ASoC: Intel: Skylake: Driver updates jeeja.kp
2016-12-02 17:41 ` [PATCH 01/12] ASoC: Intel: Skylake: Add helper function to setup host/link dma jeeja.kp
2016-12-05 11:35   ` Mark Brown
2016-12-05 17:09     ` Jeeja KP
2016-12-02 17:41 ` [PATCH 02/12] ASoC: Intel: Skylake: Configure DMA in PRE_PMD handler of Mixer jeeja.kp
2016-12-15 12:20   ` Applied "ASoC: Intel: Skylake: Configure DMA in PRE_PMD handler of Mixer" to the asoc tree Mark Brown
2016-12-02 17:41 ` [PATCH 03/12] ASoC: Intel: Skylake: Removed unused skl_get_format() jeeja.kp
2016-12-15 12:20   ` Applied "ASoC: Intel: Skylake: Removed unused skl_get_format()" to the asoc tree Mark Brown
2016-12-02 17:41 ` [PATCH 04/12] ALSA: hda: check stream decoupled register state jeeja.kp
2016-12-02 19:03   ` Takashi Iwai
2016-12-05  6:52     ` Jeeja KP
2016-12-02 17:41 ` [PATCH 05/12] ASoC: Intel: Skylake: Add set_tristate DAI ops to enable SSP MCLK jeeja.kp
2016-12-02 17:41 ` [PATCH 06/12] ASoC: Intel: Skylake: Remove unused SSP BE prepare DAI ops jeeja.kp
2016-12-02 17:41 ` [PATCH 07/12] ASoC: Intel: Skylake: Add supply widget as non DSP widget jeeja.kp
2016-12-02 17:41 ` jeeja.kp [this message]
2016-12-02 17:41 ` [PATCH 09/12] ASoC: Intel: Skylake: Add supply widget in bxt_da_max machine jeeja.kp
2016-12-02 17:41 ` [PATCH 10/12] ASoC: Intel: Skylake: Don't reset pass-through pipe in BE prepare jeeja.kp
2017-01-19 18:03   ` Applied "ASoC: Intel: Skylake: Don't reset pass-through pipe in BE prepare" to the asoc tree Mark Brown
2016-12-02 17:41 ` [PATCH 11/12] ASoC: Intel: Skylake: set the resume point to LPIB jeeja.kp
2017-01-19 18:03   ` Applied "ASoC: Intel: Skylake: set the resume point to LPIB" to the asoc tree Mark Brown
2016-12-02 17:41 ` [PATCH 12/12] ASoC: hdac_hdmi: Enable pin and converter in prepare jeeja.kp

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=1480700509-23380-9-git-send-email-jeeja.kp@intel.com \
    --to=jeeja.kp@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=liam.r.girdwood@intel.com \
    --cc=patches.audio@intel.com \
    --cc=tiwai@suse.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).