From patchwork Fri Dec 2 17:41:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeeja KP X-Patchwork-Id: 9459103 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 23F426074E for ; Fri, 2 Dec 2016 19:57:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08F00285AE for ; Fri, 2 Dec 2016 19:57:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1C91285B2; Fri, 2 Dec 2016 19:57:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C06D285AE for ; Fri, 2 Dec 2016 19:57:35 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id DD8A32677B1; Fri, 2 Dec 2016 20:57:33 +0100 (CET) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id CB6C026698C; Fri, 2 Dec 2016 20:55:14 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 397F326782B; Fri, 2 Dec 2016 18:32:15 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by alsa0.perex.cz (Postfix) with ESMTP id BE99A267826 for ; Fri, 2 Dec 2016 18:32:12 +0100 (CET) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP; 02 Dec 2016 09:32:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,287,1477983600"; d="scan'208";a="38344548" Received: from kpjeeja-desk.iind.intel.com ([10.223.96.110]) by fmsmga006.fm.intel.com with ESMTP; 02 Dec 2016 09:32:09 -0800 From: jeeja.kp@intel.com To: alsa-devel@alsa-project.org Date: Fri, 2 Dec 2016 23:11:45 +0530 Message-Id: <1480700509-23380-9-git-send-email-jeeja.kp@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1480700509-23380-1-git-send-email-jeeja.kp@intel.com> References: <1480700509-23380-1-git-send-email-jeeja.kp@intel.com> Cc: tiwai@suse.de, patches.audio@intel.com, broonie@kernel.org, liam.r.girdwood@intel.com, Jeeja KP Subject: [alsa-devel] [PATCH 08/12] ASoC: Intel: Skylake: Add supply widget in skl_nau_max machine X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jeeja KP 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 --- 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" },