xref: /linux/sound/soc/sof/intel/hda-common-ops.c (revision 3daee2e4b3568f0ed88b0598df96547fcf21cb9b)
1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
2 //
3 // This file is provided under a dual BSD/GPLv2 license.  When using or
4 // redistributing this file, you may do so under either license.
5 //
6 // Copyright(c) 2022 Intel Corporation
7 //
8 
9 /*
10  * common ops for SKL+ HDAudio platforms
11  */
12 
13 #include "../sof-priv.h"
14 #include "hda.h"
15 #include "../sof-audio.h"
16 
17 const struct snd_sof_dsp_ops sof_hda_common_ops = {
18 	/* probe/remove/shutdown */
19 	.probe_early	= hda_dsp_probe_early,
20 	.probe		= hda_dsp_probe,
21 	.remove		= hda_dsp_remove,
22 	.remove_late	= hda_dsp_remove_late,
23 
24 	/* Register IO uses direct mmio */
25 
26 	/* Block IO */
27 	.block_read	= sof_block_read,
28 	.block_write	= sof_block_write,
29 
30 	/* Mailbox IO */
31 	.mailbox_read	= sof_mailbox_read,
32 	.mailbox_write	= sof_mailbox_write,
33 
34 	/* ipc */
35 	.get_mailbox_offset = hda_dsp_ipc_get_mailbox_offset,
36 	.get_window_offset = hda_dsp_ipc_get_window_offset,
37 
38 	.ipc_msg_data	= hda_ipc_msg_data,
39 	.set_stream_data_offset = hda_set_stream_data_offset,
40 
41 	/* machine driver */
42 	.machine_select = hda_machine_select,
43 	.machine_register = sof_machine_register,
44 	.machine_unregister = sof_machine_unregister,
45 	.set_mach_params = hda_set_mach_params,
46 
47 	/* debug */
48 	.dbg_dump	= hda_dsp_dump,
49 	.debugfs_add_region_item = snd_sof_debugfs_add_region_item_iomem,
50 
51 	/* stream callbacks */
52 	.pcm_open	= hda_dsp_pcm_open,
53 	.pcm_close	= hda_dsp_pcm_close,
54 	.pcm_hw_params	= hda_dsp_pcm_hw_params,
55 	.pcm_hw_free	= hda_dsp_stream_hw_free,
56 	.pcm_trigger	= hda_dsp_pcm_trigger,
57 	.pcm_pointer	= hda_dsp_pcm_pointer,
58 	.pcm_ack	= hda_dsp_pcm_ack,
59 
60 	.get_dai_frame_counter = hda_dsp_get_stream_llp,
61 	.get_host_byte_counter = hda_dsp_get_stream_ldp,
62 
63 	/* firmware loading */
64 	.load_firmware = snd_sof_load_firmware_raw,
65 
66 	/* pre/post fw run */
67 	.pre_fw_run = hda_dsp_pre_fw_run,
68 
69 	/* firmware run */
70 	.run = hda_dsp_cl_boot_firmware,
71 
72 	/* parse platform specific extended manifest */
73 	.parse_platform_ext_manifest = hda_dsp_ext_man_get_cavs_config_data,
74 
75 	/* dsp core get/put */
76 
77 	/* trace callback */
78 	.trace_init = hda_dsp_trace_init,
79 	.trace_release = hda_dsp_trace_release,
80 	.trace_trigger = hda_dsp_trace_trigger,
81 
82 	/* client ops */
83 	.register_ipc_clients = hda_register_clients,
84 	.unregister_ipc_clients = hda_unregister_clients,
85 
86 	/* DAI drivers */
87 	.drv		= skl_dai,
88 	.num_drv	= SOF_SKL_NUM_DAIS,
89 	.is_chain_dma_supported	= hda_is_chain_dma_supported,
90 
91 	/* PM */
92 	.suspend		= hda_dsp_suspend,
93 	.resume			= hda_dsp_resume,
94 	.runtime_suspend	= hda_dsp_runtime_suspend,
95 	.runtime_resume		= hda_dsp_runtime_resume,
96 	.runtime_idle		= hda_dsp_runtime_idle,
97 	.set_hw_params_upon_resume = hda_dsp_set_hw_params_upon_resume,
98 
99 	/* ALSA HW info flags */
100 	.hw_info =	SNDRV_PCM_INFO_MMAP |
101 			SNDRV_PCM_INFO_MMAP_VALID |
102 			SNDRV_PCM_INFO_INTERLEAVED |
103 			SNDRV_PCM_INFO_PAUSE |
104 			SNDRV_PCM_INFO_NO_PERIOD_WAKEUP,
105 
106 	.dsp_arch_ops = &sof_xtensa_arch_ops,
107 };
108 EXPORT_SYMBOL_NS(sof_hda_common_ops, SND_SOC_SOF_INTEL_HDA_GENERIC);
109