1e149ca29SPierre-Louis Bossart /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
2d1d95fcbSLiam Girdwood /*
3d1d95fcbSLiam Girdwood * This file is provided under a dual BSD/GPLv2 license. When using or
4d1d95fcbSLiam Girdwood * redistributing this file, you may do so under either license.
5d1d95fcbSLiam Girdwood *
6d1d95fcbSLiam Girdwood * Copyright(c) 2018 Intel Corporation. All rights reserved.
7d1d95fcbSLiam Girdwood *
8d1d95fcbSLiam Girdwood * Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
9d1d95fcbSLiam Girdwood */
10d1d95fcbSLiam Girdwood
11d1d95fcbSLiam Girdwood #ifndef __SOUND_SOC_SOF_IO_H
12d1d95fcbSLiam Girdwood #define __SOUND_SOC_SOF_IO_H
13d1d95fcbSLiam Girdwood
14d1d95fcbSLiam Girdwood #include <linux/device.h>
15d1d95fcbSLiam Girdwood #include <linux/interrupt.h>
16d1d95fcbSLiam Girdwood #include <linux/kernel.h>
17d1d95fcbSLiam Girdwood #include <linux/types.h>
18d1d95fcbSLiam Girdwood #include <sound/pcm.h>
19d1d95fcbSLiam Girdwood #include "sof-priv.h"
20d1d95fcbSLiam Girdwood
21d1d95fcbSLiam Girdwood #define sof_ops(sdev) \
22d1d95fcbSLiam Girdwood ((sdev)->pdata->desc->ops)
23d1d95fcbSLiam Girdwood
sof_ops_init(struct snd_sof_dev * sdev)2437e809d5SPierre-Louis Bossart static inline int sof_ops_init(struct snd_sof_dev *sdev)
25856601e5SPierre-Louis Bossart {
26856601e5SPierre-Louis Bossart if (sdev->pdata->desc->ops_init)
2737e809d5SPierre-Louis Bossart return sdev->pdata->desc->ops_init(sdev);
2837e809d5SPierre-Louis Bossart
2937e809d5SPierre-Louis Bossart return 0;
30856601e5SPierre-Louis Bossart }
31856601e5SPierre-Louis Bossart
sof_ops_free(struct snd_sof_dev * sdev)32bc433fd7SRanjani Sridharan static inline void sof_ops_free(struct snd_sof_dev *sdev)
33bc433fd7SRanjani Sridharan {
34bc433fd7SRanjani Sridharan if (sdev->pdata->desc->ops_free)
35bc433fd7SRanjani Sridharan sdev->pdata->desc->ops_free(sdev);
36bc433fd7SRanjani Sridharan }
37bc433fd7SRanjani Sridharan
38d1d95fcbSLiam Girdwood /* Mandatory operations are verified during probing */
39d1d95fcbSLiam Girdwood
40d1d95fcbSLiam Girdwood /* init */
snd_sof_probe(struct snd_sof_dev * sdev)41d1d95fcbSLiam Girdwood static inline int snd_sof_probe(struct snd_sof_dev *sdev)
42d1d95fcbSLiam Girdwood {
43d1d95fcbSLiam Girdwood return sof_ops(sdev)->probe(sdev);
44d1d95fcbSLiam Girdwood }
45d1d95fcbSLiam Girdwood
snd_sof_remove(struct snd_sof_dev * sdev)46d1d95fcbSLiam Girdwood static inline int snd_sof_remove(struct snd_sof_dev *sdev)
47d1d95fcbSLiam Girdwood {
48d1d95fcbSLiam Girdwood if (sof_ops(sdev)->remove)
49d1d95fcbSLiam Girdwood return sof_ops(sdev)->remove(sdev);
50d1d95fcbSLiam Girdwood
51d1d95fcbSLiam Girdwood return 0;
52d1d95fcbSLiam Girdwood }
53d1d95fcbSLiam Girdwood
snd_sof_shutdown(struct snd_sof_dev * sdev)547edb3051SKeyon Jie static inline int snd_sof_shutdown(struct snd_sof_dev *sdev)
557edb3051SKeyon Jie {
567edb3051SKeyon Jie if (sof_ops(sdev)->shutdown)
577edb3051SKeyon Jie return sof_ops(sdev)->shutdown(sdev);
587edb3051SKeyon Jie
597edb3051SKeyon Jie return 0;
607edb3051SKeyon Jie }
617edb3051SKeyon Jie
62d1d95fcbSLiam Girdwood /* control */
63d1d95fcbSLiam Girdwood
64d1d95fcbSLiam Girdwood /*
65d1d95fcbSLiam Girdwood * snd_sof_dsp_run returns the core mask of the cores that are available
66d1d95fcbSLiam Girdwood * after successful fw boot
67d1d95fcbSLiam Girdwood */
snd_sof_dsp_run(struct snd_sof_dev * sdev)68d1d95fcbSLiam Girdwood static inline int snd_sof_dsp_run(struct snd_sof_dev *sdev)
69d1d95fcbSLiam Girdwood {
70d1d95fcbSLiam Girdwood return sof_ops(sdev)->run(sdev);
71d1d95fcbSLiam Girdwood }
72d1d95fcbSLiam Girdwood
snd_sof_dsp_stall(struct snd_sof_dev * sdev,unsigned int core_mask)73a70eb708SFred Oh static inline int snd_sof_dsp_stall(struct snd_sof_dev *sdev, unsigned int core_mask)
74d1d95fcbSLiam Girdwood {
75d1d95fcbSLiam Girdwood if (sof_ops(sdev)->stall)
76a70eb708SFred Oh return sof_ops(sdev)->stall(sdev, core_mask);
77d1d95fcbSLiam Girdwood
78d1d95fcbSLiam Girdwood return 0;
79d1d95fcbSLiam Girdwood }
80d1d95fcbSLiam Girdwood
snd_sof_dsp_reset(struct snd_sof_dev * sdev)81d1d95fcbSLiam Girdwood static inline int snd_sof_dsp_reset(struct snd_sof_dev *sdev)
82d1d95fcbSLiam Girdwood {
83d1d95fcbSLiam Girdwood if (sof_ops(sdev)->reset)
84d1d95fcbSLiam Girdwood return sof_ops(sdev)->reset(sdev);
85d1d95fcbSLiam Girdwood
86d1d95fcbSLiam Girdwood return 0;
87d1d95fcbSLiam Girdwood }
88d1d95fcbSLiam Girdwood
899ea80748SRanjani Sridharan /* dsp core get/put */
snd_sof_dsp_core_get(struct snd_sof_dev * sdev,int core)90c414d5dfSRanjani Sridharan static inline int snd_sof_dsp_core_get(struct snd_sof_dev *sdev, int core)
91c414d5dfSRanjani Sridharan {
92c414d5dfSRanjani Sridharan if (core > sdev->num_cores - 1) {
93c414d5dfSRanjani Sridharan dev_err(sdev->dev, "invalid core id: %d for num_cores: %d\n", core,
94c414d5dfSRanjani Sridharan sdev->num_cores);
95c414d5dfSRanjani Sridharan return -EINVAL;
96c414d5dfSRanjani Sridharan }
97c414d5dfSRanjani Sridharan
98c414d5dfSRanjani Sridharan if (sof_ops(sdev)->core_get) {
99c414d5dfSRanjani Sridharan int ret;
100c414d5dfSRanjani Sridharan
101c414d5dfSRanjani Sridharan /* if current ref_count is > 0, increment it and return */
102c414d5dfSRanjani Sridharan if (sdev->dsp_core_ref_count[core] > 0) {
103c414d5dfSRanjani Sridharan sdev->dsp_core_ref_count[core]++;
104c414d5dfSRanjani Sridharan return 0;
105c414d5dfSRanjani Sridharan }
106c414d5dfSRanjani Sridharan
107c414d5dfSRanjani Sridharan /* power up the core */
108c414d5dfSRanjani Sridharan ret = sof_ops(sdev)->core_get(sdev, core);
109c414d5dfSRanjani Sridharan if (ret < 0)
110c414d5dfSRanjani Sridharan return ret;
111c414d5dfSRanjani Sridharan
112c414d5dfSRanjani Sridharan /* increment ref_count */
113c414d5dfSRanjani Sridharan sdev->dsp_core_ref_count[core]++;
114c414d5dfSRanjani Sridharan
115c414d5dfSRanjani Sridharan /* and update enabled_cores_mask */
116c414d5dfSRanjani Sridharan sdev->enabled_cores_mask |= BIT(core);
117c414d5dfSRanjani Sridharan
118c414d5dfSRanjani Sridharan dev_dbg(sdev->dev, "Core %d powered up\n", core);
119c414d5dfSRanjani Sridharan }
120c414d5dfSRanjani Sridharan
121c414d5dfSRanjani Sridharan return 0;
122c414d5dfSRanjani Sridharan }
123c414d5dfSRanjani Sridharan
snd_sof_dsp_core_put(struct snd_sof_dev * sdev,int core)124c414d5dfSRanjani Sridharan static inline int snd_sof_dsp_core_put(struct snd_sof_dev *sdev, int core)
125c414d5dfSRanjani Sridharan {
126c414d5dfSRanjani Sridharan if (core > sdev->num_cores - 1) {
127c414d5dfSRanjani Sridharan dev_err(sdev->dev, "invalid core id: %d for num_cores: %d\n", core,
128c414d5dfSRanjani Sridharan sdev->num_cores);
129c414d5dfSRanjani Sridharan return -EINVAL;
130c414d5dfSRanjani Sridharan }
131c414d5dfSRanjani Sridharan
132c414d5dfSRanjani Sridharan if (sof_ops(sdev)->core_put) {
133c414d5dfSRanjani Sridharan int ret;
134c414d5dfSRanjani Sridharan
135c414d5dfSRanjani Sridharan /* decrement ref_count and return if it is > 0 */
136c414d5dfSRanjani Sridharan if (--(sdev->dsp_core_ref_count[core]) > 0)
137c414d5dfSRanjani Sridharan return 0;
138c414d5dfSRanjani Sridharan
139c414d5dfSRanjani Sridharan /* power down the core */
140c414d5dfSRanjani Sridharan ret = sof_ops(sdev)->core_put(sdev, core);
141c414d5dfSRanjani Sridharan if (ret < 0)
142c414d5dfSRanjani Sridharan return ret;
143c414d5dfSRanjani Sridharan
144c414d5dfSRanjani Sridharan /* and update enabled_cores_mask */
145c414d5dfSRanjani Sridharan sdev->enabled_cores_mask &= ~BIT(core);
146c414d5dfSRanjani Sridharan
147c414d5dfSRanjani Sridharan dev_dbg(sdev->dev, "Core %d powered down\n", core);
148c414d5dfSRanjani Sridharan }
149c414d5dfSRanjani Sridharan
150c414d5dfSRanjani Sridharan return 0;
151c414d5dfSRanjani Sridharan }
152c414d5dfSRanjani Sridharan
153d1d95fcbSLiam Girdwood /* pre/post fw load */
snd_sof_dsp_pre_fw_run(struct snd_sof_dev * sdev)154d1d95fcbSLiam Girdwood static inline int snd_sof_dsp_pre_fw_run(struct snd_sof_dev *sdev)
155d1d95fcbSLiam Girdwood {
156d1d95fcbSLiam Girdwood if (sof_ops(sdev)->pre_fw_run)
157d1d95fcbSLiam Girdwood return sof_ops(sdev)->pre_fw_run(sdev);
158d1d95fcbSLiam Girdwood
159d1d95fcbSLiam Girdwood return 0;
160d1d95fcbSLiam Girdwood }
161d1d95fcbSLiam Girdwood
snd_sof_dsp_post_fw_run(struct snd_sof_dev * sdev)162d1d95fcbSLiam Girdwood static inline int snd_sof_dsp_post_fw_run(struct snd_sof_dev *sdev)
163d1d95fcbSLiam Girdwood {
164d1d95fcbSLiam Girdwood if (sof_ops(sdev)->post_fw_run)
165d1d95fcbSLiam Girdwood return sof_ops(sdev)->post_fw_run(sdev);
166d1d95fcbSLiam Girdwood
167d1d95fcbSLiam Girdwood return 0;
168d1d95fcbSLiam Girdwood }
169d1d95fcbSLiam Girdwood
170e984f3efSFred Oh /* parse platform specific extended manifest */
snd_sof_dsp_parse_platform_ext_manifest(struct snd_sof_dev * sdev,const struct sof_ext_man_elem_header * hdr)171e984f3efSFred Oh static inline int snd_sof_dsp_parse_platform_ext_manifest(struct snd_sof_dev *sdev,
172e984f3efSFred Oh const struct sof_ext_man_elem_header *hdr)
173e984f3efSFred Oh {
174e984f3efSFred Oh if (sof_ops(sdev)->parse_platform_ext_manifest)
175e984f3efSFred Oh return sof_ops(sdev)->parse_platform_ext_manifest(sdev, hdr);
176e984f3efSFred Oh
177e984f3efSFred Oh return 0;
178e984f3efSFred Oh }
179e984f3efSFred Oh
180ce8234a6SDaniel Baluta /* misc */
181ce8234a6SDaniel Baluta
182ce8234a6SDaniel Baluta /**
183ce8234a6SDaniel Baluta * snd_sof_dsp_get_bar_index - Maps a section type with a BAR index
184ce8234a6SDaniel Baluta *
185ce8234a6SDaniel Baluta * @sdev: sof device
186ce8234a6SDaniel Baluta * @type: section type as described by snd_sof_fw_blk_type
187ce8234a6SDaniel Baluta *
188ce8234a6SDaniel Baluta * Returns the corresponding BAR index (a positive integer) or -EINVAL
189ce8234a6SDaniel Baluta * in case there is no mapping
190ce8234a6SDaniel Baluta */
snd_sof_dsp_get_bar_index(struct snd_sof_dev * sdev,u32 type)191ce8234a6SDaniel Baluta static inline int snd_sof_dsp_get_bar_index(struct snd_sof_dev *sdev, u32 type)
192ce8234a6SDaniel Baluta {
193ce8234a6SDaniel Baluta if (sof_ops(sdev)->get_bar_index)
194ce8234a6SDaniel Baluta return sof_ops(sdev)->get_bar_index(sdev, type);
195ce8234a6SDaniel Baluta
196ce8234a6SDaniel Baluta return sdev->mmio_bar;
197ce8234a6SDaniel Baluta }
198ce8234a6SDaniel Baluta
snd_sof_dsp_get_mailbox_offset(struct snd_sof_dev * sdev)199bb9c93f5SDaniel Baluta static inline int snd_sof_dsp_get_mailbox_offset(struct snd_sof_dev *sdev)
200bb9c93f5SDaniel Baluta {
201bb9c93f5SDaniel Baluta if (sof_ops(sdev)->get_mailbox_offset)
202bb9c93f5SDaniel Baluta return sof_ops(sdev)->get_mailbox_offset(sdev);
203bb9c93f5SDaniel Baluta
204bb9c93f5SDaniel Baluta dev_err(sdev->dev, "error: %s not defined\n", __func__);
205bb9c93f5SDaniel Baluta return -ENOTSUPP;
206bb9c93f5SDaniel Baluta }
207bb9c93f5SDaniel Baluta
snd_sof_dsp_get_window_offset(struct snd_sof_dev * sdev,u32 id)208e17422cdSDaniel Baluta static inline int snd_sof_dsp_get_window_offset(struct snd_sof_dev *sdev,
209e17422cdSDaniel Baluta u32 id)
210e17422cdSDaniel Baluta {
211e17422cdSDaniel Baluta if (sof_ops(sdev)->get_window_offset)
212e17422cdSDaniel Baluta return sof_ops(sdev)->get_window_offset(sdev, id);
213e17422cdSDaniel Baluta
214e17422cdSDaniel Baluta dev_err(sdev->dev, "error: %s not defined\n", __func__);
215e17422cdSDaniel Baluta return -ENOTSUPP;
216e17422cdSDaniel Baluta }
217d1d95fcbSLiam Girdwood /* power management */
snd_sof_dsp_resume(struct snd_sof_dev * sdev)218d1d95fcbSLiam Girdwood static inline int snd_sof_dsp_resume(struct snd_sof_dev *sdev)
219d1d95fcbSLiam Girdwood {
220d1d95fcbSLiam Girdwood if (sof_ops(sdev)->resume)
221d1d95fcbSLiam Girdwood return sof_ops(sdev)->resume(sdev);
222d1d95fcbSLiam Girdwood
223d1d95fcbSLiam Girdwood return 0;
224d1d95fcbSLiam Girdwood }
225d1d95fcbSLiam Girdwood
snd_sof_dsp_suspend(struct snd_sof_dev * sdev,u32 target_state)22661e285caSRanjani Sridharan static inline int snd_sof_dsp_suspend(struct snd_sof_dev *sdev,
22761e285caSRanjani Sridharan u32 target_state)
228d1d95fcbSLiam Girdwood {
229d1d95fcbSLiam Girdwood if (sof_ops(sdev)->suspend)
23061e285caSRanjani Sridharan return sof_ops(sdev)->suspend(sdev, target_state);
231d1d95fcbSLiam Girdwood
232d1d95fcbSLiam Girdwood return 0;
233d1d95fcbSLiam Girdwood }
234d1d95fcbSLiam Girdwood
snd_sof_dsp_runtime_resume(struct snd_sof_dev * sdev)235d1d95fcbSLiam Girdwood static inline int snd_sof_dsp_runtime_resume(struct snd_sof_dev *sdev)
236d1d95fcbSLiam Girdwood {
237d1d95fcbSLiam Girdwood if (sof_ops(sdev)->runtime_resume)
238d1d95fcbSLiam Girdwood return sof_ops(sdev)->runtime_resume(sdev);
239d1d95fcbSLiam Girdwood
240d1d95fcbSLiam Girdwood return 0;
241d1d95fcbSLiam Girdwood }
242d1d95fcbSLiam Girdwood
snd_sof_dsp_runtime_suspend(struct snd_sof_dev * sdev)2431c38c922SFred Oh static inline int snd_sof_dsp_runtime_suspend(struct snd_sof_dev *sdev)
244d1d95fcbSLiam Girdwood {
245d1d95fcbSLiam Girdwood if (sof_ops(sdev)->runtime_suspend)
2461c38c922SFred Oh return sof_ops(sdev)->runtime_suspend(sdev);
247d1d95fcbSLiam Girdwood
248d1d95fcbSLiam Girdwood return 0;
249d1d95fcbSLiam Girdwood }
250d1d95fcbSLiam Girdwood
snd_sof_dsp_runtime_idle(struct snd_sof_dev * sdev)25162fde977SKai Vehmanen static inline int snd_sof_dsp_runtime_idle(struct snd_sof_dev *sdev)
25262fde977SKai Vehmanen {
25362fde977SKai Vehmanen if (sof_ops(sdev)->runtime_idle)
25462fde977SKai Vehmanen return sof_ops(sdev)->runtime_idle(sdev);
25562fde977SKai Vehmanen
25662fde977SKai Vehmanen return 0;
25762fde977SKai Vehmanen }
25862fde977SKai Vehmanen
snd_sof_dsp_hw_params_upon_resume(struct snd_sof_dev * sdev)2597077a07aSRanjani Sridharan static inline int snd_sof_dsp_hw_params_upon_resume(struct snd_sof_dev *sdev)
260ed3baacdSRanjani Sridharan {
261ed3baacdSRanjani Sridharan if (sof_ops(sdev)->set_hw_params_upon_resume)
2627077a07aSRanjani Sridharan return sof_ops(sdev)->set_hw_params_upon_resume(sdev);
2637077a07aSRanjani Sridharan return 0;
264ed3baacdSRanjani Sridharan }
265ed3baacdSRanjani Sridharan
snd_sof_dsp_set_clk(struct snd_sof_dev * sdev,u32 freq)266d1d95fcbSLiam Girdwood static inline int snd_sof_dsp_set_clk(struct snd_sof_dev *sdev, u32 freq)
267d1d95fcbSLiam Girdwood {
268d1d95fcbSLiam Girdwood if (sof_ops(sdev)->set_clk)
269d1d95fcbSLiam Girdwood return sof_ops(sdev)->set_clk(sdev, freq);
270d1d95fcbSLiam Girdwood
271d1d95fcbSLiam Girdwood return 0;
272d1d95fcbSLiam Girdwood }
273d1d95fcbSLiam Girdwood
27461e285caSRanjani Sridharan static inline int
snd_sof_dsp_set_power_state(struct snd_sof_dev * sdev,const struct sof_dsp_power_state * target_state)27561e285caSRanjani Sridharan snd_sof_dsp_set_power_state(struct snd_sof_dev *sdev,
27661e285caSRanjani Sridharan const struct sof_dsp_power_state *target_state)
277e8f112d8SKeyon Jie {
2788b66d7c5SKeyon Jie int ret = 0;
279e8f112d8SKeyon Jie
2808b66d7c5SKeyon Jie mutex_lock(&sdev->power_state_access);
2818b66d7c5SKeyon Jie
2828b66d7c5SKeyon Jie if (sof_ops(sdev)->set_power_state)
2838b66d7c5SKeyon Jie ret = sof_ops(sdev)->set_power_state(sdev, target_state);
2848b66d7c5SKeyon Jie
2858b66d7c5SKeyon Jie mutex_unlock(&sdev->power_state_access);
2868b66d7c5SKeyon Jie
2878b66d7c5SKeyon Jie return ret;
288e8f112d8SKeyon Jie }
289e8f112d8SKeyon Jie
290d1d95fcbSLiam Girdwood /* debug */
2912f148430SPeter Ujfalusi void snd_sof_dsp_dbg_dump(struct snd_sof_dev *sdev, const char *msg, u32 flags);
2925e4a27fdSPan Xiuli
snd_sof_debugfs_add_region_item(struct snd_sof_dev * sdev,enum snd_sof_fw_blk_type blk_type,u32 offset,size_t size,const char * name,enum sof_debugfs_access_type access_type)29307e833b4SPeter Ujfalusi static inline int snd_sof_debugfs_add_region_item(struct snd_sof_dev *sdev,
29407e833b4SPeter Ujfalusi enum snd_sof_fw_blk_type blk_type, u32 offset, size_t size,
29507e833b4SPeter Ujfalusi const char *name, enum sof_debugfs_access_type access_type)
29607e833b4SPeter Ujfalusi {
29707e833b4SPeter Ujfalusi if (sof_ops(sdev) && sof_ops(sdev)->debugfs_add_region_item)
29807e833b4SPeter Ujfalusi return sof_ops(sdev)->debugfs_add_region_item(sdev, blk_type, offset,
29907e833b4SPeter Ujfalusi size, name, access_type);
30007e833b4SPeter Ujfalusi
30107e833b4SPeter Ujfalusi return 0;
30207e833b4SPeter Ujfalusi }
30307e833b4SPeter Ujfalusi
304d1d95fcbSLiam Girdwood /* register IO */
snd_sof_dsp_write8(struct snd_sof_dev * sdev,u32 bar,u32 offset,u8 value)305f8fbf0dcSPierre-Louis Bossart static inline void snd_sof_dsp_write8(struct snd_sof_dev *sdev, u32 bar,
30674fe0c4dSPierre-Louis Bossart u32 offset, u8 value)
30774fe0c4dSPierre-Louis Bossart {
308f8fbf0dcSPierre-Louis Bossart if (sof_ops(sdev)->write8)
309f8fbf0dcSPierre-Louis Bossart sof_ops(sdev)->write8(sdev, sdev->bar[bar] + offset, value);
31074fe0c4dSPierre-Louis Bossart else
31174fe0c4dSPierre-Louis Bossart writeb(value, sdev->bar[bar] + offset);
31274fe0c4dSPierre-Louis Bossart }
31374fe0c4dSPierre-Louis Bossart
snd_sof_dsp_write(struct snd_sof_dev * sdev,u32 bar,u32 offset,u32 value)314d1d95fcbSLiam Girdwood static inline void snd_sof_dsp_write(struct snd_sof_dev *sdev, u32 bar,
315d1d95fcbSLiam Girdwood u32 offset, u32 value)
316d1d95fcbSLiam Girdwood {
31701278cb6SPierre-Louis Bossart if (sof_ops(sdev)->write)
318d1d95fcbSLiam Girdwood sof_ops(sdev)->write(sdev, sdev->bar[bar] + offset, value);
31901278cb6SPierre-Louis Bossart else
32001278cb6SPierre-Louis Bossart writel(value, sdev->bar[bar] + offset);
321d1d95fcbSLiam Girdwood }
322d1d95fcbSLiam Girdwood
snd_sof_dsp_write64(struct snd_sof_dev * sdev,u32 bar,u32 offset,u64 value)323d1d95fcbSLiam Girdwood static inline void snd_sof_dsp_write64(struct snd_sof_dev *sdev, u32 bar,
324d1d95fcbSLiam Girdwood u32 offset, u64 value)
325d1d95fcbSLiam Girdwood {
32601278cb6SPierre-Louis Bossart if (sof_ops(sdev)->write64)
327d1d95fcbSLiam Girdwood sof_ops(sdev)->write64(sdev, sdev->bar[bar] + offset, value);
32801278cb6SPierre-Louis Bossart else
32901278cb6SPierre-Louis Bossart writeq(value, sdev->bar[bar] + offset);
330d1d95fcbSLiam Girdwood }
331d1d95fcbSLiam Girdwood
snd_sof_dsp_read8(struct snd_sof_dev * sdev,u32 bar,u32 offset)332f8fbf0dcSPierre-Louis Bossart static inline u8 snd_sof_dsp_read8(struct snd_sof_dev *sdev, u32 bar,
33374fe0c4dSPierre-Louis Bossart u32 offset)
33474fe0c4dSPierre-Louis Bossart {
335f8fbf0dcSPierre-Louis Bossart if (sof_ops(sdev)->read8)
336f8fbf0dcSPierre-Louis Bossart return sof_ops(sdev)->read8(sdev, sdev->bar[bar] + offset);
33774fe0c4dSPierre-Louis Bossart else
33874fe0c4dSPierre-Louis Bossart return readb(sdev->bar[bar] + offset);
33974fe0c4dSPierre-Louis Bossart }
34074fe0c4dSPierre-Louis Bossart
snd_sof_dsp_read(struct snd_sof_dev * sdev,u32 bar,u32 offset)341d1d95fcbSLiam Girdwood static inline u32 snd_sof_dsp_read(struct snd_sof_dev *sdev, u32 bar,
342d1d95fcbSLiam Girdwood u32 offset)
343d1d95fcbSLiam Girdwood {
344d1d95fcbSLiam Girdwood if (sof_ops(sdev)->read)
345d1d95fcbSLiam Girdwood return sof_ops(sdev)->read(sdev, sdev->bar[bar] + offset);
34601278cb6SPierre-Louis Bossart else
34701278cb6SPierre-Louis Bossart return readl(sdev->bar[bar] + offset);
348d1d95fcbSLiam Girdwood }
349d1d95fcbSLiam Girdwood
snd_sof_dsp_read64(struct snd_sof_dev * sdev,u32 bar,u32 offset)350d1d95fcbSLiam Girdwood static inline u64 snd_sof_dsp_read64(struct snd_sof_dev *sdev, u32 bar,
351d1d95fcbSLiam Girdwood u32 offset)
352d1d95fcbSLiam Girdwood {
353d1d95fcbSLiam Girdwood if (sof_ops(sdev)->read64)
354d1d95fcbSLiam Girdwood return sof_ops(sdev)->read64(sdev, sdev->bar[bar] + offset);
35501278cb6SPierre-Louis Bossart else
35601278cb6SPierre-Louis Bossart return readq(sdev->bar[bar] + offset);
357d1d95fcbSLiam Girdwood }
358d1d95fcbSLiam Girdwood
snd_sof_dsp_update8(struct snd_sof_dev * sdev,u32 bar,u32 offset,u8 mask,u8 value)359f8fbf0dcSPierre-Louis Bossart static inline void snd_sof_dsp_update8(struct snd_sof_dev *sdev, u32 bar,
360*5afc7eefSRander Wang u32 offset, u8 mask, u8 value)
361c28a36b0SPierre-Louis Bossart {
362c28a36b0SPierre-Louis Bossart u8 reg;
363c28a36b0SPierre-Louis Bossart
364f8fbf0dcSPierre-Louis Bossart reg = snd_sof_dsp_read8(sdev, bar, offset);
365c28a36b0SPierre-Louis Bossart reg &= ~mask;
366c28a36b0SPierre-Louis Bossart reg |= value;
367f8fbf0dcSPierre-Louis Bossart snd_sof_dsp_write8(sdev, bar, offset, reg);
368c28a36b0SPierre-Louis Bossart }
369c28a36b0SPierre-Louis Bossart
370d1d95fcbSLiam Girdwood /* block IO */
snd_sof_dsp_block_read(struct snd_sof_dev * sdev,enum snd_sof_fw_blk_type blk_type,u32 offset,void * dest,size_t bytes)3714624bb2fSPeter Ujfalusi static inline int snd_sof_dsp_block_read(struct snd_sof_dev *sdev,
3724624bb2fSPeter Ujfalusi enum snd_sof_fw_blk_type blk_type,
373d1d95fcbSLiam Girdwood u32 offset, void *dest, size_t bytes)
374d1d95fcbSLiam Girdwood {
3754624bb2fSPeter Ujfalusi return sof_ops(sdev)->block_read(sdev, blk_type, offset, dest, bytes);
376d1d95fcbSLiam Girdwood }
377d1d95fcbSLiam Girdwood
snd_sof_dsp_block_write(struct snd_sof_dev * sdev,enum snd_sof_fw_blk_type blk_type,u32 offset,void * src,size_t bytes)3784624bb2fSPeter Ujfalusi static inline int snd_sof_dsp_block_write(struct snd_sof_dev *sdev,
3794624bb2fSPeter Ujfalusi enum snd_sof_fw_blk_type blk_type,
380d1d95fcbSLiam Girdwood u32 offset, void *src, size_t bytes)
381d1d95fcbSLiam Girdwood {
3824624bb2fSPeter Ujfalusi return sof_ops(sdev)->block_write(sdev, blk_type, offset, src, bytes);
383d1d95fcbSLiam Girdwood }
384d1d95fcbSLiam Girdwood
385f71f59ddSDaniel Baluta /* mailbox IO */
snd_sof_dsp_mailbox_read(struct snd_sof_dev * sdev,u32 offset,void * dest,size_t bytes)386f71f59ddSDaniel Baluta static inline void snd_sof_dsp_mailbox_read(struct snd_sof_dev *sdev,
387f71f59ddSDaniel Baluta u32 offset, void *dest, size_t bytes)
388f71f59ddSDaniel Baluta {
389f71f59ddSDaniel Baluta if (sof_ops(sdev)->mailbox_read)
390f71f59ddSDaniel Baluta sof_ops(sdev)->mailbox_read(sdev, offset, dest, bytes);
391f71f59ddSDaniel Baluta }
392f71f59ddSDaniel Baluta
snd_sof_dsp_mailbox_write(struct snd_sof_dev * sdev,u32 offset,void * src,size_t bytes)393f71f59ddSDaniel Baluta static inline void snd_sof_dsp_mailbox_write(struct snd_sof_dev *sdev,
394f71f59ddSDaniel Baluta u32 offset, void *src, size_t bytes)
395f71f59ddSDaniel Baluta {
396f71f59ddSDaniel Baluta if (sof_ops(sdev)->mailbox_write)
397f71f59ddSDaniel Baluta sof_ops(sdev)->mailbox_write(sdev, offset, src, bytes);
398f71f59ddSDaniel Baluta }
399f71f59ddSDaniel Baluta
400d1d95fcbSLiam Girdwood /* ipc */
snd_sof_dsp_send_msg(struct snd_sof_dev * sdev,struct snd_sof_ipc_msg * msg)401d1d95fcbSLiam Girdwood static inline int snd_sof_dsp_send_msg(struct snd_sof_dev *sdev,
402d1d95fcbSLiam Girdwood struct snd_sof_ipc_msg *msg)
403d1d95fcbSLiam Girdwood {
404d1d95fcbSLiam Girdwood return sof_ops(sdev)->send_msg(sdev, msg);
405d1d95fcbSLiam Girdwood }
406d1d95fcbSLiam Girdwood
407d1d95fcbSLiam Girdwood /* host PCM ops */
408d1d95fcbSLiam Girdwood static inline int
snd_sof_pcm_platform_open(struct snd_sof_dev * sdev,struct snd_pcm_substream * substream)409d1d95fcbSLiam Girdwood snd_sof_pcm_platform_open(struct snd_sof_dev *sdev,
410d1d95fcbSLiam Girdwood struct snd_pcm_substream *substream)
411d1d95fcbSLiam Girdwood {
412d1d95fcbSLiam Girdwood if (sof_ops(sdev) && sof_ops(sdev)->pcm_open)
413d1d95fcbSLiam Girdwood return sof_ops(sdev)->pcm_open(sdev, substream);
414d1d95fcbSLiam Girdwood
415d1d95fcbSLiam Girdwood return 0;
416d1d95fcbSLiam Girdwood }
417d1d95fcbSLiam Girdwood
418d1d95fcbSLiam Girdwood /* disconnect pcm substream to a host stream */
419d1d95fcbSLiam Girdwood static inline int
snd_sof_pcm_platform_close(struct snd_sof_dev * sdev,struct snd_pcm_substream * substream)420d1d95fcbSLiam Girdwood snd_sof_pcm_platform_close(struct snd_sof_dev *sdev,
421d1d95fcbSLiam Girdwood struct snd_pcm_substream *substream)
422d1d95fcbSLiam Girdwood {
423d1d95fcbSLiam Girdwood if (sof_ops(sdev) && sof_ops(sdev)->pcm_close)
424d1d95fcbSLiam Girdwood return sof_ops(sdev)->pcm_close(sdev, substream);
425d1d95fcbSLiam Girdwood
426d1d95fcbSLiam Girdwood return 0;
427d1d95fcbSLiam Girdwood }
428d1d95fcbSLiam Girdwood
429d1d95fcbSLiam Girdwood /* host stream hw params */
430d1d95fcbSLiam Girdwood static inline int
snd_sof_pcm_platform_hw_params(struct snd_sof_dev * sdev,struct snd_pcm_substream * substream,struct snd_pcm_hw_params * params,struct snd_sof_platform_stream_params * platform_params)431d1d95fcbSLiam Girdwood snd_sof_pcm_platform_hw_params(struct snd_sof_dev *sdev,
432d1d95fcbSLiam Girdwood struct snd_pcm_substream *substream,
433d1d95fcbSLiam Girdwood struct snd_pcm_hw_params *params,
43431f60a0cSPeter Ujfalusi struct snd_sof_platform_stream_params *platform_params)
435d1d95fcbSLiam Girdwood {
436d1d95fcbSLiam Girdwood if (sof_ops(sdev) && sof_ops(sdev)->pcm_hw_params)
43731f60a0cSPeter Ujfalusi return sof_ops(sdev)->pcm_hw_params(sdev, substream, params,
43831f60a0cSPeter Ujfalusi platform_params);
439d1d95fcbSLiam Girdwood
440d1d95fcbSLiam Girdwood return 0;
441d1d95fcbSLiam Girdwood }
442d1d95fcbSLiam Girdwood
44393146bc2SRanjani Sridharan /* host stream hw free */
44493146bc2SRanjani Sridharan static inline int
snd_sof_pcm_platform_hw_free(struct snd_sof_dev * sdev,struct snd_pcm_substream * substream)44593146bc2SRanjani Sridharan snd_sof_pcm_platform_hw_free(struct snd_sof_dev *sdev,
44693146bc2SRanjani Sridharan struct snd_pcm_substream *substream)
44793146bc2SRanjani Sridharan {
44893146bc2SRanjani Sridharan if (sof_ops(sdev) && sof_ops(sdev)->pcm_hw_free)
44993146bc2SRanjani Sridharan return sof_ops(sdev)->pcm_hw_free(sdev, substream);
45093146bc2SRanjani Sridharan
45193146bc2SRanjani Sridharan return 0;
45293146bc2SRanjani Sridharan }
45393146bc2SRanjani Sridharan
454d1d95fcbSLiam Girdwood /* host stream trigger */
455d1d95fcbSLiam Girdwood static inline int
snd_sof_pcm_platform_trigger(struct snd_sof_dev * sdev,struct snd_pcm_substream * substream,int cmd)456d1d95fcbSLiam Girdwood snd_sof_pcm_platform_trigger(struct snd_sof_dev *sdev,
457d1d95fcbSLiam Girdwood struct snd_pcm_substream *substream, int cmd)
458d1d95fcbSLiam Girdwood {
459d1d95fcbSLiam Girdwood if (sof_ops(sdev) && sof_ops(sdev)->pcm_trigger)
460d1d95fcbSLiam Girdwood return sof_ops(sdev)->pcm_trigger(sdev, substream, cmd);
461d1d95fcbSLiam Girdwood
462d1d95fcbSLiam Girdwood return 0;
463d1d95fcbSLiam Girdwood }
464d1d95fcbSLiam Girdwood
46596ec1741SPeter Ujfalusi /* Firmware loading */
snd_sof_load_firmware(struct snd_sof_dev * sdev)46696ec1741SPeter Ujfalusi static inline int snd_sof_load_firmware(struct snd_sof_dev *sdev)
46796ec1741SPeter Ujfalusi {
46896ec1741SPeter Ujfalusi dev_dbg(sdev->dev, "loading firmware\n");
46996ec1741SPeter Ujfalusi
47096ec1741SPeter Ujfalusi return sof_ops(sdev)->load_firmware(sdev);
47196ec1741SPeter Ujfalusi }
47296ec1741SPeter Ujfalusi
473d1d95fcbSLiam Girdwood /* host DSP message data */
snd_sof_ipc_msg_data(struct snd_sof_dev * sdev,struct snd_sof_pcm_stream * sps,void * p,size_t sz)4746a0ba071SGuennadi Liakhovetski static inline int snd_sof_ipc_msg_data(struct snd_sof_dev *sdev,
4751b905942SDaniel Baluta struct snd_sof_pcm_stream *sps,
476d1d95fcbSLiam Girdwood void *p, size_t sz)
477d1d95fcbSLiam Girdwood {
4781b905942SDaniel Baluta return sof_ops(sdev)->ipc_msg_data(sdev, sps, p, sz);
479d1d95fcbSLiam Girdwood }
480757ce810SPeter Ujfalusi /* host side configuration of the stream's data offset in stream mailbox area */
481757ce810SPeter Ujfalusi static inline int
snd_sof_set_stream_data_offset(struct snd_sof_dev * sdev,struct snd_sof_pcm_stream * sps,size_t posn_offset)482757ce810SPeter Ujfalusi snd_sof_set_stream_data_offset(struct snd_sof_dev *sdev,
483249f186dSDaniel Baluta struct snd_sof_pcm_stream *sps,
484757ce810SPeter Ujfalusi size_t posn_offset)
485757ce810SPeter Ujfalusi {
486757ce810SPeter Ujfalusi if (sof_ops(sdev) && sof_ops(sdev)->set_stream_data_offset)
487249f186dSDaniel Baluta return sof_ops(sdev)->set_stream_data_offset(sdev, sps,
488757ce810SPeter Ujfalusi posn_offset);
489757ce810SPeter Ujfalusi
490757ce810SPeter Ujfalusi return 0;
491757ce810SPeter Ujfalusi }
492757ce810SPeter Ujfalusi
493d1d95fcbSLiam Girdwood /* host stream pointer */
494d1d95fcbSLiam Girdwood static inline snd_pcm_uframes_t
snd_sof_pcm_platform_pointer(struct snd_sof_dev * sdev,struct snd_pcm_substream * substream)495d1d95fcbSLiam Girdwood snd_sof_pcm_platform_pointer(struct snd_sof_dev *sdev,
496d1d95fcbSLiam Girdwood struct snd_pcm_substream *substream)
497d1d95fcbSLiam Girdwood {
498d1d95fcbSLiam Girdwood if (sof_ops(sdev) && sof_ops(sdev)->pcm_pointer)
499d1d95fcbSLiam Girdwood return sof_ops(sdev)->pcm_pointer(sdev, substream);
500d1d95fcbSLiam Girdwood
501d1d95fcbSLiam Girdwood return 0;
502d1d95fcbSLiam Girdwood }
503d1d95fcbSLiam Girdwood
5044a39ea3fSRanjani Sridharan /* pcm ack */
snd_sof_pcm_platform_ack(struct snd_sof_dev * sdev,struct snd_pcm_substream * substream)5054a39ea3fSRanjani Sridharan static inline int snd_sof_pcm_platform_ack(struct snd_sof_dev *sdev,
5064a39ea3fSRanjani Sridharan struct snd_pcm_substream *substream)
5074a39ea3fSRanjani Sridharan {
5084a39ea3fSRanjani Sridharan if (sof_ops(sdev) && sof_ops(sdev)->pcm_ack)
5094a39ea3fSRanjani Sridharan return sof_ops(sdev)->pcm_ack(sdev, substream);
5104a39ea3fSRanjani Sridharan
5114a39ea3fSRanjani Sridharan return 0;
5124a39ea3fSRanjani Sridharan }
5134a39ea3fSRanjani Sridharan
snd_sof_pcm_get_stream_position(struct snd_sof_dev * sdev,struct snd_soc_component * component,struct snd_pcm_substream * substream)5147f956297SRander Wang static inline u64 snd_sof_pcm_get_stream_position(struct snd_sof_dev *sdev,
5157f956297SRander Wang struct snd_soc_component *component,
5167f956297SRander Wang struct snd_pcm_substream *substream)
5177f956297SRander Wang {
5187f956297SRander Wang if (sof_ops(sdev) && sof_ops(sdev)->get_stream_position)
5197f956297SRander Wang return sof_ops(sdev)->get_stream_position(sdev, component, substream);
5207f956297SRander Wang
5217f956297SRander Wang return 0;
5227f956297SRander Wang }
5237f956297SRander Wang
524285880a2SDaniel Baluta /* machine driver */
525285880a2SDaniel Baluta static inline int
snd_sof_machine_register(struct snd_sof_dev * sdev,void * pdata)526285880a2SDaniel Baluta snd_sof_machine_register(struct snd_sof_dev *sdev, void *pdata)
527285880a2SDaniel Baluta {
528285880a2SDaniel Baluta if (sof_ops(sdev) && sof_ops(sdev)->machine_register)
529285880a2SDaniel Baluta return sof_ops(sdev)->machine_register(sdev, pdata);
530285880a2SDaniel Baluta
531285880a2SDaniel Baluta return 0;
532285880a2SDaniel Baluta }
533285880a2SDaniel Baluta
534285880a2SDaniel Baluta static inline void
snd_sof_machine_unregister(struct snd_sof_dev * sdev,void * pdata)535285880a2SDaniel Baluta snd_sof_machine_unregister(struct snd_sof_dev *sdev, void *pdata)
536285880a2SDaniel Baluta {
537285880a2SDaniel Baluta if (sof_ops(sdev) && sof_ops(sdev)->machine_unregister)
538285880a2SDaniel Baluta sof_ops(sdev)->machine_unregister(sdev, pdata);
539285880a2SDaniel Baluta }
540285880a2SDaniel Baluta
541cb515f10SGuennadi Liakhovetski static inline struct snd_soc_acpi_mach *
snd_sof_machine_select(struct snd_sof_dev * sdev)542285880a2SDaniel Baluta snd_sof_machine_select(struct snd_sof_dev *sdev)
543285880a2SDaniel Baluta {
544285880a2SDaniel Baluta if (sof_ops(sdev) && sof_ops(sdev)->machine_select)
545cb515f10SGuennadi Liakhovetski return sof_ops(sdev)->machine_select(sdev);
546cb515f10SGuennadi Liakhovetski
547cb515f10SGuennadi Liakhovetski return NULL;
548285880a2SDaniel Baluta }
549285880a2SDaniel Baluta
550285880a2SDaniel Baluta static inline void
snd_sof_set_mach_params(struct snd_soc_acpi_mach * mach,struct snd_sof_dev * sdev)551cb515f10SGuennadi Liakhovetski snd_sof_set_mach_params(struct snd_soc_acpi_mach *mach,
55217e9d6b0SPierre-Louis Bossart struct snd_sof_dev *sdev)
553285880a2SDaniel Baluta {
554285880a2SDaniel Baluta if (sof_ops(sdev) && sof_ops(sdev)->set_mach_params)
55517e9d6b0SPierre-Louis Bossart sof_ops(sdev)->set_mach_params(mach, sdev);
556285880a2SDaniel Baluta }
557285880a2SDaniel Baluta
558d1d95fcbSLiam Girdwood /**
559d1d95fcbSLiam Girdwood * snd_sof_dsp_register_poll_timeout - Periodically poll an address
560d1d95fcbSLiam Girdwood * until a condition is met or a timeout occurs
561d1d95fcbSLiam Girdwood * @op: accessor function (takes @addr as its only argument)
562d1d95fcbSLiam Girdwood * @addr: Address to poll
563d1d95fcbSLiam Girdwood * @val: Variable to read the value into
564d1d95fcbSLiam Girdwood * @cond: Break condition (usually involving @val)
565d1d95fcbSLiam Girdwood * @sleep_us: Maximum time to sleep between reads in us (0
566d1d95fcbSLiam Girdwood * tight-loops). Should be less than ~20ms since usleep_range
567458f69efSMauro Carvalho Chehab * is used (see Documentation/timers/timers-howto.rst).
568d1d95fcbSLiam Girdwood * @timeout_us: Timeout in us, 0 means never timeout
569d1d95fcbSLiam Girdwood *
570d1d95fcbSLiam Girdwood * Returns 0 on success and -ETIMEDOUT upon a timeout. In either
571d1d95fcbSLiam Girdwood * case, the last read value at @addr is stored in @val. Must not
572d1d95fcbSLiam Girdwood * be called from atomic context if sleep_us or timeout_us are used.
573d1d95fcbSLiam Girdwood *
574d1d95fcbSLiam Girdwood * This is modelled after the readx_poll_timeout macros in linux/iopoll.h.
575d1d95fcbSLiam Girdwood */
576d1d95fcbSLiam Girdwood #define snd_sof_dsp_read_poll_timeout(sdev, bar, offset, val, cond, sleep_us, timeout_us) \
577d1d95fcbSLiam Girdwood ({ \
578d1d95fcbSLiam Girdwood u64 __timeout_us = (timeout_us); \
579d1d95fcbSLiam Girdwood unsigned long __sleep_us = (sleep_us); \
580d1d95fcbSLiam Girdwood ktime_t __timeout = ktime_add_us(ktime_get(), __timeout_us); \
581d1d95fcbSLiam Girdwood might_sleep_if((__sleep_us) != 0); \
582d1d95fcbSLiam Girdwood for (;;) { \
583d1d95fcbSLiam Girdwood (val) = snd_sof_dsp_read(sdev, bar, offset); \
584d1d95fcbSLiam Girdwood if (cond) { \
585d1d95fcbSLiam Girdwood dev_dbg(sdev->dev, \
5863b2e93edSKeyon Jie "FW Poll Status: reg[%#x]=%#x successful\n", \
5873b2e93edSKeyon Jie (offset), (val)); \
588d1d95fcbSLiam Girdwood break; \
589d1d95fcbSLiam Girdwood } \
590d1d95fcbSLiam Girdwood if (__timeout_us && \
591d1d95fcbSLiam Girdwood ktime_compare(ktime_get(), __timeout) > 0) { \
592d1d95fcbSLiam Girdwood (val) = snd_sof_dsp_read(sdev, bar, offset); \
593d1d95fcbSLiam Girdwood dev_dbg(sdev->dev, \
5943b2e93edSKeyon Jie "FW Poll Status: reg[%#x]=%#x timedout\n", \
5953b2e93edSKeyon Jie (offset), (val)); \
596d1d95fcbSLiam Girdwood break; \
597d1d95fcbSLiam Girdwood } \
598d1d95fcbSLiam Girdwood if (__sleep_us) \
599d1d95fcbSLiam Girdwood usleep_range((__sleep_us >> 2) + 1, __sleep_us); \
600d1d95fcbSLiam Girdwood } \
601d1d95fcbSLiam Girdwood (cond) ? 0 : -ETIMEDOUT; \
602d1d95fcbSLiam Girdwood })
603d1d95fcbSLiam Girdwood
604d1d95fcbSLiam Girdwood /* This is for registers bits with attribute RWC */
605d1d95fcbSLiam Girdwood bool snd_sof_pci_update_bits(struct snd_sof_dev *sdev, u32 offset,
606d1d95fcbSLiam Girdwood u32 mask, u32 value);
607d1d95fcbSLiam Girdwood
608d1d95fcbSLiam Girdwood bool snd_sof_dsp_update_bits_unlocked(struct snd_sof_dev *sdev, u32 bar,
609d1d95fcbSLiam Girdwood u32 offset, u32 mask, u32 value);
610d1d95fcbSLiam Girdwood
611d1d95fcbSLiam Girdwood bool snd_sof_dsp_update_bits64_unlocked(struct snd_sof_dev *sdev, u32 bar,
612d1d95fcbSLiam Girdwood u32 offset, u64 mask, u64 value);
613d1d95fcbSLiam Girdwood
614d1d95fcbSLiam Girdwood bool snd_sof_dsp_update_bits(struct snd_sof_dev *sdev, u32 bar, u32 offset,
615d1d95fcbSLiam Girdwood u32 mask, u32 value);
616d1d95fcbSLiam Girdwood
617d1d95fcbSLiam Girdwood bool snd_sof_dsp_update_bits64(struct snd_sof_dev *sdev, u32 bar,
618d1d95fcbSLiam Girdwood u32 offset, u64 mask, u64 value);
619d1d95fcbSLiam Girdwood
620d1d95fcbSLiam Girdwood void snd_sof_dsp_update_bits_forced(struct snd_sof_dev *sdev, u32 bar,
621d1d95fcbSLiam Girdwood u32 offset, u32 mask, u32 value);
622d1d95fcbSLiam Girdwood
623d1d95fcbSLiam Girdwood int snd_sof_dsp_register_poll(struct snd_sof_dev *sdev, u32 bar, u32 offset,
624d1d95fcbSLiam Girdwood u32 mask, u32 target, u32 timeout_ms,
625d1d95fcbSLiam Girdwood u32 interval_us);
626d1d95fcbSLiam Girdwood
627b2b10aa7SPeter Ujfalusi void snd_sof_dsp_panic(struct snd_sof_dev *sdev, u32 offset, bool non_recoverable);
628d1d95fcbSLiam Girdwood #endif
629