linux/sound/soc/sof/intel/lnl.c

// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
//
// Copyright(c) 2023 Intel Corporation

/*
 * Hardware interface for audio DSP on LunarLake.
 */

#include <linux/debugfs.h>
#include <linux/firmware.h>
#include <sound/hda_register.h>
#include <sound/sof/ipc4/header.h>
#include <trace/events/sof_intel.h>
#include "../ipc4-priv.h"
#include "../ops.h"
#include "hda.h"
#include "hda-ipc.h"
#include "../sof-audio.h"
#include "mtl.h"
#include "lnl.h"
#include <sound/hda-mlink.h>

/* LunarLake ops */
struct snd_sof_dsp_ops sof_lnl_ops;
EXPORT_SYMBOL_NS();

static const struct snd_sof_debugfs_map lnl_dsp_debugfs[] =;

/* this helps allows the DSP to setup DMIC/SSP */
static int hdac_bus_offload_dmic_ssp(struct hdac_bus *bus, bool enable)
{}

static int lnl_hda_dsp_probe(struct snd_sof_dev *sdev)
{}

static void lnl_hda_dsp_remove(struct snd_sof_dev *sdev)
{}

static int lnl_hda_dsp_resume(struct snd_sof_dev *sdev)
{}

static int lnl_hda_dsp_runtime_resume(struct snd_sof_dev *sdev)
{}

static int lnl_dsp_post_fw_run(struct snd_sof_dev *sdev)
{}

int sof_lnl_ops_init(struct snd_sof_dev *sdev)
{
	struct sof_ipc4_fw_data *ipc4_data;

	/* common defaults */
	memcpy(&sof_lnl_ops, &sof_hda_common_ops, sizeof(struct snd_sof_dsp_ops));

	/* probe/remove */
	if (!sdev->dspless_mode_selected) {
		sof_lnl_ops.probe = lnl_hda_dsp_probe;
		sof_lnl_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 */

	/* 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 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();

/* Check if an SDW IRQ occurred */
static bool lnl_dsp_check_sdw_irq(struct snd_sof_dev *sdev)
{}

static void lnl_enable_sdw_irq(struct snd_sof_dev *sdev, bool enable)
{}

static int lnl_dsp_disable_interrupts(struct snd_sof_dev *sdev)
{}

static bool lnl_sdw_check_wakeen_irq(struct snd_sof_dev *sdev)
{}

const struct sof_intel_dsp_desc lnl_chip_info =;

const struct sof_intel_dsp_desc ptl_chip_info =;
EXPORT_SYMBOL_NS();