Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
To: lgirdwood@gmail.com, broonie@kernel.org
Cc: linux-sound@vger.kernel.org, kai.vehmanen@linux.intel.com,
	ranjani.sridharan@linux.intel.com,
	yung-chuan.liao@linux.intel.com, pierre-louis.bossart@linux.dev,
	liam.r.girdwood@intel.com, amadeuszx.slawinski@linux.intel.com
Subject: [PATCH v2 2/8] ASoC: SOF: Intel: lnl/ptl: Only set dsp_ops which differs from MTL
Date: Fri,  7 Mar 2025 13:28:10 +0200	[thread overview]
Message-ID: <20250307112816.1495-3-peter.ujfalusi@linux.intel.com> (raw)
In-Reply-To: <20250307112816.1495-1-peter.ujfalusi@linux.intel.com>

LunarLake is a next generation in ACE architecture and most of the dsp_ops
are the same as it is in previous generation.
Use the sof_mtl_set_ops() to get the ops used for mtl and update the ones
that needs different functions for LNL.

Update pci-ptl at the same time to use the LNL dsp_ops as before.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
---
 sound/soc/sof/intel/hda.h     |  2 -
 sound/soc/sof/intel/lnl.c     | 86 +++++++----------------------------
 sound/soc/sof/intel/lnl.h     |  2 +
 sound/soc/sof/intel/pci-lnl.c | 12 +++--
 sound/soc/sof/intel/pci-ptl.c | 15 ++++--
 5 files changed, 38 insertions(+), 79 deletions(-)

diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h
index 92b7402e752e..76154627fc17 100644
--- a/sound/soc/sof/intel/hda.h
+++ b/sound/soc/sof/intel/hda.h
@@ -913,8 +913,6 @@ extern struct snd_sof_dsp_ops sof_tgl_ops;
 int sof_tgl_ops_init(struct snd_sof_dev *sdev);
 extern struct snd_sof_dsp_ops sof_icl_ops;
 int sof_icl_ops_init(struct snd_sof_dev *sdev);
-extern struct snd_sof_dsp_ops sof_lnl_ops;
-int sof_lnl_ops_init(struct snd_sof_dev *sdev);
 
 extern const struct sof_intel_dsp_desc skl_chip_info;
 extern const struct sof_intel_dsp_desc apl_chip_info;
diff --git a/sound/soc/sof/intel/lnl.c b/sound/soc/sof/intel/lnl.c
index 793d8539821d..ffda39ca3606 100644
--- a/sound/soc/sof/intel/lnl.c
+++ b/sound/soc/sof/intel/lnl.c
@@ -20,17 +20,6 @@
 #include "lnl.h"
 #include <sound/hda-mlink.h>
 
-/* LunarLake ops */
-struct snd_sof_dsp_ops sof_lnl_ops;
-EXPORT_SYMBOL_NS(sof_lnl_ops, "SND_SOC_SOF_INTEL_LNL");
-
-static const struct snd_sof_debugfs_map lnl_dsp_debugfs[] = {
-	{"hda", HDA_DSP_HDA_BAR, 0, 0x4000, SOF_DEBUGFS_ACCESS_ALWAYS},
-	{"pp", HDA_DSP_PP_BAR,  0, 0x1000, SOF_DEBUGFS_ACCESS_ALWAYS},
-	{"dsp", HDA_DSP_BAR,  0, 0x10000, SOF_DEBUGFS_ACCESS_ALWAYS},
-	{"fw_regs", HDA_DSP_BAR,  MTL_SRAM_WINDOW_OFFSET(0), 0x1000, SOF_DEBUGFS_ACCESS_D0_ONLY},
-};
-
 /* this helps allows the DSP to setup DMIC/SSP */
 static int hdac_bus_offload_dmic_ssp(struct hdac_bus *bus, bool enable)
 {
@@ -111,78 +100,32 @@ static int lnl_dsp_post_fw_run(struct snd_sof_dev *sdev)
 	return 0;
 }
 
