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. All rights reserved.
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 struct snd_sof_dsp_ops sof_hda_common_ops = {
18 	/* probe/remove/shutdown */
19 	.probe		= hda_dsp_probe,
20 	.remove		= hda_dsp_remove,
21 
22 	/* Register IO uses direct mmio */
23 
24 	/* Block IO */
25 	.block_read	= sof_block_read,
26 	.block_write	= sof_block_write,
27 
28 	/* Mailbox IO */
29 	.mailbox_read	= sof_mailbox_read,
30 	.mailbox_write	= sof_mailbox_write,
31 
32 	/* ipc */
33 	.get_mailbox_offset = hda_dsp_ipc_get_mailbox_offset,
34 	.get_window_offset = hda_dsp_ipc_get_window_offset,
35 
36 	.ipc_msg_data	= hda_ipc_msg_data,
37 	.set_stream_data_offset = hda_set_stream_data_offset,
38 
39 	/* machine driver */
40 	.machine_select = hda_machine_select,
41 	.machine_register = sof_machine_register,
42 	.machine_unregister = sof_machine_unregister,
43 	.set_mach_params = hda_set_mach_params,
44 
45 	/* debug */
46 	.dbg_dump	= hda_dsp_dump,
47 	.debugfs_add_region_item = snd_sof_debugfs_add_region_item_iomem,
48 
49 	/* stream callbacks */
50 	.pcm_open	= hda_dsp_pcm_open,
51 	.pcm_close	= hda_dsp_pcm_close,
52 	.pcm_hw_params	= hda_dsp_pcm_hw_params,
53 	.pcm_hw_free	= hda_dsp_stream_hw_free,
54 	.pcm_trigger	= hda_dsp_pcm_trigger,
55 	.pcm_pointer	= hda_dsp_pcm_pointer,
56 	.pcm_ack	= hda_dsp_pcm_ack,
57 
58 	/* firmware loading */
59 	.load_firmware = snd_sof_load_firmware_raw,
60 
61 	/* pre/post fw run */
62 	.pre_fw_run = hda_dsp_pre_fw_run,
63 
64 	/* firmware run */
65 	.run = hda_dsp_cl_boot_firmware,
66 
67 	/* parse platform specific extended manifest */
68 	.parse_platform_ext_manifest = hda_dsp_ext_man_get_cavs_config_data,
69 
70 	/* dsp core get/put */
71 
72 	/* trace callback */
73 	.trace_init = hda_dsp_trace_init,
74 	.trace_release = hda_dsp_trace_release,
75 	.trace_trigger = hda_dsp_trace_trigger,
76 
77 	/* client ops */
78 	.register_ipc_clients = hda_register_clients,
79 	.unregister_ipc_clients = hda_unregister_clients,
80 
81 	/* DAI drivers */
82 	.drv		= skl_dai,
83 	.num_drv	= SOF_SKL_NUM_DAIS,
84 
85 	/* PM */
86 	.suspend		= hda_dsp_suspend,
87 	.resume			= hda_dsp_resume,
88 	.runtime_suspend	= hda_dsp_runtime_suspend,
89 	.runtime_resume		= hda_dsp_runtime_resume,
90 	.runtime_idle		= hda_dsp_runtime_idle,
91 	.set_hw_params_upon_resume = hda_dsp_set_hw_params_upon_resume,
92 	.set_power_state	= hda_dsp_set_power_state,
93 
94 	/* ALSA HW info flags */
95 	.hw_info =	SNDRV_PCM_INFO_MMAP |
96 			SNDRV_PCM_INFO_MMAP_VALID |
97 			SNDRV_PCM_INFO_INTERLEAVED |
98 			SNDRV_PCM_INFO_PAUSE |
99 			SNDRV_PCM_INFO_NO_PERIOD_WAKEUP,
100 
101 	.dsp_arch_ops = &sof_xtensa_arch_ops,
102 };
103