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(struct snd_sof_dev *sdev) in snd_sof_probe() argument
43 return sof_ops(sdev)->probe(sdev); in snd_sof_probe()
46 static inline int snd_sof_remove(struct snd_sof_dev *sdev) in snd_sof_remove() argument
48 if (sof_ops(sdev)->remove) in snd_sof_remove()
49 return sof_ops(sdev)->remove(sdev); in snd_sof_remove()
54 static inline int snd_sof_shutdown(struct snd_sof_dev *sdev) in snd_sof_shutdown() argument
56 if (sof_ops(sdev)->shutdown) in snd_sof_shutdown()
57 return sof_ops(sdev)->shutdown(sdev); in snd_sof_shutdown()
68 static inline int snd_sof_dsp_run(struct snd_sof_dev *sdev) in snd_sof_dsp_run() argument
70 return sof_ops(sdev)->run(sdev); in snd_sof_dsp_run()
73 static inline int snd_sof_dsp_stall(struct snd_sof_dev *sdev, unsigned int core_mask) in snd_sof_dsp_stall() argument
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()
81 static inline int snd_sof_dsp_reset(struct snd_sof_dev *sdev) in snd_sof_dsp_reset() argument
83 if (sof_ops(sdev)->reset) in snd_sof_dsp_reset()
84 return sof_ops(sdev)->reset(sdev); in snd_sof_dsp_reset()
90 static inline int snd_sof_dsp_core_get(struct snd_sof_dev *sdev, int core) in snd_sof_dsp_core_get() argument
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()
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()
124 static inline int snd_sof_dsp_core_put(struct snd_sof_dev *sdev, int core) in snd_sof_dsp_core_put() argument
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()
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()
154 static inline int snd_sof_dsp_pre_fw_run(struct snd_sof_dev *sdev) in snd_sof_dsp_pre_fw_run() argument
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()
162 static inline int snd_sof_dsp_post_fw_run(struct snd_sof_dev *sdev) in snd_sof_dsp_post_fw_run() argument
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()
171 static inline int snd_sof_dsp_parse_platform_ext_manifest(struct snd_sof_dev *sdev, in snd_sof_dsp_parse_platform_ext_manifest() argument
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()
191 static inline int snd_sof_dsp_get_bar_index(struct snd_sof_dev *sdev, u32 type) in snd_sof_dsp_get_bar_index() argument
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()
199 static inline int snd_sof_dsp_get_mailbox_offset(struct snd_sof_dev *sdev) in snd_sof_dsp_get_mailbox_offset() argument
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()
208 static inline int snd_sof_dsp_get_window_offset(struct snd_sof_dev *sdev, in snd_sof_dsp_get_window_offset() argument
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()
218 static inline int snd_sof_dsp_resume(struct snd_sof_dev *sdev) in snd_sof_dsp_resume() argument
220 if (sof_ops(sdev)->resume) in snd_sof_dsp_resume()
221 return sof_ops(sdev)->resume(sdev); in snd_sof_dsp_resume()
226 static inline int snd_sof_dsp_suspend(struct snd_sof_dev *sdev, in snd_sof_dsp_suspend() argument
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()
235 static inline int snd_sof_dsp_runtime_resume(struct snd_sof_dev *sdev) in snd_sof_dsp_runtime_resume() argument
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()
243 static inline int snd_sof_dsp_runtime_suspend(struct snd_sof_dev *sdev) in snd_sof_dsp_runtime_suspend() argument
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()
251 static inline int snd_sof_dsp_runtime_idle(struct snd_sof_dev *sdev) in snd_sof_dsp_runtime_idle() argument
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()
259 static inline int snd_sof_dsp_hw_params_upon_resume(struct snd_sof_dev *sdev) in snd_sof_dsp_hw_params_upon_resume() argument
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()
266 static inline int snd_sof_dsp_set_clk(struct snd_sof_dev *sdev, u32 freq) in snd_sof_dsp_set_clk() argument
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()
275 snd_sof_dsp_set_power_state(struct snd_sof_dev *sdev, in snd_sof_dsp_set_power_state() argument
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()
291 void snd_sof_dsp_dbg_dump(struct snd_sof_dev *sdev, const char *msg, u32 flags);
293 static inline int snd_sof_debugfs_add_region_item(struct snd_sof_dev *sdev, in snd_sof_debugfs_add_region_item() argument
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()
305 static inline void snd_sof_dsp_write8(struct snd_sof_dev *sdev, u32 bar, in snd_sof_dsp_write8() argument
308 if (sof_ops(sdev)->write8) in snd_sof_dsp_write8()
309 sof_ops(sdev)->write8(sdev, sdev->bar[bar] + offset, value); in snd_sof_dsp_write8()
311 writeb(value, sdev->bar[bar] + offset); in snd_sof_dsp_write8()
314 static inline void snd_sof_dsp_write(struct snd_sof_dev *sdev, u32 bar, in snd_sof_dsp_write() argument
317 if (sof_ops(sdev)->write) in snd_sof_dsp_write()
318 sof_ops(sdev)->write(sdev, sdev->bar[bar] + offset, value); in snd_sof_dsp_write()
320 writel(value, sdev->bar[bar] + offset); in snd_sof_dsp_write()
323 static inline void snd_sof_dsp_write64(struct snd_sof_dev *sdev, u32 bar, in snd_sof_dsp_write64() argument
326 if (sof_ops(sdev)->write64) in snd_sof_dsp_write64()
327 sof_ops(sdev)->write64(sdev, sdev->bar[bar] + offset, value); in snd_sof_dsp_write64()
329 writeq(value, sdev->bar[bar] + offset); in snd_sof_dsp_write64()
332 static inline u8 snd_sof_dsp_read8(struct snd_sof_dev *sdev, u32 bar, in snd_sof_dsp_read8() argument
335 if (sof_ops(sdev)->read8) in snd_sof_dsp_read8()
336 return sof_ops(sdev)->read8(sdev, sdev->bar[bar] + offset); in snd_sof_dsp_read8()
338 return readb(sdev->bar[bar] + offset); in snd_sof_dsp_read8()
341 static inline u32 snd_sof_dsp_read(struct snd_sof_dev *sdev, u32 bar, in snd_sof_dsp_read() argument
344 if (sof_ops(sdev)->read) in snd_sof_dsp_read()
345 return sof_ops(sdev)->read(sdev, sdev->bar[bar] + offset); in snd_sof_dsp_read()
347 return readl(sdev->bar[bar] + offset); in snd_sof_dsp_read()
350 static inline u64 snd_sof_dsp_read64(struct snd_sof_dev *sdev, u32 bar, in snd_sof_dsp_read64() argument
353 if (sof_ops(sdev)->read64) in snd_sof_dsp_read64()
354 return sof_ops(sdev)->read64(sdev, sdev->bar[bar] + offset); in snd_sof_dsp_read64()
356 return readq(sdev->bar[bar] + offset); in snd_sof_dsp_read64()
359 static inline void snd_sof_dsp_update8(struct snd_sof_dev *sdev, u32 bar, in snd_sof_dsp_update8() argument
364 reg = snd_sof_dsp_read8(sdev, bar, offset); in snd_sof_dsp_update8()
367 snd_sof_dsp_write8(sdev, bar, offset, reg); in snd_sof_dsp_update8()
371 static inline int snd_sof_dsp_block_read(struct snd_sof_dev *sdev, in snd_sof_dsp_block_read() argument
375 return sof_ops(sdev)->block_read(sdev, blk_type, offset, dest, bytes); in snd_sof_dsp_block_read()
378 static inline int snd_sof_dsp_block_write(struct snd_sof_dev *sdev, in snd_sof_dsp_block_write() argument
382 return sof_ops(sdev)->block_write(sdev, blk_type, offset, src, bytes); in snd_sof_dsp_block_write()
386 static inline void snd_sof_dsp_mailbox_read(struct snd_sof_dev *sdev, in snd_sof_dsp_mailbox_read() argument
389 if (sof_ops(sdev)->mailbox_read) in snd_sof_dsp_mailbox_read()
390 sof_ops(sdev)->mailbox_read(sdev, offset, dest, bytes); in snd_sof_dsp_mailbox_read()
393 static inline void snd_sof_dsp_mailbox_write(struct snd_sof_dev *sdev, in snd_sof_dsp_mailbox_write() argument
396 if (sof_ops(sdev)->mailbox_write) in snd_sof_dsp_mailbox_write()
397 sof_ops(sdev)->mailbox_write(sdev, offset, src, bytes); in snd_sof_dsp_mailbox_write()
401 static inline int snd_sof_dsp_send_msg(struct snd_sof_dev *sdev, in snd_sof_dsp_send_msg() argument
404 return sof_ops(sdev)->send_msg(sdev, msg); in snd_sof_dsp_send_msg()
409 snd_sof_pcm_platform_open(struct snd_sof_dev *sdev, in snd_sof_pcm_platform_open() argument
412 if (sof_ops(sdev) && sof_ops(sdev)->pcm_open) in snd_sof_pcm_platform_open()
413 return sof_ops(sdev)->pcm_open(sdev, substream); in snd_sof_pcm_platform_open()
420 snd_sof_pcm_platform_close(struct snd_sof_dev *sdev, in snd_sof_pcm_platform_close() argument
423 if (sof_ops(sdev) && sof_ops(sdev)->pcm_close) in snd_sof_pcm_platform_close()
424 return sof_ops(sdev)->pcm_close(sdev, substream); in snd_sof_pcm_platform_close()
431 snd_sof_pcm_platform_hw_params(struct snd_sof_dev *sdev, in snd_sof_pcm_platform_hw_params() argument
436 if (sof_ops(sdev) && sof_ops(sdev)->pcm_hw_params) in snd_sof_pcm_platform_hw_params()
437 return sof_ops(sdev)->pcm_hw_params(sdev, substream, params, in snd_sof_pcm_platform_hw_params()
445 snd_sof_pcm_platform_hw_free(struct snd_sof_dev *sdev, in snd_sof_pcm_platform_hw_free() argument
448 if (sof_ops(sdev) && sof_ops(sdev)->pcm_hw_free) in snd_sof_pcm_platform_hw_free()
449 return sof_ops(sdev)->pcm_hw_free(sdev, substream); in snd_sof_pcm_platform_hw_free()
456 snd_sof_pcm_platform_trigger(struct snd_sof_dev *sdev, in snd_sof_pcm_platform_trigger() argument
459 if (sof_ops(sdev) && sof_ops(sdev)->pcm_trigger) in snd_sof_pcm_platform_trigger()
460 return sof_ops(sdev)->pcm_trigger(sdev, substream, cmd); in snd_sof_pcm_platform_trigger()
466 static inline int snd_sof_load_firmware(struct snd_sof_dev *sdev) in snd_sof_load_firmware() argument
468 dev_dbg(sdev->dev, "loading firmware\n"); in snd_sof_load_firmware()
470 return sof_ops(sdev)->load_firmware(sdev); in snd_sof_load_firmware()
474 static inline int snd_sof_ipc_msg_data(struct snd_sof_dev *sdev, in snd_sof_ipc_msg_data() argument
478 return sof_ops(sdev)->ipc_msg_data(sdev, sps, p, sz); in snd_sof_ipc_msg_data()
482 snd_sof_set_stream_data_offset(struct snd_sof_dev *sdev, in snd_sof_set_stream_data_offset() argument
486 if (sof_ops(sdev) && sof_ops(sdev)->set_stream_data_offset) in snd_sof_set_stream_data_offset()
487 return sof_ops(sdev)->set_stream_data_offset(sdev, sps, in snd_sof_set_stream_data_offset()
495 snd_sof_pcm_platform_pointer(struct snd_sof_dev *sdev, in snd_sof_pcm_platform_pointer() argument
498 if (sof_ops(sdev) && sof_ops(sdev)->pcm_pointer) in snd_sof_pcm_platform_pointer()
499 return sof_ops(sdev)->pcm_pointer(sdev, substream); in snd_sof_pcm_platform_pointer()
505 static inline int snd_sof_pcm_platform_ack(struct snd_sof_dev *sdev, in snd_sof_pcm_platform_ack() argument
508 if (sof_ops(sdev) && sof_ops(sdev)->pcm_ack) in snd_sof_pcm_platform_ack()
509 return sof_ops(sdev)->pcm_ack(sdev, substream); in snd_sof_pcm_platform_ack()
514 static inline u64 snd_sof_pcm_get_stream_position(struct snd_sof_dev *sdev, in snd_sof_pcm_get_stream_position() argument
518 if (sof_ops(sdev) && sof_ops(sdev)->get_stream_position) in snd_sof_pcm_get_stream_position()
519 return sof_ops(sdev)->get_stream_position(sdev, component, substream); in snd_sof_pcm_get_stream_position()
526 snd_sof_machine_register(struct snd_sof_dev *sdev, void *pdata) in snd_sof_machine_register() argument
528 if (sof_ops(sdev) && sof_ops(sdev)->machine_register) in snd_sof_machine_register()
529 return sof_ops(sdev)->machine_register(sdev, pdata); in snd_sof_machine_register()
535 snd_sof_machine_unregister(struct snd_sof_dev *sdev, void *pdata) in snd_sof_machine_unregister() argument
537 if (sof_ops(sdev) && sof_ops(sdev)->machine_unregister) in snd_sof_machine_unregister()
538 sof_ops(sdev)->machine_unregister(sdev, pdata); in snd_sof_machine_unregister()
542 snd_sof_machine_select(struct snd_sof_dev *sdev) in snd_sof_machine_select() argument
544 if (sof_ops(sdev) && sof_ops(sdev)->machine_select) in snd_sof_machine_select()
545 return sof_ops(sdev)->machine_select(sdev); in snd_sof_machine_select()
552 struct snd_sof_dev *sdev) in snd_sof_set_mach_params() argument
554 if (sof_ops(sdev) && sof_ops(sdev)->set_mach_params) in snd_sof_set_mach_params()
555 sof_ops(sdev)->set_mach_params(mach, sdev); in snd_sof_set_mach_params()
576 #define snd_sof_dsp_read_poll_timeout(sdev, bar, offset, val, cond, sleep_us, timeout_us) \ argument
583 (val) = snd_sof_dsp_read(sdev, bar, offset); \
585 dev_dbg(sdev->dev, \
592 (val) = snd_sof_dsp_read(sdev, bar, offset); \
593 dev_dbg(sdev->dev, \
605 bool snd_sof_pci_update_bits(struct snd_sof_dev *sdev, u32 offset,
608 bool snd_sof_dsp_update_bits_unlocked(struct snd_sof_dev *sdev, u32 bar,
611 bool snd_sof_dsp_update_bits64_unlocked(struct snd_sof_dev *sdev, u32 bar,
614 bool snd_sof_dsp_update_bits(struct snd_sof_dev *sdev, u32 bar, u32 offset,
617 bool snd_sof_dsp_update_bits64(struct snd_sof_dev *sdev, u32 bar,
620 void snd_sof_dsp_update_bits_forced(struct snd_sof_dev *sdev, u32 bar,
623 int snd_sof_dsp_register_poll(struct snd_sof_dev *sdev, u32 bar, u32 offset,
627 void snd_sof_dsp_panic(struct snd_sof_dev *sdev, u32 offset, bool non_recoverable);