skl-sst-ipc.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. * Intel SKL IPC Support
  3. *
  4. * Copyright (C) 2014-15, Intel Corporation.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as version 2, as
  8. * published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. */
  15. #ifndef __SKL_IPC_H
  16. #define __SKL_IPC_H
  17. #include <linux/kthread.h>
  18. #include <linux/irqreturn.h>
  19. #include "../common/sst-ipc.h"
  20. struct sst_dsp;
  21. struct skl_sst;
  22. struct sst_generic_ipc;
  23. enum skl_ipc_pipeline_state {
  24. PPL_INVALID_STATE = 0,
  25. PPL_UNINITIALIZED = 1,
  26. PPL_RESET = 2,
  27. PPL_PAUSED = 3,
  28. PPL_RUNNING = 4,
  29. PPL_ERROR_STOP = 5,
  30. PPL_SAVED = 6,
  31. PPL_RESTORED = 7
  32. };
  33. struct skl_ipc_dxstate_info {
  34. u32 core_mask;
  35. u32 dx_mask;
  36. };
  37. struct skl_ipc_header {
  38. u32 primary;
  39. u32 extension;
  40. };
  41. struct skl_sst {
  42. struct device *dev;
  43. struct sst_dsp *dsp;
  44. /* boot */
  45. wait_queue_head_t boot_wait;
  46. bool boot_complete;
  47. /* IPC messaging */
  48. struct sst_generic_ipc ipc;
  49. };
  50. struct skl_ipc_init_instance_msg {
  51. u32 module_id;
  52. u32 instance_id;
  53. u16 param_data_size;
  54. u8 ppl_instance_id;
  55. u8 core_id;
  56. };
  57. struct skl_ipc_bind_unbind_msg {
  58. u32 module_id;
  59. u32 instance_id;
  60. u32 dst_module_id;
  61. u32 dst_instance_id;
  62. u8 src_queue;
  63. u8 dst_queue;
  64. bool bind;
  65. };
  66. struct skl_ipc_large_config_msg {
  67. u32 module_id;
  68. u32 instance_id;
  69. u32 large_param_id;
  70. u32 param_data_size;
  71. };
  72. #define SKL_IPC_BOOT_MSECS 3000
  73. #define SKL_IPC_D3_MASK 0
  74. #define SKL_IPC_D0_MASK 3
  75. irqreturn_t skl_dsp_irq_thread_handler(int irq, void *context);
  76. int skl_ipc_create_pipeline(struct sst_generic_ipc *sst_ipc,
  77. u16 ppl_mem_size, u8 ppl_type, u8 instance_id);
  78. int skl_ipc_delete_pipeline(struct sst_generic_ipc *sst_ipc, u8 instance_id);
  79. int skl_ipc_set_pipeline_state(struct sst_generic_ipc *sst_ipc,
  80. u8 instance_id, enum skl_ipc_pipeline_state state);
  81. int skl_ipc_save_pipeline(struct sst_generic_ipc *ipc,
  82. u8 instance_id, int dma_id);
  83. int skl_ipc_restore_pipeline(struct sst_generic_ipc *ipc, u8 instance_id);
  84. int skl_ipc_init_instance(struct sst_generic_ipc *sst_ipc,
  85. struct skl_ipc_init_instance_msg *msg, void *param_data);
  86. int skl_ipc_bind_unbind(struct sst_generic_ipc *sst_ipc,
  87. struct skl_ipc_bind_unbind_msg *msg);
  88. int skl_ipc_set_dx(struct sst_generic_ipc *ipc,
  89. u8 instance_id, u16 module_id, struct skl_ipc_dxstate_info *dx);
  90. int skl_ipc_set_large_config(struct sst_generic_ipc *ipc,
  91. struct skl_ipc_large_config_msg *msg, u32 *param);
  92. void skl_ipc_int_enable(struct sst_dsp *dsp);
  93. void skl_ipc_op_int_enable(struct sst_dsp *ctx);
  94. void skl_ipc_op_int_disable(struct sst_dsp *ctx);
  95. void skl_ipc_int_disable(struct sst_dsp *dsp);
  96. bool skl_ipc_int_status(struct sst_dsp *dsp);
  97. void skl_ipc_free(struct sst_generic_ipc *ipc);
  98. int skl_ipc_init(struct device *dev, struct skl_sst *skl);
  99. #endif /* __SKL_IPC_H */