2020-05-01 21:58:50 +07:00
|
|
|
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
|
2019-04-12 23:08:58 +07:00
|
|
|
//
|
|
|
|
// This file is provided under a dual BSD/GPLv2 license. When using or
|
|
|
|
// redistributing this file, you may do so under either license.
|
|
|
|
//
|
|
|
|
// Copyright(c) 2018 Intel Corporation. All rights reserved.
|
|
|
|
//
|
|
|
|
// Authors: Liam Girdwood <liam.r.girdwood@linux.intel.com>
|
|
|
|
// Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
|
|
|
|
// Rander Wang <rander.wang@intel.com>
|
|
|
|
// Keyon Jie <yang.jie@linux.intel.com>
|
|
|
|
//
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Hardware interface for audio DSP on Apollolake and GeminiLake
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "../sof-priv.h"
|
|
|
|
#include "hda.h"
|
2019-12-05 04:15:53 +07:00
|
|
|
#include "../sof-audio.h"
|
2019-04-12 23:08:58 +07:00
|
|
|
|
|
|
|
static const struct snd_sof_debugfs_map apl_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},
|
|
|
|
};
|
|
|
|
|
|
|
|
/* apollolake ops */
|
|
|
|
const struct snd_sof_dsp_ops sof_apl_ops = {
|
|
|
|
/* probe and remove */
|
|
|
|
.probe = hda_dsp_probe,
|
|
|
|
.remove = hda_dsp_remove,
|
|
|
|
|
|
|
|
/* Register IO */
|
|
|
|
.write = sof_io_write,
|
|
|
|
.read = sof_io_read,
|
|
|
|
.write64 = sof_io_write64,
|
|
|
|
.read64 = sof_io_read64,
|
|
|
|
|
|
|
|
/* Block IO */
|
|
|
|
.block_read = sof_block_read,
|
|
|
|
.block_write = sof_block_write,
|
|
|
|
|
|
|
|
/* doorbell */
|
|
|
|
.irq_thread = hda_dsp_ipc_irq_thread,
|
|
|
|
|
|
|
|
/* ipc */
|
|
|
|
.send_msg = hda_dsp_ipc_send_msg,
|
2019-08-07 22:02:03 +07:00
|
|
|
.fw_ready = sof_fw_ready,
|
|
|
|
.get_mailbox_offset = hda_dsp_ipc_get_mailbox_offset,
|
|
|
|
.get_window_offset = hda_dsp_ipc_get_window_offset,
|
2019-04-12 23:08:58 +07:00
|
|
|
|
|
|
|
.ipc_msg_data = hda_ipc_msg_data,
|
|
|
|
.ipc_pcm_params = hda_ipc_pcm_params,
|
|
|
|
|
2019-12-05 04:15:53 +07:00
|
|
|
/* machine driver */
|
|
|
|
.machine_select = hda_machine_select,
|
|
|
|
.machine_register = sof_machine_register,
|
|
|
|
.machine_unregister = sof_machine_unregister,
|
|
|
|
.set_mach_params = hda_set_mach_params,
|
|
|
|
|
2019-04-12 23:08:58 +07:00
|
|
|
/* debug */
|
|
|
|
.debug_map = apl_dsp_debugfs,
|
|
|
|
.debug_map_count = ARRAY_SIZE(apl_dsp_debugfs),
|
|
|
|
.dbg_dump = hda_dsp_dump,
|
2019-05-01 06:09:33 +07:00
|
|
|
.ipc_dump = hda_ipc_dump,
|
2019-04-12 23:08:58 +07:00
|
|
|
|
|
|
|
/* stream callbacks */
|
|
|
|
.pcm_open = hda_dsp_pcm_open,
|
|
|
|
.pcm_close = hda_dsp_pcm_close,
|
|
|
|
.pcm_hw_params = hda_dsp_pcm_hw_params,
|
2019-06-13 00:23:39 +07:00
|
|
|
.pcm_hw_free = hda_dsp_stream_hw_free,
|
2019-04-12 23:08:58 +07:00
|
|
|
.pcm_trigger = hda_dsp_pcm_trigger,
|
|
|
|
.pcm_pointer = hda_dsp_pcm_pointer,
|
|
|
|
|
2020-02-18 21:39:22 +07:00
|
|
|
#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_PROBES)
|
|
|
|
/* probe callbacks */
|
|
|
|
.probe_assign = hda_probe_compr_assign,
|
|
|
|
.probe_free = hda_probe_compr_free,
|
|
|
|
.probe_set_params = hda_probe_compr_set_params,
|
|
|
|
.probe_trigger = hda_probe_compr_trigger,
|
|
|
|
.probe_pointer = hda_probe_compr_pointer,
|
|
|
|
#endif
|
|
|
|
|
2019-04-12 23:08:58 +07:00
|
|
|
/* firmware loading */
|
|
|
|
.load_firmware = snd_sof_load_firmware_raw,
|
|
|
|
|
|
|
|
/* firmware run */
|
|
|
|
.run = hda_dsp_cl_boot_firmware,
|
|
|
|
|
|
|
|
/* pre/post fw run */
|
|
|
|
.pre_fw_run = hda_dsp_pre_fw_run,
|
|
|
|
.post_fw_run = hda_dsp_post_fw_run,
|
|
|
|
|
|
|
|
/* dsp core power up/down */
|
|
|
|
.core_power_up = hda_dsp_enable_core,
|
|
|
|
.core_power_down = hda_dsp_core_reset_power_down,
|
|
|
|
|
|
|
|
/* trace callback */
|
|
|
|
.trace_init = hda_dsp_trace_init,
|
|
|
|
.trace_release = hda_dsp_trace_release,
|
|
|
|
.trace_trigger = hda_dsp_trace_trigger,
|
|
|
|
|
|
|
|
/* DAI drivers */
|
|
|
|
.drv = skl_dai,
|
|
|
|
.num_drv = SOF_SKL_NUM_DAIS,
|
|
|
|
|
|
|
|
/* PM */
|
|
|
|
.suspend = hda_dsp_suspend,
|
|
|
|
.resume = hda_dsp_resume,
|
|
|
|
.runtime_suspend = hda_dsp_runtime_suspend,
|
|
|
|
.runtime_resume = hda_dsp_runtime_resume,
|
2019-07-02 20:24:28 +07:00
|
|
|
.runtime_idle = hda_dsp_runtime_idle,
|
2019-05-01 06:09:31 +07:00
|
|
|
.set_hw_params_upon_resume = hda_dsp_set_hw_params_upon_resume,
|
2019-10-26 05:41:02 +07:00
|
|
|
.set_power_state = hda_dsp_set_power_state,
|
2019-10-25 04:03:17 +07:00
|
|
|
|
|
|
|
/* ALSA HW info flags */
|
|
|
|
.hw_info = SNDRV_PCM_INFO_MMAP |
|
|
|
|
SNDRV_PCM_INFO_MMAP_VALID |
|
|
|
|
SNDRV_PCM_INFO_INTERLEAVED |
|
|
|
|
SNDRV_PCM_INFO_PAUSE |
|
|
|
|
SNDRV_PCM_INFO_NO_PERIOD_WAKEUP,
|
2019-12-18 03:22:30 +07:00
|
|
|
|
|
|
|
.arch_ops = &sof_xtensa_arch_ops,
|
2019-04-12 23:08:58 +07:00
|
|
|
};
|
2019-12-18 03:22:28 +07:00
|
|
|
EXPORT_SYMBOL_NS(sof_apl_ops, SND_SOC_SOF_INTEL_HDA_COMMON);
|
2019-04-12 23:08:58 +07:00
|
|
|
|
|
|
|
const struct sof_intel_dsp_desc apl_chip_info = {
|
|
|
|
/* Apollolake */
|
|
|
|
.cores_num = 2,
|
|
|
|
.init_core_mask = 1,
|
|
|
|
.cores_mask = HDA_DSP_CORE_MASK(0) | HDA_DSP_CORE_MASK(1),
|
|
|
|
.ipc_req = HDA_DSP_REG_HIPCI,
|
|
|
|
.ipc_req_mask = HDA_DSP_REG_HIPCI_BUSY,
|
|
|
|
.ipc_ack = HDA_DSP_REG_HIPCIE,
|
|
|
|
.ipc_ack_mask = HDA_DSP_REG_HIPCIE_DONE,
|
|
|
|
.ipc_ctl = HDA_DSP_REG_HIPCCTL,
|
|
|
|
.rom_init_timeout = 150,
|
2019-05-01 06:09:21 +07:00
|
|
|
.ssp_count = APL_SSP_COUNT,
|
|
|
|
.ssp_base_offset = APL_SSP_BASE_OFFSET,
|
2019-04-12 23:08:58 +07:00
|
|
|
};
|
2019-12-18 03:22:28 +07:00
|
|
|
EXPORT_SYMBOL_NS(apl_chip_info, SND_SOC_SOF_INTEL_HDA_COMMON);
|