From patchwork Tue Apr 30 23:09:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 10924339 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F156A933 for ; Tue, 30 Apr 2019 23:11:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2A6328E5E for ; Tue, 30 Apr 2019 23:11:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6BED28E64; Tue, 30 Apr 2019 23:11:51 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 289D828E60 for ; Tue, 30 Apr 2019 23:11:51 +0000 (UTC) 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 27AB716A6; Wed, 1 May 2019 01:10:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 27AB716A6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1556665909; bh=+yuvEuYSZZHmI9JeuvbJBRjc8l5gTr4jT+BE5ImGz3I=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Y1ZUCj+ZILInDMDpuJiYQCtJhwVWsvWZuazsC9knaDjkim7hdiab6427jwl2u0bnH jazunu08ahWvSLEke4knCSC8ddwwXBCej5nTW0u8wLpkUiJPdpa6SKJXqMcauicJQz IY4UjPpeu6FFOlGVAj/qIzRarwzKHEyar99m0PLQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4D2FEF89727; Wed, 1 May 2019 01:10:05 +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 0F1E9F89720; Wed, 1 May 2019 01:10:00 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 6AA30F8065C for ; Wed, 1 May 2019 01:09:55 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6AA30F8065C X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Apr 2019 16:09:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,415,1549958400"; d="scan'208";a="166540876" Received: from slawsonx-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.251.133.128]) by fmsmga004.fm.intel.com with ESMTP; 30 Apr 2019 16:09:52 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Tue, 30 Apr 2019 18:09:16 -0500 Message-Id: <20190430230934.4321-2-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> References: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> Cc: tiwai@suse.de, broonie@kernel.org, Pierre-Louis Bossart Subject: [alsa-devel] [PATCH 01/19] ASoC: SOF: add Kconfig option for strict ABI checks 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" X-Virus-Scanned: ClamAV using ClamSMTP When the kernel is more recent than firmware files, it will always behave in backwards-compatible ways. Add optional behavior to check if the kernel is older than the firmware files, so that the kernel fails early instead of attempting to use new functionality it does not support. Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/Kconfig | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sound/soc/sof/Kconfig b/sound/soc/sof/Kconfig index eaa380092c3b..a1a9ffe605dc 100644 --- a/sound/soc/sof/Kconfig +++ b/sound/soc/sof/Kconfig @@ -53,6 +53,21 @@ config SND_SOC_SOF_NOCODEC Say Y if you need this nocodec fallback option If unsure select "N". +config SND_SOC_SOF_STRICT_ABI_CHECKS + bool "SOF strict ABI checks" + help + This option enables strict ABI checks for firmware and topology + files. + When these files are more recent than the kernel, the kernel + will handle the functionality it supports and may report errors + during topology creation or run-time usage if new functionality + is invoked. + This option will stop topology creation and firmware load upfront. + It is intended for SOF CI/releases and not for users or distros. + Say Y if you want strict ABI checks for an SOF release + If you are not involved in SOF releases and CI development + select "N". + config SND_SOC_SOF_DEBUG bool "SOF debugging features" help From patchwork Tue Apr 30 23:09:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 10924341 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E9B57933 for ; Tue, 30 Apr 2019 23:12:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA11F28B00 for ; Tue, 30 Apr 2019 23:12:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD5C728B82; Tue, 30 Apr 2019 23:12:35 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1C18D28B00 for ; Tue, 30 Apr 2019 23:12:35 +0000 (UTC) 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 5774416AC; Wed, 1 May 2019 01:11:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5774416AC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1556665953; bh=VH2Zft6vcr6QDnsvaNRLdauklLJwM1rG4PBTKbAqnt4=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=cO6odkLkD7KkBaeFVlIoTkZ951lmMnbWoNmV1LkFGXhj3WX6+onqWIkgeRiS0NVbo jEGO84P9nQq1bd1kemvKRNXzTEeTVpP4WLhzNklS5vBJpG0EwxVbFmK+60KdYVY4pv uqYgF2nOGGVh3f/rba5COaGn/1iBGaxFG0zyo/rg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B3924F8972C; Wed, 1 May 2019 01:10:07 +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 A61DEF89724; Wed, 1 May 2019 01:10:02 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 4E01DF8962C for ; Wed, 1 May 2019 01:09:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4E01DF8962C X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Apr 2019 16:09:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,415,1549958400"; d="scan'208";a="166540893" Received: from slawsonx-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.251.133.128]) by fmsmga004.fm.intel.com with ESMTP; 30 Apr 2019 16:09:53 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Tue, 30 Apr 2019 18:09:17 -0500 Message-Id: <20190430230934.4321-3-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> References: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> Cc: tiwai@suse.de, broonie@kernel.org, Pierre-Louis Bossart Subject: [alsa-devel] [PATCH 02/19] ASOC: SOF: ipc: add support for stricter ABI checks 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" X-Virus-Scanned: ClamAV using ClamSMTP Fail early if firmware is more recent than kernel and Kconfig is selected. Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/ipc.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c index d00373ceca12..bf58d58e7379 100644 --- a/sound/soc/sof/ipc.c +++ b/sound/soc/sof/ipc.c @@ -762,6 +762,15 @@ int snd_sof_ipc_valid(struct snd_sof_dev *sdev) return -EINVAL; } + if (v->abi_version > SOF_ABI_VERSION) { + if (!IS_ENABLED(CONFIG_SND_SOC_SOF_STRICT_ABI_CHECKS)) { + dev_warn(sdev->dev, "warn: FW ABI is more recent than kernel\n"); + } else { + dev_err(sdev->dev, "error: FW ABI is more recent than kernel\n"); + return -EINVAL; + } + } + if (ready->debug.bits.build) { dev_info(sdev->dev, "Firmware debug build %d on %s-%s - options:\n" From patchwork Tue Apr 30 23:09:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 10924349 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 27FDC92A for ; Tue, 30 Apr 2019 23:15:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1449728889 for ; Tue, 30 Apr 2019 23:15:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0296B28931; Tue, 30 Apr 2019 23:15: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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4763728889 for ; Tue, 30 Apr 2019 23:15:11 +0000 (UTC) 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 7FE2016C4; Wed, 1 May 2019 01:14:19 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7FE2016C4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1556666109; bh=YyCBNnLTVc+6JBXk24egIVOk4AZxvf1W9dB129ZItSA=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=KKFUb7WQsgHC7v1Yz2HJF06kL/djXDhctZIeBYk2DiXgvrfzqDm/lMiYy+pMebD1z +tU6I+twizrNxipTUnv3twchyT51yJ95owuq3t/KGrQnJYYzJgcXOYO0ZZswwgwzkB n4T9upScOhyPiymyjst5c3btlRfddcqneuuqgfkA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 93618F8973C; Wed, 1 May 2019 01:10:28 +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 4FD2AF89735; Wed, 1 May 2019 01:10:14 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 F0368F896AA for ; Wed, 1 May 2019 01:09:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz F0368F896AA X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Apr 2019 16:09:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,415,1549958400"; d="scan'208";a="166540908" Received: from slawsonx-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.251.133.128]) by fmsmga004.fm.intel.com with ESMTP; 30 Apr 2019 16:09:54 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Tue, 30 Apr 2019 18:09:18 -0500 Message-Id: <20190430230934.4321-4-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> References: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> Cc: tiwai@suse.de, broonie@kernel.org, Pierre-Louis Bossart Subject: [alsa-devel] [PATCH 03/19] ASoC: SOF: topology: add support for stricter ABI checks 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" X-Virus-Scanned: ClamAV using ClamSMTP Fail early if topology is more recent than kernel and Kconfig is selected. Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/topology.c | 43 ++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 2b9de1b97447..b04b99cc0ff8 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -3051,6 +3051,7 @@ static int sof_manifest(struct snd_soc_component *scomp, int index, { struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); u32 size; + u32 abi_version; size = le32_to_cpu(man->priv.size); @@ -3060,20 +3061,36 @@ static int sof_manifest(struct snd_soc_component *scomp, int index, return 0; } - if (size == SOF_TPLG_ABI_SIZE) { - dev_info(sdev->dev, - "Topology: ABI %d:%d:%d Kernel ABI %d:%d:%d\n", - man->priv.data[0], man->priv.data[1], - man->priv.data[2], SOF_ABI_MAJOR, SOF_ABI_MINOR, - SOF_ABI_PATCH); - if (SOF_ABI_VER(man->priv.data[0], man->priv.data[1], - man->priv.data[2]) <= SOF_ABI_VERSION) - return 0; + if (size != SOF_TPLG_ABI_SIZE) { + dev_err(sdev->dev, "error: invalid topology ABI size\n"); + return -EINVAL; } - dev_err(sdev->dev, - "error: Incompatible ABI version %d:%d:%d\n", - man->priv.data[0], man->priv.data[1], man->priv.data[2]); - return -EINVAL; + + dev_info(sdev->dev, + "Topology: ABI %d:%d:%d Kernel ABI %d:%d:%d\n", + man->priv.data[0], man->priv.data[1], + man->priv.data[2], SOF_ABI_MAJOR, SOF_ABI_MINOR, + SOF_ABI_PATCH); + + abi_version = SOF_ABI_VER(man->priv.data[0], + man->priv.data[1], + man->priv.data[2]); + + if (SOF_ABI_VERSION_INCOMPATIBLE(SOF_ABI_VERSION, abi_version)) { + dev_err(sdev->dev, "error: incompatible topology ABI version\n"); + return -EINVAL; + } + + if (abi_version > SOF_ABI_VERSION) { + if (!IS_ENABLED(CONFIG_SND_SOC_SOF_STRICT_ABI_CHECKS)) { + dev_warn(sdev->dev, "warn: topology ABI is more recent than kernel\n"); + } else { + dev_err(sdev->dev, "error: topology ABI is more recent than kernel\n"); + return -EINVAL; + } + } + + return 0; } /* vendor specific kcontrol handlers available for binding */ From patchwork Tue Apr 30 23:09:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 10924347 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8CF69933 for ; Tue, 30 Apr 2019 23:14:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B12D28AEB for ; Tue, 30 Apr 2019 23:14:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F2B728AF5; Tue, 30 Apr 2019 23:14:28 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BD67128ADE for ; Tue, 30 Apr 2019 23:14:27 +0000 (UTC) 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 0E9D31679; Wed, 1 May 2019 01:13:36 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0E9D31679 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1556666066; bh=LVHDk8Z5v7dwI0OUEfH+YNwMV7Nf7B4xnQzyVDCTfYQ=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=VxqUi7g+rJ7aspcKGqVbbSaNpvyKzUjK1+91Y1R8vsG2K5vKPUNYdZTLISH6gBNeM ftlnYpA1RNE6RCJdhe3cgN5SNXR4WxIClvdEDvYyH/s/fbfYax92mG3sCK0Orhg5yf qnTWGqN3zKlPflg3hX9XnMpwM1CLzNC82Ao/imZ0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id AE666F8962C; Wed, 1 May 2019 01:10:25 +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 94D9EF8971A; Wed, 1 May 2019 01:10:14 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 79D02F80C0D for ; Wed, 1 May 2019 01:09:58 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 79D02F80C0D X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Apr 2019 16:09:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,415,1549958400"; d="scan'208";a="166540918" Received: from slawsonx-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.251.133.128]) by fmsmga004.fm.intel.com with ESMTP; 30 Apr 2019 16:09:54 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Tue, 30 Apr 2019 18:09:19 -0500 Message-Id: <20190430230934.4321-5-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> References: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> Cc: tiwai@suse.de, broonie@kernel.org, Keyon Jie , Pierre-Louis Bossart Subject: [alsa-devel] [PATCH 04/19] ASoC: SOF: Intel: cnl: add pointer ops to use DPIB position 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" X-Virus-Scanned: ClamAV using ClamSMTP From: Keyon Jie Add .pcm_pointer ops for cannonlake to read DPIB/posbuf and get pointer for ALSA, to align with apollolake. Signed-off-by: Keyon Jie Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/intel/cnl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/sof/intel/cnl.c b/sound/soc/sof/intel/cnl.c index 3e95c1e5e491..36ae9b88d0dc 100644 --- a/sound/soc/sof/intel/cnl.c +++ b/sound/soc/sof/intel/cnl.c @@ -199,6 +199,7 @@ const struct snd_sof_dsp_ops sof_cnl_ops = { .pcm_close = hda_dsp_pcm_close, .pcm_hw_params = hda_dsp_pcm_hw_params, .pcm_trigger = hda_dsp_pcm_trigger, + .pcm_pointer = hda_dsp_pcm_pointer, /* firmware loading */ .load_firmware = snd_sof_load_firmware_raw, From patchwork Tue Apr 30 23:09:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 10924343 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2B5FE933 for ; Tue, 30 Apr 2019 23:13:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19AC628AC3 for ; Tue, 30 Apr 2019 23:13:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0DF3C28AF5; Tue, 30 Apr 2019 23:13:14 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 50AFF28AC3 for ; Tue, 30 Apr 2019 23:13:13 +0000 (UTC) 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 8BCEA16BF; Wed, 1 May 2019 01:12:21 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8BCEA16BF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1556665991; bh=j2Srqw65cEylQlqg6MC/EdSztY+Gjl03ys2AZVh+fqs=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=sIusj2bm+fYHoKCedx+m71Vb6auvBe/cAwE9+na6nA2WEd+XWEG7zKlqtbfO2owXP XGovG7HCzxwqtkqJPshFJEAiKenUGN5Uk3HYWXHBJRTb69+RJtkyRGKKFPslbNc7dm bL1r+RJH+nr6AqtIuAs4Dlgrh9wLzo5dpvw22RAg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 469EAF896AA; Wed, 1 May 2019 01:10:15 +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 0C09CF89737; Wed, 1 May 2019 01:10:11 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 52549F896E3 for ; Wed, 1 May 2019 01:09:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 52549F896E3 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Apr 2019 16:09:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,415,1549958400"; d="scan'208";a="166540919" Received: from slawsonx-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.251.133.128]) by fmsmga004.fm.intel.com with ESMTP; 30 Apr 2019 16:09:55 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Tue, 30 Apr 2019 18:09:20 -0500 Message-Id: <20190430230934.4321-6-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> References: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> Cc: tiwai@suse.de, broonie@kernel.org, Zhu Yingjiang , Pierre-Louis Bossart Subject: [alsa-devel] [PATCH 05/19] ASoC: SOF: Intel: hda: add the SSP Host Device memory space 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" X-Virus-Scanned: ClamAV using ClamSMTP From: Zhu Yingjiang The DSP SSP device memory can be conditionally accessed by the host(depending on access policy). Add the SSP base memory offset of APL and CNL. Signed-off-by: Zhu Yingjiang Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/intel/hda.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index 4efcf85af6b5..c4550f2e493d 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -338,6 +338,13 @@ #define HDA_ADSP_FW_STATUS_SKL HDA_ADSP_SRAM0_BASE_SKL #define HDA_ADSP_ERROR_CODE_SKL (HDA_ADSP_FW_STATUS_SKL + 0x4) +/* Host Device Memory Space */ +#define APL_SSP_BASE_OFFSET 0x2000 +#define CNL_SSP_BASE_OFFSET 0x10000 + +/* Host Device Memory Size of a Single SSP */ +#define SSP_DEV_MEM_SIZE 0x1000 + #define HDA_IDISP_CODEC(x) ((x) & BIT(2)) struct sof_intel_dsp_bdl { From patchwork Tue Apr 30 23:09:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 10924351 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4E2F9933 for ; Tue, 30 Apr 2019 23:15:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B3A728B5A for ; Tue, 30 Apr 2019 23:15:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2EDE128B78; Tue, 30 Apr 2019 23:15:49 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C087528B5A for ; Tue, 30 Apr 2019 23:15:47 +0000 (UTC) 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 EF37816A4; Wed, 1 May 2019 01:14:55 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EF37816A4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1556666146; bh=H5RBVbjsym5RG4ZDBshToVy3qPjeDtRxuMZ0jXIZof8=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=sM6CqIk5mJS9IcRyj77/kztwh6AAsKF6HVPttXSSCjwkJKjYcK4fnxGQT3iPdC0ek jq4V2yDnqm7zZDN2xAJzBYamMBV9I6DYashS0XU0Kcpa0hSzVvGNSwFcazAZKkZ1Bz 7NrYyu+JhKn/TpTRIicIoh3VW9fpl6cxB7eio9cU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id EE538F8972F; Wed, 1 May 2019 01:10:31 +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 0864FF89737; Wed, 1 May 2019 01:10:15 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 E4A9CF896EC for ; Wed, 1 May 2019 01:09:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E4A9CF896EC X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Apr 2019 16:09:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,415,1549958400"; d="scan'208";a="166540922" Received: from slawsonx-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.251.133.128]) by fmsmga004.fm.intel.com with ESMTP; 30 Apr 2019 16:09:55 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Tue, 30 Apr 2019 18:09:21 -0500 Message-Id: <20190430230934.4321-7-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> References: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> Cc: tiwai@suse.de, broonie@kernel.org, Zhu Yingjiang , Pierre-Louis Bossart Subject: [alsa-devel] [PATCH 06/19] ASoC: SOF: Intel: hda: add SSP info to the chip info struct 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" X-Virus-Scanned: ClamAV using ClamSMTP From: Zhu Yingjiang add SSP info of APL and CNL, to the sof_intel_dsp_desc structure. The max SSP count the platform support and the SSP base address. Signed-off-by: Zhu Yingjiang Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/intel/apl.c | 2 ++ sound/soc/sof/intel/cnl.c | 2 ++ sound/soc/sof/intel/hda.h | 4 ++++ sound/soc/sof/intel/shim.h | 2 ++ 4 files changed, 10 insertions(+) diff --git a/sound/soc/sof/intel/apl.c b/sound/soc/sof/intel/apl.c index 8c6282606944..026dde839621 100644 --- a/sound/soc/sof/intel/apl.c +++ b/sound/soc/sof/intel/apl.c @@ -105,5 +105,7 @@ const struct sof_intel_dsp_desc apl_chip_info = { .ipc_ack_mask = HDA_DSP_REG_HIPCIE_DONE, .ipc_ctl = HDA_DSP_REG_HIPCCTL, .rom_init_timeout = 150, + .ssp_count = APL_SSP_COUNT, + .ssp_base_offset = APL_SSP_BASE_OFFSET, }; EXPORT_SYMBOL(apl_chip_info); diff --git a/sound/soc/sof/intel/cnl.c b/sound/soc/sof/intel/cnl.c index 36ae9b88d0dc..3afd96d9c925 100644 --- a/sound/soc/sof/intel/cnl.c +++ b/sound/soc/sof/intel/cnl.c @@ -246,5 +246,7 @@ const struct sof_intel_dsp_desc cnl_chip_info = { .ipc_ack_mask = CNL_DSP_REG_HIPCIDA_DONE, .ipc_ctl = CNL_DSP_REG_HIPCCTL, .rom_init_timeout = 300, + .ssp_count = CNL_SSP_COUNT, + .ssp_base_offset = CNL_SSP_BASE_OFFSET, }; EXPORT_SYMBOL(cnl_chip_info); diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index c4550f2e493d..b2cf6fa15575 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -345,6 +345,10 @@ /* Host Device Memory Size of a Single SSP */ #define SSP_DEV_MEM_SIZE 0x1000 +/* SSP Count of the Platform */ +#define APL_SSP_COUNT 6 +#define CNL_SSP_COUNT 3 + #define HDA_IDISP_CODEC(x) ((x) & BIT(2)) struct sof_intel_dsp_bdl { diff --git a/sound/soc/sof/intel/shim.h b/sound/soc/sof/intel/shim.h index 11fd77cb4e6d..f7a3f62e45d4 100644 --- a/sound/soc/sof/intel/shim.h +++ b/sound/soc/sof/intel/shim.h @@ -162,6 +162,8 @@ struct sof_intel_dsp_desc { int ipc_ack_mask; int ipc_ctl; int rom_init_timeout; + int ssp_count; /* ssp count of the platform */ + int ssp_base_offset; /* base address of the SSPs */ }; extern const struct snd_sof_dsp_ops sof_tng_ops; From patchwork Tue Apr 30 23:09:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 10924345 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 32F54912 for ; Tue, 30 Apr 2019 23:13:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F75A28AC3 for ; Tue, 30 Apr 2019 23:13:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10DB328AF5; Tue, 30 Apr 2019 23:13:56 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 46AF328AC3 for ; Tue, 30 Apr 2019 23:13:55 +0000 (UTC) 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 773A216B2; Wed, 1 May 2019 01:13:03 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 773A216B2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1556666033; bh=gB/VPEU3DqurEvttaksRl3p2pTrbi7sDJCfvoo8YHgo=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=bOTD7bnGzQs4Np7S7FtsQwJW+tu9a2vRAg0wp9AMkhGtZZRf8HSntpL0VLumq1Rve SacAD74JNHRrJITzR6rNic1MTR+YLz/y0M7zqOW2w+16JvpoGq/wLKVkGZNEFLWQJc RN0MWVBb3iX24S8jRKNnjVn3ZNWr/osCaoiRg5SU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A048FF89737; Wed, 1 May 2019 01:10:20 +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 27AA3F89736; Wed, 1 May 2019 01:10:13 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 7978FF8971A for ; Wed, 1 May 2019 01:10:00 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 7978FF8971A X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Apr 2019 16:09:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,415,1549958400"; d="scan'208";a="166540923" Received: from slawsonx-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.251.133.128]) by fmsmga004.fm.intel.com with ESMTP; 30 Apr 2019 16:09:56 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Tue, 30 Apr 2019 18:09:22 -0500 Message-Id: <20190430230934.4321-8-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> References: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> Cc: tiwai@suse.de, broonie@kernel.org, Zhu Yingjiang , Pierre-Louis Bossart Subject: [alsa-devel] [PATCH 07/19] ASoC: SOF: Intel: hda: set I2S slave before enabling DSP 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" X-Virus-Scanned: ClamAV using ClamSMTP From: Zhu Yingjiang By default, the I2S ports are configured in master mode during DSP powerup sequences, the FS and BCLK lines will be driven on startup, even when the topology file explicitly requires the SSP to be slave. This may be problematic for external components configured in master mode who don't expect the Intel SOC/PCH to drive. Fix by configuring the SSP as slave before the SSP outputs are enabled to avoid this transient behavior. When the topology file configures the SSP as clock master, the initial slave configuration will be overridden. Signed-off-by: Zhu Yingjiang Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/intel/hda-loader.c | 11 +++++++++++ sound/soc/sof/intel/hda.h | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/sound/soc/sof/intel/hda-loader.c b/sound/soc/sof/intel/hda-loader.c index 6a44bc349e44..6427f0b3a2f1 100644 --- a/sound/soc/sof/intel/hda-loader.c +++ b/sound/soc/sof/intel/hda-loader.c @@ -84,6 +84,7 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, const void *fwdata, const struct sof_intel_dsp_desc *chip = hda->desc; unsigned int status; int ret; + int i; /* step 1: power up corex */ ret = hda_dsp_core_power_up(sdev, chip->cores_mask); @@ -92,6 +93,16 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, const void *fwdata, goto err; } + /* DSP is powered up, set all SSPs to slave mode */ + for (i = 0; i < chip->ssp_count; i++) { + snd_sof_dsp_update_bits_unlocked(sdev, HDA_DSP_BAR, + chip->ssp_base_offset + + i * SSP_DEV_MEM_SIZE + + SSP_SSC1_OFFSET, + SSP_SET_SLAVE, + SSP_SET_SLAVE); + } + /* step 2: purge FW request */ snd_sof_dsp_write(sdev, HDA_DSP_BAR, chip->ipc_req, chip->ipc_req_mask | (HDA_DSP_IPC_PURGE_FW | diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index b2cf6fa15575..3799a3518106 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -349,6 +349,12 @@ #define APL_SSP_COUNT 6 #define CNL_SSP_COUNT 3 +/* SSP Registers */ +#define SSP_SSC1_OFFSET 0x4 +#define SSP_SET_SCLK_SLAVE BIT(25) +#define SSP_SET_SFRM_SLAVE BIT(24) +#define SSP_SET_SLAVE (SSP_SET_SCLK_SLAVE | SSP_SET_SFRM_SLAVE) + #define HDA_IDISP_CODEC(x) ((x) & BIT(2)) struct sof_intel_dsp_bdl { From patchwork Tue Apr 30 23:09:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 10924355 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 22CB592A for ; Tue, 30 Apr 2019 23:17:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1160028B5A for ; Tue, 30 Apr 2019 23:17:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 03D0628B78; Tue, 30 Apr 2019 23:17:16 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5046E28B5A for ; Tue, 30 Apr 2019 23:17:15 +0000 (UTC) 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 94D0F16C0; Wed, 1 May 2019 01:16:23 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 94D0F16C0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1556666233; bh=iF3Ohs7Blqtmn1eUn2NGa/xQPJtaPS76R7Z+yRIlpLE=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=UciqJ9h2HlvBjRa2QMK5AQzTqfIocJiS6yaElun17FMgbpFEcPy2kmClk+Fx2fI/a iiyfUxIWLRFK5WX12V9HvKg2xSAQjmIKQc1M8pAwut+O5VRpli/WM/zb9OPL4pnoSn PCxdKKDL4+USTeMVtTJGf7S0mgHDXG5d3CQ+fWpE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E1C08F89749; Wed, 1 May 2019 01:10:37 +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 E7D2BF8973B; Wed, 1 May 2019 01:10:21 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 81F02F8065C for ; Wed, 1 May 2019 01:10:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 81F02F8065C X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Apr 2019 16:09:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,415,1549958400"; d="scan'208";a="166540931" Received: from slawsonx-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.251.133.128]) by fmsmga004.fm.intel.com with ESMTP; 30 Apr 2019 16:09:57 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Tue, 30 Apr 2019 18:09:23 -0500 Message-Id: <20190430230934.4321-9-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> References: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> Cc: tiwai@suse.de, broonie@kernel.org, Zhu Yingjiang , Pierre-Louis Bossart Subject: [alsa-devel] [PATCH 08/19] ASoC: SOF: Intel: hda: set bus->idx as 0 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" X-Virus-Scanned: ClamAV using ClamSMTP From: Zhu Yingjiang Setting the bus->idx as 0, for we only have one HDA bus atm. This need to be fixed when there are more than one HDA bus. Signed-off-by: Zhu Yingjiang Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/intel/hda-bus.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sound/soc/sof/intel/hda-bus.c b/sound/soc/sof/intel/hda-bus.c index 62cc9921bb55..a7e6d8227df6 100644 --- a/sound/soc/sof/intel/hda-bus.c +++ b/sound/soc/sof/intel/hda-bus.c @@ -80,8 +80,6 @@ static const struct hdac_io_ops io_ops = { void sof_hda_bus_init(struct hdac_bus *bus, struct device *dev, const struct hdac_ext_bus_ops *ext_ops) { - static int idx; - memset(bus, 0, sizeof(*bus)); bus->dev = dev; @@ -90,7 +88,12 @@ void sof_hda_bus_init(struct hdac_bus *bus, struct device *dev, bus->irq = -1; bus->ext_ops = ext_ops; - bus->idx = idx++; + + /* + * There is only one HDA bus atm. keep the index as 0. + * Need to fix when there are more than one HDA bus. + */ + bus->idx = 0; spin_lock_init(&bus->reg_lock); From patchwork Tue Apr 30 23:09:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 10924353 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 281A5933 for ; Tue, 30 Apr 2019 23:16:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1423928B5A for ; Tue, 30 Apr 2019 23:16:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0372028B78; Tue, 30 Apr 2019 23:16:39 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3270828B5A for ; Tue, 30 Apr 2019 23:16:38 +0000 (UTC) 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 7163116BB; Wed, 1 May 2019 01:15:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7163116BB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1556666196; bh=3oipj97POMBycqUhsqZzmflHI5/0OiEnQCbwuUWwnLI=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=G6ONbYQBuzNOUUiNgYGCsw3wPIGhjXJpAF9Tg7oaiR47r5Q9KZ7QZHsS6/2Dzm+Xa KwswNOuKR6vQvhMpTMIBPFrMqV6omt/g3HFBP47Cn5pUdSDqaBSyXHhU489L2vP2KX efvFZOy8ysynvAsGRIMUcxBNxR250RDIPYv6C/gQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E6B10F89745; Wed, 1 May 2019 01:10:35 +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 57354F8973A; Wed, 1 May 2019 01:10:21 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 F1D28F8962C for ; Wed, 1 May 2019 01:10:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz F1D28F8962C X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Apr 2019 16:09:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,415,1549958400"; d="scan'208";a="166540936" Received: from slawsonx-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.251.133.128]) by fmsmga004.fm.intel.com with ESMTP; 30 Apr 2019 16:09:57 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Tue, 30 Apr 2019 18:09:24 -0500 Message-Id: <20190430230934.4321-10-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> References: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> Cc: tiwai@suse.de, broonie@kernel.org, Pierre-Louis Bossart Subject: [alsa-devel] [PATCH 09/19] ASoC: SOF: Intel: hda-pcm: remove useless dependency on hdac_ext 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" X-Virus-Scanned: ClamAV using ClamSMTP Nothing depends on definitions in hdaudio_ext.h, don't include it Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/intel/hda-pcm.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sound/soc/sof/intel/hda-pcm.c b/sound/soc/sof/intel/hda-pcm.c index 5714a79fbe1a..9b730f183529 100644 --- a/sound/soc/sof/intel/hda-pcm.c +++ b/sound/soc/sof/intel/hda-pcm.c @@ -15,7 +15,6 @@ * Hardware interface for generic Intel audio DSP HDA IP */ -#include #include #include #include "../ops.h" From patchwork Tue Apr 30 23:09:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 10924361 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 791B192A for ; Tue, 30 Apr 2019 23:19:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6596C28B5A for ; Tue, 30 Apr 2019 23:19:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5833D28B78; Tue, 30 Apr 2019 23:19:14 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9003D28B5A for ; Tue, 30 Apr 2019 23:19:13 +0000 (UTC) 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 D62B516D2; Wed, 1 May 2019 01:18:21 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D62B516D2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1556666351; bh=5D6HDbqMdB+VognjoLOa6VsJ2ay5u7vydrVVVhqhAaQ=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=mRTo2l0npeev3ECvLh/P9VWx+SgcHXXgYONLYTVAIMcPMsuaBxUc8a4on7ZZcdze+ MALihknHQqDqF3c6EHADiY4eNN23KNU2HQIwnbSiQ5ZKu656OCxLHzhhyHgWetUamP DXg09khYBHG4Ufnhor5kNnA5nDy8wKGmrom9/IG8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7E6DDF89758; Wed, 1 May 2019 01:10:42 +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 30651F89720; Wed, 1 May 2019 01:10:24 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 007CEF89723 for ; Wed, 1 May 2019 01:10:02 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 007CEF89723 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Apr 2019 16:09:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,415,1549958400"; d="scan'208";a="166540938" Received: from slawsonx-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.251.133.128]) by fmsmga004.fm.intel.com with ESMTP; 30 Apr 2019 16:09:58 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Tue, 30 Apr 2019 18:09:25 -0500 Message-Id: <20190430230934.4321-11-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> References: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> Cc: tiwai@suse.de, broonie@kernel.org, Keyon Jie , Pierre-Louis Bossart Subject: [alsa-devel] [PATCH 10/19] ASoC: SOF: PCM: add period_elapsed work to fix race condition in interrupt context 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" X-Virus-Scanned: ClamAV using ClamSMTP From: Keyon Jie The IPC implementation in SOF requires sending IPCs serially: we should not send a new IPC command to the firmware before we get an ACK (or time out) from firmware, and the IRQ processing is complete. snd_pcm_period_elapsed() can be called in interrupt context before IRQ_HANDLED is returned. When the PCM is done draining, a STOP IPC will then be sent, which breaks the expectation that IPCs are handled serially and leads to IPC timeouts. This patch adds a workqueue to defer the call to snd_pcm_elapsed() after the IRQ is handled. Signed-off-by: Keyon Jie Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/pcm.c | 48 ++++++++++++++++++++++++++++++++++++++++ sound/soc/sof/sof-priv.h | 2 ++ 2 files changed, 50 insertions(+) diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c index be4984c4da4e..649968841dad 100644 --- a/sound/soc/sof/pcm.c +++ b/sound/soc/sof/pcm.c @@ -52,6 +52,48 @@ static int sof_pcm_dsp_params(struct snd_sof_pcm *spcm, struct snd_pcm_substream return ret; } +/* + * sof pcm period elapse work + */ +static void sof_pcm_period_elapsed_work(struct work_struct *work) +{ + struct snd_sof_pcm_stream *sps = + container_of(work, struct snd_sof_pcm_stream, + period_elapsed_work); + + snd_pcm_period_elapsed(sps->substream); +} + +/* + * sof pcm period elapse, this could be called at irq thread context. + */ +void snd_sof_pcm_period_elapsed(struct snd_pcm_substream *substream) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_component *component = + snd_soc_rtdcom_lookup(rtd, DRV_NAME); + struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component); + struct snd_sof_pcm *spcm; + + spcm = snd_sof_find_spcm_dai(sdev, rtd); + if (!spcm) { + dev_err(sdev->dev, + "error: period elapsed for unknown stream!\n"); + return; + } + + /* + * snd_pcm_period_elapsed() can be called in interrupt context + * before IRQ_HANDLED is returned. Inside snd_pcm_period_elapsed(), + * when the PCM is done draining or xrun happened, a STOP IPC will + * then be sent and this IPC will hit IPC timeout. + * To avoid sending IPC before the previous IPC is handled, we + * schedule delayed work here to call the snd_pcm_period_elapsed(). + */ + schedule_work(&spcm->stream[substream->stream].period_elapsed_work); +} +EXPORT_SYMBOL(snd_sof_pcm_period_elapsed); + /* this may get called several times by oss emulation */ static int sof_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) @@ -169,6 +211,9 @@ static int sof_pcm_hw_params(struct snd_pcm_substream *substream, /* save pcm hw_params */ memcpy(&spcm->params[substream->stream], params, sizeof(*params)); + INIT_WORK(&spcm->stream[substream->stream].period_elapsed_work, + sof_pcm_period_elapsed_work); + return ret; } @@ -203,6 +248,9 @@ static int sof_pcm_hw_free(struct snd_pcm_substream *substream) sizeof(stream), &reply, sizeof(reply)); snd_pcm_lib_free_pages(substream); + + cancel_work_sync(&spcm->stream[substream->stream].period_elapsed_work); + return ret; } diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index 35e78ffecce2..675bb10c82f5 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -274,6 +274,7 @@ struct snd_sof_pcm_stream { struct snd_dma_buffer page_table; struct sof_ipc_stream_posn posn; struct snd_pcm_substream *substream; + struct work_struct period_elapsed_work; }; /* ALSA SOF PCM device */ @@ -495,6 +496,7 @@ struct snd_sof_pcm *snd_sof_find_spcm_comp(struct snd_sof_dev *sdev, int *direction); struct snd_sof_pcm *snd_sof_find_spcm_pcm_id(struct snd_sof_dev *sdev, unsigned int pcm_id); +void snd_sof_pcm_period_elapsed(struct snd_pcm_substream *substream); /* * Stream IPC From patchwork Tue Apr 30 23:09:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 10924357 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B64CE933 for ; Tue, 30 Apr 2019 23:17:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A32F228B5A for ; Tue, 30 Apr 2019 23:17:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9482428B78; Tue, 30 Apr 2019 23:17:53 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E2BBC28B5A for ; Tue, 30 Apr 2019 23:17:52 +0000 (UTC) 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 2EABA16C3; Wed, 1 May 2019 01:17:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2EABA16C3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1556666271; bh=rkZrmafPn8sIZDziw4gtePvSgRNts9skXMxzTsTBpak=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Drn83Dv1T4D2umI7q4SAtFa+fbaxv55SmyY37/lzt/igTI846yA2CZKdpKO5ZVRSj L9OyDUNfDhmD0DMglRjs3U6BzQ3Lc25P4LkT1r8G+dhITJsgk7GHWifi+8BcoroTXq 2YApV40KcEkp6rMaI2EKqF8E+XU9dM5DIhpVeKdg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 71E77F8974B; Wed, 1 May 2019 01:10: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 1F7A6F8962C; Wed, 1 May 2019 01:10:22 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 98DF2F89720 for ; Wed, 1 May 2019 01:10:03 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 98DF2F89720 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Apr 2019 16:09:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,415,1549958400"; d="scan'208";a="166540943" Received: from slawsonx-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.251.133.128]) by fmsmga004.fm.intel.com with ESMTP; 30 Apr 2019 16:09:58 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Tue, 30 Apr 2019 18:09:26 -0500 Message-Id: <20190430230934.4321-12-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> References: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> Cc: tiwai@suse.de, broonie@kernel.org, Keyon Jie , Pierre-Louis Bossart Subject: [alsa-devel] [PATCH 11/19] ASoC: SOF: Intel: use snd_sof_pcm_period_elapsed 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" X-Virus-Scanned: ClamAV using ClamSMTP From: Keyon Jie Switch to a wrapper function which schedules the actual call of snd_pcm_period_elapsed after the current IPC is completed. Signed-off-by: Keyon Jie Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/intel/hda-stream.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/sof/intel/hda-stream.c b/sound/soc/sof/intel/hda-stream.c index 6290b2df5e62..47eff161c60e 100644 --- a/sound/soc/sof/intel/hda-stream.c +++ b/sound/soc/sof/intel/hda-stream.c @@ -465,8 +465,8 @@ irqreturn_t hda_dsp_stream_threaded_handler(int irq, void *context) { struct hdac_bus *bus = context; struct sof_intel_hda_dev *sof_hda = bus_to_sof_hda(bus); - struct hdac_stream *s; u32 status = snd_hdac_chip_readl(bus, INTSTS); + struct hdac_stream *s; u32 sd_status; /* check streams */ @@ -486,7 +486,7 @@ irqreturn_t hda_dsp_stream_threaded_handler(int irq, void *context) /* Inform ALSA only in case not do that with IPC */ if (sof_hda->no_ipc_position) - snd_pcm_period_elapsed(s->substream); + snd_sof_pcm_period_elapsed(s->substream); } } From patchwork Tue Apr 30 23:09:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 10924359 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 206C192A for ; Tue, 30 Apr 2019 23:18:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DEF428B5A for ; Tue, 30 Apr 2019 23:18:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 005BB28B78; Tue, 30 Apr 2019 23:18:32 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 52E5728B5A for ; Tue, 30 Apr 2019 23:18:32 +0000 (UTC) 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 A541A16AA; Wed, 1 May 2019 01:17:40 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A541A16AA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1556666310; bh=MkOXV2LxuwR2QhhGSrBf6cSZrV38fcoS0zKEhnFGQqk=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=d5sBF1bN/bRUNIjXnLz/ZH92TGcbhExai/24t5oanObk2NTdDVL4jHKxn+TBe9Dfm PQzcjnVlckZTE3cvPy1J0vis6ninYZsCJPk3iHmeFgeSVq46iugzeI2KoCa2vgCCKK ST4+npZ4hjPwOonh3atABq1jus9wG7WruHeSlQ5I= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 29928F89751; Wed, 1 May 2019 01:10:41 +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 BDA6FF8962C; Wed, 1 May 2019 01:10:23 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 2CF66F89724 for ; Wed, 1 May 2019 01:10:04 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2CF66F89724 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Apr 2019 16:10:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,415,1549958400"; d="scan'208";a="166540946" Received: from slawsonx-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.251.133.128]) by fmsmga004.fm.intel.com with ESMTP; 30 Apr 2019 16:09:59 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Tue, 30 Apr 2019 18:09:27 -0500 Message-Id: <20190430230934.4321-13-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> References: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> Cc: tiwai@suse.de, broonie@kernel.org, Keyon Jie , Pierre-Louis Bossart Subject: [alsa-devel] [PATCH 12/19] ASoC: SOF: ipc: use snd_sof_pcm_period_elapsed 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" X-Virus-Scanned: ClamAV using ClamSMTP From: Keyon Jie Switch to a wrapper function which schedules the actual call of snd_pcm_period_elapsed after the current IPC is completed. Signed-off-by: Keyon Jie Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/ipc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c index bf58d58e7379..437e80a07bc2 100644 --- a/sound/soc/sof/ipc.c +++ b/sound/soc/sof/ipc.c @@ -445,7 +445,7 @@ static void ipc_period_elapsed(struct snd_sof_dev *sdev, u32 msg_id) /* only inform ALSA for period_wakeup mode */ if (!stream->substream->runtime->no_period_wakeup) - snd_pcm_period_elapsed(stream->substream); + snd_sof_pcm_period_elapsed(stream->substream); } /* DSP notifies host of an XRUN within FW */ From patchwork Tue Apr 30 23:09:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 10924363 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3B97C933 for ; Tue, 30 Apr 2019 23:19:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2679E289A5 for ; Tue, 30 Apr 2019 23:19:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 16149289D2; Tue, 30 Apr 2019 23:19:52 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4DC0828B5A for ; Tue, 30 Apr 2019 23:19:51 +0000 (UTC) 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 8B3CD16B3; Wed, 1 May 2019 01:18:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8B3CD16B3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1556666389; bh=XW0E+NBbRcrQWMJcZRyoWRnNqDfwJgBxPvFLE0is1kc=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=g/14YlU1xD+hfZJE9oksAntwlW6mG0huSMeIdBJc8upBkl3Loiyr0+rX7pUirGPS3 8FnbkllZsSz0dOlce6BxGw0TGN/r1WniBu8QriNg+RKper5PXgbybkWojYdDU+sR35 4vvJW3yVeGdMWwe/igJLghU2/S1OxYmMN1PnVIpk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 5085AF8975D; Wed, 1 May 2019 01:10:44 +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 7F164F89740; Wed, 1 May 2019 01:10:29 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 10504F89729 for ; Wed, 1 May 2019 01:10:04 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 10504F89729 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Apr 2019 16:10:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,415,1549958400"; d="scan'208";a="166540954" Received: from slawsonx-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.251.133.128]) by fmsmga004.fm.intel.com with ESMTP; 30 Apr 2019 16:10:00 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Tue, 30 Apr 2019 18:09:28 -0500 Message-Id: <20190430230934.4321-14-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> References: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> Cc: tiwai@suse.de, broonie@kernel.org, Keyon Jie , Pierre-Louis Bossart Subject: [alsa-devel] [PATCH 13/19] ASoC: SOF: Intel: hda-ipc: simplify handling of IPC IRQ 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" X-Virus-Scanned: ClamAV using ClamSMTP From: Keyon Jie When using a shared IRQ between IPC interrupt and stream IOC interrupt, the interrupt handlers need to check the interrupt source before scheduling their respective IRQ threads. In the case of IPC handler, it should check if it is an IPC interrupt before waking up the IPC IRQ thread. The IPC IRQ thread, once scheduled, does not need to check the IRQ source again. So, remove the superfluous check in the thread. Remove the irq_status field from snd_sof_dev struct also as it is no longer needed. Signed-off-by: Keyon Jie Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/intel/cnl.c | 4 ---- sound/soc/sof/intel/hda-ipc.c | 13 +++++-------- sound/soc/sof/sof-priv.h | 1 - 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/sound/soc/sof/intel/cnl.c b/sound/soc/sof/intel/cnl.c index 3afd96d9c925..d128839b2450 100644 --- a/sound/soc/sof/intel/cnl.c +++ b/sound/soc/sof/intel/cnl.c @@ -39,10 +39,6 @@ static irqreturn_t cnl_ipc_irq_thread(int irq, void *context) u32 msg_ext; irqreturn_t ret = IRQ_NONE; - /* here we handle IPC interrupts only */ - if (!(sdev->irq_status & HDA_DSP_ADSPIS_IPC)) - return ret; - hipcida = snd_sof_dsp_read(sdev, HDA_DSP_BAR, CNL_DSP_REG_HIPCIDA); hipcctl = snd_sof_dsp_read(sdev, HDA_DSP_BAR, CNL_DSP_REG_HIPCCTL); hipctdr = snd_sof_dsp_read(sdev, HDA_DSP_BAR, CNL_DSP_REG_HIPCTDR); diff --git a/sound/soc/sof/intel/hda-ipc.c b/sound/soc/sof/intel/hda-ipc.c index a938f568dbb1..73ead7070cde 100644 --- a/sound/soc/sof/intel/hda-ipc.c +++ b/sound/soc/sof/intel/hda-ipc.c @@ -145,10 +145,6 @@ irqreturn_t hda_dsp_ipc_irq_thread(int irq, void *context) u32 msg; u32 msg_ext; - /* here we handle IPC interrupts only */ - if (!(sdev->irq_status & HDA_DSP_ADSPIS_IPC)) - return IRQ_NONE; - /* read IPC status */ hipcie = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_REG_HIPCIE); @@ -234,19 +230,20 @@ irqreturn_t hda_dsp_ipc_irq_handler(int irq, void *context) { struct snd_sof_dev *sdev = context; int ret = IRQ_NONE; + u32 irq_status; spin_lock(&sdev->hw_lock); /* store status */ - sdev->irq_status = snd_sof_dsp_read(sdev, HDA_DSP_BAR, - HDA_DSP_REG_ADSPIS); + irq_status = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_REG_ADSPIS); + dev_vdbg(sdev->dev, "irq handler: irq_status:0x%x\n", irq_status); /* invalid message ? */ - if (sdev->irq_status == 0xffffffff) + if (irq_status == 0xffffffff) goto out; /* IPC message ? */ - if (sdev->irq_status & HDA_DSP_ADSPIS_IPC) { + if (irq_status & HDA_DSP_ADSPIS_IPC) { /* disable IPC interrupt */ snd_sof_dsp_update_bits_unlocked(sdev, HDA_DSP_BAR, HDA_DSP_REG_ADSPIC, diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index 675bb10c82f5..bbc285018f9a 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -366,7 +366,6 @@ struct snd_sof_dev { struct snd_sof_mailbox host_box; /* Host initiated IPC */ struct snd_sof_mailbox stream_box; /* Stream position update */ struct snd_sof_ipc_msg *msg; - u64 irq_status; int ipc_irq; u32 next_comp_id; /* monotonic - reset during S3 */ From patchwork Tue Apr 30 23:09:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 10924365 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C37EB92A for ; Tue, 30 Apr 2019 23:20:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC8E928B9F for ; Tue, 30 Apr 2019 23:20:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B15A28BAA; Tue, 30 Apr 2019 23:20:30 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D768C28B9F for ; Tue, 30 Apr 2019 23:20:29 +0000 (UTC) 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 18D0316D4; Wed, 1 May 2019 01:19:38 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 18D0316D4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1556666428; bh=Q9avSIKolu7EY0lIRPvnlPmXx+A5pzZ39kWGaNEnrYI=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=RKSVMajpOdH4pF8F9d2Ixs1xorVvuiNUKtlKGNxaLDQWDnIQdl4EPzZTUCEF2mI10 W1il4lc8mzjTwua2oVFgPF/EKlY+f0d4bJplEbhfosDgwl1DeHwj7R/tmI3wT+rDsB +77hajVPcgW2XimK5AYmrne1FAwXUx2x3aneMU54= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 9980EF89762; Wed, 1 May 2019 01:10:45 +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 71399F89741; Wed, 1 May 2019 01:10:30 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 A6A70F89726 for ; Wed, 1 May 2019 01:10:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A6A70F89726 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Apr 2019 16:10:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,415,1549958400"; d="scan'208";a="166540964" Received: from slawsonx-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.251.133.128]) by fmsmga004.fm.intel.com with ESMTP; 30 Apr 2019 16:10:00 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Tue, 30 Apr 2019 18:09:29 -0500 Message-Id: <20190430230934.4321-15-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> References: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> Cc: tiwai@suse.de, broonie@kernel.org, Keyon Jie , Pierre-Louis Bossart Subject: [alsa-devel] [PATCH 14/19] ASoC: SOF: Intel: hda-stream: store stream capabilities 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" X-Virus-Scanned: ClamAV using ClamSMTP From: Keyon Jie Add stream_max into struct sof_intel_hda_dev to store the total hda stream number that the platform can support, and initialize it at stream_init. This can be used later e.g. for stream bitmask. Signed-off-by: Keyon Jie Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/intel/hda-stream.c | 4 ++++ sound/soc/sof/intel/hda.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/sound/soc/sof/intel/hda-stream.c b/sound/soc/sof/intel/hda-stream.c index 47eff161c60e..39f4212bde4b 100644 --- a/sound/soc/sof/intel/hda-stream.c +++ b/sound/soc/sof/intel/hda-stream.c @@ -500,6 +500,7 @@ int hda_dsp_stream_init(struct snd_sof_dev *sdev) struct hdac_ext_stream *stream; struct hdac_stream *hstream; struct pci_dev *pci = to_pci_dev(sdev->dev); + struct sof_intel_hda_dev *sof_hda = bus_to_sof_hda(bus); int sd_offset; int i, num_playback, num_capture, num_total, ret; u32 gcap; @@ -657,6 +658,9 @@ int hda_dsp_stream_init(struct snd_sof_dev *sdev) list_add_tail(&hstream->list, &bus->stream_list); } + /* store total stream count (playback + capture) from GCAP */ + sof_hda->stream_max = num_total; + return 0; } diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index 3799a3518106..7cb2fb92c4eb 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -383,6 +383,9 @@ struct sof_intel_hda_dev { /* if position update IPC needed */ u32 no_ipc_position; + /* the maximum number of streams (playback + capture) supported */ + u32 stream_max; + int irq; /* DMIC device */ From patchwork Tue Apr 30 23:09:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 10924369 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BF97B1390 for ; Tue, 30 Apr 2019 23:21:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACB7228B9F for ; Tue, 30 Apr 2019 23:21:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9EC8728BAF; Tue, 30 Apr 2019 23:21:59 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D222528B9F for ; Tue, 30 Apr 2019 23:21:58 +0000 (UTC) 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 21FB316DB; Wed, 1 May 2019 01:21:07 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 21FB316DB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1556666517; bh=ZLB4t6SQl3LF7z/W9yz+KA/xX8TmYr5dxxDyr1HuSlI=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=U2SVwPKEpiysCOUqncxuuaknwEJy/l0TvZy8jX2+cogZdBWJECN9lrVfd3qw7SZ6b qh3+OeKDyjibDSuXO7swzA/PPH5uhpWw+FQTOEUcBiv0MQjKDcLPXY4RxF95R4E3kJ R0oYmGEntABTPckDg9NSGq21i6558h0NJV5NNA18= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4735DF89772; Wed, 1 May 2019 01:10:49 +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 8D2A0F89726; Wed, 1 May 2019 01:10:30 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 68122F8972A for ; Wed, 1 May 2019 01:10:06 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 68122F8972A X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Apr 2019 16:10:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,415,1549958400"; d="scan'208";a="166540969" Received: from slawsonx-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.251.133.128]) by fmsmga004.fm.intel.com with ESMTP; 30 Apr 2019 16:10:01 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Tue, 30 Apr 2019 18:09:30 -0500 Message-Id: <20190430230934.4321-16-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> References: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> Cc: tiwai@suse.de, broonie@kernel.org, Keyon Jie , Pierre-Louis Bossart Subject: [alsa-devel] [PATCH 15/19] ASoC: SOF: Intel: hda-stream: handle real stream interrupts only 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" X-Virus-Scanned: ClamAV using ClamSMTP From: Keyon Jie The stream and IPC share the same interrupt. The stream interrupt handler mistakenly uses the ipc interrupt and return IRQ_HANDLED, causing the ipc interrupt to be missed. Make sure the stream interrupt handler only deals with stream-related interrupts. Signed-off-by: Keyon Jie Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/intel/hda-stream.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/intel/hda-stream.c b/sound/soc/sof/intel/hda-stream.c index 39f4212bde4b..c92006f89499 100644 --- a/sound/soc/sof/intel/hda-stream.c +++ b/sound/soc/sof/intel/hda-stream.c @@ -433,6 +433,8 @@ int hda_dsp_stream_hw_params(struct snd_sof_dev *sdev, irqreturn_t hda_dsp_stream_interrupt(int irq, void *context) { struct hdac_bus *bus = context; + struct sof_intel_hda_dev *sof_hda = bus_to_sof_hda(bus); + u32 stream_mask; u32 status; if (!pm_runtime_active(bus->dev)) @@ -441,7 +443,10 @@ irqreturn_t hda_dsp_stream_interrupt(int irq, void *context) spin_lock(&bus->reg_lock); status = snd_hdac_chip_readl(bus, INTSTS); - if (status == 0 || status == 0xffffffff) { + stream_mask = GENMASK(sof_hda->stream_max - 1, 0) | AZX_INT_CTRL_EN; + + /* Not stream interrupt or register inaccessible, ignore it.*/ + if (!(status & stream_mask) || status == 0xffffffff) { spin_unlock(&bus->reg_lock); return IRQ_NONE; } From patchwork Tue Apr 30 23:09:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 10924371 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 728AE14B6 for ; Tue, 30 Apr 2019 23:22:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CB6A28B9F for ; Tue, 30 Apr 2019 23:22:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 427DF28BAA; Tue, 30 Apr 2019 23:22:37 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4B0AC28B9F for ; Tue, 30 Apr 2019 23:22:36 +0000 (UTC) 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 7EA9216CE; Wed, 1 May 2019 01:21:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7EA9216CE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1556666554; bh=IEUhX6r8ifAlMvmDnJnTi1XH/v4quMi/am9mc0cs1No=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=DGJ1pgIzbwI7iQdAZB/BQX6lyzUHqTL+GlG0k5xu1TdJPinhHSGS6s4HExJVW+YC+ XoOJxOZAiq1UbZqZxhz9hABXydnqU4xEjPnlJw9jnI9VKvOTzmsXNXqa1u6QrPhC9b xPC24pTb9vLj1nvpfuPoeGQ4B9ZA+8w1+ybMf+2g= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id EF1BDF89777; Wed, 1 May 2019 01:10:50 +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 36C95F89726; Wed, 1 May 2019 01:10:32 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 38D3CF89731 for ; Wed, 1 May 2019 01:10:07 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 38D3CF89731 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Apr 2019 16:10:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,415,1549958400"; d="scan'208";a="166540975" Received: from slawsonx-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.251.133.128]) by fmsmga004.fm.intel.com with ESMTP; 30 Apr 2019 16:10:01 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Tue, 30 Apr 2019 18:09:31 -0500 Message-Id: <20190430230934.4321-17-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> References: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> Cc: tiwai@suse.de, broonie@kernel.org, Ranjani Sridharan , Pierre-Louis Bossart Subject: [alsa-devel] [PATCH 16/19] ASoC: SOF: intel: hda: add hw_params_upon_resume flag for hda stream 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" X-Virus-Scanned: ClamAV using ClamSMTP From: Ranjani Sridharan The prepare() ioctl for BE dai link gets called both when the stream is started and when it is resumed from suspend. SOF uses this ioctl to set the hw params again only if the stream has been suspended. When the stream is started, the hw_params ioctl gets called before prepare() and hw_params is set for the BE dai link. So the prepare call does not need to do anything further. When the stream resumes after system suspend, SOF requires that the hw_params be set again for the BE dai. In order to determine which streams should set the hw params during prepare(), an internal flag called "hw_params_upon_resume" is introduced in struct sof_intel_hda_stream. The flag is set for hda streams when the sof device suspends and is cleared after hw_params is set. Signed-off-by: Ranjani Sridharan Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/intel/apl.c | 1 + sound/soc/sof/intel/cnl.c | 1 + sound/soc/sof/intel/hda-dai.c | 23 ++++++++++++++--------- sound/soc/sof/intel/hda-dsp.c | 16 ++++++++++++++++ sound/soc/sof/intel/hda.h | 2 ++ sound/soc/sof/ops.h | 6 ++++++ sound/soc/sof/pm.c | 3 +++ sound/soc/sof/sof-priv.h | 1 + 8 files changed, 44 insertions(+), 9 deletions(-) diff --git a/sound/soc/sof/intel/apl.c b/sound/soc/sof/intel/apl.c index 026dde839621..d1fb2f2ba1e1 100644 --- a/sound/soc/sof/intel/apl.c +++ b/sound/soc/sof/intel/apl.c @@ -91,6 +91,7 @@ const struct snd_sof_dsp_ops sof_apl_ops = { .resume = hda_dsp_resume, .runtime_suspend = hda_dsp_runtime_suspend, .runtime_resume = hda_dsp_runtime_resume, + .set_hw_params_upon_resume = hda_dsp_set_hw_params_upon_resume, }; EXPORT_SYMBOL(sof_apl_ops); diff --git a/sound/soc/sof/intel/cnl.c b/sound/soc/sof/intel/cnl.c index d128839b2450..2eac20bbcaea 100644 --- a/sound/soc/sof/intel/cnl.c +++ b/sound/soc/sof/intel/cnl.c @@ -225,6 +225,7 @@ const struct snd_sof_dsp_ops sof_cnl_ops = { .resume = hda_dsp_resume, .runtime_suspend = hda_dsp_runtime_suspend, .runtime_resume = hda_dsp_runtime_resume, + .set_hw_params_upon_resume = hda_dsp_set_hw_params_upon_resume, }; EXPORT_SYMBOL(sof_cnl_ops); diff --git a/sound/soc/sof/intel/hda-dai.c b/sound/soc/sof/intel/hda-dai.c index 830328af19c5..e1decf25aeac 100644 --- a/sound/soc/sof/intel/hda-dai.c +++ b/sound/soc/sof/intel/hda-dai.c @@ -131,12 +131,17 @@ static int hda_link_hw_params(struct snd_pcm_substream *substream, struct hdac_ext_stream *link_dev; struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream); struct snd_soc_dai *codec_dai = rtd->codec_dai; + struct sof_intel_hda_stream *hda_stream; struct hda_pipe_params p_params = {0}; struct hdac_ext_link *link; int stream_tag; link_dev = snd_soc_dai_get_dma_data(dai, substream); + hda_stream = container_of(link_dev, struct sof_intel_hda_stream, + hda_stream); + hda_stream->hw_params_upon_resume = 0; + link = snd_hdac_ext_bus_get_link(bus, codec_dai->component->name); if (!link) return -EINVAL; @@ -168,22 +173,22 @@ static int hda_link_hw_params(struct snd_pcm_substream *substream, static int hda_link_pcm_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct hdac_ext_stream *link_dev = + snd_soc_dai_get_dma_data(dai, substream); + struct sof_intel_hda_stream *hda_stream; struct snd_sof_dev *sdev = - snd_soc_component_get_drvdata(dai->component); - struct snd_sof_pcm *spcm; + snd_soc_component_get_drvdata(dai->component); + struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream); int stream = substream->stream; - spcm = snd_sof_find_spcm_dai(sdev, rtd); - if (!spcm) - return -EINVAL; + hda_stream = container_of(link_dev, struct sof_intel_hda_stream, + hda_stream); /* setup hw_params again only if resuming from system suspend */ - if (!spcm->hw_params_upon_resume[stream]) + if (!hda_stream->hw_params_upon_resume) return 0; - dev_dbg(sdev->dev, "hda: prepare stream %d dir %d\n", - spcm->pcm.pcm_id, substream->stream); + dev_dbg(sdev->dev, "hda: prepare stream dir %d\n", substream->stream); return hda_link_hw_params(substream, &rtd->dpcm[stream].hw_params, dai); diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c index 311fed502e09..5b73115a0b78 100644 --- a/sound/soc/sof/intel/hda-dsp.c +++ b/sound/soc/sof/intel/hda-dsp.c @@ -453,3 +453,19 @@ int hda_dsp_suspend(struct snd_sof_dev *sdev, int state) return 0; } + +void hda_dsp_set_hw_params_upon_resume(struct snd_sof_dev *sdev) +{ + struct hdac_bus *bus = sof_to_bus(sdev); + struct sof_intel_hda_stream *hda_stream; + struct hdac_ext_stream *stream; + struct hdac_stream *s; + + /* set internal flag for BE */ + list_for_each_entry(s, &bus->stream_list, list) { + stream = stream_to_hdac_ext_stream(s); + hda_stream = container_of(stream, struct sof_intel_hda_stream, + hda_stream); + hda_stream->hw_params_upon_resume = 1; + } +} diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index 7cb2fb92c4eb..4b00e5d88565 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -409,6 +409,7 @@ static inline struct hda_bus *sof_to_hbus(struct snd_sof_dev *s) struct sof_intel_hda_stream { struct hdac_ext_stream hda_stream; struct sof_intel_stream stream; + int hw_params_upon_resume; /* set up hw_params upon resume */ }; #define bus_to_sof_hda(bus) \ @@ -443,6 +444,7 @@ int hda_dsp_suspend(struct snd_sof_dev *sdev, int state); int hda_dsp_resume(struct snd_sof_dev *sdev); int hda_dsp_runtime_suspend(struct snd_sof_dev *sdev, int state); int hda_dsp_runtime_resume(struct snd_sof_dev *sdev); +void hda_dsp_set_hw_params_upon_resume(struct snd_sof_dev *sdev); void hda_dsp_dump_skl(struct snd_sof_dev *sdev, u32 flags); void hda_dsp_dump(struct snd_sof_dev *sdev, u32 flags); diff --git a/sound/soc/sof/ops.h b/sound/soc/sof/ops.h index 2a5d4c63f160..b8e2bf1fee24 100644 --- a/sound/soc/sof/ops.h +++ b/sound/soc/sof/ops.h @@ -134,6 +134,12 @@ static inline int snd_sof_dsp_runtime_suspend(struct snd_sof_dev *sdev, return 0; } +static inline void snd_sof_dsp_hw_params_upon_resume(struct snd_sof_dev *sdev) +{ + if (sof_ops(sdev)->set_hw_params_upon_resume) + sof_ops(sdev)->set_hw_params_upon_resume(sdev); +} + static inline int snd_sof_dsp_set_clk(struct snd_sof_dev *sdev, u32 freq) { if (sof_ops(sdev)->set_clk) diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c index fc599e1b6f65..8ef1d51025d8 100644 --- a/sound/soc/sof/pm.c +++ b/sound/soc/sof/pm.c @@ -227,6 +227,9 @@ static void sof_set_hw_params_upon_resume(struct snd_sof_dev *sdev) spcm->hw_params_upon_resume[dir] = 1; } } + + /* set internal flag for BE */ + snd_sof_dsp_hw_params_upon_resume(sdev); } #if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_ENABLE_DEBUGFS_CACHE) diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index bbc285018f9a..170adc21ef17 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -166,6 +166,7 @@ struct snd_sof_dsp_ops { int (*runtime_suspend)(struct snd_sof_dev *sof_dev, int state); /* optional */ int (*runtime_resume)(struct snd_sof_dev *sof_dev); /* optional */ + void (*set_hw_params_upon_resume)(struct snd_sof_dev *sdev); /* optional */ /* DSP clocking */ int (*set_clk)(struct snd_sof_dev *sof_dev, u32 freq); /* optional */ From patchwork Tue Apr 30 23:09:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 10924367 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1C51B92A for ; Tue, 30 Apr 2019 23:21:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08FB128B9F for ; Tue, 30 Apr 2019 23:21:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF17728BAA; Tue, 30 Apr 2019 23:21:08 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4885C28B9F for ; Tue, 30 Apr 2019 23:21:08 +0000 (UTC) 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 8950C16C6; Wed, 1 May 2019 01:20:16 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8950C16C6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1556666466; bh=ZrOLWRujv/17GOUE7m4oHHdqDACnxVn5X6s4EOEfXlA=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=LTqlxgaXmnHeDsCq8Qa3m2WjcfeDOpiOqDnFB7LNNU1w5NYsTdQZQifwOGB9kp8o9 c6ixvTfMUQRrEBpe/4bSDBpxcq31VLR7P5LV3WOZITFr62U8r5bpoYyGsQZ3SXtXsV A49FUaX90lttthQdB4/tJ7Q1UGLSAeOHcvrUarA4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id EFC3DF89765; Wed, 1 May 2019 01:10:46 +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 09FCBF8973F; Wed, 1 May 2019 01:10:29 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 CD03DF8972F for ; Wed, 1 May 2019 01:10:07 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz CD03DF8972F X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Apr 2019 16:10:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,415,1549958400"; d="scan'208";a="166540985" Received: from slawsonx-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.251.133.128]) by fmsmga004.fm.intel.com with ESMTP; 30 Apr 2019 16:10:02 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Tue, 30 Apr 2019 18:09:32 -0500 Message-Id: <20190430230934.4321-18-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> References: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> Cc: tiwai@suse.de, broonie@kernel.org, Pan Xiuli , Pierre-Louis Bossart Subject: [alsa-devel] [PATCH 17/19] ASoC: SOF: IPC: add ipc dump function 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" X-Virus-Scanned: ClamAV using ClamSMTP From: Pan Xiuli Dump IPC status when IPC timed out. IPC status is platform specific and need bind to plaform. Signed-off-by: Pan Xiuli Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/ipc.c | 1 + sound/soc/sof/ops.h | 6 ++++++ sound/soc/sof/sof-priv.h | 1 + 3 files changed, 8 insertions(+) diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c index 437e80a07bc2..ba1bb17a8d1e 100644 --- a/sound/soc/sof/ipc.c +++ b/sound/soc/sof/ipc.c @@ -207,6 +207,7 @@ static int tx_wait_done(struct snd_sof_ipc *ipc, struct snd_sof_ipc_msg *msg, dev_err(sdev->dev, "error: ipc timed out for 0x%x size %d\n", hdr->cmd, hdr->size); snd_sof_dsp_dbg_dump(ipc->sdev, SOF_DBG_REGS | SOF_DBG_MBOX); + snd_sof_ipc_dump(ipc->sdev); snd_sof_trace_notify_for_error(ipc->sdev); ret = -ETIMEDOUT; } else { diff --git a/sound/soc/sof/ops.h b/sound/soc/sof/ops.h index b8e2bf1fee24..80fc3b374c2b 100644 --- a/sound/soc/sof/ops.h +++ b/sound/soc/sof/ops.h @@ -155,6 +155,12 @@ static inline void snd_sof_dsp_dbg_dump(struct snd_sof_dev *sdev, u32 flags) return sof_ops(sdev)->dbg_dump(sdev, flags); } +static inline void snd_sof_ipc_dump(struct snd_sof_dev *sdev) +{ + if (sof_ops(sdev)->ipc_dump) + return sof_ops(sdev)->ipc_dump(sdev); +} + /* register IO */ static inline void snd_sof_dsp_write(struct snd_sof_dev *sdev, u32 bar, u32 offset, u32 value) diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index 170adc21ef17..1e85d6f9c5c3 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -176,6 +176,7 @@ struct snd_sof_dsp_ops { int debug_map_count; /* optional */ void (*dbg_dump)(struct snd_sof_dev *sof_dev, u32 flags); /* optional */ + void (*ipc_dump)(struct snd_sof_dev *sof_dev); /* optional */ /* host DMA trace initialization */ int (*trace_init)(struct snd_sof_dev *sdev, From patchwork Tue Apr 30 23:09:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 10924375 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6CA041515 for ; Tue, 30 Apr 2019 23:23:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A28F28B9F for ; Tue, 30 Apr 2019 23:23:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4A36628BAA; Tue, 30 Apr 2019 23:23:52 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8E7A828B9F for ; Tue, 30 Apr 2019 23:23:51 +0000 (UTC) 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 C6E2916DF; Wed, 1 May 2019 01:22:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C6E2916DF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1556666629; bh=wRc5jZQifCxyoHrANybCSbT0lr9472blNee7m4gFDKg=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=CDK20JVfpU3JEvJqumrlTyVqQIsSbHfc3bzuEa3OysDNyT7JgL87eA02uivpwt2d+ slrRTtO94u4MRvFXXOcwvGGC66MBvpH96cPFLNvLhYhE/s/P4rfQnEcSqsSlTCQEJG MagAcq7+XnrpRloMyH4wUHowjt73W+kCUxF6RMtw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7BCF5F8977E; Wed, 1 May 2019 01:10:54 +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 4ACDBF89741; Wed, 1 May 2019 01:10:34 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 554CAF89732 for ; Wed, 1 May 2019 01:10:08 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 554CAF89732 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Apr 2019 16:10:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,415,1549958400"; d="scan'208";a="166540991" Received: from slawsonx-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.251.133.128]) by fmsmga004.fm.intel.com with ESMTP; 30 Apr 2019 16:10:03 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Tue, 30 Apr 2019 18:09:33 -0500 Message-Id: <20190430230934.4321-19-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> References: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> Cc: tiwai@suse.de, broonie@kernel.org, Pan Xiuli , Pierre-Louis Bossart Subject: [alsa-devel] [PATCH 18/19] ASoC: SOF: Intel: APL: add ipc dump function 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" X-Virus-Scanned: ClamAV using ClamSMTP From: Pan Xiuli Add IPC dump function for APL plaform Signed-off-by: Pan Xiuli Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/intel/apl.c | 1 + sound/soc/sof/intel/hda.c | 18 ++++++++++++++++++ sound/soc/sof/intel/hda.h | 1 + 3 files changed, 20 insertions(+) diff --git a/sound/soc/sof/intel/apl.c b/sound/soc/sof/intel/apl.c index d1fb2f2ba1e1..f215d80dce2c 100644 --- a/sound/soc/sof/intel/apl.c +++ b/sound/soc/sof/intel/apl.c @@ -55,6 +55,7 @@ const struct snd_sof_dsp_ops sof_apl_ops = { .debug_map = apl_dsp_debugfs, .debug_map_count = ARRAY_SIZE(apl_dsp_debugfs), .dbg_dump = hda_dsp_dump, + .ipc_dump = hda_ipc_dump, /* stream callbacks */ .pcm_open = hda_dsp_pcm_open, diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index b8fc19790f3b..c7d419d340c8 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -179,6 +179,24 @@ void hda_dsp_dump(struct snd_sof_dev *sdev, u32 flags) } } +void hda_ipc_dump(struct snd_sof_dev *sdev) +{ + u32 hipcie; + u32 hipct; + u32 hipcctl; + + /* read IPC status */ + hipcie = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_REG_HIPCIE); + hipct = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_REG_HIPCT); + hipcctl = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_REG_HIPCCTL); + + /* dump the IPC regs */ + /* TODO: parse the raw msg */ + dev_err(sdev->dev, + "error: host status 0x%8.8x dsp status 0x%8.8x mask 0x%8.8x\n", + hipcie, hipct, hipcctl); +} + static int hda_init(struct snd_sof_dev *sdev) { struct hda_bus *hbus; diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index 4b00e5d88565..92d45c43b4b1 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -447,6 +447,7 @@ int hda_dsp_runtime_resume(struct snd_sof_dev *sdev); void hda_dsp_set_hw_params_upon_resume(struct snd_sof_dev *sdev); void hda_dsp_dump_skl(struct snd_sof_dev *sdev, u32 flags); void hda_dsp_dump(struct snd_sof_dev *sdev, u32 flags); +void hda_ipc_dump(struct snd_sof_dev *sdev); /* * DSP PCM Operations. From patchwork Tue Apr 30 23:09:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 10924373 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4BABF14B6 for ; Tue, 30 Apr 2019 23:23:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 354C628B9F for ; Tue, 30 Apr 2019 23:23:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 25FF228BAA; Tue, 30 Apr 2019 23:23:14 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 642A128B9F for ; Tue, 30 Apr 2019 23:23:13 +0000 (UTC) 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 A431816DC; Wed, 1 May 2019 01:22:21 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A431816DC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1556666591; bh=m7BP8AF1hRUQ6ZRp7dVFgvOWoFfWms2TjQQ+HDan1ZY=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=lkG+in1lupDzZAp+t9qBr+6KNBdgTr5vhtiv2Xf1SBHJr4+/gFh41m75U0Jqzshx9 0T4pkdPnrF1Km0q/K3zQYKnfLGEMpSoDFd6vIACc9Q5uIt8SMXn8enaWMIthXpZfU6 qRH1gdJJXk8f3neLE+YlBtidwPMJkTju7SVD+J/A= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A282AF8977B; Wed, 1 May 2019 01:10:52 +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 77077F89740; Wed, 1 May 2019 01:10:33 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 6D1C4F89734 for ; Wed, 1 May 2019 01:10:09 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6D1C4F89734 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Apr 2019 16:10:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,415,1549958400"; d="scan'208";a="166540995" Received: from slawsonx-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.251.133.128]) by fmsmga004.fm.intel.com with ESMTP; 30 Apr 2019 16:10:03 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Tue, 30 Apr 2019 18:09:34 -0500 Message-Id: <20190430230934.4321-20-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> References: <20190430230934.4321-1-pierre-louis.bossart@linux.intel.com> Cc: tiwai@suse.de, broonie@kernel.org, Pan Xiuli , Pierre-Louis Bossart Subject: [alsa-devel] [PATCH 19/19] ASoC: SOF: Intel: CNL: add ipc dump function 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" X-Virus-Scanned: ClamAV using ClamSMTP From: Pan Xiuli Add ipc dump function to CNL+ platforms. Signed-off-by: Pan Xiuli Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/intel/cnl.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/sound/soc/sof/intel/cnl.c b/sound/soc/sof/intel/cnl.c index 2eac20bbcaea..08a1a3d3c08d 100644 --- a/sound/soc/sof/intel/cnl.c +++ b/sound/soc/sof/intel/cnl.c @@ -158,6 +158,24 @@ static int cnl_ipc_send_msg(struct snd_sof_dev *sdev, return 0; } +static void cnl_ipc_dump(struct snd_sof_dev *sdev) +{ + u32 hipcctl; + u32 hipcida; + u32 hipctdr; + + /* read IPC status */ + hipcida = snd_sof_dsp_read(sdev, HDA_DSP_BAR, CNL_DSP_REG_HIPCIDA); + hipcctl = snd_sof_dsp_read(sdev, HDA_DSP_BAR, CNL_DSP_REG_HIPCCTL); + hipctdr = snd_sof_dsp_read(sdev, HDA_DSP_BAR, CNL_DSP_REG_HIPCTDR); + + /* dump the IPC regs */ + /* TODO: parse the raw msg */ + dev_err(sdev->dev, + "error: host status 0x%8.8x dsp status 0x%8.8x mask 0x%8.8x\n", + hipcida, hipctdr, hipcctl); +} + /* cannonlake ops */ const struct snd_sof_dsp_ops sof_cnl_ops = { /* probe and remove */ @@ -189,6 +207,7 @@ const struct snd_sof_dsp_ops sof_cnl_ops = { .debug_map = cnl_dsp_debugfs, .debug_map_count = ARRAY_SIZE(cnl_dsp_debugfs), .dbg_dump = hda_dsp_dump, + .ipc_dump = cnl_ipc_dump, /* stream callbacks */ .pcm_open = hda_dsp_pcm_open,