1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright(c) 2021 Intel Corporation. All rights reserved.
5 * Authors: Cezary Rojewski <cezary.rojewski@intel.com>
6 * Amadeusz Slawinski <amadeuszx.slawinski@linux.intel.com>
9 #ifndef __SOUND_SOC_INTEL_AVS_TPLG_H
10 #define __SOUND_SOC_INTEL_AVS_TPLG_H
12 #include <linux/list.h>
15 #define INVALID_OBJECT_ID UINT_MAX
17 struct snd_soc_component;
20 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
22 struct snd_soc_component *comp;
24 struct avs_tplg_library *libs;
26 struct avs_audio_format *fmts;
28 struct avs_tplg_modcfg_base *modcfgs_base;
30 struct avs_tplg_modcfg_ext *modcfgs_ext;
32 struct avs_tplg_pplcfg *pplcfgs;
34 struct avs_tplg_binding *bindings;
37 struct list_head path_tmpl_list;
40 struct avs_tplg_library {
41 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
44 /* Matches header of struct avs_mod_cfg_base. */
45 struct avs_tplg_modcfg_base {
52 struct avs_tplg_pin_format {
55 struct avs_audio_format *fmt;
58 struct avs_tplg_modcfg_ext {
65 struct avs_tplg_pin_format *pin_fmts;
68 struct avs_audio_format *out_fmt;
69 struct avs_audio_format *blob_fmt; /* optional override */
71 union avs_virtual_index vindex;
75 /* config_data part of priv data */
78 u32 out_channel_config;
79 u32 coefficients_select;
80 s32 coefficients[AVS_CHANNELS_MAX];
89 u8 disable_jitter_buffer;
95 struct avs_audio_format *ref_fmt;
96 struct avs_audio_format *out_fmt;
100 struct avs_audio_format *ref_fmt;
101 struct avs_audio_format *out_fmt;
104 struct avs_audio_format *out_fmt;
109 /* Specifies path behaviour during PCM ->trigger(START) command. */
110 enum avs_tplg_trigger {
111 AVS_TPLG_TRIGGER_AUTO = 0,
114 struct avs_tplg_pplcfg {
119 enum avs_tplg_trigger trigger;
122 struct avs_tplg_binding {
123 char target_tplg_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
124 u32 target_path_tmpl_id;
133 struct avs_tplg_path_template_id {
135 char tplg_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
138 struct avs_tplg_path_template {
141 struct snd_soc_dapm_widget *w;
143 struct list_head path_list;
145 struct avs_tplg *owner;
146 /* Driver path templates management. */
147 struct list_head node;
150 struct avs_tplg_path {
153 /* Path format requirements. */
154 struct avs_audio_format *fe_fmt;
155 struct avs_audio_format *be_fmt;
157 struct list_head ppl_list;
159 struct avs_tplg_path_template *owner;
160 /* Path template path-variants management. */
161 struct list_head node;
164 struct avs_tplg_pipeline {
167 struct avs_tplg_pplcfg *cfg;
168 struct avs_tplg_binding **bindings;
170 struct list_head mod_list;
172 struct avs_tplg_path *owner;
173 /* Path pipelines management. */
174 struct list_head node;
177 struct avs_tplg_module {
180 struct avs_tplg_modcfg_base *cfg_base;
181 struct avs_audio_format *in_fmt;
184 struct avs_tplg_modcfg_ext *cfg_ext;
187 struct avs_tplg_pipeline *owner;
188 /* Pipeline modules management. */
189 struct list_head node;
192 struct avs_tplg *avs_tplg_new(struct snd_soc_component *comp);
194 int avs_load_topology(struct snd_soc_component *comp, const char *filename);
195 int avs_remove_topology(struct snd_soc_component *comp);