skl-sst-ipc.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Intel SKL IPC Support
  4. *
  5. * Copyright (C) 2014-15, Intel Corporation.
  6. */
  7. #ifndef __SKL_IPC_H
  8. #define __SKL_IPC_H
  9. #include <linux/irqreturn.h>
  10. #include "../common/sst-ipc.h"
  11. #include "skl-sst-dsp.h"
  12. struct sst_dsp;
  13. struct sst_generic_ipc;
  14. enum skl_ipc_pipeline_state {
  15. PPL_INVALID_STATE = 0,
  16. PPL_UNINITIALIZED = 1,
  17. PPL_RESET = 2,
  18. PPL_PAUSED = 3,
  19. PPL_RUNNING = 4,
  20. PPL_ERROR_STOP = 5,
  21. PPL_SAVED = 6,
  22. PPL_RESTORED = 7
  23. };
  24. struct skl_ipc_dxstate_info {
  25. u32 core_mask;
  26. u32 dx_mask;
  27. };
  28. struct skl_ipc_header {
  29. u32 primary;
  30. u32 extension;
  31. };
  32. struct skl_dsp_cores {
  33. unsigned int count;
  34. enum skl_dsp_states *state;
  35. int *usage_count;
  36. };
  37. /**
  38. * skl_d0i3_data: skl D0i3 counters data struct
  39. *
  40. * @streaming: Count of usecases that can attempt streaming D0i3
  41. * @non_streaming: Count of usecases that can attempt non-streaming D0i3
  42. * @non_d0i3: Count of usecases that cannot attempt D0i3
  43. * @state: current state
  44. * @work: D0i3 worker thread
  45. */
  46. struct skl_d0i3_data {
  47. int streaming;
  48. int non_streaming;
  49. int non_d0i3;
  50. enum skl_dsp_d0i3_states state;
  51. struct delayed_work work;
  52. };
  53. #define SKL_LIB_NAME_LENGTH 128
  54. #define SKL_MAX_LIB 16
  55. struct skl_lib_info {
  56. char name[SKL_LIB_NAME_LENGTH];
  57. const struct firmware *fw;
  58. };
  59. struct skl_ipc_init_instance_msg {
  60. u32 module_id;
  61. u32 instance_id;
  62. u16 param_data_size;
  63. u8 ppl_instance_id;
  64. u8 core_id;
  65. u8 domain;
  66. };
  67. struct skl_ipc_bind_unbind_msg {
  68. u32 module_id;
  69. u32 instance_id;
  70. u32 dst_module_id;
  71. u32 dst_instance_id;
  72. u8 src_queue;
  73. u8 dst_queue;
  74. bool bind;
  75. };
  76. struct skl_ipc_large_config_msg {
  77. u32 module_id;
  78. u32 instance_id;
  79. u32 large_param_id;
  80. u32 param_data_size;
  81. };
  82. struct skl_ipc_d0ix_msg {
  83. u32 module_id;
  84. u32 instance_id;
  85. u8 streaming;
  86. u8 wake;
  87. };
  88. #define SKL_IPC_BOOT_MSECS 3000
  89. #define SKL_IPC_D3_MASK 0
  90. #define SKL_IPC_D0_MASK 3
  91. irqreturn_t skl_dsp_irq_thread_handler(int irq, void *context);
  92. int skl_ipc_create_pipeline(struct sst_generic_ipc *ipc,
  93. u16 ppl_mem_size, u8 ppl_type, u8 instance_id, u8 lp_mode);
  94. int skl_ipc_delete_pipeline(struct sst_generic_ipc *ipc, u8 instance_id);
  95. int skl_ipc_set_pipeline_state(struct sst_generic_ipc *ipc,
  96. u8 instance_id, enum skl_ipc_pipeline_state state);
  97. int skl_ipc_save_pipeline(struct sst_generic_ipc *ipc,
  98. u8 instance_id, int dma_id);
  99. int skl_ipc_restore_pipeline(struct sst_generic_ipc *ipc, u8 instance_id);
  100. int skl_ipc_init_instance(struct sst_generic_ipc *ipc,
  101. struct skl_ipc_init_instance_msg *msg, void *param_data);
  102. int skl_ipc_bind_unbind(struct sst_generic_ipc *ipc,
  103. struct skl_ipc_bind_unbind_msg *msg);
  104. int skl_ipc_load_modules(struct sst_generic_ipc *ipc,
  105. u8 module_cnt, void *data);
  106. int skl_ipc_unload_modules(struct sst_generic_ipc *ipc,
  107. u8 module_cnt, void *data);
  108. int skl_ipc_set_dx(struct sst_generic_ipc *ipc,
  109. u8 instance_id, u16 module_id, struct skl_ipc_dxstate_info *dx);
  110. int skl_ipc_set_large_config(struct sst_generic_ipc *ipc,
  111. struct skl_ipc_large_config_msg *msg, u32 *param);
  112. int skl_ipc_get_large_config(struct sst_generic_ipc *ipc,
  113. struct skl_ipc_large_config_msg *msg,
  114. u32 **payload, size_t *bytes);
  115. int skl_sst_ipc_load_library(struct sst_generic_ipc *ipc,
  116. u8 dma_id, u8 table_id, bool wait);
  117. int skl_ipc_set_d0ix(struct sst_generic_ipc *ipc,
  118. struct skl_ipc_d0ix_msg *msg);
  119. int skl_ipc_check_D0i0(struct sst_dsp *dsp, bool state);
  120. void skl_ipc_int_enable(struct sst_dsp *ctx);
  121. void skl_ipc_op_int_enable(struct sst_dsp *ctx);
  122. void skl_ipc_op_int_disable(struct sst_dsp *ctx);
  123. void skl_ipc_int_disable(struct sst_dsp *ctx);
  124. bool skl_ipc_int_status(struct sst_dsp *ctx);
  125. void skl_ipc_free(struct sst_generic_ipc *ipc);
  126. int skl_ipc_init(struct device *dev, struct skl_dev *skl);
  127. void skl_clear_module_cnt(struct sst_dsp *ctx);
  128. void skl_ipc_process_reply(struct sst_generic_ipc *ipc,
  129. struct skl_ipc_header header);
  130. int skl_ipc_process_notification(struct sst_generic_ipc *ipc,
  131. struct skl_ipc_header header);
  132. void skl_ipc_tx_data_copy(struct ipc_message *msg, char *tx_data,
  133. size_t tx_size);
  134. #endif /* __SKL_IPC_H */