Lines Matching +full:pre +full:- +full:verified
1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
19 #include "sof-priv.h"
22 ((sdev)->pdata->desc->ops)
26 if (sdev->pdata->desc->ops_init) in sof_ops_init()
27 return sdev->pdata->desc->ops_init(sdev); in sof_ops_init()
34 if (sdev->pdata->desc->ops_free) in sof_ops_free()
35 sdev->pdata->desc->ops_free(sdev); in sof_ops_free()
38 /* Mandatory operations are verified during probing */
43 return sof_ops(sdev)->probe(sdev); in snd_sof_probe()
48 if (sof_ops(sdev)->remove) in snd_sof_remove()
49 return sof_ops(sdev)->remove(sdev); in snd_sof_remove()
56 if (sof_ops(sdev)->shutdown) in snd_sof_shutdown()
57 return sof_ops(sdev)->shutdown(sdev); in snd_sof_shutdown()
70 return sof_ops(sdev)->run(sdev); in snd_sof_dsp_run()
75 if (sof_ops(sdev)->stall) in snd_sof_dsp_stall()
76 return sof_ops(sdev)->stall(sdev, core_mask); in snd_sof_dsp_stall()
83 if (sof_ops(sdev)->reset) in snd_sof_dsp_reset()
84 return sof_ops(sdev)->reset(sdev); in snd_sof_dsp_reset()
92 if (core > sdev->num_cores - 1) { in snd_sof_dsp_core_get()
93 dev_err(sdev->dev, "invalid core id: %d for num_cores: %d\n", core, in snd_sof_dsp_core_get()
94 sdev->num_cores); in snd_sof_dsp_core_get()
95 return -EINVAL; in snd_sof_dsp_core_get()
98 if (sof_ops(sdev)->core_get) { in snd_sof_dsp_core_get()
102 if (sdev->dsp_core_ref_count[core] > 0) { in snd_sof_dsp_core_get()
103 sdev->dsp_core_ref_count[core]++; in snd_sof_dsp_core_get()
108 ret = sof_ops(sdev)->core_get(sdev, core); in snd_sof_dsp_core_get()
113 sdev->dsp_core_ref_count[core]++; in snd_sof_dsp_core_get()
116 sdev->enabled_cores_mask |= BIT(core); in snd_sof_dsp_core_get()
118 dev_dbg(sdev->dev, "Core %d powered up\n", core); in snd_sof_dsp_core_get()
126 if (core > sdev->num_cores - 1) { in snd_sof_dsp_core_put()
127 dev_err(sdev->dev, "invalid core id: %d for num_cores: %d\n", core, in snd_sof_dsp_core_put()
128 sdev->num_cores); in snd_sof_dsp_core_put()
129 return -EINVAL; in snd_sof_dsp_core_put()
132 if (sof_ops(sdev)->core_put) { in snd_sof_dsp_core_put()
136 if (--(sdev->dsp_core_ref_count[core]) > 0) in snd_sof_dsp_core_put()
140 ret = sof_ops(sdev)->core_put(sdev, core); in snd_sof_dsp_core_put()
145 sdev->enabled_cores_mask &= ~BIT(core); in snd_sof_dsp_core_put()
147 dev_dbg(sdev->dev, "Core %d powered down\n", core); in snd_sof_dsp_core_put()
153 /* pre/post fw load */
156 if (sof_ops(sdev)->pre_fw_run) in snd_sof_dsp_pre_fw_run()
157 return sof_ops(sdev)->pre_fw_run(sdev); in snd_sof_dsp_pre_fw_run()
164 if (sof_ops(sdev)->post_fw_run) in snd_sof_dsp_post_fw_run()
165 return sof_ops(sdev)->post_fw_run(sdev); in snd_sof_dsp_post_fw_run()
174 if (sof_ops(sdev)->parse_platform_ext_manifest) in snd_sof_dsp_parse_platform_ext_manifest()
175 return sof_ops(sdev)->parse_platform_ext_manifest(sdev, hdr); in snd_sof_dsp_parse_platform_ext_manifest()
183 * snd_sof_dsp_get_bar_index - Maps a section type with a BAR index
188 * Returns the corresponding BAR index (a positive integer) or -EINVAL
193 if (sof_ops(sdev)->get_bar_index) in snd_sof_dsp_get_bar_index()
194 return sof_ops(sdev)->get_bar_index(sdev, type); in snd_sof_dsp_get_bar_index()
196 return sdev->mmio_bar; in snd_sof_dsp_get_bar_index()
201 if (sof_ops(sdev)->get_mailbox_offset) in snd_sof_dsp_get_mailbox_offset()
202 return sof_ops(sdev)->get_mailbox_offset(sdev); in snd_sof_dsp_get_mailbox_offset()
204 dev_err(sdev->dev, "error: %s not defined\n", __func__); in snd_sof_dsp_get_mailbox_offset()
205 return -ENOTSUPP; in snd_sof_dsp_get_mailbox_offset()
211 if (sof_ops(sdev)->get_window_offset) in snd_sof_dsp_get_window_offset()
212 return sof_ops(sdev)->get_window_offset(sdev, id); in snd_sof_dsp_get_window_offset()
214 dev_err(sdev->dev, "error: %s not defined\n", __func__); in snd_sof_dsp_get_window_offset()
215 return -ENOTSUPP; in snd_sof_dsp_get_window_offset()
220 if (sof_ops(sdev)->resume) in snd_sof_dsp_resume()
221 return sof_ops(sdev)->resume(sdev); in snd_sof_dsp_resume()
229 if (sof_ops(sdev)->suspend) in snd_sof_dsp_suspend()
230 return sof_ops(sdev)->suspend(sdev, target_state); in snd_sof_dsp_suspend()
237 if (sof_ops(sdev)->runtime_resume) in snd_sof_dsp_runtime_resume()
238 return sof_ops(sdev)->runtime_resume(sdev); in snd_sof_dsp_runtime_resume()
245 if (sof_ops(sdev)->runtime_suspend) in snd_sof_dsp_runtime_suspend()
246 return sof_ops(sdev)->runtime_suspend(sdev); in snd_sof_dsp_runtime_suspend()
253 if (sof_ops(sdev)->runtime_idle) in snd_sof_dsp_runtime_idle()
254 return sof_ops(sdev)->runtime_idle(sdev); in snd_sof_dsp_runtime_idle()
261 if (sof_ops(sdev)->set_hw_params_upon_resume) in snd_sof_dsp_hw_params_upon_resume()
262 return sof_ops(sdev)->set_hw_params_upon_resume(sdev); in snd_sof_dsp_hw_params_upon_resume()
268 if (sof_ops(sdev)->set_clk) in snd_sof_dsp_set_clk()
269 return sof_ops(sdev)->set_clk(sdev, freq); in snd_sof_dsp_set_clk()
280 mutex_lock(&sdev->power_state_access); in snd_sof_dsp_set_power_state()
282 if (sof_ops(sdev)->set_power_state) in snd_sof_dsp_set_power_state()
283 ret = sof_ops(sdev)->set_power_state(sdev, target_state); in snd_sof_dsp_set_power_state()
285 mutex_unlock(&sdev->power_state_access); in snd_sof_dsp_set_power_state()
297 if (sof_ops(sdev) && sof_ops(sdev)->debugfs_add_region_item) in snd_sof_debugfs_add_region_item()
298 return sof_ops(sdev)->debugfs_add_region_item(sdev, blk_type, offset, in snd_sof_debugfs_add_region_item()
308 if (sof_ops(sdev)->write) { in snd_sof_dsp_write()
309 sof_ops(sdev)->write(sdev, sdev->bar[bar] + offset, value); in snd_sof_dsp_write()
313 dev_err_ratelimited(sdev->dev, "error: %s not defined\n", __func__); in snd_sof_dsp_write()
319 if (sof_ops(sdev)->write64) { in snd_sof_dsp_write64()
320 sof_ops(sdev)->write64(sdev, sdev->bar[bar] + offset, value); in snd_sof_dsp_write64()
324 dev_err_ratelimited(sdev->dev, "error: %s not defined\n", __func__); in snd_sof_dsp_write64()
330 if (sof_ops(sdev)->read) in snd_sof_dsp_read()
331 return sof_ops(sdev)->read(sdev, sdev->bar[bar] + offset); in snd_sof_dsp_read()
333 dev_err(sdev->dev, "error: %s not defined\n", __func__); in snd_sof_dsp_read()
334 return -ENOTSUPP; in snd_sof_dsp_read()
340 if (sof_ops(sdev)->read64) in snd_sof_dsp_read64()
341 return sof_ops(sdev)->read64(sdev, sdev->bar[bar] + offset); in snd_sof_dsp_read64()
343 dev_err(sdev->dev, "error: %s not defined\n", __func__); in snd_sof_dsp_read64()
344 return -ENOTSUPP; in snd_sof_dsp_read64()
352 return sof_ops(sdev)->block_read(sdev, blk_type, offset, dest, bytes); in snd_sof_dsp_block_read()
359 return sof_ops(sdev)->block_write(sdev, blk_type, offset, src, bytes); in snd_sof_dsp_block_write()
366 if (sof_ops(sdev)->mailbox_read) in snd_sof_dsp_mailbox_read()
367 sof_ops(sdev)->mailbox_read(sdev, offset, dest, bytes); in snd_sof_dsp_mailbox_read()
373 if (sof_ops(sdev)->mailbox_write) in snd_sof_dsp_mailbox_write()
374 sof_ops(sdev)->mailbox_write(sdev, offset, src, bytes); in snd_sof_dsp_mailbox_write()
381 return sof_ops(sdev)->send_msg(sdev, msg); in snd_sof_dsp_send_msg()
389 if (sof_ops(sdev) && sof_ops(sdev)->pcm_open) in snd_sof_pcm_platform_open()
390 return sof_ops(sdev)->pcm_open(sdev, substream); in snd_sof_pcm_platform_open()
400 if (sof_ops(sdev) && sof_ops(sdev)->pcm_close) in snd_sof_pcm_platform_close()
401 return sof_ops(sdev)->pcm_close(sdev, substream); in snd_sof_pcm_platform_close()
413 if (sof_ops(sdev) && sof_ops(sdev)->pcm_hw_params) in snd_sof_pcm_platform_hw_params()
414 return sof_ops(sdev)->pcm_hw_params(sdev, substream, params, in snd_sof_pcm_platform_hw_params()
425 if (sof_ops(sdev) && sof_ops(sdev)->pcm_hw_free) in snd_sof_pcm_platform_hw_free()
426 return sof_ops(sdev)->pcm_hw_free(sdev, substream); in snd_sof_pcm_platform_hw_free()
436 if (sof_ops(sdev) && sof_ops(sdev)->pcm_trigger) in snd_sof_pcm_platform_trigger()
437 return sof_ops(sdev)->pcm_trigger(sdev, substream, cmd); in snd_sof_pcm_platform_trigger()
445 dev_dbg(sdev->dev, "loading firmware\n"); in snd_sof_load_firmware()
447 return sof_ops(sdev)->load_firmware(sdev); in snd_sof_load_firmware()
455 return sof_ops(sdev)->ipc_msg_data(sdev, substream, p, sz); in snd_sof_ipc_msg_data()
463 if (sof_ops(sdev) && sof_ops(sdev)->set_stream_data_offset) in snd_sof_set_stream_data_offset()
464 return sof_ops(sdev)->set_stream_data_offset(sdev, substream, in snd_sof_set_stream_data_offset()
475 if (sof_ops(sdev) && sof_ops(sdev)->pcm_pointer) in snd_sof_pcm_platform_pointer()
476 return sof_ops(sdev)->pcm_pointer(sdev, substream); in snd_sof_pcm_platform_pointer()
485 if (sof_ops(sdev) && sof_ops(sdev)->pcm_ack) in snd_sof_pcm_platform_ack()
486 return sof_ops(sdev)->pcm_ack(sdev, substream); in snd_sof_pcm_platform_ack()
495 if (sof_ops(sdev) && sof_ops(sdev)->machine_register) in snd_sof_machine_register()
496 return sof_ops(sdev)->machine_register(sdev, pdata); in snd_sof_machine_register()
504 if (sof_ops(sdev) && sof_ops(sdev)->machine_unregister) in snd_sof_machine_unregister()
505 sof_ops(sdev)->machine_unregister(sdev, pdata); in snd_sof_machine_unregister()
511 if (sof_ops(sdev) && sof_ops(sdev)->machine_select) in snd_sof_machine_select()
512 return sof_ops(sdev)->machine_select(sdev); in snd_sof_machine_select()
521 if (sof_ops(sdev) && sof_ops(sdev)->set_mach_params) in snd_sof_set_mach_params()
522 sof_ops(sdev)->set_mach_params(mach, sdev); in snd_sof_set_mach_params()
526 * snd_sof_dsp_register_poll_timeout - Periodically poll an address
533 * tight-loops). Should be less than ~20ms since usleep_range
534 * is used (see Documentation/timers/timers-howto.rst).
537 * Returns 0 on success and -ETIMEDOUT upon a timeout. In either
552 dev_dbg(sdev->dev, \
560 dev_dbg(sdev->dev, \
568 (cond) ? 0 : -ETIMEDOUT; \