skl-topology.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. /*
  2. * skl_topology.h - Intel HDA Platform topology header file
  3. *
  4. * Copyright (C) 2014-15 Intel Corp
  5. * Author: Jeeja KP <jeeja.kp@intel.com>
  6. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; version 2 of the License.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  18. *
  19. */
  20. #ifndef __SKL_TOPOLOGY_H__
  21. #define __SKL_TOPOLOGY_H__
  22. #include <linux/types.h>
  23. #include <sound/hdaudio_ext.h>
  24. #include <sound/soc.h>
  25. #include "skl.h"
  26. #include "skl-tplg-interface.h"
  27. #define BITS_PER_BYTE 8
  28. #define MAX_TS_GROUPS 8
  29. #define MAX_DMIC_TS_GROUPS 4
  30. #define MAX_FIXED_DMIC_PARAMS_SIZE 727
  31. /* Maximum number of coefficients up down mixer module */
  32. #define UP_DOWN_MIXER_MAX_COEFF 6
  33. enum skl_channel_index {
  34. SKL_CHANNEL_LEFT = 0,
  35. SKL_CHANNEL_RIGHT = 1,
  36. SKL_CHANNEL_CENTER = 2,
  37. SKL_CHANNEL_LEFT_SURROUND = 3,
  38. SKL_CHANNEL_CENTER_SURROUND = 3,
  39. SKL_CHANNEL_RIGHT_SURROUND = 4,
  40. SKL_CHANNEL_LFE = 7,
  41. SKL_CHANNEL_INVALID = 0xF,
  42. };
  43. enum skl_bitdepth {
  44. SKL_DEPTH_8BIT = 8,
  45. SKL_DEPTH_16BIT = 16,
  46. SKL_DEPTH_24BIT = 24,
  47. SKL_DEPTH_32BIT = 32,
  48. SKL_DEPTH_INVALID
  49. };
  50. enum skl_interleaving {
  51. /* [s1_ch1...s1_chN,...,sM_ch1...sM_chN] */
  52. SKL_INTERLEAVING_PER_CHANNEL = 0,
  53. /* [s1_ch1...sM_ch1,...,s1_chN...sM_chN] */
  54. SKL_INTERLEAVING_PER_SAMPLE = 1,
  55. };
  56. enum skl_s_freq {
  57. SKL_FS_8000 = 8000,
  58. SKL_FS_11025 = 11025,
  59. SKL_FS_12000 = 12000,
  60. SKL_FS_16000 = 16000,
  61. SKL_FS_22050 = 22050,
  62. SKL_FS_24000 = 24000,
  63. SKL_FS_32000 = 32000,
  64. SKL_FS_44100 = 44100,
  65. SKL_FS_48000 = 48000,
  66. SKL_FS_64000 = 64000,
  67. SKL_FS_88200 = 88200,
  68. SKL_FS_96000 = 96000,
  69. SKL_FS_128000 = 128000,
  70. SKL_FS_176400 = 176400,
  71. SKL_FS_192000 = 192000,
  72. SKL_FS_INVALID
  73. };
  74. enum skl_widget_type {
  75. SKL_WIDGET_VMIXER = 1,
  76. SKL_WIDGET_MIXER = 2,
  77. SKL_WIDGET_PGA = 3,
  78. SKL_WIDGET_MUX = 4
  79. };
  80. struct skl_audio_data_format {
  81. enum skl_s_freq s_freq;
  82. enum skl_bitdepth bit_depth;
  83. u32 channel_map;
  84. enum skl_ch_cfg ch_cfg;
  85. enum skl_interleaving interleaving;
  86. u8 number_of_channels;
  87. u8 valid_bit_depth;
  88. u8 sample_type;
  89. u8 reserved[1];
  90. } __packed;
  91. struct skl_base_cfg {
  92. u32 cps;
  93. u32 ibs;
  94. u32 obs;
  95. u32 is_pages;
  96. struct skl_audio_data_format audio_fmt;
  97. };
  98. struct skl_cpr_gtw_cfg {
  99. u32 node_id;
  100. u32 dma_buffer_size;
  101. u32 config_length;
  102. /* not mandatory; required only for DMIC/I2S */
  103. u32 config_data[1];
  104. } __packed;
  105. struct skl_cpr_cfg {
  106. struct skl_base_cfg base_cfg;
  107. struct skl_audio_data_format out_fmt;
  108. u32 cpr_feature_mask;
  109. struct skl_cpr_gtw_cfg gtw_cfg;
  110. } __packed;
  111. struct skl_src_module_cfg {
  112. struct skl_base_cfg base_cfg;
  113. enum skl_s_freq src_cfg;
  114. } __packed;
  115. struct skl_up_down_mixer_cfg {
  116. struct skl_base_cfg base_cfg;
  117. enum skl_ch_cfg out_ch_cfg;
  118. /* This should be set to 1 if user coefficients are required */
  119. u32 coeff_sel;
  120. /* Pass the user coeff in this array */
  121. s32 coeff[UP_DOWN_MIXER_MAX_COEFF];
  122. } __packed;
  123. enum skl_dma_type {
  124. SKL_DMA_HDA_HOST_OUTPUT_CLASS = 0,
  125. SKL_DMA_HDA_HOST_INPUT_CLASS = 1,
  126. SKL_DMA_HDA_HOST_INOUT_CLASS = 2,
  127. SKL_DMA_HDA_LINK_OUTPUT_CLASS = 8,
  128. SKL_DMA_HDA_LINK_INPUT_CLASS = 9,
  129. SKL_DMA_HDA_LINK_INOUT_CLASS = 0xA,
  130. SKL_DMA_DMIC_LINK_INPUT_CLASS = 0xB,
  131. SKL_DMA_I2S_LINK_OUTPUT_CLASS = 0xC,
  132. SKL_DMA_I2S_LINK_INPUT_CLASS = 0xD,
  133. };
  134. union skl_ssp_dma_node {
  135. u8 val;
  136. struct {
  137. u8 dual_mono:1;
  138. u8 time_slot:3;
  139. u8 i2s_instance:4;
  140. } dma_node;
  141. };
  142. union skl_connector_node_id {
  143. u32 val;
  144. struct {
  145. u32 vindex:8;
  146. u32 dma_type:4;
  147. u32 rsvd:20;
  148. } node;
  149. };
  150. struct skl_module_fmt {
  151. u32 channels;
  152. u32 s_freq;
  153. u32 bit_depth;
  154. u32 valid_bit_depth;
  155. u32 ch_cfg;
  156. };
  157. struct skl_module_inst_id {
  158. u32 module_id;
  159. u32 instance_id;
  160. };
  161. struct skl_module_pin {
  162. struct skl_module_inst_id id;
  163. u8 pin_index;
  164. bool is_dynamic;
  165. bool in_use;
  166. };
  167. struct skl_specific_cfg {
  168. u32 caps_size;
  169. u32 *caps;
  170. };
  171. enum skl_pipe_state {
  172. SKL_PIPE_INVALID = 0,
  173. SKL_PIPE_CREATED = 1,
  174. SKL_PIPE_PAUSED = 2,
  175. SKL_PIPE_STARTED = 3
  176. };
  177. struct skl_pipe_module {
  178. struct snd_soc_dapm_widget *w;
  179. struct list_head node;
  180. };
  181. struct skl_pipe_params {
  182. u8 host_dma_id;
  183. u8 link_dma_id;
  184. u32 ch;
  185. u32 s_freq;
  186. u32 s_fmt;
  187. u8 linktype;
  188. int stream;
  189. };
  190. struct skl_pipe {
  191. u8 ppl_id;
  192. u8 pipe_priority;
  193. u16 conn_type;
  194. u32 memory_pages;
  195. struct skl_pipe_params *p_params;
  196. enum skl_pipe_state state;
  197. struct list_head w_list;
  198. };
  199. enum skl_module_state {
  200. SKL_MODULE_UNINIT = 0,
  201. SKL_MODULE_INIT_DONE = 1,
  202. SKL_MODULE_LOADED = 2,
  203. SKL_MODULE_UNLOADED = 3,
  204. SKL_MODULE_BIND_DONE = 4
  205. };
  206. struct skl_module_cfg {
  207. struct skl_module_inst_id id;
  208. struct skl_module_fmt in_fmt;
  209. struct skl_module_fmt out_fmt;
  210. u8 max_in_queue;
  211. u8 max_out_queue;
  212. u8 in_queue_mask;
  213. u8 out_queue_mask;
  214. u8 in_queue;
  215. u8 out_queue;
  216. u32 mcps;
  217. u32 ibs;
  218. u32 obs;
  219. u8 is_loadable;
  220. u8 core_id;
  221. u8 dev_type;
  222. u8 dma_id;
  223. u8 time_slot;
  224. u32 params_fixup;
  225. u32 converter;
  226. u32 vbus_id;
  227. struct skl_module_pin *m_in_pin;
  228. struct skl_module_pin *m_out_pin;
  229. enum skl_module_type m_type;
  230. enum skl_hw_conn_type hw_conn_type;
  231. enum skl_module_state m_state;
  232. struct skl_pipe *pipe;
  233. struct skl_specific_cfg formats_config;
  234. };
  235. int skl_create_pipeline(struct skl_sst *ctx, struct skl_pipe *pipe);
  236. int skl_run_pipe(struct skl_sst *ctx, struct skl_pipe *pipe);
  237. int skl_pause_pipe(struct skl_sst *ctx, struct skl_pipe *pipe);
  238. int skl_delete_pipe(struct skl_sst *ctx, struct skl_pipe *pipe);
  239. int skl_stop_pipe(struct skl_sst *ctx, struct skl_pipe *pipe);
  240. int skl_init_module(struct skl_sst *ctx, struct skl_module_cfg *module_config,
  241. char *param);
  242. int skl_bind_modules(struct skl_sst *ctx, struct skl_module_cfg
  243. *src_module, struct skl_module_cfg *dst_module);
  244. int skl_unbind_modules(struct skl_sst *ctx, struct skl_module_cfg
  245. *src_module, struct skl_module_cfg *dst_module);
  246. enum skl_bitdepth skl_get_bit_depth(int params);
  247. #endif