1 /* SPDX-License-Identifier: GPL-2.0-or-later */
6 static const struct nhlt_format_config dmic_1ch_formats
[] = {
7 /* 48 KHz 16-bits per sample. */
10 .sample_freq_khz
= 48,
11 .container_bits_per_sample
= 16,
12 .valid_bits_per_sample
= 16,
13 .settings_file
= "dmic-1ch-48khz-16b.bin",
17 static const struct nhlt_dmic_array_config dmic_1ch_mic_config
= {
19 .config_type
= NHLT_TDM_MIC_ARRAY
,
21 .array_type
= NHLT_MIC_ARRAY_VENDOR_DEFINED
,
24 static const struct nhlt_endp_descriptor dmic_1ch_descriptors
[] = {
26 .link
= NHLT_LINK_PDM
,
27 .device
= NHLT_PDM_DEV
,
28 .direction
= NHLT_DIR_CAPTURE
,
31 .cfg
= &dmic_1ch_mic_config
,
32 .cfg_size
= sizeof(dmic_1ch_mic_config
),
33 .formats
= dmic_1ch_formats
,
34 .num_formats
= ARRAY_SIZE(dmic_1ch_formats
),
38 static const struct nhlt_format_config dmic_2ch_formats
[] = {
39 /* 48 KHz 16-bits per sample. */
42 .sample_freq_khz
= 48,
43 .container_bits_per_sample
= 16,
44 .valid_bits_per_sample
= 16,
45 .settings_file
= "dmic-2ch-48khz-16b.bin",
49 static const struct nhlt_dmic_array_config dmic_2ch_mic_config
= {
51 .config_type
= NHLT_TDM_MIC_ARRAY
,
53 .array_type
= NHLT_MIC_ARRAY_2CH_SMALL
,
56 static const struct nhlt_endp_descriptor dmic_2ch_descriptors
[] = {
58 .link
= NHLT_LINK_PDM
,
59 .device
= NHLT_PDM_DEV
,
60 .direction
= NHLT_DIR_CAPTURE
,
63 .cfg
= &dmic_2ch_mic_config
,
64 .cfg_size
= sizeof(dmic_2ch_mic_config
),
65 .formats
= dmic_2ch_formats
,
66 .num_formats
= ARRAY_SIZE(dmic_2ch_formats
),
70 static const struct nhlt_format_config dmic_4ch_formats
[] = {
71 /* 48 KHz 16-bits per sample. */
74 .sample_freq_khz
= 48,
75 .container_bits_per_sample
= 16,
76 .valid_bits_per_sample
= 16,
77 .settings_file
= "dmic-4ch-48khz-16b.bin",
81 static const struct nhlt_dmic_array_config dmic_4ch_mic_config
= {
83 .config_type
= NHLT_TDM_MIC_ARRAY
,
85 .array_type
= NHLT_MIC_ARRAY_4CH_L_SHAPED
,
88 static const struct nhlt_endp_descriptor dmic_4ch_descriptors
[] = {
90 .link
= NHLT_LINK_PDM
,
91 .device
= NHLT_PDM_DEV
,
92 .direction
= NHLT_DIR_CAPTURE
,
95 .cfg
= &dmic_4ch_mic_config
,
96 .cfg_size
= sizeof(dmic_4ch_mic_config
),
97 .formats
= dmic_4ch_formats
,
98 .num_formats
= ARRAY_SIZE(dmic_4ch_formats
),
102 static const struct nhlt_format_config da7219_formats
[] = {
103 /* 48 KHz 24-bits per sample. */
106 .sample_freq_khz
= 48,
107 .container_bits_per_sample
= 32,
108 .valid_bits_per_sample
= 24,
109 .settings_file
= "dialog-2ch-48khz-24b.bin",
113 static const struct nhlt_tdm_config tdm_config
= {
115 .config_type
= NHLT_TDM_BASIC
,
118 static const struct nhlt_endp_descriptor da7219_descriptors
[] = {
119 /* Render Endpoint */
121 .link
= NHLT_LINK_SSP
,
122 .device
= NHLT_SSP_DEV_I2S
,
123 .direction
= NHLT_DIR_RENDER
,
127 .cfg_size
= sizeof(tdm_config
),
128 .formats
= da7219_formats
,
129 .num_formats
= ARRAY_SIZE(da7219_formats
),
131 /* Capture Endpoint */
133 .link
= NHLT_LINK_SSP
,
134 .device
= NHLT_SSP_DEV_I2S
,
135 .direction
= NHLT_DIR_CAPTURE
,
139 .cfg_size
= sizeof(tdm_config
),
140 .formats
= da7219_formats
,
141 .num_formats
= ARRAY_SIZE(da7219_formats
),
145 static const struct nhlt_format_config max98357_formats
[] = {
146 /* 48 KHz 24-bits per sample. */
149 .sample_freq_khz
= 48,
150 .container_bits_per_sample
= 32,
151 .valid_bits_per_sample
= 24,
152 .settings_file
= "max98357-render-2ch-48khz-24b.bin",
156 static const struct nhlt_endp_descriptor max98357_descriptors
[] = {
158 .link
= NHLT_LINK_SSP
,
159 .device
= NHLT_SSP_DEV_I2S
,
160 .direction
= NHLT_DIR_RENDER
,
163 .formats
= max98357_formats
,
164 .num_formats
= ARRAY_SIZE(max98357_formats
),
168 int nhlt_soc_add_dmic_array(struct nhlt
*nhlt
, int num_channels
)
170 switch (num_channels
) {
172 return nhlt_add_endpoints(nhlt
, dmic_1ch_descriptors
,
173 ARRAY_SIZE(dmic_1ch_descriptors
));
175 return nhlt_add_endpoints(nhlt
, dmic_2ch_descriptors
,
176 ARRAY_SIZE(dmic_2ch_descriptors
));
178 return nhlt_add_endpoints(nhlt
, dmic_4ch_descriptors
,
179 ARRAY_SIZE(dmic_4ch_descriptors
));
186 * The same DSP firmware settings are used for both the capture and
189 static const struct nhlt_format_config rt5682_formats
[] = {
190 /* 48 KHz 24-bits per sample. */
193 .sample_freq_khz
= 48,
194 .container_bits_per_sample
= 32,
195 .valid_bits_per_sample
= 24,
196 .speaker_mask
= SPEAKER_FRONT_LEFT
| SPEAKER_FRONT_RIGHT
,
197 .settings_file
= "rt5682-2ch-48khz-24b.bin",
202 * The rt5682 just has headphones and a mic. Both the capture and render
203 * endpoints occupy the same virtual slot.
205 static const struct nhlt_endp_descriptor rt5682_descriptors
[] = {
206 /* Render Endpoint */
208 .link
= NHLT_LINK_SSP
,
209 .device
= NHLT_SSP_DEV_I2S
,
210 .direction
= NHLT_DIR_RENDER
,
214 .cfg_size
= sizeof(tdm_config
),
215 .formats
= rt5682_formats
,
216 .num_formats
= ARRAY_SIZE(rt5682_formats
),
218 /* Capture Endpoint */
220 .link
= NHLT_LINK_SSP
,
221 .device
= NHLT_SSP_DEV_I2S
,
222 .direction
= NHLT_DIR_CAPTURE
,
226 .cfg_size
= sizeof(tdm_config
),
227 .formats
= rt5682_formats
,
228 .num_formats
= ARRAY_SIZE(rt5682_formats
),
232 int nhlt_soc_add_da7219(struct nhlt
*nhlt
, int hwlink
)
234 /* Virtual bus id of SSP links are the hardware port ids proper. */
235 return nhlt_add_ssp_endpoints(nhlt
, hwlink
, da7219_descriptors
,
236 ARRAY_SIZE(da7219_descriptors
));
239 int nhlt_soc_add_max98357(struct nhlt
*nhlt
, int hwlink
)
241 /* Virtual bus id of SSP links are the hardware port ids proper. */
242 return nhlt_add_ssp_endpoints(nhlt
, hwlink
, max98357_descriptors
,
243 ARRAY_SIZE(max98357_descriptors
));
246 int nhlt_soc_add_rt5682(struct nhlt
*nhlt
, int hwlink
)
248 /* Virtual bus id of SSP links are the hardware port ids proper. */
249 return nhlt_add_ssp_endpoints(nhlt
, hwlink
, rt5682_descriptors
,
250 ARRAY_SIZE(rt5682_descriptors
));