Lines Matching refs:sdev

21 #define sof_ops(sdev) \  argument
22 ((sdev)->pdata->desc->ops)
24 static inline int sof_ops_init(struct snd_sof_dev *sdev) in sof_ops_init() argument
26 if (sdev->pdata->desc->ops_init) in sof_ops_init()
27 return sdev->pdata->desc->ops_init(sdev); in sof_ops_init()
32 static inline void sof_ops_free(struct snd_sof_dev *sdev) in sof_ops_free() argument
34 if (sdev->pdata->desc->ops_free) in sof_ops_free()
35 sdev->pdata->desc->ops_free(sdev); in sof_ops_free()
41 static inline int snd_sof_probe_early(struct snd_sof_dev *sdev) in snd_sof_probe_early() argument
43 if (sof_ops(sdev)->probe_early) in snd_sof_probe_early()
44 return sof_ops(sdev)->probe_early(sdev); in snd_sof_probe_early()
49 static inline int snd_sof_probe(struct snd_sof_dev *sdev) in snd_sof_probe() argument
51 return sof_ops(sdev)->probe(sdev); in snd_sof_probe()
54 static inline void snd_sof_remove(struct snd_sof_dev *sdev) in snd_sof_remove() argument
56 if (sof_ops(sdev)->remove) in snd_sof_remove()
57 sof_ops(sdev)->remove(sdev); in snd_sof_remove()
60 static inline void snd_sof_remove_late(struct snd_sof_dev *sdev) in snd_sof_remove_late() argument
62 if (sof_ops(sdev)->remove_late) in snd_sof_remove_late()
63 sof_ops(sdev)->remove_late(sdev); in snd_sof_remove_late()
66 static inline int snd_sof_shutdown(struct snd_sof_dev *sdev) in snd_sof_shutdown() argument
68 if (sof_ops(sdev)->shutdown) in snd_sof_shutdown()
69 return sof_ops(sdev)->shutdown(sdev); in snd_sof_shutdown()
80 static inline int snd_sof_dsp_run(struct snd_sof_dev *sdev) in snd_sof_dsp_run() argument
82 return sof_ops(sdev)->run(sdev); in snd_sof_dsp_run()
85 static inline int snd_sof_dsp_stall(struct snd_sof_dev *sdev, unsigned int core_mask) in snd_sof_dsp_stall() argument
87 if (sof_ops(sdev)->stall) in snd_sof_dsp_stall()
88 return sof_ops(sdev)->stall(sdev, core_mask); in snd_sof_dsp_stall()
93 static inline int snd_sof_dsp_reset(struct snd_sof_dev *sdev) in snd_sof_dsp_reset() argument
95 if (sof_ops(sdev)->reset) in snd_sof_dsp_reset()
96 return sof_ops(sdev)->reset(sdev); in snd_sof_dsp_reset()
102 static inline int snd_sof_dsp_core_get(struct snd_sof_dev *sdev, int core) in snd_sof_dsp_core_get() argument
104 if (core > sdev->num_cores - 1) { in snd_sof_dsp_core_get()
105 dev_err(sdev->dev, "invalid core id: %d for num_cores: %d\n", core, in snd_sof_dsp_core_get()
106 sdev->num_cores); in snd_sof_dsp_core_get()
110 if (sof_ops(sdev)->core_get) { in snd_sof_dsp_core_get()
114 if (sdev->dsp_core_ref_count[core] > 0) { in snd_sof_dsp_core_get()
115 sdev->dsp_core_ref_count[core]++; in snd_sof_dsp_core_get()
120 ret = sof_ops(sdev)->core_get(sdev, core); in snd_sof_dsp_core_get()
125 sdev->dsp_core_ref_count[core]++; in snd_sof_dsp_core_get()
128 sdev->enabled_cores_mask |= BIT(core); in snd_sof_dsp_core_get()
130 dev_dbg(sdev->dev, "Core %d powered up\n", core); in snd_sof_dsp_core_get()
136 static inline int snd_sof_dsp_core_put(struct snd_sof_dev *sdev, int core) in snd_sof_dsp_core_put() argument
138 if (core > sdev->num_cores - 1) { in snd_sof_dsp_core_put()
139 dev_err(sdev->dev, "invalid core id: %d for num_cores: %d\n", core, in snd_sof_dsp_core_put()
140 sdev->num_cores); in snd_sof_dsp_core_put()
144 if (sof_ops(sdev)->core_put) { in snd_sof_dsp_core_put()
148 if (--(sdev->dsp_core_ref_count[core]) > 0) in snd_sof_dsp_core_put()
152 ret = sof_ops(sdev)->core_put(sdev, core); in snd_sof_dsp_core_put()
157 sdev->enabled_cores_mask &= ~BIT(core); in snd_sof_dsp_core_put()
159 dev_dbg(sdev->dev, "Core %d powered down\n", core); in snd_sof_dsp_core_put()
166 static inline int snd_sof_dsp_pre_fw_run(struct snd_sof_dev *sdev) in snd_sof_dsp_pre_fw_run() argument
168 if (sof_ops(sdev)->pre_fw_run) in snd_sof_dsp_pre_fw_run()
169 return sof_ops(sdev)->pre_fw_run(sdev); in snd_sof_dsp_pre_fw_run()
174 static inline int snd_sof_dsp_post_fw_run(struct snd_sof_dev *sdev) in snd_sof_dsp_post_fw_run() argument
176 if (sof_ops(sdev)->post_fw_run) in snd_sof_dsp_post_fw_run()
177 return sof_ops(sdev)->post_fw_run(sdev); in snd_sof_dsp_post_fw_run()
183 static inline int snd_sof_dsp_parse_platform_ext_manifest(struct snd_sof_dev *sdev, in snd_sof_dsp_parse_platform_ext_manifest() argument
186 if (sof_ops(sdev)->parse_platform_ext_manifest) in snd_sof_dsp_parse_platform_ext_manifest()
187 return sof_ops(sdev)->parse_platform_ext_manifest(sdev, hdr); in snd_sof_dsp_parse_platform_ext_manifest()
203 static inline int snd_sof_dsp_get_bar_index(struct snd_sof_dev *sdev, u32 type) in snd_sof_dsp_get_bar_index() argument
205 if (sof_ops(sdev)->get_bar_index) in snd_sof_dsp_get_bar_index()
206 return sof_ops(sdev)->get_bar_index(sdev, type); in snd_sof_dsp_get_bar_index()
208 return sdev->mmio_bar; in snd_sof_dsp_get_bar_index()
211 static inline int snd_sof_dsp_get_mailbox_offset(struct snd_sof_dev *sdev) in snd_sof_dsp_get_mailbox_offset() argument
213 if (sof_ops(sdev)->get_mailbox_offset) in snd_sof_dsp_get_mailbox_offset()
214 return sof_ops(sdev)->get_mailbox_offset(sdev); in snd_sof_dsp_get_mailbox_offset()
216 dev_err(sdev->dev, "error: %s not defined\n", __func__); in snd_sof_dsp_get_mailbox_offset()
220 static inline int snd_sof_dsp_get_window_offset(struct snd_sof_dev *sdev, in snd_sof_dsp_get_window_offset() argument
223 if (sof_ops(sdev)->get_window_offset) in snd_sof_dsp_get_window_offset()
224 return sof_ops(sdev)->get_window_offset(sdev, id); in snd_sof_dsp_get_window_offset()
226 dev_err(sdev->dev, "error: %s not defined\n", __func__); in snd_sof_dsp_get_window_offset()
230 static inline int snd_sof_dsp_resume(struct snd_sof_dev *sdev) in snd_sof_dsp_resume() argument
232 if (sof_ops(sdev)->resume) in snd_sof_dsp_resume()
233 return sof_ops(sdev)->resume(sdev); in snd_sof_dsp_resume()
238 static inline int snd_sof_dsp_suspend(struct snd_sof_dev *sdev, in snd_sof_dsp_suspend() argument
241 if (sof_ops(sdev)->suspend) in snd_sof_dsp_suspend()
242 return sof_ops(sdev)->suspend(sdev, target_state); in snd_sof_dsp_suspend()
247 static inline int snd_sof_dsp_runtime_resume(struct snd_sof_dev *sdev) in snd_sof_dsp_runtime_resume() argument
249 if (sof_ops(sdev)->runtime_resume) in snd_sof_dsp_runtime_resume()
250 return sof_ops(sdev)->runtime_resume(sdev); in snd_sof_dsp_runtime_resume()
255 static inline int snd_sof_dsp_runtime_suspend(struct snd_sof_dev *sdev) in snd_sof_dsp_runtime_suspend() argument
257 if (sof_ops(sdev)->runtime_suspend) in snd_sof_dsp_runtime_suspend()
258 return sof_ops(sdev)->runtime_suspend(sdev); in snd_sof_dsp_runtime_suspend()
263 static inline int snd_sof_dsp_runtime_idle(struct snd_sof_dev *sdev) in snd_sof_dsp_runtime_idle() argument
265 if (sof_ops(sdev)->runtime_idle) in snd_sof_dsp_runtime_idle()
266 return sof_ops(sdev)->runtime_idle(sdev); in snd_sof_dsp_runtime_idle()
271 static inline int snd_sof_dsp_hw_params_upon_resume(struct snd_sof_dev *sdev) in snd_sof_dsp_hw_params_upon_resume() argument
273 if (sof_ops(sdev)->set_hw_params_upon_resume) in snd_sof_dsp_hw_params_upon_resume()
274 return sof_ops(sdev)->set_hw_params_upon_resume(sdev); in snd_sof_dsp_hw_params_upon_resume()
278 static inline int snd_sof_dsp_set_clk(struct snd_sof_dev *sdev, u32 freq) in snd_sof_dsp_set_clk() argument
280 if (sof_ops(sdev)->set_clk) in snd_sof_dsp_set_clk()
281 return sof_ops(sdev)->set_clk(sdev, freq); in snd_sof_dsp_set_clk()
287 snd_sof_dsp_set_power_state(struct snd_sof_dev *sdev, in snd_sof_dsp_set_power_state() argument
292 mutex_lock(&sdev->power_state_access); in snd_sof_dsp_set_power_state()
294 if (sof_ops(sdev)->set_power_state) in snd_sof_dsp_set_power_state()
295 ret = sof_ops(sdev)->set_power_state(sdev, target_state); in snd_sof_dsp_set_power_state()
297 mutex_unlock(&sdev->power_state_access); in snd_sof_dsp_set_power_state()
303 void snd_sof_dsp_dbg_dump(struct snd_sof_dev *sdev, const char *msg, u32 flags);
305 static inline int snd_sof_debugfs_add_region_item(struct snd_sof_dev *sdev, in snd_sof_debugfs_add_region_item() argument
309 if (sof_ops(sdev) && sof_ops(sdev)->debugfs_add_region_item) in snd_sof_debugfs_add_region_item()
310 return sof_ops(sdev)->debugfs_add_region_item(sdev, blk_type, offset, in snd_sof_debugfs_add_region_item()
317 static inline void snd_sof_dsp_write8(struct snd_sof_dev *sdev, u32 bar, in snd_sof_dsp_write8() argument
320 if (sof_ops(sdev)->write8) in snd_sof_dsp_write8()
321 sof_ops(sdev)->write8(sdev, sdev->bar[bar] + offset, value); in snd_sof_dsp_write8()
323 writeb(value, sdev->bar[bar] + offset); in snd_sof_dsp_write8()
326 static inline void snd_sof_dsp_write(struct snd_sof_dev *sdev, u32 bar, in snd_sof_dsp_write() argument
329 if (sof_ops(sdev)->write) in snd_sof_dsp_write()
330 sof_ops(sdev)->write(sdev, sdev->bar[bar] + offset, value); in snd_sof_dsp_write()
332 writel(value, sdev->bar[bar] + offset); in snd_sof_dsp_write()
335 static inline void snd_sof_dsp_write64(struct snd_sof_dev *sdev, u32 bar, in snd_sof_dsp_write64() argument
338 if (sof_ops(sdev)->write64) in snd_sof_dsp_write64()
339 sof_ops(sdev)->write64(sdev, sdev->bar[bar] + offset, value); in snd_sof_dsp_write64()
341 writeq(value, sdev->bar[bar] + offset); in snd_sof_dsp_write64()
344 static inline u8 snd_sof_dsp_read8(struct snd_sof_dev *sdev, u32 bar, in snd_sof_dsp_read8() argument
347 if (sof_ops(sdev)->read8) in snd_sof_dsp_read8()
348 return sof_ops(sdev)->read8(sdev, sdev->bar[bar] + offset); in snd_sof_dsp_read8()
350 return readb(sdev->bar[bar] + offset); in snd_sof_dsp_read8()
353 static inline u32 snd_sof_dsp_read(struct snd_sof_dev *sdev, u32 bar, in snd_sof_dsp_read() argument
356 if (sof_ops(sdev)->read) in snd_sof_dsp_read()
357 return sof_ops(sdev)->read(sdev, sdev->bar[bar] + offset); in snd_sof_dsp_read()
359 return readl(sdev->bar[bar] + offset); in snd_sof_dsp_read()
362 static inline u64 snd_sof_dsp_read64(struct snd_sof_dev *sdev, u32 bar, in snd_sof_dsp_read64() argument
365 if (sof_ops(sdev)->read64) in snd_sof_dsp_read64()
366 return sof_ops(sdev)->read64(sdev, sdev->bar[bar] + offset); in snd_sof_dsp_read64()
368 return readq(sdev->bar[bar] + offset); in snd_sof_dsp_read64()
371 static inline void snd_sof_dsp_update8(struct snd_sof_dev *sdev, u32 bar, in snd_sof_dsp_update8() argument
376 reg = snd_sof_dsp_read8(sdev, bar, offset); in snd_sof_dsp_update8()
379 snd_sof_dsp_write8(sdev, bar, offset, reg); in snd_sof_dsp_update8()
383 static inline int snd_sof_dsp_block_read(struct snd_sof_dev *sdev, in snd_sof_dsp_block_read() argument
387 return sof_ops(sdev)->block_read(sdev, blk_type, offset, dest, bytes); in snd_sof_dsp_block_read()
390 static inline int snd_sof_dsp_block_write(struct snd_sof_dev *sdev, in snd_sof_dsp_block_write() argument
394 return sof_ops(sdev)->block_write(sdev, blk_type, offset, src, bytes); in snd_sof_dsp_block_write()
398 static inline void snd_sof_dsp_mailbox_read(struct snd_sof_dev *sdev, in snd_sof_dsp_mailbox_read() argument
401 if (sof_ops(sdev)->mailbox_read) in snd_sof_dsp_mailbox_read()
402 sof_ops(sdev)->mailbox_read(sdev, offset, dest, bytes); in snd_sof_dsp_mailbox_read()
405 static inline void snd_sof_dsp_mailbox_write(struct snd_sof_dev *sdev, in snd_sof_dsp_mailbox_write() argument
408 if (sof_ops(sdev)->mailbox_write) in snd_sof_dsp_mailbox_write()
409 sof_ops(sdev)->mailbox_write(sdev, offset, src, bytes); in snd_sof_dsp_mailbox_write()
413 static inline int snd_sof_dsp_send_msg(struct snd_sof_dev *sdev, in snd_sof_dsp_send_msg() argument
416 return sof_ops(sdev)->send_msg(sdev, msg); in snd_sof_dsp_send_msg()
421 snd_sof_pcm_platform_open(struct snd_sof_dev *sdev, in snd_sof_pcm_platform_open() argument
424 if (sof_ops(sdev) && sof_ops(sdev)->pcm_open) in snd_sof_pcm_platform_open()
425 return sof_ops(sdev)->pcm_open(sdev, substream); in snd_sof_pcm_platform_open()
432 snd_sof_pcm_platform_close(struct snd_sof_dev *sdev, in snd_sof_pcm_platform_close() argument
435 if (sof_ops(sdev) && sof_ops(sdev)->pcm_close) in snd_sof_pcm_platform_close()
436 return sof_ops(sdev)->pcm_close(sdev, substream); in snd_sof_pcm_platform_close()
443 snd_sof_pcm_platform_hw_params(struct snd_sof_dev *sdev, in snd_sof_pcm_platform_hw_params() argument
448 if (sof_ops(sdev) && sof_ops(sdev)->pcm_hw_params) in snd_sof_pcm_platform_hw_params()
449 return sof_ops(sdev)->pcm_hw_params(sdev, substream, params, in snd_sof_pcm_platform_hw_params()
457 snd_sof_pcm_platform_hw_free(struct snd_sof_dev *sdev, in snd_sof_pcm_platform_hw_free() argument
460 if (sof_ops(sdev) && sof_ops(sdev)->pcm_hw_free) in snd_sof_pcm_platform_hw_free()
461 return sof_ops(sdev)->pcm_hw_free(sdev, substream); in snd_sof_pcm_platform_hw_free()
468 snd_sof_pcm_platform_trigger(struct snd_sof_dev *sdev, in snd_sof_pcm_platform_trigger() argument
471 if (sof_ops(sdev) && sof_ops(sdev)->pcm_trigger) in snd_sof_pcm_platform_trigger()
472 return sof_ops(sdev)->pcm_trigger(sdev, substream, cmd); in snd_sof_pcm_platform_trigger()
478 static inline int snd_sof_load_firmware(struct snd_sof_dev *sdev) in snd_sof_load_firmware() argument
480 dev_dbg(sdev->dev, "loading firmware\n"); in snd_sof_load_firmware()
482 return sof_ops(sdev)->load_firmware(sdev); in snd_sof_load_firmware()
486 static inline int snd_sof_ipc_msg_data(struct snd_sof_dev *sdev, in snd_sof_ipc_msg_data() argument
490 return sof_ops(sdev)->ipc_msg_data(sdev, sps, p, sz); in snd_sof_ipc_msg_data()
494 snd_sof_set_stream_data_offset(struct snd_sof_dev *sdev, in snd_sof_set_stream_data_offset() argument
498 if (sof_ops(sdev) && sof_ops(sdev)->set_stream_data_offset) in snd_sof_set_stream_data_offset()
499 return sof_ops(sdev)->set_stream_data_offset(sdev, sps, in snd_sof_set_stream_data_offset()
507 snd_sof_pcm_platform_pointer(struct snd_sof_dev *sdev, in snd_sof_pcm_platform_pointer() argument
510 if (sof_ops(sdev) && sof_ops(sdev)->pcm_pointer) in snd_sof_pcm_platform_pointer()
511 return sof_ops(sdev)->pcm_pointer(sdev, substream); in snd_sof_pcm_platform_pointer()
517 static inline int snd_sof_pcm_platform_ack(struct snd_sof_dev *sdev, in snd_sof_pcm_platform_ack() argument
520 if (sof_ops(sdev) && sof_ops(sdev)->pcm_ack) in snd_sof_pcm_platform_ack()
521 return sof_ops(sdev)->pcm_ack(sdev, substream); in snd_sof_pcm_platform_ack()
527 snd_sof_pcm_get_dai_frame_counter(struct snd_sof_dev *sdev, in snd_sof_pcm_get_dai_frame_counter() argument
531 if (sof_ops(sdev) && sof_ops(sdev)->get_dai_frame_counter) in snd_sof_pcm_get_dai_frame_counter()
532 return sof_ops(sdev)->get_dai_frame_counter(sdev, component, in snd_sof_pcm_get_dai_frame_counter()
539 snd_sof_pcm_get_host_byte_counter(struct snd_sof_dev *sdev, in snd_sof_pcm_get_host_byte_counter() argument
543 if (sof_ops(sdev) && sof_ops(sdev)->get_host_byte_counter) in snd_sof_pcm_get_host_byte_counter()
544 return sof_ops(sdev)->get_host_byte_counter(sdev, component, in snd_sof_pcm_get_host_byte_counter()
552 snd_sof_machine_register(struct snd_sof_dev *sdev, void *pdata) in snd_sof_machine_register() argument
554 if (sof_ops(sdev) && sof_ops(sdev)->machine_register) in snd_sof_machine_register()
555 return sof_ops(sdev)->machine_register(sdev, pdata); in snd_sof_machine_register()
561 snd_sof_machine_unregister(struct snd_sof_dev *sdev, void *pdata) in snd_sof_machine_unregister() argument
563 if (sof_ops(sdev) && sof_ops(sdev)->machine_unregister) in snd_sof_machine_unregister()
564 sof_ops(sdev)->machine_unregister(sdev, pdata); in snd_sof_machine_unregister()
568 snd_sof_machine_select(struct snd_sof_dev *sdev) in snd_sof_machine_select() argument
570 if (sof_ops(sdev) && sof_ops(sdev)->machine_select) in snd_sof_machine_select()
571 return sof_ops(sdev)->machine_select(sdev); in snd_sof_machine_select()
578 struct snd_sof_dev *sdev) in snd_sof_set_mach_params() argument
580 if (sof_ops(sdev) && sof_ops(sdev)->set_mach_params) in snd_sof_set_mach_params()
581 sof_ops(sdev)->set_mach_params(mach, sdev); in snd_sof_set_mach_params()
585 snd_sof_is_chain_dma_supported(struct snd_sof_dev *sdev, u32 dai_type) in snd_sof_is_chain_dma_supported() argument
587 if (sof_ops(sdev) && sof_ops(sdev)->is_chain_dma_supported) in snd_sof_is_chain_dma_supported()
588 return sof_ops(sdev)->is_chain_dma_supported(sdev, dai_type); in snd_sof_is_chain_dma_supported()
611 #define snd_sof_dsp_read_poll_timeout(sdev, bar, offset, val, cond, sleep_us, timeout_us) \ argument
618 (val) = snd_sof_dsp_read(sdev, bar, offset); \
620 dev_dbg(sdev->dev, \
627 (val) = snd_sof_dsp_read(sdev, bar, offset); \
628 dev_dbg(sdev->dev, \
640 bool snd_sof_pci_update_bits(struct snd_sof_dev *sdev, u32 offset,
643 bool snd_sof_dsp_update_bits_unlocked(struct snd_sof_dev *sdev, u32 bar,
646 bool snd_sof_dsp_update_bits64_unlocked(struct snd_sof_dev *sdev, u32 bar,
649 bool snd_sof_dsp_update_bits(struct snd_sof_dev *sdev, u32 bar, u32 offset,
652 bool snd_sof_dsp_update_bits64(struct snd_sof_dev *sdev, u32 bar,
655 void snd_sof_dsp_update_bits_forced(struct snd_sof_dev *sdev, u32 bar,
658 int snd_sof_dsp_register_poll(struct snd_sof_dev *sdev, u32 bar, u32 offset,
662 void snd_sof_dsp_panic(struct snd_sof_dev *sdev, u32 offset, bool non_recoverable);