From patchwork Mon Apr 2 06:45:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sriram Periyasamy X-Patchwork-Id: 10319463 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 CCCDF60467 for ; Mon, 2 Apr 2018 06:54:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB67326AE3 for ; Mon, 2 Apr 2018 06:54:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AFD6727C05; Mon, 2 Apr 2018 06:54:58 +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 CFB6326AE3 for ; Mon, 2 Apr 2018 06:54:57 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id EE66C2673C9; Mon, 2 Apr 2018 08:54:49 +0200 (CEST) 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 36E1926720D; Mon, 2 Apr 2018 08:54:45 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by alsa0.perex.cz (Postfix) with ESMTP id E0CDF2670D5 for ; Mon, 2 Apr 2018 08:54:41 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Apr 2018 23:54:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,394,1517904000"; d="scan'208";a="44145042" Received: from mtbf-optiplex-9010.iind.intel.com ([10.223.96.13]) by orsmga001.jf.intel.com with ESMTP; 01 Apr 2018 23:54:38 -0700 From: Sriram Periyasamy To: ALSA ML , Mark Brown Date: Mon, 2 Apr 2018 12:15:48 +0530 Message-Id: <1522651550-27236-2-git-send-email-sriramx.periyasamy@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522651550-27236-1-git-send-email-sriramx.periyasamy@intel.com> References: <1522651550-27236-1-git-send-email-sriramx.periyasamy@intel.com> Cc: Takashi Iwai , Divya Prakash , Patches Audio , Liam Girdwood , Vinod Koul , Pardha Saradhi K , Sriram Periyasamy Subject: [alsa-devel] [PATCH 1/3] ASoC: Intel: Skylake: Reset DSP Pipelines in prepare 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: Pardha Saradhi K An application can choose to call .prepare function any number of times. In such scenarios, there is a need to reset the DSP pipeline. Signed-off-by: Pardha Saradhi K Signed-off-by: Divya Prakash Signed-off-by: Sriram Periyasamy --- sound/soc/intel/skylake/skl-pcm.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c index 15cb8ac3e374..5ac0a12007c2 100644 --- a/sound/soc/intel/skylake/skl-pcm.c +++ b/sound/soc/intel/skylake/skl-pcm.c @@ -268,15 +268,31 @@ static int skl_pcm_prepare(struct snd_pcm_substream *substream, { struct skl *skl = get_skl_ctx(dai->dev); struct skl_module_cfg *mconfig; + int ret; dev_dbg(dai->dev, "%s: %s\n", __func__, dai->name); mconfig = skl_tplg_fe_get_cpr_module(dai, substream->stream); - /* In case of XRUN recovery, reset the FW pipe to clean state */ - if (mconfig && (substream->runtime->status->state == - SNDRV_PCM_STATE_XRUN)) - skl_reset_pipe(skl->skl_sst, mconfig->pipe); + /* + * In case of XRUN recovery or in the case when the application + * calls prepare another time, reset the FW pipe to clean state + */ + if (mconfig && + (substream->runtime->status->state == SNDRV_PCM_STATE_XRUN || + mconfig->pipe->state == SKL_PIPE_CREATED || + mconfig->pipe->state == SKL_PIPE_PAUSED)) { + + ret = skl_reset_pipe(skl->skl_sst, mconfig->pipe); + + if (ret < 0) + return ret; + + ret = skl_pcm_host_dma_prepare(dai->dev, + mconfig->pipe->p_params); + if (ret < 0) + return ret; + } return 0; }