From patchwork Fri Oct 4 15:41:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 11174927 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E0A5676 for ; Fri, 4 Oct 2019 15:42:32 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1ED5F222C0 for ; Fri, 4 Oct 2019 15:42:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="Lw3iJM9g" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1ED5F222C0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id AA96C1672; Fri, 4 Oct 2019 17:41:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AA96C1672 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1570203749; bh=X6nSA0ZFQMvP4zWzch/iC3CKN0Ct1t6DWJGE7RiZFks=; h=From:To:Date:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=Lw3iJM9g9MwheNSsceJ98ZN8VOMUway69LPhSSJpVVw87v7gEGshpLXsHi/KBQMe4 3Tb0iQ+bVXx9P7urSPCLenrr8iB6iguVW+EhkES26bKusVaXcqM6P32iK7/+6GtZXs R8vFag6VQ84J7kib4Yr8wa4uQRxrpLQF2CX5jj+M= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 1B2B8F80391; Fri, 4 Oct 2019 17:41:39 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 275D0F803D5; Fri, 4 Oct 2019 17:41:37 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=PRX_BODY_76,SPF_HELO_NONE, SPF_NONE autolearn=disabled version=3.4.0 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 69A87F80137 for ; Fri, 4 Oct 2019 17:41:32 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 69A87F80137 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Oct 2019 08:41:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,256,1566889200"; d="scan'208";a="192463294" Received: from rmadapoo-mobl.amr.corp.intel.com (HELO ranjani-desktop.hsd1.ca.comcast.net) ([10.255.92.146]) by fmsmga007.fm.intel.com with ESMTP; 04 Oct 2019 08:41:29 -0700 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Date: Fri, 4 Oct 2019 08:41:25 -0700 Message-Id: <20191004154127.28459-1-ranjani.sridharan@linux.intel.com> X-Mailer: git-send-email 2.17.1 Cc: broonie@kernel.org, tiwai@suse.com, pierre-louis.bossart@linux.intel.com Subject: [alsa-devel] [RFC PATCH 0/2] Alter the trigger order for FE/BE DAI's based on command X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" Currently, the trigger orders SND_SOC_DPCM_TRIGGER_PRE/POST determine the order in which FE DAI and BE DAI are triggered. In the case of SND_SOC_DPCM_TRIGGER_PRE, the FE DAI is triggered before the BE DAI and in the case of SND_SOC_DPCM_TRIGGER_POST, the BE DAI is triggered before the FE DAI. And this order remains the same irrespective of the trigger command. In the case of the SOF driver, during playback, the FW expects the BE DAI to be triggered before the FE DAI during the START trigger. The BE DAI trigger handles the starting of Link DMA and so it must be started before the FE DAI is started to prevent xruns during pause/release. This can be addressed by setting the trigger order for the FE dai link to SND_SOC_DPCM_TRIGGER_POST. But during the STOP trigger, the FW expects the FE DAI to be triggered before the BE DAI. Retaining the same order during the START and STOP commands, results in FW error as the DAI component in the FW is still active. The issue can be fixed by mirroring the trigger order of FE and BE DAI's during the START and STOP trigger. So, with the trigger order set to SND_SOC_DPCM_TRIGGER_PRE, the FE DAI will be trigger first during SNDRV_PCM_TRIGGER_START/STOP/RESUME and the BE DAI will be triggered first during the STOP/SUSPEND/PAUSE commands. Conversely, with the trigger order set to SND_SOC_DPCM_TRIGGER_POST, the BE DAI will be triggered first during the SNDRV_PCM_TRIGGER_START/STOP/RESUME commands and the FE DAI will be triggered first during the SNDRV_PCM_TRIGGER_STOP/SUSPEND/PAUSE commands. My first thought was to use a BESPOKE trigger for the SOF driver but looking more into the implementation of the bespoke trigger in soc_pcm_bespoke_trigger() didnt indicate it had much to do with the ordering of the FE/BE DAI's but rather just use the bespoke trigger callbacks in the DAI driver. More details on the SOF issue can be found in: Github Issue: https://github.com/thesofproject/linux/issues/1160 Ranjani Sridharan (2): ASoC: pcm: update FE/BE trigger order based on the command ASoC: SOF: topology: set trigger order for FE DAI link sound/soc/soc-pcm.c | 99 +++++++++++++++++++++++++++++----------- sound/soc/sof/topology.c | 4 ++ 2 files changed, 76 insertions(+), 27 deletions(-)