topology.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright(c) 2021 Intel Corporation. All rights reserved.
  4. *
  5. * Authors: Cezary Rojewski <[email protected]>
  6. * Amadeusz Slawinski <[email protected]>
  7. */
  8. #ifndef __SOUND_SOC_INTEL_AVS_TPLG_H
  9. #define __SOUND_SOC_INTEL_AVS_TPLG_H
  10. #include <linux/list.h>
  11. #include "messages.h"
  12. #define INVALID_OBJECT_ID UINT_MAX
  13. struct snd_soc_component;
  14. struct avs_tplg {
  15. char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
  16. u32 version;
  17. struct snd_soc_component *comp;
  18. struct avs_tplg_library *libs;
  19. u32 num_libs;
  20. struct avs_audio_format *fmts;
  21. u32 num_fmts;
  22. struct avs_tplg_modcfg_base *modcfgs_base;
  23. u32 num_modcfgs_base;
  24. struct avs_tplg_modcfg_ext *modcfgs_ext;
  25. u32 num_modcfgs_ext;
  26. struct avs_tplg_pplcfg *pplcfgs;
  27. u32 num_pplcfgs;
  28. struct avs_tplg_binding *bindings;
  29. u32 num_bindings;
  30. struct list_head path_tmpl_list;
  31. };
  32. struct avs_tplg_library {
  33. char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
  34. };
  35. /* Matches header of struct avs_mod_cfg_base. */
  36. struct avs_tplg_modcfg_base {
  37. u32 cpc;
  38. u32 ibs;
  39. u32 obs;
  40. u32 is_pages;
  41. };
  42. struct avs_tplg_pin_format {
  43. u32 pin_index;
  44. u32 iobs;
  45. struct avs_audio_format *fmt;
  46. };
  47. struct avs_tplg_modcfg_ext {
  48. guid_t type;
  49. union {
  50. struct {
  51. u16 num_input_pins;
  52. u16 num_output_pins;
  53. struct avs_tplg_pin_format *pin_fmts;
  54. } generic;
  55. struct {
  56. struct avs_audio_format *out_fmt;
  57. struct avs_audio_format *blob_fmt; /* optional override */
  58. u32 feature_mask;
  59. union avs_virtual_index vindex;
  60. u32 dma_type;
  61. u32 dma_buffer_size;
  62. u32 config_length;
  63. /* config_data part of priv data */
  64. } copier;
  65. struct {
  66. u32 out_channel_config;
  67. u32 coefficients_select;
  68. s32 coefficients[AVS_CHANNELS_MAX];
  69. u32 channel_map;
  70. } updown_mix;
  71. struct {
  72. u32 out_freq;
  73. } src;
  74. struct {
  75. u32 out_freq;
  76. u8 mode;
  77. u8 disable_jitter_buffer;
  78. } asrc;
  79. struct {
  80. u32 cpc_lp_mode;
  81. } wov;
  82. struct {
  83. struct avs_audio_format *ref_fmt;
  84. struct avs_audio_format *out_fmt;
  85. u32 cpc_lp_mode;
  86. } aec;
  87. struct {
  88. struct avs_audio_format *ref_fmt;
  89. struct avs_audio_format *out_fmt;
  90. } mux;
  91. struct {
  92. struct avs_audio_format *out_fmt;
  93. } micsel;
  94. };
  95. };
  96. /* Specifies path behaviour during PCM ->trigger(START) command. */
  97. enum avs_tplg_trigger {
  98. AVS_TPLG_TRIGGER_AUTO = 0,
  99. };
  100. struct avs_tplg_pplcfg {
  101. u16 req_size;
  102. u8 priority;
  103. bool lp;
  104. u16 attributes;
  105. enum avs_tplg_trigger trigger;
  106. };
  107. struct avs_tplg_binding {
  108. char target_tplg_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
  109. u32 target_path_tmpl_id;
  110. u32 target_ppl_id;
  111. u32 target_mod_id;
  112. u8 target_mod_pin;
  113. u32 mod_id;
  114. u8 mod_pin;
  115. u8 is_sink;
  116. };
  117. struct avs_tplg_path_template_id {
  118. u32 id;
  119. char tplg_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
  120. };
  121. struct avs_tplg_path_template {
  122. u32 id;
  123. struct list_head path_list;
  124. struct avs_tplg *owner;
  125. /* Driver path templates management. */
  126. struct list_head node;
  127. };
  128. struct avs_tplg_path {
  129. u32 id;
  130. /* Path format requirements. */
  131. struct avs_audio_format *fe_fmt;
  132. struct avs_audio_format *be_fmt;
  133. struct list_head ppl_list;
  134. struct avs_tplg_path_template *owner;
  135. /* Path template path-variants management. */
  136. struct list_head node;
  137. };
  138. struct avs_tplg_pipeline {
  139. u32 id;
  140. struct avs_tplg_pplcfg *cfg;
  141. struct avs_tplg_binding **bindings;
  142. u32 num_bindings;
  143. struct list_head mod_list;
  144. struct avs_tplg_path *owner;
  145. /* Path pipelines management. */
  146. struct list_head node;
  147. };
  148. struct avs_tplg_module {
  149. u32 id;
  150. struct avs_tplg_modcfg_base *cfg_base;
  151. struct avs_audio_format *in_fmt;
  152. u8 core_id;
  153. u8 domain;
  154. struct avs_tplg_modcfg_ext *cfg_ext;
  155. struct avs_tplg_pipeline *owner;
  156. /* Pipeline modules management. */
  157. struct list_head node;
  158. };
  159. struct avs_tplg *avs_tplg_new(struct snd_soc_component *comp);
  160. int avs_load_topology(struct snd_soc_component *comp, const char *filename);
  161. int avs_remove_topology(struct snd_soc_component *comp);
  162. #endif