Lines Matching refs:sdev
21 #define sof_ops(sdev) \
22 ((sdev)->pdata->desc->ops)
24 static inline int sof_ops_init(struct snd_sof_dev *sdev)
26 if (sdev->pdata->desc->ops_init)
27 return sdev->pdata->desc->ops_init(sdev);
32 static inline void sof_ops_free(struct snd_sof_dev *sdev)
34 if (sdev->pdata->desc->ops_free)
35 sdev->pdata->desc->ops_free(sdev);
41 static inline int snd_sof_probe_early(struct snd_sof_dev *sdev)
43 if (sof_ops(sdev)->probe_early)
44 return sof_ops(sdev)->probe_early(sdev);
49 static inline int snd_sof_probe(struct snd_sof_dev *sdev)
51 return sof_ops(sdev)->probe(sdev);
54 static inline void snd_sof_remove(struct snd_sof_dev *sdev)
56 if (sof_ops(sdev)->remove)
57 sof_ops(sdev)->remove(sdev);
60 static inline void snd_sof_remove_late(struct snd_sof_dev *sdev)
62 if (sof_ops(sdev)->remove_late)
63 sof_ops(sdev)->remove_late(sdev);
66 static inline int snd_sof_shutdown(struct snd_sof_dev *sdev)
68 if (sof_ops(sdev)->shutdown)
69 return sof_ops(sdev)->shutdown(sdev);
80 static inline int snd_sof_dsp_run(struct snd_sof_dev *sdev)
82 return sof_ops(sdev)->run(sdev);
85 static inline int snd_sof_dsp_stall(struct snd_sof_dev *sdev, unsigned int core_mask)
87 if (sof_ops(sdev)->stall)
88 return sof_ops(sdev)->stall(sdev, core_mask);
93 static inline int snd_sof_dsp_reset(struct snd_sof_dev *sdev)
95 if (sof_ops(sdev)->reset)
96 return sof_ops(sdev)->reset(sdev);
102 static inline int snd_sof_dsp_core_get(struct snd_sof_dev *sdev, int core)
104 if (core > sdev->num_cores - 1) {
105 dev_err(sdev->dev, "invalid core id: %d for num_cores: %d\n", core,
106 sdev->num_cores);
110 if (sof_ops(sdev)->core_get) {
114 if (sdev->dsp_core_ref_count[core] > 0) {
115 sdev->dsp_core_ref_count[core]++;
120 ret = sof_ops(sdev)->core_get(sdev, core);
125 sdev->dsp_core_ref_count[core]++;
128 sdev->enabled_cores_mask |= BIT(core);
130 dev_dbg(sdev->dev, "Core %d powered up\n", core);
136 static inline int snd_sof_dsp_core_put(struct snd_sof_dev *sdev, int core)
138 if (core > sdev->num_cores - 1) {
139 dev_err(sdev->dev, "invalid core id: %d for num_cores: %d\n", core,
140 sdev->num_cores);
144 if (sof_ops(sdev)->core_put) {
148 if (--(sdev->dsp_core_ref_count[core]) > 0)
152 ret = sof_ops(sdev)->core_put(sdev, core);
157 sdev->enabled_cores_mask &= ~BIT(core);
159 dev_dbg(sdev->dev, "Core %d powered down\n", core);
166 static inline int snd_sof_dsp_pre_fw_run(struct snd_sof_dev *sdev)
168 if (sof_ops(sdev)->pre_fw_run)
169 return sof_ops(sdev)->pre_fw_run(sdev);
174 static inline int snd_sof_dsp_post_fw_run(struct snd_sof_dev *sdev)
176 if (sof_ops(sdev)->post_fw_run)
177 return sof_ops(sdev)->post_fw_run(sdev);
183 static inline int snd_sof_dsp_parse_platform_ext_manifest(struct snd_sof_dev *sdev,
186 if (sof_ops(sdev)->parse_platform_ext_manifest)
187 return sof_ops(sdev)->parse_platform_ext_manifest(sdev, hdr);
197 * @sdev: sof device
203 static inline int snd_sof_dsp_get_bar_index(struct snd_sof_dev *sdev, u32 type)
205 if (sof_ops(sdev)->get_bar_index)
206 return sof_ops(sdev)->get_bar_index(sdev, type);
208 return sdev->mmio_bar;
211 static inline int snd_sof_dsp_get_mailbox_offset(struct snd_sof_dev *sdev)
213 if (sof_ops(sdev)->get_mailbox_offset)
214 return sof_ops(sdev)->get_mailbox_offset(sdev);
216 dev_err(sdev->dev, "error: %s not defined\n", __func__);
220 static inline int snd_sof_dsp_get_window_offset(struct snd_sof_dev *sdev,
223 if (sof_ops(sdev)->get_window_offset)
224 return sof_ops(sdev)->get_window_offset(sdev, id);
226 dev_err(sdev->dev, "error: %s not defined\n", __func__);
230 static inline int snd_sof_dsp_resume(struct snd_sof_dev *sdev)
232 if (sof_ops(sdev)->resume)
233 return sof_ops(sdev)->resume(sdev);
238 static inline int snd_sof_dsp_suspend(struct snd_sof_dev *sdev,
241 if (sof_ops(sdev)->suspend)
242 return sof_ops(sdev)->suspend(sdev, target_state);
247 static inline int snd_sof_dsp_runtime_resume(struct snd_sof_dev *sdev)
249 if (sof_ops(sdev)->runtime_resume)
250 return sof_ops(sdev)->runtime_resume(sdev);
255 static inline int snd_sof_dsp_runtime_suspend(struct snd_sof_dev *sdev)
257 if (sof_ops(sdev)->runtime_suspend)
258 return sof_ops(sdev)->runtime_suspend(sdev);
263 static inline int snd_sof_dsp_runtime_idle(struct snd_sof_dev *sdev)
265 if (sof_ops(sdev)->runtime_idle)
266 return sof_ops(sdev)->runtime_idle(sdev);
271 static inline int snd_sof_dsp_hw_params_upon_resume(struct snd_sof_dev *sdev)
273 if (sof_ops(sdev)->set_hw_params_upon_resume)
274 return sof_ops(sdev)->set_hw_params_upon_resume(sdev);
278 static inline int snd_sof_dsp_set_clk(struct snd_sof_dev *sdev, u32 freq)
280 if (sof_ops(sdev)->set_clk)
281 return sof_ops(sdev)->set_clk(sdev, freq);
287 snd_sof_dsp_set_power_state(struct snd_sof_dev *sdev,
290 guard(mutex)(&sdev->power_state_access);
292 if (sof_ops(sdev)->set_power_state)
293 return sof_ops(sdev)->set_power_state(sdev, target_state);
299 void snd_sof_dsp_dbg_dump(struct snd_sof_dev *sdev, const char *msg, u32 flags);
301 static inline int snd_sof_debugfs_add_region_item(struct snd_sof_dev *sdev,
305 if (sof_ops(sdev) && sof_ops(sdev)->debugfs_add_region_item)
306 return sof_ops(sdev)->debugfs_add_region_item(sdev, blk_type, offset,
313 static inline void snd_sof_dsp_write8(struct snd_sof_dev *sdev, u32 bar,
316 if (sof_ops(sdev)->write8)
317 sof_ops(sdev)->write8(sdev, sdev->bar[bar] + offset, value);
319 writeb(value, sdev->bar[bar] + offset);
322 static inline void snd_sof_dsp_write(struct snd_sof_dev *sdev, u32 bar,
325 if (sof_ops(sdev)->write)
326 sof_ops(sdev)->write(sdev, sdev->bar[bar] + offset, value);
328 writel(value, sdev->bar[bar] + offset);
331 static inline void snd_sof_dsp_write64(struct snd_sof_dev *sdev, u32 bar,
334 if (sof_ops(sdev)->write64)
335 sof_ops(sdev)->write64(sdev, sdev->bar[bar] + offset, value);
337 writeq(value, sdev->bar[bar] + offset);
340 static inline u8 snd_sof_dsp_read8(struct snd_sof_dev *sdev, u32 bar,
343 if (sof_ops(sdev)->read8)
344 return sof_ops(sdev)->read8(sdev, sdev->bar[bar] + offset);
346 return readb(sdev->bar[bar] + offset);
349 static inline u32 snd_sof_dsp_read(struct snd_sof_dev *sdev, u32 bar,
352 if (sof_ops(sdev)->read)
353 return sof_ops(sdev)->read(sdev, sdev->bar[bar] + offset);
355 return readl(sdev->bar[bar] + offset);
358 static inline u64 snd_sof_dsp_read64(struct snd_sof_dev *sdev, u32 bar,
361 if (sof_ops(sdev)->read64)
362 return sof_ops(sdev)->read64(sdev, sdev->bar[bar] + offset);
364 return readq(sdev->bar[bar] + offset);
367 static inline void snd_sof_dsp_update8(struct snd_sof_dev *sdev, u32 bar,
372 reg = snd_sof_dsp_read8(sdev, bar, offset);
375 snd_sof_dsp_write8(sdev, bar, offset, reg);
379 static inline int snd_sof_dsp_block_read(struct snd_sof_dev *sdev,
383 return sof_ops(sdev)->block_read(sdev, blk_type, offset, dest, bytes);
386 static inline int snd_sof_dsp_block_write(struct snd_sof_dev *sdev,
390 return sof_ops(sdev)->block_write(sdev, blk_type, offset, src, bytes);
394 static inline void snd_sof_dsp_mailbox_read(struct snd_sof_dev *sdev,
397 if (sof_ops(sdev)->mailbox_read)
398 sof_ops(sdev)->mailbox_read(sdev, offset, dest, bytes);
401 static inline void snd_sof_dsp_mailbox_write(struct snd_sof_dev *sdev,
404 if (sof_ops(sdev)->mailbox_write)
405 sof_ops(sdev)->mailbox_write(sdev, offset, src, bytes);
409 static inline int snd_sof_dsp_send_msg(struct snd_sof_dev *sdev,
412 return sof_ops(sdev)->send_msg(sdev, msg);
417 snd_sof_pcm_platform_open(struct snd_sof_dev *sdev,
420 if (sof_ops(sdev) && sof_ops(sdev)->pcm_open)
421 return sof_ops(sdev)->pcm_open(sdev, substream);
428 snd_sof_pcm_platform_close(struct snd_sof_dev *sdev,
431 if (sof_ops(sdev) && sof_ops(sdev)->pcm_close)
432 return sof_ops(sdev)->pcm_close(sdev, substream);
439 snd_sof_pcm_platform_hw_params(struct snd_sof_dev *sdev,
444 if (sof_ops(sdev) && sof_ops(sdev)->pcm_hw_params)
445 return sof_ops(sdev)->pcm_hw_params(sdev, substream, params,
453 snd_sof_pcm_platform_hw_free(struct snd_sof_dev *sdev,
456 if (sof_ops(sdev) && sof_ops(sdev)->pcm_hw_free)
457 return sof_ops(sdev)->pcm_hw_free(sdev, substream);
464 snd_sof_pcm_platform_trigger(struct snd_sof_dev *sdev,
467 if (sof_ops(sdev) && sof_ops(sdev)->pcm_trigger)
468 return sof_ops(sdev)->pcm_trigger(sdev, substream, cmd);
474 static inline int snd_sof_load_firmware(struct snd_sof_dev *sdev)
476 dev_dbg(sdev->dev, "loading firmware\n");
478 return sof_ops(sdev)->load_firmware(sdev);
482 static inline int snd_sof_ipc_msg_data(struct snd_sof_dev *sdev,
486 return sof_ops(sdev)->ipc_msg_data(sdev, sps, p, sz);
490 snd_sof_set_stream_data_offset(struct snd_sof_dev *sdev,
494 if (sof_ops(sdev) && sof_ops(sdev)->set_stream_data_offset)
495 return sof_ops(sdev)->set_stream_data_offset(sdev, sps,
503 snd_sof_pcm_platform_pointer(struct snd_sof_dev *sdev,
506 if (sof_ops(sdev) && sof_ops(sdev)->pcm_pointer)
507 return sof_ops(sdev)->pcm_pointer(sdev, substream);
513 static inline int snd_sof_pcm_platform_ack(struct snd_sof_dev *sdev,
516 if (sof_ops(sdev) && sof_ops(sdev)->pcm_ack)
517 return sof_ops(sdev)->pcm_ack(sdev, substream);
523 snd_sof_pcm_get_dai_frame_counter(struct snd_sof_dev *sdev,
527 if (sof_ops(sdev) && sof_ops(sdev)->get_dai_frame_counter)
528 return sof_ops(sdev)->get_dai_frame_counter(sdev, component,
535 snd_sof_pcm_get_host_byte_counter(struct snd_sof_dev *sdev,
539 if (sof_ops(sdev) && sof_ops(sdev)->get_host_byte_counter)
540 return sof_ops(sdev)->get_host_byte_counter(sdev, component,
548 snd_sof_machine_register(struct snd_sof_dev *sdev, void *pdata)
550 if (sof_ops(sdev) && sof_ops(sdev)->machine_register)
551 return sof_ops(sdev)->machine_register(sdev, pdata);
557 snd_sof_machine_unregister(struct snd_sof_dev *sdev, void *pdata)
559 if (sof_ops(sdev) && sof_ops(sdev)->machine_unregister)
560 sof_ops(sdev)->machine_unregister(sdev, pdata);
564 snd_sof_machine_select(struct snd_sof_dev *sdev)
566 if (sof_ops(sdev) && sof_ops(sdev)->machine_select)
567 return sof_ops(sdev)->machine_select(sdev);
574 struct snd_sof_dev *sdev)
576 if (sof_ops(sdev) && sof_ops(sdev)->set_mach_params)
577 sof_ops(sdev)->set_mach_params(mach, sdev);
581 snd_sof_is_chain_dma_supported(struct snd_sof_dev *sdev, u32 dai_type)
583 if (sof_ops(sdev) && sof_ops(sdev)->is_chain_dma_supported)
584 return sof_ops(sdev)->is_chain_dma_supported(sdev, dai_type);
607 #define snd_sof_dsp_read_poll_timeout(sdev, bar, offset, val, cond, sleep_us, timeout_us) \
614 (val) = snd_sof_dsp_read(sdev, bar, offset); \
616 dev_dbg(sdev->dev, \
623 (val) = snd_sof_dsp_read(sdev, bar, offset); \
624 dev_dbg(sdev->dev, \
636 bool snd_sof_pci_update_bits(struct snd_sof_dev *sdev, u32 offset,
639 bool snd_sof_dsp_update_bits_unlocked(struct snd_sof_dev *sdev, u32 bar,
642 bool snd_sof_dsp_update_bits64_unlocked(struct snd_sof_dev *sdev, u32 bar,
645 bool snd_sof_dsp_update_bits(struct snd_sof_dev *sdev, u32 bar, u32 offset,
648 bool snd_sof_dsp_update_bits64(struct snd_sof_dev *sdev, u32 bar,
651 void snd_sof_dsp_update_bits_forced(struct snd_sof_dev *sdev, u32 bar,
654 int snd_sof_dsp_register_poll(struct snd_sof_dev *sdev, u32 bar, u32 offset,
658 void snd_sof_dsp_panic(struct snd_sof_dev *sdev, u32 offset, bool non_recoverable);