1 // SPDX-License-Identifier: GPL-2.0+
3 * Machine driver for AMD Yellow Carp platform using DMIC
5 * Copyright 2021 Advanced Micro Devices, Inc.
9 #include <sound/soc-dapm.h>
10 #include <linux/module.h>
11 #include <sound/pcm.h>
12 #include <sound/pcm_params.h>
14 #include <linux/dmi.h>
15 #include <linux/acpi.h>
19 #define DRV_NAME "acp_yc_mach"
21 SND_SOC_DAILINK_DEF(acp6x_pdm,
22 DAILINK_COMP_ARRAY(COMP_CPU("acp_yc_pdm_dma.0")));
24 SND_SOC_DAILINK_DEF(dmic_codec,
25 DAILINK_COMP_ARRAY(COMP_CODEC("dmic-codec.0",
28 SND_SOC_DAILINK_DEF(pdm_platform,
29 DAILINK_COMP_ARRAY(COMP_PLATFORM("acp_yc_pdm_dma.0")));
31 static struct snd_soc_dai_link acp6x_dai_pdm[] = {
33 .name = "acp6x-dmic-capture",
34 .stream_name = "DMIC capture",
36 SND_SOC_DAILINK_REG(acp6x_pdm, dmic_codec, pdm_platform),
40 static struct snd_soc_card acp6x_card = {
43 .dai_link = acp6x_dai_pdm,
47 static const struct dmi_system_id yc_acp_quirk_table[] = {
49 .driver_data = &acp6x_card,
51 DMI_MATCH(DMI_BOARD_VENDOR, "Dell Inc."),
52 DMI_MATCH(DMI_PRODUCT_NAME, "Dell G15 5525"),
56 .driver_data = &acp6x_card,
58 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
59 DMI_MATCH(DMI_PRODUCT_NAME, "21D0"),
63 .driver_data = &acp6x_card,
65 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
66 DMI_MATCH(DMI_PRODUCT_NAME, "21D0"),
70 .driver_data = &acp6x_card,
72 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
73 DMI_MATCH(DMI_PRODUCT_NAME, "21D1"),
77 .driver_data = &acp6x_card,
79 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
80 DMI_MATCH(DMI_PRODUCT_NAME, "21D2"),
84 .driver_data = &acp6x_card,
86 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
87 DMI_MATCH(DMI_PRODUCT_NAME, "21D3"),
91 .driver_data = &acp6x_card,
93 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
94 DMI_MATCH(DMI_PRODUCT_NAME, "21D4"),
98 .driver_data = &acp6x_card,
100 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
101 DMI_MATCH(DMI_PRODUCT_NAME, "21D5"),
105 .driver_data = &acp6x_card,
107 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
108 DMI_MATCH(DMI_PRODUCT_NAME, "21CF"),
112 .driver_data = &acp6x_card,
114 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
115 DMI_MATCH(DMI_PRODUCT_NAME, "21CG"),
119 .driver_data = &acp6x_card,
121 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
122 DMI_MATCH(DMI_PRODUCT_NAME, "21CQ"),
126 .driver_data = &acp6x_card,
128 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
129 DMI_MATCH(DMI_PRODUCT_NAME, "21CR"),
133 .driver_data = &acp6x_card,
135 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
136 DMI_MATCH(DMI_PRODUCT_NAME, "21CM"),
140 .driver_data = &acp6x_card,
142 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
143 DMI_MATCH(DMI_PRODUCT_NAME, "21CN"),
147 .driver_data = &acp6x_card,
149 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
150 DMI_MATCH(DMI_PRODUCT_NAME, "21CH"),
154 .driver_data = &acp6x_card,
156 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
157 DMI_MATCH(DMI_PRODUCT_NAME, "21CJ"),
161 .driver_data = &acp6x_card,
163 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
164 DMI_MATCH(DMI_PRODUCT_NAME, "21CK"),
168 .driver_data = &acp6x_card,
170 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
171 DMI_MATCH(DMI_PRODUCT_NAME, "21CL"),
175 .driver_data = &acp6x_card,
177 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
178 DMI_MATCH(DMI_PRODUCT_NAME, "21EF"),
182 .driver_data = &acp6x_card,
184 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
185 DMI_MATCH(DMI_PRODUCT_NAME, "21EM"),
189 .driver_data = &acp6x_card,
191 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
192 DMI_MATCH(DMI_PRODUCT_NAME, "21EN"),
196 .driver_data = &acp6x_card,
198 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
199 DMI_MATCH(DMI_PRODUCT_NAME, "21HY"),
203 .driver_data = &acp6x_card,
205 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
206 DMI_MATCH(DMI_PRODUCT_NAME, "21J5"),
210 .driver_data = &acp6x_card,
212 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
213 DMI_MATCH(DMI_PRODUCT_NAME, "21J6"),
217 .driver_data = &acp6x_card,
219 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
220 DMI_MATCH(DMI_PRODUCT_NAME, "82QF"),
224 .driver_data = &acp6x_card,
226 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
227 DMI_MATCH(DMI_PRODUCT_NAME, "82TL"),
231 .driver_data = &acp6x_card,
233 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
234 DMI_MATCH(DMI_PRODUCT_NAME, "82UG"),
238 .driver_data = &acp6x_card,
240 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
241 DMI_MATCH(DMI_PRODUCT_NAME, "82V2"),
245 .driver_data = &acp6x_card,
247 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
248 DMI_MATCH(DMI_PRODUCT_NAME, "82YM"),
252 .driver_data = &acp6x_card,
254 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK COMPUTER INC."),
255 DMI_MATCH(DMI_PRODUCT_NAME, "UM5302TA"),
259 .driver_data = &acp6x_card,
261 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK COMPUTER INC."),
262 DMI_MATCH(DMI_PRODUCT_NAME, "M5402RA"),
266 .driver_data = &acp6x_card,
268 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK COMPUTER INC."),
269 DMI_MATCH(DMI_PRODUCT_NAME, "M6400RC"),
273 .driver_data = &acp6x_card,
275 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK COMPUTER INC."),
276 DMI_MATCH(DMI_PRODUCT_NAME, "M3402RA"),
280 .driver_data = &acp6x_card,
282 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK COMPUTER INC."),
283 DMI_MATCH(DMI_PRODUCT_NAME, "M6500RC"),
287 .driver_data = &acp6x_card,
289 DMI_MATCH(DMI_BOARD_VENDOR, "Micro-Star International Co., Ltd."),
290 DMI_MATCH(DMI_PRODUCT_NAME, "Bravo 15 B7ED"),
294 .driver_data = &acp6x_card,
296 DMI_MATCH(DMI_BOARD_VENDOR, "Alienware"),
297 DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m17 R5 AMD"),
301 .driver_data = &acp6x_card,
303 DMI_MATCH(DMI_BOARD_VENDOR, "TIMI"),
304 DMI_MATCH(DMI_PRODUCT_NAME, "Redmi Book Pro 14 2022"),
308 .driver_data = &acp6x_card,
310 DMI_MATCH(DMI_BOARD_VENDOR, "TIMI"),
311 DMI_MATCH(DMI_PRODUCT_NAME, "Redmi Book Pro 15 2022"),
315 .driver_data = &acp6x_card,
317 DMI_MATCH(DMI_BOARD_VENDOR, "Razer"),
318 DMI_MATCH(DMI_PRODUCT_NAME, "Blade 14 (2022) - RZ09-0427"),
322 .driver_data = &acp6x_card,
324 DMI_MATCH(DMI_BOARD_VENDOR, "RB"),
325 DMI_MATCH(DMI_PRODUCT_NAME, "Swift SFA16-41"),
329 .driver_data = &acp6x_card,
331 DMI_MATCH(DMI_BOARD_VENDOR, "IRBIS"),
332 DMI_MATCH(DMI_PRODUCT_NAME, "15NBC1011"),
336 .driver_data = &acp6x_card,
338 DMI_MATCH(DMI_BOARD_VENDOR, "HP"),
339 DMI_MATCH(DMI_PRODUCT_NAME, "OMEN by HP Gaming Laptop 16z-n000"),
343 .driver_data = &acp6x_card,
345 DMI_MATCH(DMI_BOARD_VENDOR, "HP"),
346 DMI_MATCH(DMI_BOARD_NAME, "8A42"),
350 .driver_data = &acp6x_card,
352 DMI_MATCH(DMI_BOARD_VENDOR, "HP"),
353 DMI_MATCH(DMI_BOARD_NAME, "8A43"),
357 .driver_data = &acp6x_card,
359 DMI_MATCH(DMI_BOARD_VENDOR, "HP"),
360 DMI_MATCH(DMI_BOARD_NAME, "8A22"),
364 .driver_data = &acp6x_card,
366 DMI_MATCH(DMI_BOARD_VENDOR, "HP"),
367 DMI_MATCH(DMI_BOARD_NAME, "8A3E"),
371 .driver_data = &acp6x_card,
373 DMI_MATCH(DMI_BOARD_VENDOR, "MECHREVO"),
374 DMI_MATCH(DMI_BOARD_NAME, "MRID6"),
378 .driver_data = &acp6x_card,
380 DMI_MATCH(DMI_BOARD_VENDOR, "System76"),
381 DMI_MATCH(DMI_PRODUCT_VERSION, "pang12"),
387 static int acp6x_probe(struct platform_device *pdev)
389 const struct dmi_system_id *dmi_id;
390 struct acp6x_pdm *machine = NULL;
391 struct snd_soc_card *card;
392 struct acpi_device *adev;
395 /* check the parent device's firmware node has _DSD or not */
396 adev = ACPI_COMPANION(pdev->dev.parent);
398 const union acpi_object *obj;
400 if (!acpi_dev_get_property(adev, "AcpDmicConnected", ACPI_TYPE_INTEGER, &obj) &&
401 obj->integer.value == 1)
402 platform_set_drvdata(pdev, &acp6x_card);
405 /* check for any DMI overrides */
406 dmi_id = dmi_first_match(yc_acp_quirk_table);
408 platform_set_drvdata(pdev, dmi_id->driver_data);
410 card = platform_get_drvdata(pdev);
413 dev_info(&pdev->dev, "Enabling ACP DMIC support via %s", dmi_id ? "DMI" : "ACPI");
414 acp6x_card.dev = &pdev->dev;
416 snd_soc_card_set_drvdata(card, machine);
417 ret = devm_snd_soc_register_card(&pdev->dev, card);
419 return dev_err_probe(&pdev->dev, ret,
420 "snd_soc_register_card(%s) failed\n",
426 static struct platform_driver acp6x_mach_driver = {
428 .name = "acp_yc_mach",
429 .pm = &snd_soc_pm_ops,
431 .probe = acp6x_probe,
434 module_platform_driver(acp6x_mach_driver);
436 MODULE_AUTHOR("Vijendar.Mukunda@amd.com");
437 MODULE_LICENSE("GPL v2");
438 MODULE_ALIAS("platform:" DRV_NAME);