Skip to content

Commit 0d2d276

Browse files
ujfalusibroonie
authored andcommitted
ASoC: SOF: Intel: lnl/ptl: Only set dsp_ops which differs from MTL
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> Link: https://patch.msgid.link/20250307112816.1495-3-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 6982333 commit 0d2d276

File tree

5 files changed

+38
-79
lines changed

5 files changed

+38
-79
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_lnl_ops;
917-
int sof_lnl_ops_init(struct snd_sof_dev *sdev);
918916

919917
extern const struct sof_intel_dsp_desc skl_chip_info;
920918
extern const struct sof_intel_dsp_desc apl_chip_info;

sound/soc/sof/intel/lnl.c

Lines changed: 16 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,6 @@
2020
#include "lnl.h"
2121
#include <sound/hda-mlink.h>
2222

23-
/* LunarLake ops */
24-
struct snd_sof_dsp_ops sof_lnl_ops;
25-
EXPORT_SYMBOL_NS(sof_lnl_ops, "SND_SOC_SOF_INTEL_LNL");
26-
27-
static const struct snd_sof_debugfs_map lnl_dsp_debugfs[] = {
28-
{"hda", HDA_DSP_HDA_BAR, 0, 0x4000, SOF_DEBUGFS_ACCESS_ALWAYS},
29-
{"pp", HDA_DSP_PP_BAR, 0, 0x1000, SOF_DEBUGFS_ACCESS_ALWAYS},
30-
{"dsp", HDA_DSP_BAR, 0, 0x10000, SOF_DEBUGFS_ACCESS_ALWAYS},
31-
{"fw_regs", HDA_DSP_BAR, MTL_SRAM_WINDOW_OFFSET(0), 0x1000, SOF_DEBUGFS_ACCESS_D0_ONLY},
32-
};
33-
3423
/* this helps allows the DSP to setup DMIC/SSP */
3524
static int hdac_bus_offload_dmic_ssp(struct hdac_bus *bus, bool enable)
3625
{
@@ -111,78 +100,32 @@ static int lnl_dsp_post_fw_run(struct snd_sof_dev *sdev)
111100
return 0;
112101
}
113102

114-
int sof_lnl_ops_init(struct snd_sof_dev *sdev)
103+
int sof_lnl_set_ops(struct snd_sof_dev *sdev, struct snd_sof_dsp_ops *dsp_ops)
115104
{
116-
struct sof_ipc4_fw_data *ipc4_data;
105+
int ret;
117106

118-
/* common defaults */
119-
memcpy(&sof_lnl_ops, &sof_hda_common_ops, sizeof(struct snd_sof_dsp_ops));
107+
ret = sof_mtl_set_ops(sdev, dsp_ops);
108+
if (ret)
109+
return ret;
120110

121111
/* probe/remove */
122112
if (!sdev->dspless_mode_selected) {
123-
sof_lnl_ops.probe = lnl_hda_dsp_probe;
124-
sof_lnl_ops.remove = lnl_hda_dsp_remove;
113+
dsp_ops->probe = lnl_hda_dsp_probe;
114+
dsp_ops->remove = lnl_hda_dsp_remove;
125115
}
126116

127-
/* shutdown */
128-
sof_lnl_ops.shutdown = hda_dsp_shutdown;
129-
130-
/* doorbell */
131-
sof_lnl_ops.irq_thread = mtl_ipc_irq_thread;
132-
133-
/* ipc */
134-
sof_lnl_ops.send_msg = mtl_ipc_send_msg;
135-
sof_lnl_ops.get_mailbox_offset = mtl_dsp_ipc_get_mailbox_offset;
136-
sof_lnl_ops.get_window_offset = mtl_dsp_ipc_get_window_offset;
137-
138-
/* debug */
139-
sof_lnl_ops.debug_map = lnl_dsp_debugfs;
140-
sof_lnl_ops.debug_map_count = ARRAY_SIZE(lnl_dsp_debugfs);
141-
sof_lnl_ops.dbg_dump = mtl_dsp_dump;
142-
sof_lnl_ops.ipc_dump = mtl_ipc_dump;
143-
144-
/* pre/post fw run */
145-
sof_lnl_ops.pre_fw_run = mtl_dsp_pre_fw_run;
146-
sof_lnl_ops.post_fw_run = lnl_dsp_post_fw_run;
147-
148-
/* parse platform specific extended manifest */
149-
sof_lnl_ops.parse_platform_ext_manifest = NULL;
150-
151-
/* dsp core get/put */
152-
/* TODO: add core_get and core_put */
117+
/* post fw run */
118+
dsp_ops->post_fw_run = lnl_dsp_post_fw_run;
153119

154120
/* PM */
155121
if (!sdev->dspless_mode_selected) {
156-
sof_lnl_ops.resume = lnl_hda_dsp_resume;
157-
sof_lnl_ops.runtime_resume = lnl_hda_dsp_runtime_resume;
122+
dsp_ops->resume = lnl_hda_dsp_resume;
123+
dsp_ops->runtime_resume = lnl_hda_dsp_runtime_resume;
158124
}
159125

160-
/* dsp core get/put */
161-
sof_lnl_ops.core_get = mtl_dsp_core_get;
162-
sof_lnl_ops.core_put = mtl_dsp_core_put;
163-
164-
sdev->private = kzalloc(sizeof(struct sof_ipc4_fw_data), GFP_KERNEL);
165-
if (!sdev->private)
166-
return -ENOMEM;
167-
168-
ipc4_data = sdev->private;
169-
ipc4_data->manifest_fw_hdr_offset = SOF_MAN4_FW_HDR_OFFSET;
170-
171-
ipc4_data->mtrace_type = SOF_IPC4_MTRACE_INTEL_CAVS_2;
172-
173-
ipc4_data->fw_context_save = true;
174-
175-
/* External library loading support */
176-
ipc4_data->load_library = hda_dsp_ipc4_load_library;
177-
178-
/* set DAI ops */
179-
hda_set_dai_drv_ops(sdev, &sof_lnl_ops);
180-
181-
sof_lnl_ops.set_power_state = hda_dsp_set_power_state_ipc4;
182-
183126
return 0;
184-
};
185-
EXPORT_SYMBOL_NS(sof_lnl_ops_init, "SND_SOC_SOF_INTEL_LNL");
127+
}
128+
EXPORT_SYMBOL_NS(sof_lnl_set_ops, "SND_SOC_SOF_INTEL_LNL");
186129