-int sof_lnl_ops_init(struct snd_sof_dev *sdev)
+int sof_lnl_set_ops(struct snd_sof_dev *sdev, struct snd_sof_dsp_ops *dsp_ops)
 {
-	struct sof_ipc4_fw_data *ipc4_data;
+	int ret;
 
-	/* common defaults */
-	memcpy(&sof_lnl_ops, &sof_hda_common_ops, sizeof(struct snd_sof_dsp_ops));
+	ret = sof_mtl_set_ops(sdev, dsp_ops);
+	if (ret)
+		return ret;
 
 	/* probe/remove */
 	if (!sdev->dspless_mode_selected) {
-		sof_lnl_ops.probe = lnl_hda_dsp_probe;
-		sof_lnl_ops.remove = lnl_hda_dsp_remove;
+		dsp_ops->probe = lnl_hda_dsp_probe;
+		dsp_ops->remove = lnl_hda_dsp_remove;
 	}
 
-	/* shutdown */
-	sof_lnl_ops.shutdown = hda_dsp_shutdown;
-
-	/* doorbell */
-	sof_lnl_ops.irq_thread = mtl_ipc_irq_thread;
-
-	/* ipc */
-	sof_lnl_ops.send_msg = mtl_ipc_send_msg;
-	sof_lnl_ops.get_mailbox_offset = mtl_dsp_ipc_get_mailbox_offset;
-	sof_lnl_ops.get_window_offset = mtl_dsp_ipc_get_window_offset;
-
-	/* debug */
-	sof_lnl_ops.debug_map = lnl_dsp_debugfs;
-	sof_lnl_ops.debug_map_count = ARRAY_SIZE(lnl_dsp_debugfs);
-	sof_lnl_ops.dbg_dump = mtl_dsp_dump;
-	sof_lnl_ops.ipc_dump = mtl_ipc_dump;
-
-	/* pre/post fw run */
-	sof_lnl_ops.pre_fw_run = mtl_dsp_pre_fw_run;
-	sof_lnl_ops.post_fw_run = lnl_dsp_post_fw_run;
-
-	/* parse platform specific extended manifest */
-	sof_lnl_ops.parse_platform_ext_manifest = NULL;
-
-	/* dsp core get/put */
-	/* TODO: add core_get and core_put */
+	/* post fw run */
+	dsp_ops->post_fw_run = lnl_dsp_post_fw_run;
 
 	/* PM */
 	if (!sdev->dspless_mode_selected) {
-		sof_lnl_ops.resume = lnl_hda_dsp_resume;
-		sof_lnl_ops.runtime_resume = lnl_hda_dsp_runtime_resume;
+		dsp_ops->resume = lnl_hda_dsp_resume;
+		dsp_ops->runtime_resume = lnl_hda_dsp_runtime_resume;
 	}
 
-	/* dsp core get/put */
-	sof_lnl_ops.core_get = mtl_dsp_core_get;
-	sof_lnl_ops.core_put = mtl_dsp_core_put;
-
-	sdev->private = kzalloc(sizeof(struct sof_ipc4_fw_data), GFP_KERNEL);
-	if (!sdev->private)
-		return -ENOMEM;
-
-	ipc4_data = sdev->private;
-	ipc4_data->manifest_fw_hdr_offset = SOF_MAN4_FW_HDR_OFFSET;
-
-	ipc4_data->mtrace_type = SOF_IPC4_MTRACE_INTEL_CAVS_2;
-
-	ipc4_data->fw_context_save = true;
-
-	/* External library loading support */
-	ipc4_data->load_library = hda_dsp_ipc4_load_library;
-
-	/* set DAI ops */
-	hda_set_dai_drv_ops(sdev, &sof_lnl_ops);
-
-	sof_lnl_ops.set_power_state = hda_dsp_set_power_state_ipc4;
-
 	return 0;
-};
-EXPORT_SYMBOL_NS(sof_lnl_ops_init, "SND_SOC_SOF_INTEL_LNL");
+}
+EXPORT_SYMBOL_NS(sof_lnl_set_ops, "SND_SOC_SOF_INTEL_LNL");
 
 /* Check if an SDW IRQ occurred */
 static bool lnl_dsp_check_sdw_irq(struct snd_sof_dev *sdev)
@@ -262,3 +205,6 @@ const struct sof_intel_dsp_desc ptl_chip_info = {
 	.hw_ip_version = SOF_INTEL_ACE_3_0,
 };
 EXPORT_SYMBOL_NS(ptl_chip_info, "SND_SOC_SOF_INTEL_LNL");
+
+MODULE_IMPORT_NS("SND_SOC_SOF_INTEL_MTL");
+MODULE_IMPORT_NS("SND_SOC_SOF_HDA_MLINK");
diff --git a/sound/soc/sof/intel/lnl.h b/sound/soc/sof/intel/lnl.h
index 79101af84b2e..e585b93d2b63 100644
--- a/sound/soc/sof/intel/lnl.h
+++ b/sound/soc/sof/intel/lnl.h
@@ -12,4 +12,6 @@
 #define LNL_DSP_REG_HFDSC		0x160200 /* DSP core0 status */
 #define LNL_DSP_REG_HFDEC		0x160204 /* DSP core0 error */
 
+int sof_lnl_set_ops(struct snd_sof_dev *sdev, struct snd_sof_dsp_ops *dsp_ops);
+
 #endif /* __SOF_INTEL_LNL_H */
diff --git a/sound/soc/sof/intel/pci-lnl.c b/sound/soc/sof/intel/pci-lnl.c
index 8d4d74ac4398..91b9cff8c4ca 100644
--- a/sound/soc/sof/intel/pci-lnl.c
+++ b/sound/soc/sof/intel/pci-lnl.c
@@ -18,7 +18,15 @@
 
 /* platform specific devices */
 #include "hda.h"
