ASoC: SOF: Intel: mtl: Split up dsp_ops setup code
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Fri, 7 Mar 2025 11:28:09 +0000 (13:28 +0200)
committerMark Brown <broonie@kernel.org>
Sat, 8 Mar 2025 16:06:37 +0000 (16:06 +0000)
Move the sof_mtl_ops and sof_mtl_ops_init() to pci-mtl.c as local static
and add a 'generic' sof_mtl_set_ops() function as replacement exported
function to fill the dsp_ops structure.

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>
Link: https://patch.msgid.link/20250307112816.1495-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/intel/hda.h
sound/soc/sof/intel/mtl.c
sound/soc/sof/intel/mtl.h
sound/soc/sof/intel/pci-mtl.c

index ee4ccc1a549001878cb8255052a79a9b5b870fdf..92b7402e752ed338331f166dad24afeeb6206aa8 100644 (file)
@@ -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_mtl_ops;
-int sof_mtl_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);
 
index 4a6b1d56171ee83681f57bae5e326398564c8ab1..ec563214dd1afdbd12c43adbb6cda67ec223b647 100644 (file)
@@ -712,43 +712,40 @@ int mtl_dsp_core_put(struct snd_sof_dev *sdev, int core)
 }
 EXPORT_SYMBOL_NS(mtl_dsp_core_put, "SND_SOC_SOF_INTEL_MTL");
 
-/* Meteorlake ops */
-struct snd_sof_dsp_ops sof_mtl_ops;
-
-int sof_mtl_ops_init(struct snd_sof_dev *sdev)
+int sof_mtl_set_ops(struct snd_sof_dev *sdev, struct snd_sof_dsp_ops *dsp_ops)
 {
        struct sof_ipc4_fw_data *ipc4_data;
 
        /* common defaults */
-       memcpy(&sof_mtl_ops, &sof_hda_common_ops, sizeof(struct snd_sof_dsp_ops));
+       memcpy(dsp_ops, &sof_hda_common_ops, sizeof(struct snd_sof_dsp_ops));
 
        /* shutdown */
-       sof_mtl_ops.shutdown = hda_dsp_shutdown;
+       dsp_ops->shutdown = hda_dsp_shutdown;
 
        /* doorbell */
-       sof_mtl_ops.irq_thread = mtl_ipc_irq_thread;
+       dsp_ops->irq_thread = mtl_ipc_irq_thread;
 
        /* ipc */
-       sof_mtl_ops.send_msg = mtl_ipc_send_msg;
-       sof_mtl_ops.get_mailbox_offset = mtl_dsp_ipc_get_mailbox_offset;
-       sof_mtl_ops.get_window_offset = mtl_dsp_ipc_get_window_offset;
+       dsp_ops->send_msg = mtl_ipc_send_msg;
+       dsp_ops->get_mailbox_offset = mtl_dsp_ipc_get_mailbox_offset;
+       dsp_ops->get_window_offset = mtl_dsp_ipc_get_window_offset;
 
        /* debug */
-       sof_mtl_ops.debug_map = mtl_dsp_debugfs;
-       sof_mtl_ops.debug_map_count = ARRAY_SIZE(mtl_dsp_debugfs);
-       sof_mtl_ops.dbg_dump = mtl_dsp_dump;
-       sof_mtl_ops.ipc_dump = mtl_ipc_dump;
+       dsp_ops->debug_map = mtl_dsp_debugfs;
+       dsp_ops->debug_map_count = ARRAY_SIZE(mtl_dsp_debugfs);
+       dsp_ops->dbg_dump = mtl_dsp_dump;
+       dsp_ops->ipc_dump = mtl_ipc_dump;
 
        /* pre/post fw run */
-       sof_mtl_ops.pre_fw_run = mtl_dsp_pre_fw_run;
-       sof_mtl_ops.post_fw_run = mtl_dsp_post_fw_run;
+       dsp_ops->pre_fw_run = mtl_dsp_pre_fw_run;
+       dsp_ops->post_fw_run = mtl_dsp_post_fw_run;
 
        /* parse platform specific extended manifest */
-       sof_mtl_ops.parse_platform_ext_manifest = NULL;
+       dsp_ops->parse_platform_ext_manifest = NULL;
 
        /* dsp core get/put */
-       sof_mtl_ops.core_get = mtl_dsp_core_get;
-       sof_mtl_ops.core_put = mtl_dsp_core_put;
+       dsp_ops->core_get = mtl_dsp_core_get;
+       dsp_ops->core_put = mtl_dsp_core_put;
 
        sdev->private = kzalloc(sizeof(struct sof_ipc4_fw_data), GFP_KERNEL);
        if (!sdev->private)
@@ -764,13 +761,14 @@ int sof_mtl_ops_init(struct snd_sof_dev *sdev)
        /* External library loading support */
        ipc4_data->load_library = hda_dsp_ipc4_load_library;
 
-       /* set DAI ops */
-       hda_set_dai_drv_ops(sdev, &sof_mtl_ops);
+       dsp_ops->set_power_state = hda_dsp_set_power_state_ipc4;
 
-       sof_mtl_ops.set_power_state = hda_dsp_set_power_state_ipc4;
+       /* set DAI ops */
+       hda_set_dai_drv_ops(sdev, dsp_ops);
 
        return 0;
-};
+}
+EXPORT_SYMBOL_NS(sof_mtl_set_ops, "SND_SOC_SOF_INTEL_MTL");
 
 const struct sof_intel_dsp_desc mtl_chip_info = {
        .cores_num = 3,
index 9ab4b21c960e2fbdae828b13c8823f8a5b108d85..4d098dae29730f4359b339c8e61a525c1b21adbc 100644 (file)
@@ -145,3 +145,5 @@ void mtl_ipc_dump(struct snd_sof_dev *sdev);
 
 int mtl_dsp_core_get(struct snd_sof_dev *sdev, int core);
 int mtl_dsp_core_put(struct snd_sof_dev *sdev, int core);
+
+int sof_mtl_set_ops(struct snd_sof_dev *sdev, struct snd_sof_dsp_ops *dsp_ops);
index 71f711cf85990e8d4245fc63edc5a92cf2df83ed..c5048a4a56be14af88152efa227202476ccf4ea5 100644 (file)
 #include "hda.h"
 #include "mtl.h"
 
+/* Meteorlake ops */
+static struct snd_sof_dsp_ops sof_mtl_ops;
+
+static int sof_mtl_ops_init(struct snd_sof_dev *sdev)
+{
+       return sof_mtl_set_ops(sdev, &sof_mtl_ops);
+}
+
 static const struct sof_dev_desc mtl_desc = {
        .use_acpi_target_states = true,
        .machines               = snd_soc_acpi_intel_mtl_machines,