0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef __SOUND_SOC_SOF_PRIV_H
0012 #define __SOUND_SOC_SOF_PRIV_H
0013
0014 #include <linux/device.h>
0015 #include <sound/hdaudio.h>
0016 #include <sound/sof.h>
0017 #include <sound/sof/info.h>
0018 #include <sound/sof/pm.h>
0019 #include <sound/sof/trace.h>
0020 #include <uapi/sound/sof/fw.h>
0021 #include <sound/sof/ext_manifest.h>
0022
0023
0024 #define SOF_DBG_ENABLE_TRACE BIT(0)
0025 #define SOF_DBG_RETAIN_CTX BIT(1)
0026 #define SOF_DBG_VERIFY_TPLG BIT(2)
0027 #define SOF_DBG_DYNAMIC_PIPELINES_OVERRIDE BIT(3)
0028
0029
0030 #define SOF_DBG_DYNAMIC_PIPELINES_ENABLE BIT(4)
0031
0032
0033 #define SOF_DBG_DISABLE_MULTICORE BIT(5)
0034
0035
0036 #define SOF_DBG_PRINT_ALL_DUMPS BIT(6)
0037 #define SOF_DBG_IGNORE_D3_PERSISTENT BIT(7)
0038
0039
0040 #define SOF_DBG_PRINT_DMA_POSITION_UPDATE_LOGS BIT(8)
0041
0042
0043 #define SOF_DBG_PRINT_IPC_SUCCESS_LOGS BIT(9)
0044
0045
0046
0047
0048 #define SOF_DBG_DUMP_REGS BIT(0)
0049 #define SOF_DBG_DUMP_MBOX BIT(1)
0050 #define SOF_DBG_DUMP_TEXT BIT(2)
0051 #define SOF_DBG_DUMP_PCI BIT(3)
0052
0053 #define SOF_DBG_DUMP_OPTIONAL BIT(4)
0054
0055
0056 bool sof_debug_check_flag(int mask);
0057
0058
0059 #define SND_SOF_BARS 8
0060
0061
0062 #define SND_SOF_SUSPEND_DELAY_MS 2000
0063
0064
0065 #define DMA_BUF_SIZE_FOR_TRACE (PAGE_SIZE * 16)
0066
0067 #define SOF_IPC_DSP_REPLY 0
0068 #define SOF_IPC_HOST_REPLY 1
0069
0070
0071 #define SOF_DAI_STREAM(sname, scmin, scmax, srates, sfmt) \
0072 {.stream_name = sname, .channels_min = scmin, .channels_max = scmax, \
0073 .rates = srates, .formats = sfmt}
0074
0075 #define SOF_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | \
0076 SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_FLOAT)
0077
0078
0079 #define SOF_DSP_PRIMARY_CORE 0
0080
0081
0082 #define SOF_MAX_DSP_NUM_CORES 8
0083
0084 struct sof_dsp_power_state {
0085 u32 state;
0086 u32 substate;
0087 };
0088
0089
0090 enum sof_system_suspend_state {
0091 SOF_SUSPEND_NONE = 0,
0092 SOF_SUSPEND_S0IX,
0093 SOF_SUSPEND_S3,
0094 SOF_SUSPEND_S4,
0095 SOF_SUSPEND_S5,
0096 };
0097
0098 enum sof_dfsentry_type {
0099 SOF_DFSENTRY_TYPE_IOMEM = 0,
0100 SOF_DFSENTRY_TYPE_BUF,
0101 };
0102
0103 enum sof_debugfs_access_type {
0104 SOF_DEBUGFS_ACCESS_ALWAYS = 0,
0105 SOF_DEBUGFS_ACCESS_D0_ONLY,
0106 };
0107
0108 struct snd_sof_dev;
0109 struct snd_sof_ipc_msg;
0110 struct snd_sof_ipc;
0111 struct snd_sof_debugfs_map;
0112 struct snd_soc_tplg_ops;
0113 struct snd_soc_component;
0114 struct snd_sof_pdata;
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124 struct snd_sof_platform_stream_params {
0125 u16 stream_tag;
0126 bool use_phy_address;
0127 u32 phy_addr;
0128 bool no_ipc_position;
0129 bool cont_update_posn;
0130 };
0131
0132
0133
0134
0135
0136
0137 struct snd_sof_dsp_ops {
0138
0139
0140 int (*probe)(struct snd_sof_dev *sof_dev);
0141 int (*remove)(struct snd_sof_dev *sof_dev);
0142 int (*shutdown)(struct snd_sof_dev *sof_dev);
0143
0144
0145 int (*run)(struct snd_sof_dev *sof_dev);
0146 int (*stall)(struct snd_sof_dev *sof_dev, unsigned int core_mask);
0147 int (*reset)(struct snd_sof_dev *sof_dev);
0148 int (*core_get)(struct snd_sof_dev *sof_dev, int core);
0149 int (*core_put)(struct snd_sof_dev *sof_dev, int core);
0150
0151
0152
0153
0154
0155
0156 void (*write)(struct snd_sof_dev *sof_dev, void __iomem *addr,
0157 u32 value);
0158 u32 (*read)(struct snd_sof_dev *sof_dev,
0159 void __iomem *addr);
0160 void (*write64)(struct snd_sof_dev *sof_dev, void __iomem *addr,
0161 u64 value);
0162 u64 (*read64)(struct snd_sof_dev *sof_dev,
0163 void __iomem *addr);
0164
0165
0166 int (*block_read)(struct snd_sof_dev *sof_dev,
0167 enum snd_sof_fw_blk_type type, u32 offset,
0168 void *dest, size_t size);
0169 int (*block_write)(struct snd_sof_dev *sof_dev,
0170 enum snd_sof_fw_blk_type type, u32 offset,
0171 void *src, size_t size);
0172
0173
0174 void (*mailbox_read)(struct snd_sof_dev *sof_dev,
0175 u32 offset, void *dest,
0176 size_t size);
0177 void (*mailbox_write)(struct snd_sof_dev *sof_dev,
0178 u32 offset, void *src,
0179 size_t size);
0180
0181
0182 irqreturn_t (*irq_handler)(int irq, void *context);
0183 irqreturn_t (*irq_thread)(int irq, void *context);
0184
0185
0186 int (*send_msg)(struct snd_sof_dev *sof_dev,
0187 struct snd_sof_ipc_msg *msg);
0188
0189
0190 int (*load_firmware)(struct snd_sof_dev *sof_dev);
0191 int (*load_module)(struct snd_sof_dev *sof_dev,
0192 struct snd_sof_mod_hdr *hdr);
0193
0194
0195 int (*pcm_open)(struct snd_sof_dev *sdev,
0196 struct snd_pcm_substream *substream);
0197
0198 int (*pcm_close)(struct snd_sof_dev *sdev,
0199 struct snd_pcm_substream *substream);
0200
0201
0202 int (*pcm_hw_params)(struct snd_sof_dev *sdev,
0203 struct snd_pcm_substream *substream,
0204 struct snd_pcm_hw_params *params,
0205 struct snd_sof_platform_stream_params *platform_params);
0206
0207
0208 int (*pcm_hw_free)(struct snd_sof_dev *sdev,
0209 struct snd_pcm_substream *substream);
0210
0211
0212 int (*pcm_trigger)(struct snd_sof_dev *sdev,
0213 struct snd_pcm_substream *substream,
0214 int cmd);
0215
0216
0217 snd_pcm_uframes_t (*pcm_pointer)(struct snd_sof_dev *sdev,
0218 struct snd_pcm_substream *substream);
0219
0220
0221 int (*pcm_ack)(struct snd_sof_dev *sdev, struct snd_pcm_substream *substream);
0222
0223
0224 int (*ipc_msg_data)(struct snd_sof_dev *sdev,
0225 struct snd_pcm_substream *substream,
0226 void *p, size_t sz);
0227
0228
0229 int (*set_stream_data_offset)(struct snd_sof_dev *sdev,
0230 struct snd_pcm_substream *substream,
0231 size_t posn_offset);
0232
0233
0234 int (*pre_fw_run)(struct snd_sof_dev *sof_dev);
0235 int (*post_fw_run)(struct snd_sof_dev *sof_dev);
0236
0237
0238 int (*parse_platform_ext_manifest)(struct snd_sof_dev *sof_dev,
0239 const struct sof_ext_man_elem_header *hdr);
0240
0241
0242 int (*suspend)(struct snd_sof_dev *sof_dev,
0243 u32 target_state);
0244 int (*resume)(struct snd_sof_dev *sof_dev);
0245 int (*runtime_suspend)(struct snd_sof_dev *sof_dev);
0246 int (*runtime_resume)(struct snd_sof_dev *sof_dev);
0247 int (*runtime_idle)(struct snd_sof_dev *sof_dev);
0248 int (*set_hw_params_upon_resume)(struct snd_sof_dev *sdev);
0249 int (*set_power_state)(struct snd_sof_dev *sdev,
0250 const struct sof_dsp_power_state *target_state);
0251
0252
0253 int (*set_clk)(struct snd_sof_dev *sof_dev, u32 freq);
0254
0255
0256 const struct snd_sof_debugfs_map *debug_map;
0257 int debug_map_count;
0258 void (*dbg_dump)(struct snd_sof_dev *sof_dev,
0259 u32 flags);
0260 void (*ipc_dump)(struct snd_sof_dev *sof_dev);
0261 int (*debugfs_add_region_item)(struct snd_sof_dev *sdev,
0262 enum snd_sof_fw_blk_type blk_type, u32 offset,
0263 size_t size, const char *name,
0264 enum sof_debugfs_access_type access_type);
0265
0266
0267 int (*trace_init)(struct snd_sof_dev *sdev,
0268 struct snd_dma_buffer *dmatb,
0269 struct sof_ipc_dma_trace_params_ext *dtrace_params);
0270 int (*trace_release)(struct snd_sof_dev *sdev);
0271 int (*trace_trigger)(struct snd_sof_dev *sdev,
0272 int cmd);
0273
0274
0275 int (*get_bar_index)(struct snd_sof_dev *sdev,
0276 u32 type);
0277 int (*get_mailbox_offset)(struct snd_sof_dev *sdev);
0278 int (*get_window_offset)(struct snd_sof_dev *sdev,
0279 u32 id);
0280
0281
0282 int (*machine_register)(struct snd_sof_dev *sdev,
0283 void *pdata);
0284 void (*machine_unregister)(struct snd_sof_dev *sdev,
0285 void *pdata);
0286 struct snd_soc_acpi_mach * (*machine_select)(struct snd_sof_dev *sdev);
0287 void (*set_mach_params)(struct snd_soc_acpi_mach *mach,
0288 struct snd_sof_dev *sdev);
0289
0290
0291 int (*register_ipc_clients)(struct snd_sof_dev *sdev);
0292 void (*unregister_ipc_clients)(struct snd_sof_dev *sdev);
0293
0294
0295 struct snd_soc_dai_driver *drv;
0296 int num_drv;
0297
0298
0299 u32 hw_info;
0300
0301 const struct dsp_arch_ops *dsp_arch_ops;
0302 };
0303
0304
0305 struct dsp_arch_ops {
0306 void (*dsp_oops)(struct snd_sof_dev *sdev, const char *level, void *oops);
0307 void (*dsp_stack)(struct snd_sof_dev *sdev, const char *level, void *oops,
0308 u32 *stack, u32 stack_words);
0309 };
0310
0311 #define sof_dsp_arch_ops(sdev) ((sdev)->pdata->desc->ops->dsp_arch_ops)
0312
0313
0314 struct snd_sof_dfsentry {
0315 size_t size;
0316 size_t buf_data_size;
0317 enum sof_dfsentry_type type;
0318
0319
0320
0321
0322
0323 enum sof_debugfs_access_type access_type;
0324 #if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_ENABLE_DEBUGFS_CACHE)
0325 char *cache_buf;
0326 #endif
0327 struct snd_sof_dev *sdev;
0328 struct list_head list;
0329 union {
0330 void __iomem *io_mem;
0331 void *buf;
0332 };
0333 };
0334
0335
0336 struct snd_sof_debugfs_map {
0337 const char *name;
0338 u32 bar;
0339 u32 offset;
0340 u32 size;
0341
0342
0343
0344
0345 enum sof_debugfs_access_type access_type;
0346 };
0347
0348
0349 struct snd_sof_mailbox {
0350 u32 offset;
0351 size_t size;
0352 };
0353
0354
0355 struct snd_sof_ipc_msg {
0356
0357 void *msg_data;
0358 void *reply_data;
0359 size_t msg_size;
0360 size_t reply_size;
0361 int reply_error;
0362
0363
0364 void *rx_data;
0365
0366 wait_queue_head_t waitq;
0367 bool ipc_complete;
0368 };
0369
0370
0371
0372
0373
0374
0375
0376
0377
0378 struct sof_ipc_fw_tracing_ops {
0379 int (*init)(struct snd_sof_dev *sdev);
0380 void (*free)(struct snd_sof_dev *sdev);
0381 void (*fw_crashed)(struct snd_sof_dev *sdev);
0382 void (*suspend)(struct snd_sof_dev *sdev, pm_message_t pm_state);
0383 int (*resume)(struct snd_sof_dev *sdev);
0384 };
0385
0386
0387
0388
0389
0390
0391
0392 struct sof_ipc_pm_ops {
0393 int (*ctx_save)(struct snd_sof_dev *sdev);
0394 int (*ctx_restore)(struct snd_sof_dev *sdev);
0395 int (*set_core_state)(struct snd_sof_dev *sdev, int core_idx, bool on);
0396 };
0397
0398
0399
0400
0401
0402
0403
0404
0405
0406
0407
0408
0409
0410 struct sof_ipc_fw_loader_ops {
0411 int (*validate)(struct snd_sof_dev *sdev);
0412 size_t (*parse_ext_manifest)(struct snd_sof_dev *sdev);
0413 int (*load_fw_to_dsp)(struct snd_sof_dev *sdev);
0414 int (*query_fw_configuration)(struct snd_sof_dev *sdev);
0415 };
0416
0417 struct sof_ipc_tplg_ops;
0418 struct sof_ipc_pcm_ops;
0419
0420
0421
0422
0423
0424
0425
0426
0427
0428
0429
0430
0431
0432
0433
0434
0435
0436
0437
0438
0439
0440
0441
0442 struct sof_ipc_ops {
0443 const struct sof_ipc_tplg_ops *tplg;
0444 const struct sof_ipc_pm_ops *pm;
0445 const struct sof_ipc_pcm_ops *pcm;
0446 const struct sof_ipc_fw_loader_ops *fw_loader;
0447 const struct sof_ipc_fw_tracing_ops *fw_tracing;
0448
0449 int (*tx_msg)(struct snd_sof_dev *sdev, void *msg_data, size_t msg_bytes,
0450 void *reply_data, size_t reply_bytes, bool no_pm);
0451 int (*set_get_data)(struct snd_sof_dev *sdev, void *data, size_t data_bytes,
0452 bool set);
0453 int (*get_reply)(struct snd_sof_dev *sdev);
0454 void (*rx_msg)(struct snd_sof_dev *sdev);
0455 };
0456
0457
0458 struct snd_sof_ipc {
0459 struct snd_sof_dev *sdev;
0460
0461
0462 struct mutex tx_mutex;
0463
0464 bool disable_ipc_tx;
0465
0466
0467 size_t max_payload_size;
0468
0469 struct snd_sof_ipc_msg msg;
0470
0471
0472 const struct sof_ipc_ops *ops;
0473 };
0474
0475
0476
0477
0478 struct snd_sof_dev {
0479 struct device *dev;
0480 spinlock_t ipc_lock;
0481 spinlock_t hw_lock;
0482
0483
0484
0485
0486
0487 struct snd_soc_component_driver plat_drv;
0488
0489
0490 struct sof_dsp_power_state dsp_power_state;
0491
0492 struct mutex power_state_access;
0493
0494
0495 enum sof_system_suspend_state system_suspend_target;
0496
0497
0498 wait_queue_head_t boot_wait;
0499 enum sof_fw_state fw_state;
0500 bool first_boot;
0501
0502
0503 struct work_struct probe_work;
0504 bool probe_completed;
0505
0506
0507 struct snd_sof_pdata *pdata;
0508
0509
0510 struct snd_sof_ipc *ipc;
0511 struct snd_sof_mailbox dsp_box;
0512 struct snd_sof_mailbox host_box;
0513 struct snd_sof_mailbox stream_box;
0514 struct snd_sof_mailbox debug_box;
0515 struct snd_sof_ipc_msg *msg;
0516 int ipc_irq;
0517 u32 next_comp_id;
0518
0519
0520 void __iomem *bar[SND_SOF_BARS];
0521 int mmio_bar;
0522 int mailbox_bar;
0523 size_t dsp_oops_offset;
0524
0525
0526 struct dentry *debugfs_root;
0527 struct list_head dfsentry_list;
0528 bool dbg_dump_printed;
0529 bool ipc_dump_printed;
0530
0531
0532 struct sof_ipc_fw_ready fw_ready;
0533 struct sof_ipc_fw_version fw_version;
0534 struct sof_ipc_cc_version *cc_version;
0535
0536
0537 struct snd_soc_tplg_ops *tplg_ops;
0538 struct list_head pcm_list;
0539 struct list_head kcontrol_list;
0540 struct list_head widget_list;
0541 struct list_head dai_list;
0542 struct list_head dai_link_list;
0543 struct list_head route_list;
0544 struct snd_soc_component *component;
0545 u32 enabled_cores_mask;
0546 bool led_present;
0547
0548
0549 struct sof_ipc_window *info_window;
0550
0551
0552 int ipc_timeout;
0553 int boot_timeout;
0554
0555
0556 bool fw_trace_is_supported;
0557 void *fw_trace_data;
0558
0559 bool msi_enabled;
0560
0561
0562 u32 num_cores;
0563
0564
0565
0566
0567
0568
0569
0570
0571 int dsp_core_ref_count[SOF_MAX_DSP_NUM_CORES];
0572
0573
0574
0575
0576
0577 struct list_head ipc_client_list;
0578
0579
0580 struct mutex ipc_client_mutex;
0581
0582
0583
0584
0585
0586 struct list_head ipc_rx_handler_list;
0587
0588
0589
0590
0591
0592 struct list_head fw_state_handler_list;
0593
0594
0595 struct mutex client_event_handler_mutex;
0596
0597 void *private;
0598 };
0599
0600
0601
0602
0603
0604 int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data);
0605 int snd_sof_device_remove(struct device *dev);
0606 int snd_sof_device_shutdown(struct device *dev);
0607 bool snd_sof_device_probe_completed(struct device *dev);
0608
0609 int snd_sof_runtime_suspend(struct device *dev);
0610 int snd_sof_runtime_resume(struct device *dev);
0611 int snd_sof_runtime_idle(struct device *dev);
0612 int snd_sof_resume(struct device *dev);
0613 int snd_sof_suspend(struct device *dev);
0614 int snd_sof_dsp_power_down_notify(struct snd_sof_dev *sdev);
0615 int snd_sof_prepare(struct device *dev);
0616 void snd_sof_complete(struct device *dev);
0617
0618 void snd_sof_new_platform_drv(struct snd_sof_dev *sdev);
0619
0620
0621
0622
0623 extern struct snd_compress_ops sof_compressed_ops;
0624
0625
0626
0627
0628 int snd_sof_load_firmware_raw(struct snd_sof_dev *sdev);
0629 int snd_sof_load_firmware_memcpy(struct snd_sof_dev *sdev);
0630 int snd_sof_run_firmware(struct snd_sof_dev *sdev);
0631 void snd_sof_fw_unload(struct snd_sof_dev *sdev);
0632
0633
0634
0635
0636 struct snd_sof_ipc *snd_sof_ipc_init(struct snd_sof_dev *sdev);
0637 void snd_sof_ipc_free(struct snd_sof_dev *sdev);
0638 void snd_sof_ipc_get_reply(struct snd_sof_dev *sdev);
0639 void snd_sof_ipc_reply(struct snd_sof_dev *sdev, u32 msg_id);
0640 static inline void snd_sof_ipc_msgs_rx(struct snd_sof_dev *sdev)
0641 {
0642 sdev->ipc->ops->rx_msg(sdev);
0643 }
0644 int sof_ipc_tx_message(struct snd_sof_ipc *ipc, void *msg_data, size_t msg_bytes,
0645 void *reply_data, size_t reply_bytes);
0646 int sof_ipc_tx_message_no_pm(struct snd_sof_ipc *ipc, void *msg_data, size_t msg_bytes,
0647 void *reply_data, size_t reply_bytes);
0648 int sof_ipc_send_msg(struct snd_sof_dev *sdev, void *msg_data, size_t msg_bytes,
0649 size_t reply_bytes);
0650
0651 static inline void snd_sof_ipc_process_reply(struct snd_sof_dev *sdev, u32 msg_id)
0652 {
0653 snd_sof_ipc_get_reply(sdev);
0654 snd_sof_ipc_reply(sdev, msg_id);
0655 }
0656
0657
0658
0659
0660 int snd_sof_dbg_init(struct snd_sof_dev *sdev);
0661 void snd_sof_free_debug(struct snd_sof_dev *sdev);
0662 int snd_sof_debugfs_buf_item(struct snd_sof_dev *sdev,
0663 void *base, size_t size,
0664 const char *name, mode_t mode);
0665 void sof_print_oops_and_stack(struct snd_sof_dev *sdev, const char *level,
0666 u32 panic_code, u32 tracep_code, void *oops,
0667 struct sof_ipc_panic_info *panic_info,
0668 void *stack, size_t stack_words);
0669 void snd_sof_handle_fw_exception(struct snd_sof_dev *sdev, const char *msg);
0670 int snd_sof_dbg_memory_info_init(struct snd_sof_dev *sdev);
0671 int snd_sof_debugfs_add_region_item_iomem(struct snd_sof_dev *sdev,
0672 enum snd_sof_fw_blk_type blk_type, u32 offset, size_t size,
0673 const char *name, enum sof_debugfs_access_type access_type);
0674
0675 int sof_fw_trace_init(struct snd_sof_dev *sdev);
0676 void sof_fw_trace_free(struct snd_sof_dev *sdev);
0677 void sof_fw_trace_fw_crashed(struct snd_sof_dev *sdev);
0678 void sof_fw_trace_suspend(struct snd_sof_dev *sdev, pm_message_t pm_state);
0679 int sof_fw_trace_resume(struct snd_sof_dev *sdev);
0680
0681
0682
0683
0684 static inline void sof_stack(struct snd_sof_dev *sdev, const char *level,
0685 void *oops, u32 *stack, u32 stack_words)
0686 {
0687 sof_dsp_arch_ops(sdev)->dsp_stack(sdev, level, oops, stack,
0688 stack_words);
0689 }
0690
0691 static inline void sof_oops(struct snd_sof_dev *sdev, const char *level, void *oops)
0692 {
0693 if (sof_dsp_arch_ops(sdev)->dsp_oops)
0694 sof_dsp_arch_ops(sdev)->dsp_oops(sdev, level, oops);
0695 }
0696
0697 extern const struct dsp_arch_ops sof_xtensa_arch_ops;
0698
0699
0700
0701
0702 void sof_set_fw_state(struct snd_sof_dev *sdev, enum sof_fw_state new_state);
0703
0704
0705
0706
0707 void sof_io_write(struct snd_sof_dev *sdev, void __iomem *addr, u32 value);
0708 void sof_io_write64(struct snd_sof_dev *sdev, void __iomem *addr, u64 value);
0709 u32 sof_io_read(struct snd_sof_dev *sdev, void __iomem *addr);
0710 u64 sof_io_read64(struct snd_sof_dev *sdev, void __iomem *addr);
0711 void sof_mailbox_write(struct snd_sof_dev *sdev, u32 offset,
0712 void *message, size_t bytes);
0713 void sof_mailbox_read(struct snd_sof_dev *sdev, u32 offset,
0714 void *message, size_t bytes);
0715 int sof_block_write(struct snd_sof_dev *sdev, enum snd_sof_fw_blk_type blk_type,
0716 u32 offset, void *src, size_t size);
0717 int sof_block_read(struct snd_sof_dev *sdev, enum snd_sof_fw_blk_type blk_type,
0718 u32 offset, void *dest, size_t size);
0719
0720 int sof_ipc_msg_data(struct snd_sof_dev *sdev,
0721 struct snd_pcm_substream *substream,
0722 void *p, size_t sz);
0723 int sof_set_stream_data_offset(struct snd_sof_dev *sdev,
0724 struct snd_pcm_substream *substream,
0725 size_t posn_offset);
0726
0727 int sof_stream_pcm_open(struct snd_sof_dev *sdev,
0728 struct snd_pcm_substream *substream);
0729 int sof_stream_pcm_close(struct snd_sof_dev *sdev,
0730 struct snd_pcm_substream *substream);
0731
0732 int sof_machine_check(struct snd_sof_dev *sdev);
0733
0734
0735 #if IS_ENABLED(CONFIG_SND_SOC_SOF_CLIENT)
0736 int sof_client_dev_register(struct snd_sof_dev *sdev, const char *name, u32 id,
0737 const void *data, size_t size);
0738 void sof_client_dev_unregister(struct snd_sof_dev *sdev, const char *name, u32 id);
0739 int sof_register_clients(struct snd_sof_dev *sdev);
0740 void sof_unregister_clients(struct snd_sof_dev *sdev);
0741 void sof_client_ipc_rx_dispatcher(struct snd_sof_dev *sdev, void *msg_buf);
0742 void sof_client_fw_state_dispatcher(struct snd_sof_dev *sdev);
0743 int sof_suspend_clients(struct snd_sof_dev *sdev, pm_message_t state);
0744 int sof_resume_clients(struct snd_sof_dev *sdev);
0745 #else
0746 static inline int sof_client_dev_register(struct snd_sof_dev *sdev, const char *name,
0747 u32 id, const void *data, size_t size)
0748 {
0749 return 0;
0750 }
0751
0752 static inline void sof_client_dev_unregister(struct snd_sof_dev *sdev,
0753 const char *name, u32 id)
0754 {
0755 }
0756
0757 static inline int sof_register_clients(struct snd_sof_dev *sdev)
0758 {
0759 return 0;
0760 }
0761
0762 static inline void sof_unregister_clients(struct snd_sof_dev *sdev)
0763 {
0764 }
0765
0766 static inline void sof_client_ipc_rx_dispatcher(struct snd_sof_dev *sdev, void *msg_buf)
0767 {
0768 }
0769
0770 static inline void sof_client_fw_state_dispatcher(struct snd_sof_dev *sdev)
0771 {
0772 }
0773
0774 static inline int sof_suspend_clients(struct snd_sof_dev *sdev, pm_message_t state)
0775 {
0776 return 0;
0777 }
0778
0779 static inline int sof_resume_clients(struct snd_sof_dev *sdev)
0780 {
0781 return 0;
0782 }
0783 #endif
0784
0785
0786 extern const struct sof_ipc_ops ipc3_ops;
0787 extern const struct sof_ipc_ops ipc4_ops;
0788
0789 #endif