1 /* This file is part of the coreboot project. */
2 /* SPDX-License-Identifier: GPL-2.0-or-later */
7 static const struct nhlt_format_config dmic_1ch_formats
[] = {
8 /* 48 KHz 16-bits per sample. */
11 .sample_freq_khz
= 48,
12 .container_bits_per_sample
= 16,
13 .valid_bits_per_sample
= 16,
14 .settings_file
= "dmic-1ch-48khz-16b.bin",
18 static const struct nhlt_dmic_array_config dmic_1ch_mic_config
= {
20 .config_type
= NHLT_TDM_MIC_ARRAY
,
22 .array_type
= NHLT_MIC_ARRAY_VENDOR_DEFINED
,
25 static const struct nhlt_endp_descriptor dmic_1ch_descriptors
[] = {
27 .link
= NHLT_LINK_PDM
,
28 .device
= NHLT_PDM_DEV
,
29 .direction
= NHLT_DIR_CAPTURE
,
32 .cfg
= &dmic_1ch_mic_config
,
33 .cfg_size
= sizeof(dmic_1ch_mic_config
),
34 .formats
= dmic_1ch_formats
,
35 .num_formats
= ARRAY_SIZE(dmic_1ch_formats
),
39 static const struct nhlt_format_config dmic_2ch_formats
[] = {
40 /* 48 KHz 16-bits per sample. */
43 .sample_freq_khz
= 48,
44 .container_bits_per_sample
= 16,
45 .valid_bits_per_sample
= 16,
46 .settings_file
= "dmic-2ch-48khz-16b.bin",
50 static const struct nhlt_dmic_array_config dmic_2ch_mic_config
= {
52 .config_type
= NHLT_TDM_MIC_ARRAY
,
54 .array_type
= NHLT_MIC_ARRAY_2CH_SMALL
,
57 static const struct nhlt_endp_descriptor dmic_2ch_descriptors
[] = {
59 .link
= NHLT_LINK_PDM
,
60 .device
= NHLT_PDM_DEV
,
61 .direction
= NHLT_DIR_CAPTURE
,
64 .cfg
= &dmic_2ch_mic_config
,
65 .cfg_size
= sizeof(dmic_2ch_mic_config
),
66 .formats
= dmic_2ch_formats
,
67 .num_formats
= ARRAY_SIZE(dmic_2ch_formats
),
71 static const struct nhlt_format_config dmic_4ch_formats
[] = {
72 /* 48 KHz 16-bits per sample. */
75 .sample_freq_khz
= 48,
76 .container_bits_per_sample
= 16,
77 .valid_bits_per_sample
= 16,
78 .settings_file
= "dmic-4ch-48khz-16b.bin",
82 static const struct nhlt_dmic_array_config dmic_4ch_mic_config
= {
84 .config_type
= NHLT_TDM_MIC_ARRAY
,
86 .array_type
= NHLT_MIC_ARRAY_4CH_L_SHAPED
,
89 static const struct nhlt_endp_descriptor dmic_4ch_descriptors
[] = {
91 .link
= NHLT_LINK_PDM
,
92 .device
= NHLT_PDM_DEV
,
93 .direction
= NHLT_DIR_CAPTURE
,
96 .cfg
= &dmic_4ch_mic_config
,
97 .cfg_size
= sizeof(dmic_4ch_mic_config
),
98 .formats
= dmic_4ch_formats
,
99 .num_formats
= ARRAY_SIZE(dmic_4ch_formats
),
103 static const struct nhlt_format_config da7219_formats
[] = {
104 /* 48 KHz 24-bits per sample. */
107 .sample_freq_khz
= 48,
108 .container_bits_per_sample
= 32,
109 .valid_bits_per_sample
= 24,
110 .settings_file
= "dialog-2ch-48khz-24b.bin",
114 static const struct nhlt_tdm_config tdm_config
= {
116 .config_type
= NHLT_TDM_BASIC
,
119 static const struct nhlt_endp_descriptor da7219_descriptors
[] = {
120 /* Render Endpoint */
122 .link
= NHLT_LINK_SSP
,
123 .device
= NHLT_SSP_DEV_I2S
,
124 .direction
= NHLT_DIR_RENDER
,
128 .cfg_size
= sizeof(tdm_config
),
129 .formats
= da7219_formats
,
130 .num_formats
= ARRAY_SIZE(da7219_formats
),
132 /* Capture Endpoint */
134 .link
= NHLT_LINK_SSP
,
135 .device
= NHLT_SSP_DEV_I2S
,
136 .direction
= NHLT_DIR_CAPTURE
,
140 .cfg_size
= sizeof(tdm_config
),
141 .formats
= da7219_formats
,
142 .num_formats
= ARRAY_SIZE(da7219_formats
),
146 static const struct nhlt_format_config max98357_formats
[] = {
147 /* 48 KHz 24-bits per sample. */
150 .sample_freq_khz
= 48,
151 .container_bits_per_sample
= 32,
152 .valid_bits_per_sample
= 24,
153 .settings_file
= "max98357-render-2ch-48khz-24b.bin",
157 static const struct nhlt_endp_descriptor max98357_descriptors
[] = {
159 .link
= NHLT_LINK_SSP
,
160 .device
= NHLT_SSP_DEV_I2S
,
161 .direction
= NHLT_DIR_RENDER
,
164 .formats
= max98357_formats
,
165 .num_formats
= ARRAY_SIZE(max98357_formats
),
169 static const struct nhlt_format_config max98373_render_formats
[] = {
170 /* 48 KHz 24-bits per sample. */
173 .sample_freq_khz
= 48,
174 .container_bits_per_sample
= 32,
175 .valid_bits_per_sample
= 24,
176 .speaker_mask
= SPEAKER_FRONT_LEFT
| SPEAKER_FRONT_RIGHT
,
177 .settings_file
= "max98373-render-2ch-48khz-24b.bin",
179 /* 48 KHz 16-bits per sample. */
182 .sample_freq_khz
= 48,
183 .container_bits_per_sample
= 16,
184 .valid_bits_per_sample
= 16,
185 .speaker_mask
= SPEAKER_FRONT_LEFT
| SPEAKER_FRONT_RIGHT
,
186 .settings_file
= "max98373-render-2ch-48khz-16b.bin",
190 static const struct nhlt_format_config max98373_capture_formats
[] = {
191 /* 48 KHz 16-bits per sample. */
194 .sample_freq_khz
= 48,
195 .container_bits_per_sample
= 16,
196 .valid_bits_per_sample
= 16,
197 .speaker_mask
= SPEAKER_FRONT_LEFT
| SPEAKER_FRONT_RIGHT
,
198 .settings_file
= "max98373-render-2ch-48khz-16b.bin",
202 static const struct nhlt_endp_descriptor max98373_descriptors
[] = {
204 .link
= NHLT_LINK_SSP
,
205 .device
= NHLT_SSP_DEV_I2S
,
206 .direction
= NHLT_DIR_RENDER
,
209 .formats
= max98373_render_formats
,
210 .num_formats
= ARRAY_SIZE(max98373_render_formats
),
213 .link
= NHLT_LINK_SSP
,
214 .device
= NHLT_SSP_DEV_I2S
,
215 .direction
= NHLT_DIR_CAPTURE
,
218 .formats
= max98373_capture_formats
,
219 .num_formats
= ARRAY_SIZE(max98373_capture_formats
),
223 int nhlt_soc_add_dmic_array(struct nhlt
*nhlt
, int num_channels
)
225 switch (num_channels
) {
227 return nhlt_add_endpoints(nhlt
, dmic_1ch_descriptors
,
228 ARRAY_SIZE(dmic_1ch_descriptors
));
230 return nhlt_add_endpoints(nhlt
, dmic_2ch_descriptors
,
231 ARRAY_SIZE(dmic_2ch_descriptors
));
233 return nhlt_add_endpoints(nhlt
, dmic_4ch_descriptors
,
234 ARRAY_SIZE(dmic_4ch_descriptors
));
240 int nhlt_soc_add_da7219(struct nhlt
*nhlt
, int hwlink
)
242 /* Virtual bus id of SSP links are the hardware port ids proper. */
243 return nhlt_add_ssp_endpoints(nhlt
, hwlink
, da7219_descriptors
,
244 ARRAY_SIZE(da7219_descriptors
));
247 int nhlt_soc_add_max98357(struct nhlt
*nhlt
, int hwlink
)
249 /* Virtual bus id of SSP links are the hardware port ids proper. */
250 return nhlt_add_ssp_endpoints(nhlt
, hwlink
, max98357_descriptors
,
251 ARRAY_SIZE(max98357_descriptors
));
254 int nhlt_soc_add_max98373(struct nhlt
*nhlt
, int hwlink
)
256 /* Virtual bus id of SSP links are the hardware port ids proper. */
257 return nhlt_add_ssp_endpoints(nhlt
, hwlink
, max98373_descriptors
,
258 ARRAY_SIZE(max98373_descriptors
));