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 list_head path_list;
143 struct avs_tplg *owner;
144 /* Driver path templates management. */
145 struct list_head node;
148 struct avs_tplg_path {
151 /* Path format requirements. */
152 struct avs_audio_format *fe_fmt;
153 struct avs_audio_format *be_fmt;
155 struct list_head ppl_list;
157 struct avs_tplg_path_template *owner;
158 /* Path template path-variants management. */
159 struct list_head node;
162 struct avs_tplg_pipeline {
165 struct avs_tplg_pplcfg *cfg;
166 struct avs_tplg_binding **bindings;
168 struct list_head mod_list;
170 struct avs_tplg_path *owner;
171 /* Path pipelines management. */
172 struct list_head node;
175 struct avs_tplg_module {
178 struct avs_tplg_modcfg_base *cfg_base;
179 struct avs_audio_format *in_fmt;
182 struct avs_tplg_modcfg_ext *cfg_ext;
184 struct avs_tplg_pipeline *owner;
185 /* Pipeline modules management. */
186 struct list_head node;
189 struct avs_tplg *avs_tplg_new(struct snd_soc_component *comp);
191 int avs_load_topology(struct snd_soc_component *comp, const char *filename);
192 int avs_remove_topology(struct snd_soc_component *comp);