2020-08-26 18:45:31 +00:00
|
|
|
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
|
|
|
|
//
|
2024-05-03 14:03:51 +00:00
|
|
|
// Copyright(c) 2020 Intel Corporation
|
2020-08-26 18:45:31 +00:00
|
|
|
//
|
|
|
|
// Authors: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
|
|
|
|
//
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Hardware interface for audio DSP on Tigerlake.
|
|
|
|
*/
|
|
|
|
|
2022-05-11 17:16:48 +00:00
|
|
|
#include <sound/sof/ext_manifest4.h>
|
|
|
|
#include "../ipc4-priv.h"
|
2020-08-26 18:45:31 +00:00
|
|
|
#include "../ops.h"
|
|
|
|
#include "hda.h"
|
|
|
|
#include "hda-ipc.h"
|
|
|
|
#include "../sof-audio.h"
|
|
|
|
|
|
|
|
static const struct snd_sof_debugfs_map tgl_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},
|
|
|
|
};
|
|
|
|
|
2024-04-09 11:33:47 +00:00
|
|
|
static const struct snd_sof_debugfs_map tgl_ipc4_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, SRAM_WINDOW_OFFSET(0), 0x1000, SOF_DEBUGFS_ACCESS_D0_ONLY},
|
|
|
|
};
|
|
|
|
|
2021-11-19 19:26:15 +00:00
|
|
|
static int tgl_dsp_core_get(struct snd_sof_dev *sdev, int core)
|
|
|
|
{
|
2022-06-10 08:35:48 +00:00
|
|
|
const struct sof_ipc_pm_ops *pm_ops = sdev->ipc->ops->pm;
|
2021-11-19 19:26:15 +00:00
|
|
|
|
|
|
|
/* power up primary core if not already powered up and return */
|
|
|
|
if (core == SOF_DSP_PRIMARY_CORE)
|
|
|
|
return hda_dsp_enable_core(sdev, BIT(core));
|
|
|
|
|
2022-06-10 08:35:48 +00:00
|
|
|
if (pm_ops->set_core_state)
|
|
|
|
return pm_ops->set_core_state(sdev, core, true);
|
|
|
|
|
|
|
|
return 0;
|
2021-11-19 19:26:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int tgl_dsp_core_put(struct snd_sof_dev *sdev, int core)
|
|
|
|
{
|
2022-06-10 08:35:48 +00:00
|
|
|
const struct sof_ipc_pm_ops *pm_ops = sdev->ipc->ops->pm;
|
2023-05-23 10:32:17 +00:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (pm_ops->set_core_state) {
|
|
|
|
ret = pm_ops->set_core_state(sdev, core, false);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
}
|
2021-11-19 19:26:15 +00:00
|
|
|
|
|
|
|
/* power down primary core and return */
|
|
|
|
if (core == SOF_DSP_PRIMARY_CORE)
|
|
|
|
return hda_dsp_core_reset_power_down(sdev, BIT(core));
|
|
|
|
|
2022-06-10 08:35:48 +00:00
|
|
|
return 0;
|
2021-11-19 19:26:15 +00:00
|
|
|
}
|
|
|
|
|
2020-08-26 18:45:31 +00:00
|
|
|
/* Tigerlake ops */
|
2022-04-14 18:48:11 +00:00
|
|
|
struct snd_sof_dsp_ops sof_tgl_ops;
|
2020-08-26 18:45:31 +00:00
|
|
|
|
2022-04-14 18:48:11 +00:00
|
|
|
int sof_tgl_ops_init(struct snd_sof_dev *sdev)
|
|
|
|
{
|
|
|
|
/* common defaults */
|
|
|
|
memcpy(&sof_tgl_ops, &sof_hda_common_ops, sizeof(struct snd_sof_dsp_ops));
|
2020-08-26 18:45:31 +00:00
|
|
|
|
2022-04-14 18:48:11 +00:00
|
|
|
/* probe/remove/shutdown */
|
2022-12-09 11:45:28 +00:00
|
|
|
sof_tgl_ops.shutdown = hda_dsp_shutdown_dma_flush;
|
2021-10-04 15:21:44 +00:00
|
|
|
|
2023-09-19 10:42:24 +00:00
|
|
|
if (sdev->pdata->ipc_type == SOF_IPC_TYPE_3) {
|
2022-05-11 17:16:44 +00:00
|
|
|
/* doorbell */
|
|
|
|
sof_tgl_ops.irq_thread = cnl_ipc_irq_thread;
|
2020-08-26 18:45:31 +00:00
|
|
|
|
2022-05-11 17:16:44 +00:00
|
|
|
/* ipc */
|
|
|
|
sof_tgl_ops.send_msg = cnl_ipc_send_msg;
|
2022-09-23 13:36:11 +00:00
|
|
|
|
|
|
|
/* debug */
|
|
|
|
sof_tgl_ops.ipc_dump = cnl_ipc_dump;
|
2024-04-09 11:33:47 +00:00
|
|
|
sof_tgl_ops.debug_map = tgl_dsp_debugfs;
|
|
|
|
sof_tgl_ops.debug_map_count = ARRAY_SIZE(tgl_dsp_debugfs);
|
2023-04-20 10:47:14 +00:00
|
|
|
|
|
|
|
sof_tgl_ops.set_power_state = hda_dsp_set_power_state_ipc3;
|
2022-05-11 17:16:44 +00:00
|
|
|
}
|
|
|
|
|
2023-09-19 10:42:24 +00:00
|
|
|
if (sdev->pdata->ipc_type == SOF_IPC_TYPE_4) {
|
2022-05-11 17:16:48 +00:00
|
|
|
struct sof_ipc4_fw_data *ipc4_data;
|
|
|
|
|
2023-11-29 12:53:26 +00:00
|
|
|
sdev->private = kzalloc(sizeof(*ipc4_data), GFP_KERNEL);
|
2022-05-11 17:16:48 +00:00
|
|
|
if (!sdev->private)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
ipc4_data = sdev->private;
|
|
|
|
ipc4_data->manifest_fw_hdr_offset = SOF_MAN4_FW_HDR_OFFSET;
|
|
|
|
|
2022-09-09 11:43:32 +00:00
|
|
|
ipc4_data->mtrace_type = SOF_IPC4_MTRACE_INTEL_CAVS_2;
|
|
|
|
|
2023-12-15 08:31:01 +00:00
|
|
|
ipc4_data->fw_context_save = true;
|
|
|
|
|
2022-10-20 12:12:34 +00:00
|
|
|
/* External library loading support */
|
|
|
|
ipc4_data->load_library = hda_dsp_ipc4_load_library;
|
|
|
|
|
2022-05-11 17:16:44 +00:00
|
|
|
/* doorbell */
|
|
|
|
sof_tgl_ops.irq_thread = cnl_ipc4_irq_thread;
|
|
|
|
|
|
|
|
/* ipc */
|
|
|
|
sof_tgl_ops.send_msg = cnl_ipc4_send_msg;
|
2022-09-23 13:36:11 +00:00
|
|
|
|
|
|
|
/* debug */
|
|
|
|
sof_tgl_ops.ipc_dump = cnl_ipc4_dump;
|
2023-09-19 09:24:15 +00:00
|
|
|
sof_tgl_ops.dbg_dump = hda_ipc4_dsp_dump;
|
2024-04-09 11:33:47 +00:00
|
|
|
sof_tgl_ops.debug_map = tgl_ipc4_dsp_debugfs;
|
|
|
|
sof_tgl_ops.debug_map_count = ARRAY_SIZE(tgl_ipc4_dsp_debugfs);
|
2023-04-20 10:47:14 +00:00
|
|
|
|
|
|
|
sof_tgl_ops.set_power_state = hda_dsp_set_power_state_ipc4;
|
2022-05-11 17:16:44 +00:00
|
|
|
}
|
2020-08-26 18:45:31 +00:00
|
|
|
|
2022-04-21 20:31:49 +00:00
|
|
|
/* set DAI driver ops */
|
|
|
|
hda_set_dai_drv_ops(sdev, &sof_tgl_ops);
|
|
|
|
|
2020-08-26 18:45:31 +00:00
|
|
|
/* pre/post fw run */
|
2022-04-14 18:48:11 +00:00
|
|
|
sof_tgl_ops.post_fw_run = hda_dsp_post_fw_run;
|
2020-08-26 18:45:31 +00:00
|
|
|
|
2022-04-14 18:48:11 +00:00
|
|
|
/* firmware run */
|
|
|
|
sof_tgl_ops.run = hda_dsp_cl_boot_firmware_iccmax;
|
2020-11-27 16:40:19 +00:00
|
|
|
|
2021-11-19 19:26:20 +00:00
|
|
|
/* dsp core get/put */
|
2022-04-14 18:48:11 +00:00
|
|
|
sof_tgl_ops.core_get = tgl_dsp_core_get;
|
|
|
|
sof_tgl_ops.core_put = tgl_dsp_core_put;
|
2020-08-26 18:45:31 +00:00
|
|
|
|
2022-04-14 18:48:11 +00:00
|
|
|
return 0;
|
2020-08-26 18:45:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const struct sof_intel_dsp_desc tgl_chip_info = {
|
2021-04-12 16:15:19 +00:00
|
|
|
/* Tigerlake , Alderlake */
|
2020-08-26 18:45:31 +00:00
|
|
|
.cores_num = 4,
|
|
|
|
.init_core_mask = 1,
|
2020-09-10 16:41:24 +00:00
|
|
|
.host_managed_cores_mask = BIT(0),
|
2020-08-26 18:45:31 +00:00
|
|
|
.ipc_req = CNL_DSP_REG_HIPCIDR,
|
|
|
|
.ipc_req_mask = CNL_DSP_REG_HIPCIDR_BUSY,
|
|
|
|
.ipc_ack = CNL_DSP_REG_HIPCIDA,
|
|
|
|
.ipc_ack_mask = CNL_DSP_REG_HIPCIDA_DONE,
|
|
|
|
.ipc_ctl = CNL_DSP_REG_HIPCCTL,
|
2022-04-14 18:48:15 +00:00
|
|
|
.rom_status_reg = HDA_DSP_SRAM_REG_ROM_STATUS,
|
2020-08-26 18:45:31 +00:00
|
|
|
.rom_init_timeout = 300,
|
2022-09-19 11:53:47 +00:00
|
|
|
.ssp_count = TGL_SSP_COUNT,
|
2020-08-26 18:45:31 +00:00
|
|
|
.ssp_base_offset = CNL_SSP_BASE_OFFSET,
|
2021-07-23 11:54:47 +00:00
|
|
|
.sdw_shim_base = SDW_SHIM_BASE,
|
|
|
|
.sdw_alh_base = SDW_ALH_BASE,
|
2022-11-07 16:41:53 +00:00
|
|
|
.d0i3_offset = SOF_HDA_VS_D0I3C,
|
2022-11-11 04:26:50 +00:00
|
|
|
.read_sdw_lcount = hda_sdw_check_lcount_common,
|
2022-11-11 04:26:47 +00:00
|
|
|
.enable_sdw_irq = hda_common_enable_sdw_irq,
|
2021-07-23 11:54:50 +00:00
|
|
|
.check_sdw_irq = hda_common_check_sdw_irq,
|
2023-08-07 21:09:55 +00:00
|
|
|
.check_sdw_wakeen_irq = hda_sdw_check_wakeen_irq_common,
|
2024-05-03 13:52:20 +00:00
|
|
|
.sdw_process_wakeen = hda_sdw_process_wakeen_common,
|
2022-04-14 18:48:14 +00:00
|
|
|
.check_ipc_irq = hda_dsp_check_ipc_irq,
|
2022-06-15 08:43:47 +00:00
|
|
|
.cl_init = cl_dsp_init,
|
2022-09-22 21:36:36 +00:00
|
|
|
.power_down_dsp = hda_power_down_dsp,
|
2022-09-22 21:36:40 +00:00
|
|
|
.disable_interrupts = hda_dsp_disable_interrupts,
|
2022-04-14 18:48:17 +00:00
|
|
|
.hw_ip_version = SOF_INTEL_CAVS_2_5,
|
2020-08-26 18:45:31 +00:00
|
|
|
};
|
2020-09-17 10:36:09 +00:00
|
|
|
|
|
|
|
const struct sof_intel_dsp_desc tglh_chip_info = {
|
|
|
|
/* Tigerlake-H */
|
|
|
|
.cores_num = 2,
|
|
|
|
.init_core_mask = 1,
|
|
|
|
.host_managed_cores_mask = BIT(0),
|
|
|
|
.ipc_req = CNL_DSP_REG_HIPCIDR,
|
|
|
|
.ipc_req_mask = CNL_DSP_REG_HIPCIDR_BUSY,
|
|
|
|
.ipc_ack = CNL_DSP_REG_HIPCIDA,
|
|
|
|
.ipc_ack_mask = CNL_DSP_REG_HIPCIDA_DONE,
|
|
|
|
.ipc_ctl = CNL_DSP_REG_HIPCCTL,
|
2022-04-14 18:48:15 +00:00
|
|
|
.rom_status_reg = HDA_DSP_SRAM_REG_ROM_STATUS,
|
2020-09-17 10:36:09 +00:00
|
|
|
.rom_init_timeout = 300,
|
2022-09-19 11:53:47 +00:00
|
|
|
.ssp_count = TGL_SSP_COUNT,
|
2020-09-17 10:36:09 +00:00
|
|
|
.ssp_base_offset = CNL_SSP_BASE_OFFSET,
|
2021-07-23 11:54:47 +00:00
|
|
|
.sdw_shim_base = SDW_SHIM_BASE,
|
|
|
|
.sdw_alh_base = SDW_ALH_BASE,
|
2022-11-07 16:41:53 +00:00
|
|
|
.d0i3_offset = SOF_HDA_VS_D0I3C,
|
2022-11-11 04:26:50 +00:00
|
|
|
.read_sdw_lcount = hda_sdw_check_lcount_common,
|
2022-11-11 04:26:47 +00:00
|
|
|
.enable_sdw_irq = hda_common_enable_sdw_irq,
|
2021-07-23 11:54:50 +00:00
|
|
|
.check_sdw_irq = hda_common_check_sdw_irq,
|
2023-08-07 21:09:55 +00:00
|
|
|
.check_sdw_wakeen_irq = hda_sdw_check_wakeen_irq_common,
|
2024-05-03 13:52:20 +00:00
|
|
|
.sdw_process_wakeen = hda_sdw_process_wakeen_common,
|
2022-04-14 18:48:14 +00:00
|
|
|
.check_ipc_irq = hda_dsp_check_ipc_irq,
|
2022-06-15 08:43:47 +00:00
|
|
|
.cl_init = cl_dsp_init,
|
2022-09-22 21:36:36 +00:00
|
|
|
.power_down_dsp = hda_power_down_dsp,
|
2022-09-22 21:36:40 +00:00
|
|
|
.disable_interrupts = hda_dsp_disable_interrupts,
|
2022-04-14 18:48:17 +00:00
|
|
|
.hw_ip_version = SOF_INTEL_CAVS_2_5,
|
2020-09-17 10:36:09 +00:00
|
|
|
};
|
2020-11-16 14:26:42 +00:00
|
|
|
|
2021-03-22 16:37:28 +00:00
|
|
|
const struct sof_intel_dsp_desc ehl_chip_info = {
|
|
|
|
/* Elkhartlake */
|
|
|
|
.cores_num = 4,
|
|
|
|
.init_core_mask = 1,
|
|
|
|
.host_managed_cores_mask = BIT(0),
|
|
|
|
.ipc_req = CNL_DSP_REG_HIPCIDR,
|
|
|
|
.ipc_req_mask = CNL_DSP_REG_HIPCIDR_BUSY,
|
|
|
|
.ipc_ack = CNL_DSP_REG_HIPCIDA,
|
|
|
|
.ipc_ack_mask = CNL_DSP_REG_HIPCIDA_DONE,
|
|
|
|
.ipc_ctl = CNL_DSP_REG_HIPCCTL,
|
2022-04-14 18:48:15 +00:00
|
|
|
.rom_status_reg = HDA_DSP_SRAM_REG_ROM_STATUS,
|
2021-03-22 16:37:28 +00:00
|
|
|
.rom_init_timeout = 300,
|
2022-09-19 11:53:47 +00:00
|
|
|
.ssp_count = TGL_SSP_COUNT,
|
2021-03-22 16:37:28 +00:00
|
|
|
.ssp_base_offset = CNL_SSP_BASE_OFFSET,
|
2021-07-23 11:54:47 +00:00
|
|
|
.sdw_shim_base = SDW_SHIM_BASE,
|
|
|
|
.sdw_alh_base = SDW_ALH_BASE,
|
2022-11-07 16:41:53 +00:00
|
|
|
.d0i3_offset = SOF_HDA_VS_D0I3C,
|
2022-11-11 04:26:50 +00:00
|
|
|
.read_sdw_lcount = hda_sdw_check_lcount_common,
|
2022-11-11 04:26:47 +00:00
|
|
|
.enable_sdw_irq = hda_common_enable_sdw_irq,
|
2021-07-23 11:54:50 +00:00
|
|
|
.check_sdw_irq = hda_common_check_sdw_irq,
|
2023-08-07 21:09:55 +00:00
|
|
|
.check_sdw_wakeen_irq = hda_sdw_check_wakeen_irq_common,
|
2024-05-03 13:52:20 +00:00
|
|
|
.sdw_process_wakeen = hda_sdw_process_wakeen_common,
|
2022-04-14 18:48:14 +00:00
|
|
|
.check_ipc_irq = hda_dsp_check_ipc_irq,
|
2022-06-15 08:43:47 +00:00
|
|
|
.cl_init = cl_dsp_init,
|
2022-09-22 21:36:36 +00:00
|
|
|
.power_down_dsp = hda_power_down_dsp,
|
2022-09-22 21:36:40 +00:00
|
|
|
.disable_interrupts = hda_dsp_disable_interrupts,
|
2022-04-14 18:48:17 +00:00
|
|
|
.hw_ip_version = SOF_INTEL_CAVS_2_5,
|
2021-03-22 16:37:28 +00:00
|
|
|
};
|
|
|
|
|
2020-11-16 14:26:42 +00:00
|
|
|
const struct sof_intel_dsp_desc adls_chip_info = {
|
|
|
|
/* Alderlake-S */
|
|
|
|
.cores_num = 2,
|
|
|
|
.init_core_mask = BIT(0),
|
|
|
|
.host_managed_cores_mask = BIT(0),
|
|
|
|
.ipc_req = CNL_DSP_REG_HIPCIDR,
|
|
|
|
.ipc_req_mask = CNL_DSP_REG_HIPCIDR_BUSY,
|
|
|
|
.ipc_ack = CNL_DSP_REG_HIPCIDA,
|
|
|
|
.ipc_ack_mask = CNL_DSP_REG_HIPCIDA_DONE,
|
|
|
|
.ipc_ctl = CNL_DSP_REG_HIPCCTL,
|
2022-04-14 18:48:15 +00:00
|
|
|
.rom_status_reg = HDA_DSP_SRAM_REG_ROM_STATUS,
|
2020-11-16 14:26:42 +00:00
|
|
|
.rom_init_timeout = 300,
|
2022-09-19 11:53:47 +00:00
|
|
|
.ssp_count = TGL_SSP_COUNT,
|
2020-11-16 14:26:42 +00:00
|
|
|
.ssp_base_offset = CNL_SSP_BASE_OFFSET,
|
2021-07-23 11:54:47 +00:00
|
|
|
.sdw_shim_base = SDW_SHIM_BASE,
|
|
|
|
.sdw_alh_base = SDW_ALH_BASE,
|
2022-11-07 16:41:53 +00:00
|
|
|
.d0i3_offset = SOF_HDA_VS_D0I3C,
|
2022-11-11 04:26:50 +00:00
|
|
|
.read_sdw_lcount = hda_sdw_check_lcount_common,
|
2022-11-11 04:26:47 +00:00
|
|
|
.enable_sdw_irq = hda_common_enable_sdw_irq,
|
2021-07-23 11:54:50 +00:00
|
|
|
.check_sdw_irq = hda_common_check_sdw_irq,
|
2023-08-07 21:09:55 +00:00
|
|
|
.check_sdw_wakeen_irq = hda_sdw_check_wakeen_irq_common,
|
2024-05-03 13:52:20 +00:00
|
|
|
.sdw_process_wakeen = hda_sdw_process_wakeen_common,
|
2022-04-14 18:48:14 +00:00
|
|
|
.check_ipc_irq = hda_dsp_check_ipc_irq,
|
2022-06-15 08:43:47 +00:00
|
|
|
.cl_init = cl_dsp_init,
|
2022-09-22 21:36:36 +00:00
|
|
|
.power_down_dsp = hda_power_down_dsp,
|
2022-09-22 21:36:40 +00:00
|
|
|
.disable_interrupts = hda_dsp_disable_interrupts,
|
2022-04-14 18:48:17 +00:00
|
|
|
.hw_ip_version = SOF_INTEL_CAVS_2_5,
|
2020-11-16 14:26:42 +00:00
|
|
|
};
|