Skip to content

Commit

Permalink
ASoC: SOF: Intel: lnl/ptl: Only set dsp_ops which differs from MTL
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Peter Ujfalusi authored and Mark Brown committed Mar 8, 2025
1 parent 6982333 commit 0d2d276
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 79 deletions.
2 changes: 0 additions & 2 deletions sound/soc/sof/intel/hda.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
86 changes: 16 additions & 70 deletions sound/soc/sof/intel/lnl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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");
2 changes: 2 additions & 0 deletions sound/soc/sof/intel/lnl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
12 changes: 9 additions & 3 deletions sound/soc/sof/intel/pci-lnl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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");
15 changes: 11 additions & 4 deletions sound/soc/sof/intel/pci-ptl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 */
Expand Down Expand Up @@ -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");

0 comments on commit 0d2d276

Please sign in to comment.