xref: /linux/sound/soc/sof/intel/hda-common-ops.c (revision 37e809d5f8a7bfbf0abbd4666d0b8ad499f12b7f)
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 	.fw_ready	= sof_fw_ready,
38 	.get_mailbox_offset = hda_dsp_ipc_get_mailbox_offset,
39 	.get_window_offset = hda_dsp_ipc_get_window_offset,
40 
41 	.ipc_msg_data	= hda_ipc_msg_data,
42 	.set_stream_data_offset = hda_set_stream_data_offset,
43 
44 	/* machine driver */
45 	.machine_select = hda_machine_select,
46 	.machine_register = sof_machine_register,
47 	.machine_unregister = sof_machine_unregister,
48 	.set_mach_params = hda_set_mach_params,
49 
50 	/* debug */
51 	.dbg_dump	= hda_dsp_dump,
52 	.debugfs_add_region_item = snd_sof_debugfs_add_region_item_iomem,
53 
54 	/* stream callbacks */
55 	.pcm_open	= hda_dsp_pcm_open,
56 	.pcm_close	= hda_dsp_pcm_close,
57 	.pcm_hw_params	= hda_dsp_pcm_hw_params,
58 	.pcm_hw_free	= hda_dsp_stream_hw_free,
59 	.pcm_trigger	= hda_dsp_pcm_trigger,
60 	.pcm_pointer	= hda_dsp_pcm_pointer,
61 	.pcm_ack	= hda_dsp_pcm_ack,
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 
90 	/* PM */
91 	.suspend		= hda_dsp_suspend,
92 	.resume			= hda_dsp_resume,
93 	.runtime_suspend	= hda_dsp_runtime_suspend,
94 	.runtime_resume		= hda_dsp_runtime_resume,
95 	.runtime_idle		= hda_dsp_runtime_idle,
96 	.set_hw_params_upon_resume = hda_dsp_set_hw_params_upon_resume,
97 	.set_power_state	= hda_dsp_set_power_state,
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