Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/sound/soc/intel/avs/topology.h
29268 views
1
/* SPDX-License-Identifier: GPL-2.0-only */
2
/*
3
* Copyright(c) 2021 Intel Corporation
4
*
5
* Authors: Cezary Rojewski <[email protected]>
6
* Amadeusz Slawinski <[email protected]>
7
*/
8
9
#ifndef __SOUND_SOC_INTEL_AVS_TPLG_H
10
#define __SOUND_SOC_INTEL_AVS_TPLG_H
11
12
#include <linux/list.h>
13
#include "messages.h"
14
15
#define INVALID_OBJECT_ID UINT_MAX
16
17
struct snd_soc_component;
18
19
struct avs_tplg {
20
char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
21
u32 version;
22
struct snd_soc_component *comp;
23
24
struct avs_tplg_library *libs;
25
u32 num_libs;
26
struct avs_audio_format *fmts;
27
u32 num_fmts;
28
struct avs_tplg_modcfg_base *modcfgs_base;
29
u32 num_modcfgs_base;
30
struct avs_tplg_modcfg_ext *modcfgs_ext;
31
u32 num_modcfgs_ext;
32
struct avs_tplg_pplcfg *pplcfgs;
33
u32 num_pplcfgs;
34
struct avs_tplg_binding *bindings;
35
u32 num_bindings;
36
struct avs_tplg_path_template *condpath_tmpls;
37
u32 num_condpath_tmpls;
38
struct avs_tplg_init_config *init_configs;
39
u32 num_init_configs;
40
41
struct list_head path_tmpl_list;
42
};
43
44
struct avs_tplg_library {
45
char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
46
};
47
48
/* Matches header of struct avs_mod_cfg_base. */
49
struct avs_tplg_modcfg_base {
50
u32 cpc;
51
u32 ibs;
52
u32 obs;
53
u32 is_pages;
54
};
55
56
struct avs_tplg_pin_format {
57
u32 pin_index;
58
u32 iobs;
59
struct avs_audio_format *fmt;
60
};
61
62
struct avs_tplg_modcfg_ext {
63
guid_t type;
64
65
union {
66
struct {
67
u16 num_input_pins;
68
u16 num_output_pins;
69
struct avs_tplg_pin_format *pin_fmts;
70
} generic;
71
struct {
72
struct avs_audio_format *out_fmt;
73
struct avs_audio_format *blob_fmt; /* optional override */
74
u32 feature_mask;
75
union avs_virtual_index vindex;
76
u32 dma_type;
77
u32 dma_buffer_size;
78
} copier;
79
struct {
80
struct avs_audio_format *ref_fmt;
81
struct avs_audio_format *out_fmt;
82
u32 wake_tick_period;
83
union avs_virtual_index vindex;
84
u32 dma_type;
85
u32 dma_buffer_size;
86
struct avs_audio_format *blob_fmt; /* optional override */
87
} whm;
88
struct {
89
u32 out_channel_config;
90
u32 coefficients_select;
91
s32 coefficients[AVS_COEFF_CHANNELS_MAX];
92
u32 channel_map;
93
} updown_mix;
94
struct {
95
u32 out_freq;
96
} src;
97
struct {
98
u32 out_freq;
99
u8 mode;
100
u8 disable_jitter_buffer;
101
} asrc;
102
struct {
103
u32 cpc_lp_mode;
104
} wov;
105
struct {
106
struct avs_audio_format *ref_fmt;
107
struct avs_audio_format *out_fmt;
108
u32 cpc_lp_mode;
109
} aec;
110
struct {
111
struct avs_audio_format *ref_fmt;
112
struct avs_audio_format *out_fmt;
113
} mux;
114
struct {
115
struct avs_audio_format *out_fmt;
116
} micsel;
117
struct {
118
u32 target_volume;
119
u32 curve_type;
120
u32 curve_duration;
121
} peakvol;
122
};
123
};
124
125
/* Specifies path behaviour during PCM ->trigger(START) command. */
126
enum avs_tplg_trigger {
127
AVS_TPLG_TRIGGER_AUTO = 0,
128
};
129
130
struct avs_tplg_pplcfg {
131
u16 req_size;
132
u8 priority;
133
bool lp;
134
u16 attributes;
135
enum avs_tplg_trigger trigger;
136
};
137
138
struct avs_tplg_binding {
139
char target_tplg_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
140
u32 target_path_tmpl_id;
141
u32 target_ppl_id;
142
u32 target_mod_id;
143
u8 target_mod_pin;
144
u32 mod_id;
145
u8 mod_pin;
146
u8 is_sink;
147
};
148
149
struct avs_tplg_path_template_id {
150
u32 id;
151
char tplg_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
152
};
153
154
struct avs_tplg_path_template {
155
u32 id;
156
157
struct snd_soc_dapm_widget *w;
158
159
/* Conditional path. */
160
struct avs_tplg_path_template_id source;
161
struct avs_tplg_path_template_id sink;
162
163
struct list_head path_list;
164
165
struct avs_tplg *owner;
166
/* Driver path templates management. */
167
struct list_head node;
168
};
169
170
struct avs_tplg_init_config {
171
u32 id;
172
173
u8 param;
174
size_t length;
175
void *data;
176
};
177
178
struct avs_tplg_path {
179
u32 id;
180
181
/* Path format requirements. */
182
struct avs_audio_format *fe_fmt;
183
struct avs_audio_format *be_fmt;
184
/* Condpath path-variant requirements. */
185
u32 source_path_id;
186
u32 sink_path_id;
187
188
struct list_head ppl_list;
189
190
struct avs_tplg_path_template *owner;
191
/* Path template path-variants management. */
192
struct list_head node;
193
};
194
195
struct avs_tplg_pipeline {
196
u32 id;
197
198
struct avs_tplg_pplcfg *cfg;
199
struct avs_tplg_binding **bindings;
200
u32 num_bindings;
201
struct list_head mod_list;
202
203
struct avs_tplg_path *owner;
204
/* Path pipelines management. */
205
struct list_head node;
206
};
207
208
struct avs_tplg_module {
209
u32 id;
210
211
struct avs_tplg_modcfg_base *cfg_base;
212
struct avs_audio_format *in_fmt;
213
u8 core_id;
214
u8 domain;
215
struct avs_tplg_modcfg_ext *cfg_ext;
216
u32 ctl_id;
217
u32 num_config_ids;
218
u32 *config_ids;
219
220
struct avs_tplg_pipeline *owner;
221
/* Pipeline modules management. */
222
struct list_head node;
223
};
224
225
struct avs_tplg *avs_tplg_new(struct snd_soc_component *comp);
226
227
int avs_load_topology(struct snd_soc_component *comp, const char *filename);
228
int avs_remove_topology(struct snd_soc_component *comp);
229
230
#endif
231
232