187130
/* Check if an SDW IRQ occurred */
188131
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 = {
262205
.hw_ip_version = SOF_INTEL_ACE_3_0,
263206
};
264207
EXPORT_SYMBOL_NS(ptl_chip_info, "SND_SOC_SOF_INTEL_LNL");
208+
209+
MODULE_IMPORT_NS("SND_SOC_SOF_INTEL_MTL");
210+
MODULE_IMPORT_NS("SND_SOC_SOF_HDA_MLINK");

sound/soc/sof/intel/lnl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@
1212
#define LNL_DSP_REG_HFDSC 0x160200 /* DSP core0 status */
1313
#define LNL_DSP_REG_HFDEC 0x160204 /* DSP core0 error */
1414

15+
int sof_lnl_set_ops(struct snd_sof_dev *sdev, struct snd_sof_dsp_ops *dsp_ops);
16+
1517
#endif /* __SOF_INTEL_LNL_H */

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@
1818

1919
/* platform specific devices */
2020
#include "hda.h"
21-
#include "mtl.h"
21+
#include "lnl.h"
22+
23+
/* LunarLake ops */
24+
static struct snd_sof_dsp_ops sof_lnl_ops;
25+
26+
static int sof_lnl_ops_init(struct snd_sof_dev *sdev)
27+
{
28+
return sof_lnl_set_ops(sdev, &sof_lnl_ops);
29+
}
2230

2331
static const struct sof_dev_desc lnl_desc = {
2432
.use_acpi_target_states = true,
@@ -73,6 +81,4 @@ MODULE_LICENSE("Dual BSD/GPL");
7381
MODULE_DESCRIPTION("SOF support for LunarLake platforms");
7482
MODULE_IMPORT_NS("SND_SOC_SOF_INTEL_HDA_GENERIC");
7583
MODULE_IMPORT_NS("SND_SOC_SOF_INTEL_HDA_COMMON");
76-
MODULE_IMPORT_NS("SND_SOC_SOF_INTEL_MTL");
77-
MODULE_IMPORT_NS("SND_SOC_SOF_HDA_MLINK");
7884
MODULE_IMPORT_NS("SND_SOC_SOF_PCI_DEV");

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,15 @@
1616

1717
/* platform specific devices */
1818
#include "hda.h"
19-
#include "mtl.h"
19+
#include "lnl.h"
20+
21+
/* PantherLake ops */
22+
static struct snd_sof_dsp_ops sof_ptl_ops;
23+
24+
static int sof_ptl_ops_init(struct snd_sof_dev *sdev)
25+
{
26+
return sof_lnl_set_ops(sdev, &sof_ptl_ops);
27+
}
2028

2129
static const struct sof_dev_desc ptl_desc = {
2230
.use_acpi_target_states = true,
@@ -43,8 +51,8 @@ static const struct sof_dev_desc ptl_desc = {
4351
[SOF_IPC_TYPE_4] = "sof-ptl.ri",
4452
},
4553
.nocodec_tplg_filename = "sof-ptl-nocodec.tplg",
46-
.ops = &sof_lnl_ops,
47-
.ops_init = sof_lnl_ops_init,
54+
.ops = &sof_ptl_ops,
55+
.ops_init = sof_ptl_ops_init,
4856
};
4957

5058
/* PCI IDs */
@@ -73,6 +81,5 @@ MODULE_DESCRIPTION("SOF support for PantherLake platforms");
7381
MODULE_IMPORT_NS("SND_SOC_SOF_INTEL_HDA_GENERIC");
7482
MODULE_IMPORT_NS("SND_SOC_SOF_INTEL_HDA_COMMON");
7583
MODULE_IMPORT_NS("SND_SOC_SOF_INTEL_LNL");
76-
MODULE_IMPORT_NS("SND_SOC_SOF_INTEL_MTL");
7784
MODULE_IMPORT_NS("SND_SOC_SOF_HDA_MLINK");
7885
MODULE_IMPORT_NS("SND_SOC_SOF_PCI_DEV");

0 commit comments

Comments
 (0)