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