summaryrefslogtreecommitdiff
path: root/sound/soc/sof/intel/tgl.c
diff options
context:
space:
mode:
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>2022-04-14 21:48:11 +0300
committerMark Brown <broonie@kernel.org>2022-04-19 14:03:40 +0300
commit37e809d5f8a7bfbf0abbd4666d0b8ad499f12b7f (patch)
tree9b769001929dfc594b3f0c969589586cf6b5d782 /sound/soc/sof/intel/tgl.c
parent856601e5a7ebe69b1c07adef7be80f9a03884329 (diff)
downloadlinux-37e809d5f8a7bfbf0abbd4666d0b8ad499f12b7f.tar.xz
ASoC: SOF: Intel: hda: use common ops across platforms
The dsp_ops are mostly common between platforms. Introduce a common structure and an init function to set platform-specific values. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20220414184817.362215-10-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/intel/tgl.c')
-rw-r--r--sound/soc/sof/intel/tgl.c108
1 files changed, 20 insertions, 88 deletions
diff --git a/sound/soc/sof/intel/tgl.c b/sound/soc/sof/intel/tgl.c
index 2bb32bbce426..18e01db882f3 100644
--- a/sound/soc/sof/intel/tgl.c
+++ b/sound/soc/sof/intel/tgl.c
@@ -59,109 +59,41 @@ static int tgl_dsp_core_put(struct snd_sof_dev *sdev, int core)
}
/* Tigerlake ops */
-struct snd_sof_dsp_ops sof_tgl_ops = {
- /* probe/remove/shutdown */
- .probe = hda_dsp_probe,
- .remove = hda_dsp_remove,
- .shutdown = hda_dsp_shutdown,
-
- /* Register IO */
- .write = sof_io_write,
- .read = sof_io_read,
- .write64 = sof_io_write64,
- .read64 = sof_io_read64,
+struct snd_sof_dsp_ops sof_tgl_ops;
+EXPORT_SYMBOL_NS(sof_tgl_ops, SND_SOC_SOF_INTEL_HDA_COMMON);
- /* Block IO */
- .block_read = sof_block_read,
- .block_write = sof_block_write,
+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));
- /* Mailbox IO */
- .mailbox_read = sof_mailbox_read,
- .mailbox_write = sof_mailbox_write,
+ /* probe/remove/shutdown */
+ sof_tgl_ops.shutdown = hda_dsp_shutdown;
/* doorbell */
- .irq_thread = cnl_ipc_irq_thread,
+ sof_tgl_ops.irq_thread = cnl_ipc_irq_thread;
/* ipc */
- .send_msg = cnl_ipc_send_msg,
- .fw_ready = sof_fw_ready,
- .get_mailbox_offset = hda_dsp_ipc_get_mailbox_offset,
- .get_window_offset = hda_dsp_ipc_get_window_offset,
-
- .ipc_msg_data = hda_ipc_msg_data,
- .set_stream_data_offset = hda_set_stream_data_offset,
-
- /* machine driver */
- .machine_select = hda_machine_select,
- .machine_register = sof_machine_register,
- .machine_unregister = sof_machine_unregister,
- .set_mach_params = hda_set_mach_params,
+ sof_tgl_ops.send_msg = cnl_ipc_send_msg;
/* debug */
- .debug_map = tgl_dsp_debugfs,
- .debug_map_count = ARRAY_SIZE(tgl_dsp_debugfs),
- .dbg_dump = hda_dsp_dump,
- .ipc_dump = cnl_ipc_dump,
- .debugfs_add_region_item = snd_sof_debugfs_add_region_item_iomem,
-
- /* stream callbacks */
- .pcm_open = hda_dsp_pcm_open,
- .pcm_close = hda_dsp_pcm_close,
- .pcm_hw_params = hda_dsp_pcm_hw_params,
- .pcm_hw_free = hda_dsp_stream_hw_free,
- .pcm_trigger = hda_dsp_pcm_trigger,
- .pcm_pointer = hda_dsp_pcm_pointer,
- .pcm_ack = hda_dsp_pcm_ack,
-
- /* firmware loading */
- .load_firmware = snd_sof_load_firmware_raw,
+ sof_tgl_ops.debug_map = tgl_dsp_debugfs;
+ sof_tgl_ops.debug_map_count = ARRAY_SIZE(tgl_dsp_debugfs);
+ sof_tgl_ops.ipc_dump = cnl_ipc_dump;
/* pre/post fw run */
- .pre_fw_run = hda_dsp_pre_fw_run,
- .post_fw_run = hda_dsp_post_fw_run,
+ sof_tgl_ops.post_fw_run = hda_dsp_post_fw_run;
- /* parse platform specific extended manifest */
- .parse_platform_ext_manifest = hda_dsp_ext_man_get_cavs_config_data,
+ /* firmware run */
+ sof_tgl_ops.run = hda_dsp_cl_boot_firmware_iccmax;
/* dsp core get/put */
- .core_get = tgl_dsp_core_get,
- .core_put = tgl_dsp_core_put,
+ sof_tgl_ops.core_get = tgl_dsp_core_get;
+ sof_tgl_ops.core_put = tgl_dsp_core_put;
- /* firmware run */
- .run = hda_dsp_cl_boot_firmware_iccmax,
-
- /* trace callback */
- .trace_init = hda_dsp_trace_init,
- .trace_release = hda_dsp_trace_release,
- .trace_trigger = hda_dsp_trace_trigger,
-
- /* client ops */
- .register_ipc_clients = hda_register_clients,
- .unregister_ipc_clients = hda_unregister_clients,
-
- /* 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,
- .runtime_idle = hda_dsp_runtime_idle,
- .set_hw_params_upon_resume = hda_dsp_set_hw_params_upon_resume,
- .set_power_state = hda_dsp_set_power_state,
-
- /* 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,
-
- .dsp_arch_ops = &sof_xtensa_arch_ops,
+ return 0;
};
-EXPORT_SYMBOL_NS(sof_tgl_ops, SND_SOC_SOF_INTEL_HDA_COMMON);
+EXPORT_SYMBOL_NS(sof_tgl_ops_init, SND_SOC_SOF_INTEL_HDA_COMMON);
const struct sof_intel_dsp_desc tgl_chip_info = {
/* Tigerlake , Alderlake */