From patchwork Mon Jan 2 07:14:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeeja KP X-Patchwork-Id: 9493157 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 A1E9C62AB2 for ; Mon, 2 Jan 2017 07:41:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9AFC725E13 for ; Mon, 2 Jan 2017 07:41:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8FD6B2675C; Mon, 2 Jan 2017 07:41:11 +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 BC52625E13 for ; Mon, 2 Jan 2017 07:41:10 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 1F058266ABC; Mon, 2 Jan 2017 08:41:09 +0100 (CET) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id BC314266A65; Mon, 2 Jan 2017 08:38:50 +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 20E6C2667D3; Mon, 2 Jan 2017 08:03:59 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by alsa0.perex.cz (Postfix) with ESMTP id 0E3E42667D3 for ; Mon, 2 Jan 2017 08:03:55 +0100 (CET) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP; 01 Jan 2017 23:03:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,432,1477983600"; d="scan'208";a="45054121" Received: from kpjeeja-desk.iind.intel.com ([10.223.96.110]) by orsmga004.jf.intel.com with ESMTP; 01 Jan 2017 23:03:52 -0800 From: jeeja.kp@intel.com To: alsa-devel@alsa-project.org Date: Mon, 2 Jan 2017 12:44:29 +0530 Message-Id: <1483341277-14475-3-git-send-email-jeeja.kp@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1483341277-14475-1-git-send-email-jeeja.kp@intel.com> References: <1483341277-14475-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 v4 2/9] ASoC: Intel: Skylake: Add set_tristate DAI ops to enable SSP MCLK 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 Some machine requires MCLK to be enabled before SSP start up, so add set_tristate() DAI ops to enable/disable SSP MCLK. This ops will be called from machine which requires early MCLK and removes the usage of enabling early MLCK in platform DAI prepare by default which is not machine specific. Signed-off-by: Jeeja KP --- sound/soc/intel/skylake/skl-pcm.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c index 10fa10d..3c16d41 100644 --- a/sound/soc/intel/skylake/skl-pcm.c +++ b/sound/soc/intel/skylake/skl-pcm.c @@ -396,6 +396,33 @@ static int skl_be_hw_params(struct snd_pcm_substream *substream, return skl_tplg_be_update_params(dai, &p_params); } +static int skl_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate) +{ + struct skl *skl = get_skl_ctx(dai->dev); + struct skl_sst *ctx = skl->skl_sst; + struct skl_module_cfg *mconfig; + int stream; + + if (dai->playback_active) + stream = SNDRV_PCM_STREAM_PLAYBACK; + else + stream = SNDRV_PCM_STREAM_CAPTURE; + + mconfig = skl_tplg_be_get_cpr_module(dai, stream); + if (!mconfig) + return -EINVAL; + + /* + * To enable ssp clk explicitly before gateway copier is configured, + * need to use dma control IPC. + * Disable will be done when DSP gateway copier modules are deleted. + */ + if (!tristate) + return skl_dsp_set_dma_control(ctx, mconfig); + + return 0; +} + static int skl_decoupled_trigger(struct snd_pcm_substream *substream, int cmd) { @@ -646,7 +673,7 @@ static struct snd_soc_dai_ops skl_dmic_dai_ops = { static struct snd_soc_dai_ops skl_be_ssp_dai_ops = { .hw_params = skl_be_hw_params, - .prepare = skl_be_prepare, + .set_tristate = skl_soc_dai_set_tristate, }; static struct snd_soc_dai_ops skl_link_dai_ops = {