-#include "mtl.h"
+#include "lnl.h"
+
+/* LunarLake ops */
+static struct snd_sof_dsp_ops sof_lnl_ops;
+
+static int sof_lnl_ops_init(struct snd_sof_dev *sdev)
+{
+	return sof_lnl_set_ops(sdev, &sof_lnl_ops);
+}
 
 static const struct sof_dev_desc lnl_desc = {
 	.use_acpi_target_states	= true,
@@ -73,6 +81,4 @@ MODULE_LICENSE("Dual BSD/GPL");
 MODULE_DESCRIPTION("SOF support for LunarLake platforms");
 MODULE_IMPORT_NS("SND_SOC_SOF_INTEL_HDA_GENERIC");
 MODULE_IMPORT_NS("SND_SOC_SOF_INTEL_HDA_COMMON");
-MODULE_IMPORT_NS("SND_SOC_SOF_INTEL_MTL");
-MODULE_IMPORT_NS("SND_SOC_SOF_HDA_MLINK");
 MODULE_IMPORT_NS("SND_SOC_SOF_PCI_DEV");
diff --git a/sound/soc/sof/intel/pci-ptl.c b/sound/soc/sof/intel/pci-ptl.c
index c4fb6a2441b7..32f93723ee66 100644
--- a/sound/soc/sof/intel/pci-ptl.c
+++ b/sound/soc/sof/intel/pci-ptl.c
@@ -16,7 +16,15 @@
 
 /* platform specific devices */
 #include "hda.h"
-#include "mtl.h"
+#include "lnl.h"
+
+/* PantherLake ops */
+static struct snd_sof_dsp_ops sof_ptl_ops;
+
+static int sof_ptl_ops_init(struct snd_sof_dev *sdev)
+{
+	return sof_lnl_set_ops(sdev, &sof_ptl_ops);
+}
 
 static const struct sof_dev_desc ptl_desc = {
 	.use_acpi_target_states	= true,
@@ -43,8 +51,8 @@ static const struct sof_dev_desc ptl_desc = {
 		[SOF_IPC_TYPE_4] = "sof-ptl.ri",
 	},
 	.nocodec_tplg_filename = "sof-ptl-nocodec.tplg",
-	.ops = &sof_lnl_ops,
-	.ops_init = sof_lnl_ops_init,
+	.ops = &sof_ptl_ops,
+	.ops_init = sof_ptl_ops_init,
 };
 
 /* PCI IDs */
@@ -73,6 +81,5 @@ MODULE_DESCRIPTION("SOF support for PantherLake platforms");
 MODULE_IMPORT_NS("SND_SOC_SOF_INTEL_HDA_GENERIC");
 MODULE_IMPORT_NS("SND_SOC_SOF_INTEL_HDA_COMMON");
 MODULE_IMPORT_NS("SND_SOC_SOF_INTEL_LNL");
-MODULE_IMPORT_NS("SND_SOC_SOF_INTEL_MTL");
 MODULE_IMPORT_NS("SND_SOC_SOF_HDA_MLINK");
 MODULE_IMPORT_NS("SND_SOC_SOF_PCI_DEV");
-- 
2.48.1


  parent reply	other threads:[~2025-03-07 11:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-07 11:28 [PATCH v2 0/8] ASoC: SOF: Intel: Add support for ACE3+ mic privacy Peter Ujfalusi
2025-03-07 11:28 ` [PATCH v2 1/8] ASoC: SOF: Intel: mtl: Split up dsp_ops setup code Peter Ujfalusi
2025-03-07 11:28 ` Peter Ujfalusi [this message]
2025-03-07 11:28 ` [PATCH v2 3/8] ASoC: SOF: Intel: mtl: Stop exporting dsp_ops callback functions Peter Ujfalusi
2025-03-07 11:28 ` [PATCH v2 4/8] ASoC: SOF: Intel: Create ptl.c as placeholder for Panther Lake features Peter Ujfalusi
2025-03-07 11:28 ` [PATCH v2 5/8] ASoC: SOF: ipc4: Add support for Intel HW managed mic privacy messaging Peter Ujfalusi
2025-03-07 11:28 ` [PATCH v2 6/8] ASoC: SOF: Intel: hda-mlink: Add support for mic privacy in VS SHIM registers Peter Ujfalusi
2025-03-07 11:28 ` [PATCH v2 7/8] ASoC: SOF: hda/shim: Add callbacks to handle mic privacy change for sdw Peter Ujfalusi
2025-03-07 11:28 ` [PATCH v2 8/8] ASoC: SOF: Intel: ptl: Add support for mic privacy Peter Ujfalusi
2025-03-10  1:25 ` [PATCH v2 0/8] ASoC: SOF: Intel: Add support for ACE3+ " Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250307112816.1495-3-peter.ujfalusi@linux.intel.com \
    --to=peter.ujfalusi@linux.intel.com \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=liam.r.girdwood@intel.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=yung-chuan.liao@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox