Skip to content

Commit 6982333

Browse files
ujfalusibroonie
authored andcommitted
ASoC: SOF: Intel: mtl: Split up dsp_ops setup code
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>
1 parent 5d5eceb commit 6982333

File tree

4 files changed

+31
-25
lines changed

4 files changed

+31
-25
lines changed

sound/soc/sof/intel/hda.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -913,8 +913,6 @@ extern struct snd_sof_dsp_ops sof_tgl_ops;
913913
int sof_tgl_ops_init(struct snd_sof_dev *sdev);
914914
extern struct snd_sof_dsp_ops sof_icl_ops;
915915
int sof_icl_ops_init(struct snd_sof_dev *sdev);
916-
extern struct snd_sof_dsp_ops sof_mtl_ops;
917-
int sof_mtl_ops_init(struct snd_sof_dev *sdev);
918916
extern struct snd_sof_dsp_ops sof_lnl_ops;
919917
int sof_lnl_ops_init(struct snd_sof_dev *sdev);
920918

sound/soc/sof/intel/mtl.c

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -712,43 +712,40 @@ int mtl_dsp_core_put(struct snd_sof_dev *sdev, int core)
712712
}
713713
EXPORT_SYMBOL_NS(mtl_dsp_core_put, "SND_SOC_SOF_INTEL_MTL");
714714

715-
/* Meteorlake ops */
716-
struct snd_sof_dsp_ops sof_mtl_ops;
717-
718-
int sof_mtl_ops_init(struct snd_sof_dev *sdev)
715+
int sof_mtl_set_ops(struct snd_sof_dev *sdev, struct snd_sof_dsp_ops *dsp_ops)
719716
{
720717
struct sof_ipc4_fw_data *ipc4_data;
721718

722719
/* common defaults */
723-
memcpy(&sof_mtl_ops, &sof_hda_common_ops, sizeof(struct snd_sof_dsp_ops));
720+
memcpy(dsp_ops, &sof_hda_common_ops, sizeof(struct snd_sof_dsp_ops));
724721

725722
/* shutdown */
726-
sof_mtl_ops.shutdown = hda_dsp_shutdown;
723+
dsp_ops->shutdown = hda_dsp_shutdown;
727724

728725
/* doorbell */
729-
sof_mtl_ops.irq_thread = mtl_ipc_irq_thread;
726+
dsp_ops->irq_thread = mtl_ipc_irq_thread;
730727

731728
/* ipc */
732-
sof_mtl_ops.send_msg = mtl_ipc_send_msg;
733-
sof_mtl_ops.get_mailbox_offset = mtl_dsp_ipc_get_mailbox_offset;
734-
sof_mtl_ops.get_window_offset = mtl_dsp_ipc_get_window_offset;
729+
dsp_ops->send_msg = mtl_ipc_send_msg;
730+
dsp_ops->get_mailbox_offset = mtl_dsp_ipc_get_mailbox_offset;
731+
dsp_ops->get_window_offset = mtl_dsp_ipc_get_window_offset;
735732

736733
/* debug */
737-
sof_mtl_ops.debug_map = mtl_dsp_debugfs;
738-
sof_mtl_ops.debug_map_count = ARRAY_SIZE(mtl_dsp_debugfs);
739-
sof_mtl_ops.dbg_dump = mtl_dsp_dump;
740-
sof_mtl_ops.ipc_dump = mtl_ipc_dump;
734+
dsp_ops->debug_map = mtl_dsp_debugfs;
735+
dsp_ops->debug_map_count = ARRAY_SIZE(mtl_dsp_debugfs);
736+
dsp_ops->dbg_dump = mtl_dsp_dump;
737+
dsp_ops->ipc_dump = mtl_ipc_dump;
741738

742739
/* pre/post fw run */
743-
sof_mtl_ops.pre_fw_run = mtl_dsp_pre_fw_run;
744-
sof_mtl_ops.post_fw_run = mtl_dsp_post_fw_run;
740+
dsp_ops->pre_fw_run = mtl_dsp_pre_fw_run;
741+
dsp_ops->post_fw_run = mtl_dsp_post_fw_run;
745742

746743
/* parse platform specific extended manifest */
747-
sof_mtl_ops.parse_platform_ext_manifest = NULL;
744+
dsp_ops->parse_platform_ext_manifest = NULL;
748745

749746
/* dsp core get/put */
750-
sof_mtl_ops.core_get = mtl_dsp_core_get;
751-
sof_mtl_ops.core_put = mtl_dsp_core_put;
747+
dsp_ops->core_get = mtl_dsp_core_get;
748+
dsp_ops->core_put = mtl_dsp_core_put;
752749

753750
sdev->private = kzalloc(sizeof(struct sof_ipc4_fw_data), GFP_KERNEL);
754751
if (!sdev->private)
@@ -764,13 +761,14 @@ int sof_mtl_ops_init(struct snd_sof_dev *sdev)
764761
/* External library loading support */
765762
ipc4_data->load_library = hda_dsp_ipc4_load_library;
766763

767-
/* set DAI ops */
768-
hda_set_dai_drv_ops(sdev, &sof_mtl_ops);
764+
dsp_ops->set_power_state = hda_dsp_set_power_state_ipc4;
769765

770-
sof_mtl_ops.set_power_state = hda_dsp_set_power_state_ipc4;
766+
/* set DAI ops */
767+
hda_set_dai_drv_ops(sdev, dsp_ops);
771768

772769
return 0;
773-
};
770+
}
771+
EXPORT_SYMBOL_NS(sof_mtl_set_ops, "SND_SOC_SOF_INTEL_MTL");
774772

775773
const struct sof_intel_dsp_desc mtl_chip_info = {
776774
.cores_num = 3,

sound/soc/sof/intel/mtl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,5 @@ void mtl_ipc_dump(struct snd_sof_dev *sdev);
145145

146146
int mtl_dsp_core_get(struct snd_sof_dev *sdev, int core);
147147
int mtl_dsp_core_put(struct snd_sof_dev *sdev, int core);
148+
149+
int sof_mtl_set_ops(struct snd_sof_dev *sdev, struct snd_sof_dsp_ops *dsp_ops);

sound/soc/sof/intel/pci-mtl.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
#include "hda.h"
2121
#include "mtl.h"
2222

23+
/* Meteorlake ops */
24+
static struct snd_sof_dsp_ops sof_mtl_ops;
25+
26+
static int sof_mtl_ops_init(struct snd_sof_dev *sdev)
27+
{
28+
return sof_mtl_set_ops(sdev, &sof_mtl_ops);
29+
}
30+
2331
static const struct sof_dev_desc mtl_desc = {
2432
.use_acpi_target_states = true,
2533
.machines = snd_soc_acpi_intel_mtl_machines,

0 commit comments

Comments
 (0)