From patchwork Mon Sep 19 12:36:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 607338 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F633C54EE9 for ; Mon, 19 Sep 2022 12:38:16 +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 37D5D164F; Mon, 19 Sep 2022 14:37:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 37D5D164F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1663591094; bh=M/JYckOd6bglLcWNB62iObyokY38Tx5QX8XbnmfCLCY=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=QrvdVBbjPnn8vW1fYGBYWpMx+AZwhzh3vC+npfRMH0Sps+lhYTcGZugbbEw4wg3sm 85+rKjmaibmz3efNQBY5uwh95N7gBXTOyB+jkNJANKYZ7mjqVPRPnMPVFyh9l5n+HS 7QV77oWKI1OsWcyhZqdjugfcBtmMPz2qzhTFzV1o= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 0854BF80543; Mon, 19 Sep 2022 14:37:07 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E67E4F800E5; Mon, 19 Sep 2022 14:37:04 +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 1B78CF80539 for ; Mon, 19 Sep 2022 14:36:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1B78CF80539 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="oEuYUrgi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663591019; x=1695127019; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=M/JYckOd6bglLcWNB62iObyokY38Tx5QX8XbnmfCLCY=; b=oEuYUrgigwlqR35X6KBizrekZeMGJgSdgmunEZCzww3Fycs4f1/YKagx mSO5NBNGQTvCLvZe7UqR7HCYcYqwjjJGOROMFQWM9Dr1ijcbXEydtn+d+ NOrU4eAOEDD34qKFk47JMUmDnAf+I5VsC7BK3oxyNDIokrTa7bF6i+RwK /oSouRMJDawAnxnztKLXlYQB7MXDHMDUulpRSFX5CBhAA8LuaHwzMu1dS k8ALfGHbqjf7sLtIYHd4QhINhhqMEtXB7wogMmQuWUA3ZFjMqcm3ItoHR K9eGrA5REWAH50zdxfU4ZyQbPICL97OfUckoGBol5h0fdvqY5llWXQztj g==; X-IronPort-AV: E=McAfee;i="6500,9779,10475"; a="298115338" X-IronPort-AV: E=Sophos;i="5.93,327,1654585200"; d="scan'208";a="298115338" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2022 05:36:45 -0700 X-IronPort-AV: E=Sophos;i="5.93,327,1654585200"; d="scan'208";a="707549757" Received: from amagnus-mobl2.ger.corp.intel.com (HELO pbossart-mobl3.home) ([10.249.46.168]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2022 05:36:40 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 1/4] ASoC: SOF: Intel: hda-dsp: expose functions for SKL support Date: Mon, 19 Sep 2022 14:36:14 +0200 Message-Id: <20220919123617.44096-2-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220919123617.44096-1-pierre-louis.bossart@linux.intel.com> References: <20220919123617.44096-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , tiwai@suse.de, Pierre-Louis Bossart , Ranjani Sridharan , broonie@kernel.org, =?utf-8?q?P=C3=A9ter_Ujfalusi?= 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" In preparation of the IPCv4 IPC support, this patch adds exposes two functions required by the SKL/KBL boot and code loader. Co-developed-by: Ranjani Sridharan Signed-off-by: Ranjani Sridharan Signed-off-by: Pierre-Louis Bossart Reviewed-by: Péter Ujfalusi --- sound/soc/sof/intel/hda-dsp.c | 4 ++-- sound/soc/sof/intel/hda.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c index 1319c8e34021b..f85ac55536fad 100644 --- a/sound/soc/sof/intel/hda-dsp.c +++ b/sound/soc/sof/intel/hda-dsp.c @@ -114,7 +114,7 @@ static int hda_dsp_core_reset_leave(struct snd_sof_dev *sdev, unsigned int core_ return ret; } -static int hda_dsp_core_stall_reset(struct snd_sof_dev *sdev, unsigned int core_mask) +int hda_dsp_core_stall_reset(struct snd_sof_dev *sdev, unsigned int core_mask) { /* stall core */ snd_sof_dsp_update_bits_unlocked(sdev, HDA_DSP_BAR, @@ -126,7 +126,7 @@ static int hda_dsp_core_stall_reset(struct snd_sof_dev *sdev, unsigned int core_ return hda_dsp_core_reset_enter(sdev, core_mask); } -static bool hda_dsp_core_is_enabled(struct snd_sof_dev *sdev, unsigned int core_mask) +bool hda_dsp_core_is_enabled(struct snd_sof_dev *sdev, unsigned int core_mask) { int val; bool is_enable; diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index bb9d2af06530e..04b730f754d7b 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -565,6 +565,7 @@ int hda_dsp_core_reset_power_down(struct snd_sof_dev *sdev, int hda_dsp_core_get(struct snd_sof_dev *sdev, int core); void hda_dsp_ipc_int_enable(struct snd_sof_dev *sdev); void hda_dsp_ipc_int_disable(struct snd_sof_dev *sdev); +bool hda_dsp_core_is_enabled(struct snd_sof_dev *sdev, unsigned int core_mask); int hda_dsp_set_power_state(struct snd_sof_dev *sdev, const struct sof_dsp_power_state *target_state); @@ -833,6 +834,8 @@ extern int sof_hda_position_quirk; void hda_set_dai_drv_ops(struct snd_sof_dev *sdev, struct snd_sof_dsp_ops *ops); void hda_ops_free(struct snd_sof_dev *sdev); +int hda_dsp_core_stall_reset(struct snd_sof_dev *sdev, unsigned int core_mask); + /* IPC4 */ irqreturn_t cnl_ipc4_irq_thread(int irq, void *context); int cnl_ipc4_send_msg(struct snd_sof_dev *sdev, struct snd_sof_ipc_msg *msg); From patchwork Mon Sep 19 12:36:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 607337 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B7055C54EE9 for ; Mon, 19 Sep 2022 12:38:49 +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 D4F431661; Mon, 19 Sep 2022 14:37:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D4F431661 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1663591127; bh=UKoV2bzXCLNUU+R/bmDWIWa+qfELb3R32OMts7LYeYA=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=hLFFIUvdtByGw66mERYi2xVKumAukYeICP3uEapPXbwS64qoZPl4ZO7B5iAWcuRgS VLaefBLXcJsg8mHYlH2TZfNdD8XGaxLyPLB9i/11pbTgfV0rhPunDYNbe+Wzqs3j8u 4SNFf1JNQy0liYI36cuAqJ+GaCjxozqg1ElKQol0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 44663F80553; Mon, 19 Sep 2022 14:37:12 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6919FF8054A; Mon, 19 Sep 2022 14:37:10 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 D5B3DF8053B for ; Mon, 19 Sep 2022 14:37:00 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D5B3DF8053B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="jHpi393k" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663591022; x=1695127022; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UKoV2bzXCLNUU+R/bmDWIWa+qfELb3R32OMts7LYeYA=; b=jHpi393kIIT+iFJGz9qwoA2pWQY7pRHr++jrnmR/vu+jzzgdt8mQjpFA B6sKO2244fkFtzTArTsbbfoxzNdvCWvHdvQlb40JkX1fNq3jEvvooS00N Glr+rlyL88CoXkbHQm0+AL2yLi9+ttBErJUJNTMwoczFJXK+Q5AOZvroz FFz/QQAQU6B+vNwvDXEFL2ElV/HLH0epD84dBcYOvf328z9J1hH0TUTNq NmfOHABG5816I0yMRcF+ImYvwUfrJ/jMNmL2wixx+/ir1j0VwfxPXmpy4 u3lGyUSpltDRGfpq9ZAnbnRvyWhkWIVdRa0s3yzjidLG7XfroEusxWfjo A==; X-IronPort-AV: E=McAfee;i="6500,9779,10475"; a="300760511" X-IronPort-AV: E=Sophos;i="5.93,327,1654585200"; d="scan'208";a="300760511" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2022 05:37:00 -0700 X-IronPort-AV: E=Sophos;i="5.93,327,1654585200"; d="scan'208";a="707549807" Received: from amagnus-mobl2.ger.corp.intel.com (HELO pbossart-mobl3.home) ([10.249.46.168]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2022 05:36:55 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 4/4] ASoC: SOF: Intel: add ops for SKL/KBL Date: Mon, 19 Sep 2022 14:36:17 +0200 Message-Id: <20220919123617.44096-5-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220919123617.44096-1-pierre-louis.bossart@linux.intel.com> References: <20220919123617.44096-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , tiwai@suse.de, =?utf-8?q?P?= =?utf-8?q?=C3=A9ter_Ujfalusi?= , Pierre-Louis Bossart , Ranjani Sridharan , broonie@kernel.org, Bard Liao 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Add ops and ops_init for SKL and KBL. Tested on Dell XPS-13-9350 Signed-off-by: Pierre-Louis Bossart Signed-off-by: Ranjani Sridharan Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi --- sound/soc/sof/intel/pci-skl.c | 2 ++ sound/soc/sof/intel/skl.c | 62 ++++++++++++++++++++++++++++++----- 2 files changed, 55 insertions(+), 9 deletions(-) diff --git a/sound/soc/sof/intel/pci-skl.c b/sound/soc/sof/intel/pci-skl.c index 2b803f8b32e99..3a99dc444f92e 100644 --- a/sound/soc/sof/intel/pci-skl.c +++ b/sound/soc/sof/intel/pci-skl.c @@ -37,6 +37,7 @@ static struct sof_dev_desc skl_desc = { }, .nocodec_tplg_filename = "sof-skl-nocodec.tplg", .ops = &sof_skl_ops, + .ops_init = sof_skl_ops_init, }; static struct sof_dev_desc kbl_desc = { @@ -59,6 +60,7 @@ static struct sof_dev_desc kbl_desc = { }, .nocodec_tplg_filename = "sof-kbl-nocodec.tplg", .ops = &sof_skl_ops, + .ops_init = sof_skl_ops_init, }; /* PCI IDs */ diff --git a/sound/soc/sof/intel/skl.c b/sound/soc/sof/intel/skl.c index 446a7afddfdbe..12c60dc75767b 100644 --- a/sound/soc/sof/intel/skl.c +++ b/sound/soc/sof/intel/skl.c @@ -23,8 +23,10 @@ #include #include #include +#include #include "../sof-priv.h" +#include "../ipc4-priv.h" #include "../ops.h" #include "hda.h" #include "../sof-audio.h" @@ -37,21 +39,63 @@ static const __maybe_unused struct snd_sof_debugfs_map skl_dsp_debugfs[] = { {"dsp", HDA_DSP_BAR, 0, 0x10000}, }; -static int __maybe_unused skl_dsp_ipc_get_window_offset(struct snd_sof_dev *sdev, u32 id) +static int skl_dsp_ipc_get_window_offset(struct snd_sof_dev *sdev, u32 id) { return SRAM_MEMORY_WINDOW_BASE + (0x2000 * id); } +static int skl_dsp_ipc_get_mailbox_offset(struct snd_sof_dev *sdev) +{ + return SRAM_MEMORY_WINDOW_BASE + 0x1000; +} + /* skylake ops */ -struct snd_sof_dsp_ops sof_skl_ops = { - /* - * the ops are left empty at this stage since the SOF releases do not - * support SKL/KBL. - * The ops will be populated when support for the Intel IPC4 is added - * to the SOF driver - */ +struct snd_sof_dsp_ops sof_skl_ops; +EXPORT_SYMBOL_NS(sof_skl_ops, SND_SOC_SOF_INTEL_HDA_COMMON); + +int sof_skl_ops_init(struct snd_sof_dev *sdev) +{ + struct sof_ipc4_fw_data *ipc4_data; + + /* common defaults */ + memcpy(&sof_skl_ops, &sof_hda_common_ops, sizeof(struct snd_sof_dsp_ops)); + + /* probe/remove/shutdown */ + sof_skl_ops.shutdown = hda_dsp_shutdown; + + sdev->private = devm_kzalloc(sdev->dev, sizeof(*ipc4_data), GFP_KERNEL); + if (!sdev->private) + return -ENOMEM; + + ipc4_data = sdev->private; + ipc4_data->manifest_fw_hdr_offset = SOF_MAN4_FW_HDR_OFFSET_CAVS_1_5; + + sof_skl_ops.get_window_offset = skl_dsp_ipc_get_window_offset; + sof_skl_ops.get_mailbox_offset = skl_dsp_ipc_get_mailbox_offset; + + /* doorbell */ + sof_skl_ops.irq_thread = hda_dsp_ipc4_irq_thread; + + /* ipc */ + sof_skl_ops.send_msg = hda_dsp_ipc4_send_msg; + + /* set DAI driver ops */ + hda_set_dai_drv_ops(sdev, &sof_skl_ops); + + /* debug */ + sof_skl_ops.debug_map = skl_dsp_debugfs; + sof_skl_ops.debug_map_count = ARRAY_SIZE(skl_dsp_debugfs); + sof_skl_ops.ipc_dump = hda_ipc_dump; + + /* firmware run */ + sof_skl_ops.run = hda_dsp_cl_boot_firmware_skl; + + /* pre/post fw run */ + sof_skl_ops.post_fw_run = hda_dsp_post_fw_run; + + return 0; }; -EXPORT_SYMBOL(sof_skl_ops); +EXPORT_SYMBOL_NS(sof_skl_ops_init, SND_SOC_SOF_INTEL_HDA_COMMON); const struct sof_intel_dsp_desc skl_chip_info = { .cores_num = 2,