Commit | Line | Data |
---|---|---|
82d9d54a JK |
1 | // SPDX-License-Identifier: GPL-2.0 |
2 | // Copyright (c) 2019 Jaroslav Kysela <perex@perex.cz> | |
3 | ||
06508575 | 4 | #include <linux/acpi.h> |
82d9d54a JK |
5 | #include <linux/bits.h> |
6 | #include <linux/dmi.h> | |
7 | #include <linux/module.h> | |
8 | #include <linux/pci.h> | |
06508575 PLB |
9 | #include <linux/soundwire/sdw.h> |
10 | #include <linux/soundwire/sdw_intel.h> | |
82d9d54a JK |
11 | #include <sound/core.h> |
12 | #include <sound/intel-dsp-config.h> | |
13 | #include <sound/intel-nhlt.h> | |
14 | ||
15 | static int dsp_driver; | |
16 | ||
17 | module_param(dsp_driver, int, 0444); | |
18 | MODULE_PARM_DESC(dsp_driver, "Force the DSP driver for Intel DSP (0=auto, 1=legacy, 2=SST, 3=SOF)"); | |
19 | ||
06508575 PLB |
20 | #define FLAG_SST BIT(0) |
21 | #define FLAG_SOF BIT(1) | |
df1fceac | 22 | #define FLAG_SST_ONLY_IF_DMIC BIT(15) |
06508575 PLB |
23 | #define FLAG_SOF_ONLY_IF_DMIC BIT(16) |
24 | #define FLAG_SOF_ONLY_IF_SOUNDWIRE BIT(17) | |
25 | ||
26 | #define FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE (FLAG_SOF_ONLY_IF_DMIC | \ | |
27 | FLAG_SOF_ONLY_IF_SOUNDWIRE) | |
82d9d54a JK |
28 | |
29 | struct config_entry { | |
30 | u32 flags; | |
31 | u16 device; | |
b5682305 | 32 | u8 acpi_hid[ACPI_ID_LEN]; |
82d9d54a JK |
33 | const struct dmi_system_id *dmi_table; |
34 | }; | |
35 | ||
36 | /* | |
37 | * configuration table | |
38 | * - the order of similar PCI ID entries is important! | |
39 | * - the first successful match will win | |
40 | */ | |
41 | static const struct config_entry config_table[] = { | |
cc8f81c7 PLB |
42 | /* Merrifield */ |
43 | #if IS_ENABLED(CONFIG_SND_SOC_SOF_MERRIFIELD) | |
82d9d54a | 44 | { |
cc8f81c7 PLB |
45 | .flags = FLAG_SOF, |
46 | .device = 0x119a, | |
82d9d54a | 47 | }, |
cc8f81c7 PLB |
48 | #endif |
49 | /* Broxton-T */ | |
50 | #if IS_ENABLED(CONFIG_SND_SOC_SOF_APOLLOLAKE) | |
82d9d54a JK |
51 | { |
52 | .flags = FLAG_SOF, | |
cc8f81c7 | 53 | .device = 0x1a98, |
82d9d54a JK |
54 | }, |
55 | #endif | |
cc8f81c7 PLB |
56 | /* |
57 | * Apollolake (Broxton-P) | |
b79de57b | 58 | * the legacy HDAudio driver is used except on Up Squared (SOF) and |
cc8f81c7 PLB |
59 | * Chromebooks (SST) |
60 | */ | |
61 | #if IS_ENABLED(CONFIG_SND_SOC_SOF_APOLLOLAKE) | |
82d9d54a | 62 | { |
cc8f81c7 PLB |
63 | .flags = FLAG_SOF, |
64 | .device = 0x5a98, | |
65 | .dmi_table = (const struct dmi_system_id []) { | |
66 | { | |
67 | .ident = "Up Squared", | |
68 | .matches = { | |
69 | DMI_MATCH(DMI_SYS_VENDOR, "AAEON"), | |
70 | DMI_MATCH(DMI_BOARD_NAME, "UP-APL01"), | |
71 | } | |
72 | }, | |
73 | {} | |
74 | } | |
82d9d54a | 75 | }, |
cc8f81c7 PLB |
76 | #endif |
77 | #if IS_ENABLED(CONFIG_SND_SOC_INTEL_APL) | |
82d9d54a | 78 | { |
cc8f81c7 PLB |
79 | .flags = FLAG_SST, |
80 | .device = 0x5a98, | |
81 | .dmi_table = (const struct dmi_system_id []) { | |
82 | { | |
83 | .ident = "Google Chromebooks", | |
84 | .matches = { | |
85 | DMI_MATCH(DMI_SYS_VENDOR, "Google"), | |
86 | } | |
87 | }, | |
88 | {} | |
89 | } | |
82d9d54a JK |
90 | }, |
91 | #endif | |
cc8f81c7 | 92 | /* |
b79de57b | 93 | * Skylake and Kabylake use legacy HDAudio driver except for Google |
cc8f81c7 PLB |
94 | * Chromebooks (SST) |
95 | */ | |
96 | ||
97 | /* Sunrise Point-LP */ | |
98 | #if IS_ENABLED(CONFIG_SND_SOC_INTEL_SKL) | |
82d9d54a | 99 | { |
cc8f81c7 PLB |
100 | .flags = FLAG_SST, |
101 | .device = 0x9d70, | |
102 | .dmi_table = (const struct dmi_system_id []) { | |
103 | { | |
104 | .ident = "Google Chromebooks", | |
105 | .matches = { | |
106 | DMI_MATCH(DMI_SYS_VENDOR, "Google"), | |
107 | } | |
108 | }, | |
109 | {} | |
110 | } | |
82d9d54a | 111 | }, |
df1fceac CR |
112 | { |
113 | .flags = FLAG_SST | FLAG_SST_ONLY_IF_DMIC, | |
114 | .device = 0x9d70, | |
115 | }, | |
82d9d54a | 116 | #endif |
cc8f81c7 PLB |
117 | /* Kabylake-LP */ |
118 | #if IS_ENABLED(CONFIG_SND_SOC_INTEL_KBL) | |
82d9d54a | 119 | { |
cc8f81c7 PLB |
120 | .flags = FLAG_SST, |
121 | .device = 0x9d71, | |
122 | .dmi_table = (const struct dmi_system_id []) { | |
123 | { | |
124 | .ident = "Google Chromebooks", | |
125 | .matches = { | |
126 | DMI_MATCH(DMI_SYS_VENDOR, "Google"), | |
127 | } | |
128 | }, | |
129 | {} | |
130 | } | |
82d9d54a | 131 | }, |
df1fceac CR |
132 | { |
133 | .flags = FLAG_SST | FLAG_SST_ONLY_IF_DMIC, | |
134 | .device = 0x9d71, | |
135 | }, | |
82d9d54a | 136 | #endif |
cc8f81c7 PLB |
137 | |
138 | /* | |
b79de57b | 139 | * Geminilake uses legacy HDAudio driver except for Google |
cc8f81c7 PLB |
140 | * Chromebooks |
141 | */ | |
82d9d54a JK |
142 | /* Geminilake */ |
143 | #if IS_ENABLED(CONFIG_SND_SOC_SOF_GEMINILAKE) | |
144 | { | |
145 | .flags = FLAG_SOF, | |
146 | .device = 0x3198, | |
147 | .dmi_table = (const struct dmi_system_id []) { | |
148 | { | |
149 | .ident = "Google Chromebooks", | |
150 | .matches = { | |
151 | DMI_MATCH(DMI_SYS_VENDOR, "Google"), | |
152 | } | |
153 | }, | |
154 | {} | |
155 | } | |
156 | }, | |
157 | #endif | |
cc8f81c7 PLB |
158 | |
159 | /* | |
160 | * CoffeeLake, CannonLake, CometLake, IceLake, TigerLake use legacy | |
b79de57b | 161 | * HDAudio driver except for Google Chromebooks and when DMICs are |
cc8f81c7 PLB |
162 | * present. Two cases are required since Coreboot does not expose NHLT |
163 | * tables. | |
164 | * | |
165 | * When the Chromebook quirk is not present, it's based on information | |
166 | * that no such device exists. When the quirk is present, it could be | |
167 | * either based on product information or a placeholder. | |
168 | */ | |
169 | ||
170 | /* Cannonlake */ | |
171 | #if IS_ENABLED(CONFIG_SND_SOC_SOF_CANNONLAKE) | |
82d9d54a | 172 | { |
cc8f81c7 PLB |
173 | .flags = FLAG_SOF, |
174 | .device = 0x9dc8, | |
175 | .dmi_table = (const struct dmi_system_id []) { | |
176 | { | |
177 | .ident = "Google Chromebooks", | |
178 | .matches = { | |
179 | DMI_MATCH(DMI_SYS_VENDOR, "Google"), | |
180 | } | |
181 | }, | |
182 | {} | |
183 | } | |
82d9d54a | 184 | }, |
82d9d54a | 185 | { |
06508575 | 186 | .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, |
cc8f81c7 | 187 | .device = 0x9dc8, |
82d9d54a JK |
188 | }, |
189 | #endif | |
cc8f81c7 PLB |
190 | |
191 | /* Coffelake */ | |
192 | #if IS_ENABLED(CONFIG_SND_SOC_SOF_COFFEELAKE) | |
193 | { | |
194 | .flags = FLAG_SOF, | |
195 | .device = 0xa348, | |
196 | .dmi_table = (const struct dmi_system_id []) { | |
197 | { | |
198 | .ident = "Google Chromebooks", | |
199 | .matches = { | |
200 | DMI_MATCH(DMI_SYS_VENDOR, "Google"), | |
201 | } | |
202 | }, | |
203 | {} | |
204 | } | |
205 | }, | |
82d9d54a | 206 | { |
06508575 | 207 | .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, |
cc8f81c7 | 208 | .device = 0xa348, |
82d9d54a JK |
209 | }, |
210 | #endif | |
cc8f81c7 | 211 | |
4228668e | 212 | #if IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE) |
cc8f81c7 | 213 | /* Cometlake-LP */ |
82d9d54a JK |
214 | { |
215 | .flags = FLAG_SOF, | |
cc8f81c7 | 216 | .device = 0x02c8, |
82d9d54a JK |
217 | .dmi_table = (const struct dmi_system_id []) { |
218 | { | |
cc8f81c7 | 219 | .ident = "Google Chromebooks", |
82d9d54a | 220 | .matches = { |
cc8f81c7 | 221 | DMI_MATCH(DMI_SYS_VENDOR, "Google"), |
82d9d54a JK |
222 | } |
223 | }, | |
06508575 PLB |
224 | { |
225 | .matches = { | |
226 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"), | |
227 | DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "09C6") | |
228 | }, | |
229 | }, | |
230 | { | |
231 | /* early version of SKU 09C6 */ | |
232 | .matches = { | |
233 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"), | |
234 | DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0983") | |
235 | }, | |
236 | }, | |
82d9d54a JK |
237 | {} |
238 | } | |
239 | }, | |
82d9d54a | 240 | { |
06508575 | 241 | .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, |
cc8f81c7 | 242 | .device = 0x02c8, |
82d9d54a | 243 | }, |
cc8f81c7 | 244 | /* Cometlake-H */ |
82d9d54a | 245 | { |
06508575 PLB |
246 | .flags = FLAG_SOF, |
247 | .device = 0x06c8, | |
248 | .dmi_table = (const struct dmi_system_id []) { | |
249 | { | |
250 | .matches = { | |
251 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"), | |
252 | DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "098F"), | |
253 | }, | |
254 | }, | |
255 | { | |
256 | .matches = { | |
257 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"), | |
258 | DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0990"), | |
259 | }, | |
260 | }, | |
261 | {} | |
262 | } | |
263 | }, | |
264 | { | |
265 | .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, | |
cc8f81c7 | 266 | .device = 0x06c8, |
82d9d54a JK |
267 | }, |
268 | #endif | |
cc8f81c7 PLB |
269 | |
270 | /* Icelake */ | |
271 | #if IS_ENABLED(CONFIG_SND_SOC_SOF_ICELAKE) | |
82d9d54a | 272 | { |
cc8f81c7 PLB |
273 | .flags = FLAG_SOF, |
274 | .device = 0x34c8, | |
275 | .dmi_table = (const struct dmi_system_id []) { | |
276 | { | |
277 | .ident = "Google Chromebooks", | |
278 | .matches = { | |
279 | DMI_MATCH(DMI_SYS_VENDOR, "Google"), | |
280 | } | |
281 | }, | |
282 | {} | |
283 | } | |
82d9d54a | 284 | }, |
82d9d54a | 285 | { |
06508575 | 286 | .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, |
cc8f81c7 | 287 | .device = 0x34c8, |
82d9d54a JK |
288 | }, |
289 | #endif | |
cc8f81c7 | 290 | |
82d9d54a JK |
291 | /* Tigerlake */ |
292 | #if IS_ENABLED(CONFIG_SND_SOC_SOF_TIGERLAKE) | |
cc8f81c7 PLB |
293 | { |
294 | .flags = FLAG_SOF, | |
295 | .device = 0xa0c8, | |
296 | .dmi_table = (const struct dmi_system_id []) { | |
297 | { | |
298 | .ident = "Google Chromebooks", | |
299 | .matches = { | |
300 | DMI_MATCH(DMI_SYS_VENDOR, "Google"), | |
301 | } | |
302 | }, | |
303 | {} | |
304 | } | |
305 | }, | |
82d9d54a | 306 | { |
06508575 | 307 | .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, |
82d9d54a JK |
308 | .device = 0xa0c8, |
309 | }, | |
c5b5ff60 BL |
310 | { |
311 | .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, | |
312 | .device = 0x43c8, | |
313 | }, | |
82d9d54a | 314 | #endif |
cc8f81c7 PLB |
315 | |
316 | /* Elkhart Lake */ | |
317 | #if IS_ENABLED(CONFIG_SND_SOC_SOF_ELKHARTLAKE) | |
82d9d54a JK |
318 | { |
319 | .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC, | |
cc8f81c7 | 320 | .device = 0x4b55, |
82d9d54a JK |
321 | }, |
322 | #endif | |
cc8f81c7 | 323 | |
82d9d54a JK |
324 | }; |
325 | ||
326 | static const struct config_entry *snd_intel_dsp_find_config | |
327 | (struct pci_dev *pci, const struct config_entry *table, u32 len) | |
328 | { | |
329 | u16 device; | |
330 | ||
331 | device = pci->device; | |
332 | for (; len > 0; len--, table++) { | |
333 | if (table->device != device) | |
334 | continue; | |
335 | if (table->dmi_table && !dmi_check_system(table->dmi_table)) | |
336 | continue; | |
337 | return table; | |
338 | } | |
339 | return NULL; | |
340 | } | |
341 | ||
342 | static int snd_intel_dsp_check_dmic(struct pci_dev *pci) | |
343 | { | |
344 | struct nhlt_acpi_table *nhlt; | |
345 | int ret = 0; | |
346 | ||
347 | nhlt = intel_nhlt_init(&pci->dev); | |
348 | if (nhlt) { | |
349 | if (intel_nhlt_get_dmic_geo(&pci->dev, nhlt)) | |
350 | ret = 1; | |
351 | intel_nhlt_free(nhlt); | |
352 | } | |
353 | return ret; | |
354 | } | |
355 | ||
06508575 PLB |
356 | #if IS_ENABLED(CONFIG_SND_SOC_SOF_INTEL_SOUNDWIRE) |
357 | static int snd_intel_dsp_check_soundwire(struct pci_dev *pci) | |
358 | { | |
359 | struct sdw_intel_acpi_info info; | |
360 | acpi_handle handle; | |
361 | int ret; | |
362 | ||
363 | handle = ACPI_HANDLE(&pci->dev); | |
364 | ||
365 | ret = sdw_intel_acpi_scan(handle, &info); | |
366 | if (ret < 0) | |
367 | return ret; | |
368 | ||
369 | return info.link_mask; | |
370 | } | |
371 | #else | |
372 | static int snd_intel_dsp_check_soundwire(struct pci_dev *pci) | |
373 | { | |
374 | return 0; | |
375 | } | |
376 | #endif | |
377 | ||
82d9d54a JK |
378 | int snd_intel_dsp_driver_probe(struct pci_dev *pci) |
379 | { | |
380 | const struct config_entry *cfg; | |
381 | ||
82d9d54a | 382 | /* Intel vendor only */ |
91636a82 | 383 | if (pci->vendor != 0x8086) |
82d9d54a JK |
384 | return SND_INTEL_DSP_DRIVER_ANY; |
385 | ||
0e5cc221 PLB |
386 | /* |
387 | * Legacy devices don't have a PCI-based DSP and use HDaudio | |
388 | * for HDMI/DP support, ignore kernel parameter | |
389 | */ | |
390 | switch (pci->device) { | |
391 | case 0x160c: /* Broadwell */ | |
392 | case 0x0a0c: /* Haswell */ | |
393 | case 0x0c0c: | |
394 | case 0x0d0c: | |
395 | case 0x0f04: /* Baytrail */ | |
396 | case 0x2284: /* Braswell */ | |
397 | return SND_INTEL_DSP_DRIVER_ANY; | |
398 | } | |
399 | ||
91636a82 TI |
400 | if (dsp_driver > 0 && dsp_driver <= SND_INTEL_DSP_DRIVER_LAST) |
401 | return dsp_driver; | |
402 | ||
82d9d54a JK |
403 | /* |
404 | * detect DSP by checking class/subclass/prog-id information | |
405 | * class=04 subclass 03 prog-if 00: no DSP, use legacy driver | |
406 | * class=04 subclass 01 prog-if 00: DSP is present | |
407 | * (and may be required e.g. for DMIC or SSP support) | |
408 | * class=04 subclass 03 prog-if 80: use DSP or legacy mode | |
409 | */ | |
410 | if (pci->class == 0x040300) | |
411 | return SND_INTEL_DSP_DRIVER_LEGACY; | |
412 | if (pci->class != 0x040100 && pci->class != 0x040380) { | |
b79de57b | 413 | dev_err(&pci->dev, "Unknown PCI class/subclass/prog-if information (0x%06x) found, selecting HDAudio legacy driver\n", pci->class); |
82d9d54a JK |
414 | return SND_INTEL_DSP_DRIVER_LEGACY; |
415 | } | |
416 | ||
417 | dev_info(&pci->dev, "DSP detected with PCI class/subclass/prog-if info 0x%06x\n", pci->class); | |
418 | ||
419 | /* find the configuration for the specific device */ | |
420 | cfg = snd_intel_dsp_find_config(pci, config_table, ARRAY_SIZE(config_table)); | |
421 | if (!cfg) | |
422 | return SND_INTEL_DSP_DRIVER_ANY; | |
423 | ||
424 | if (cfg->flags & FLAG_SOF) { | |
06508575 PLB |
425 | if (cfg->flags & FLAG_SOF_ONLY_IF_SOUNDWIRE && |
426 | snd_intel_dsp_check_soundwire(pci) > 0) { | |
427 | dev_info(&pci->dev, "SoundWire enabled on CannonLake+ platform, using SOF driver\n"); | |
428 | return SND_INTEL_DSP_DRIVER_SOF; | |
429 | } | |
430 | if (cfg->flags & FLAG_SOF_ONLY_IF_DMIC && | |
431 | snd_intel_dsp_check_dmic(pci)) { | |
432 | dev_info(&pci->dev, "Digital mics found on Skylake+ platform, using SOF driver\n"); | |
82d9d54a JK |
433 | return SND_INTEL_DSP_DRIVER_SOF; |
434 | } | |
06508575 PLB |
435 | if (!(cfg->flags & FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE)) |
436 | return SND_INTEL_DSP_DRIVER_SOF; | |
82d9d54a JK |
437 | } |
438 | ||
df1fceac CR |
439 | |
440 | if (cfg->flags & FLAG_SST) { | |
441 | if (cfg->flags & FLAG_SST_ONLY_IF_DMIC) { | |
442 | if (snd_intel_dsp_check_dmic(pci)) { | |
443 | dev_info(&pci->dev, "Digital mics found on Skylake+ platform, using SST driver\n"); | |
444 | return SND_INTEL_DSP_DRIVER_SST; | |
445 | } | |
446 | } else { | |
447 | return SND_INTEL_DSP_DRIVER_SST; | |
448 | } | |
449 | } | |
82d9d54a JK |
450 | |
451 | return SND_INTEL_DSP_DRIVER_LEGACY; | |
452 | } | |
453 | EXPORT_SYMBOL_GPL(snd_intel_dsp_driver_probe); | |
454 | ||
5427c7d6 HG |
455 | /* Should we default to SOF or SST for BYT/CHT ? */ |
456 | #if IS_ENABLED(CONFIG_SND_INTEL_BYT_PREFER_SOF) || \ | |
457 | !IS_ENABLED(CONFIG_SND_SST_ATOM_HIFI2_PLATFORM_ACPI) | |
458 | #define FLAG_SST_OR_SOF_BYT FLAG_SOF | |
459 | #else | |
460 | #define FLAG_SST_OR_SOF_BYT FLAG_SST | |
461 | #endif | |
462 | ||
b5682305 PLB |
463 | /* |
464 | * configuration table | |
465 | * - the order of similar ACPI ID entries is important! | |
466 | * - the first successful match will win | |
467 | */ | |
468 | static const struct config_entry acpi_config_table[] = { | |
5427c7d6 HG |
469 | #if IS_ENABLED(CONFIG_SND_SST_ATOM_HIFI2_PLATFORM_ACPI) || \ |
470 | IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL) | |
b5682305 | 471 | /* BayTrail */ |
b5682305 | 472 | { |
5427c7d6 | 473 | .flags = FLAG_SST_OR_SOF_BYT, |
b5682305 PLB |
474 | .acpi_hid = "80860F28", |
475 | }, | |
b5682305 | 476 | /* CherryTrail */ |
b5682305 | 477 | { |
5427c7d6 | 478 | .flags = FLAG_SST_OR_SOF_BYT, |
b5682305 PLB |
479 | .acpi_hid = "808622A8", |
480 | }, | |
481 | #endif | |
803e5913 PLB |
482 | /* Broadwell */ |
483 | #if IS_ENABLED(CONFIG_SND_SOC_INTEL_CATPT) | |
484 | { | |
485 | .flags = FLAG_SST, | |
486 | .acpi_hid = "INT3438" | |
487 | }, | |
488 | #endif | |
489 | #if IS_ENABLED(CONFIG_SND_SOC_SOF_BROADWELL) | |
490 | { | |
491 | .flags = FLAG_SOF, | |
492 | .acpi_hid = "INT3438" | |
493 | }, | |
494 | #endif | |
495 | /* Haswell - not supported by SOF but added for consistency */ | |
496 | #if IS_ENABLED(CONFIG_SND_SOC_INTEL_CATPT) | |
497 | { | |
498 | .flags = FLAG_SST, | |
499 | .acpi_hid = "INT33C8" | |
500 | }, | |
501 | #endif | |
b5682305 PLB |
502 | }; |
503 | ||
504 | static const struct config_entry *snd_intel_acpi_dsp_find_config(const u8 acpi_hid[ACPI_ID_LEN], | |
505 | const struct config_entry *table, | |
506 | u32 len) | |
507 | { | |
508 | for (; len > 0; len--, table++) { | |
509 | if (memcmp(table->acpi_hid, acpi_hid, ACPI_ID_LEN)) | |
510 | continue; | |
511 | if (table->dmi_table && !dmi_check_system(table->dmi_table)) | |
512 | continue; | |
513 | return table; | |
514 | } | |
515 | return NULL; | |
516 | } | |
517 | ||
518 | int snd_intel_acpi_dsp_driver_probe(struct device *dev, const u8 acpi_hid[ACPI_ID_LEN]) | |
519 | { | |
520 | const struct config_entry *cfg; | |
521 | ||
522 | if (dsp_driver > SND_INTEL_DSP_DRIVER_LEGACY && dsp_driver <= SND_INTEL_DSP_DRIVER_LAST) | |
523 | return dsp_driver; | |
524 | ||
525 | if (dsp_driver == SND_INTEL_DSP_DRIVER_LEGACY) { | |
526 | dev_warn(dev, "dsp_driver parameter %d not supported, using automatic detection\n", | |
527 | SND_INTEL_DSP_DRIVER_LEGACY); | |
528 | } | |
529 | ||
530 | /* find the configuration for the specific device */ | |
531 | cfg = snd_intel_acpi_dsp_find_config(acpi_hid, acpi_config_table, | |
532 | ARRAY_SIZE(acpi_config_table)); | |
533 | if (!cfg) | |
534 | return SND_INTEL_DSP_DRIVER_ANY; | |
535 | ||
536 | if (cfg->flags & FLAG_SST) | |
537 | return SND_INTEL_DSP_DRIVER_SST; | |
538 | ||
539 | if (cfg->flags & FLAG_SOF) | |
540 | return SND_INTEL_DSP_DRIVER_SOF; | |
541 | ||
542 | return SND_INTEL_DSP_DRIVER_SST; | |
543 | } | |
544 | EXPORT_SYMBOL_GPL(snd_intel_acpi_dsp_driver_probe); | |
545 | ||
82d9d54a JK |
546 | MODULE_LICENSE("GPL v2"); |
547 | MODULE_DESCRIPTION("Intel DSP config driver"); | |
06508575 | 548 | MODULE_IMPORT_NS(SOUNDWIRE_INTEL_INIT); |