Skip to content

Commit f51daa7

Browse files
committed
Improve AMD ACP Vangogh audio support for Steam Deck
Merge series from Cristian Ciocaltea <cristian.ciocaltea@collabora.com>: This patch series provides several fixes and improvements to AMD ACP drivers targeting the Vangogh platform, as found on the Valve's new Steam Deck OLED. Although in theory the board should have been supported by both SOF and legacy ACP drivers, as of next-20231208 the audio seems to be completely broken. Please note this only restores the legacy support, while SOF will be handled in a separate series.
2 parents 7a27dbf + 576f3ae commit f51daa7

4 files changed

Lines changed: 26 additions & 30 deletions

File tree

sound/soc/amd/acp-config.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,4 +307,5 @@ struct snd_soc_acpi_mach snd_soc_acpi_amd_acp63_sof_machines[] = {
307307
};
308308
EXPORT_SYMBOL(snd_soc_acpi_amd_acp63_sof_machines);
309309

310+
MODULE_DESCRIPTION("AMD ACP Machine Configuration Module");
310311
MODULE_LICENSE("Dual BSD/GPL");

sound/soc/amd/acp/acp-mach-common.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1773,4 +1773,5 @@ int acp_legacy_dai_links_create(struct snd_soc_card *card)
17731773
}
17741774
EXPORT_SYMBOL_NS_GPL(acp_legacy_dai_links_create, SND_SOC_AMD_MACH);
17751775

1776+
MODULE_DESCRIPTION("AMD ACP Common Machine driver");
17761777
MODULE_LICENSE("GPL v2");

sound/soc/amd/vangogh/acp5x-mach.c

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,15 @@ static const struct dmi_system_id acp5x_vg_quirk_table[] = {
439439
.matches = {
440440
DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Valve"),
441441
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Jupiter"),
442-
}
442+
},
443+
.driver_data = (void *)&acp5x_8821_35l41_card,
444+
},
445+
{
446+
.matches = {
447+
DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Valve"),
448+
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Galileo"),
449+
},
450+
.driver_data = (void *)&acp5x_8821_98388_card,
443451
},
444452
{}
445453
};
@@ -452,25 +460,15 @@ static int acp5x_probe(struct platform_device *pdev)
452460
struct snd_soc_card *card;
453461
int ret;
454462

455-
card = (struct snd_soc_card *)device_get_match_data(dev);
456-
if (!card) {
457-
/*
458-
* This is normally the result of directly probing the driver
459-
* in pci-acp5x through platform_device_register_full(), which
460-
* is necessary for the CS35L41 variant, as it doesn't support
461-
* ACPI probing and relies on DMI quirks.
462-
*/
463-
dmi_id = dmi_first_match(acp5x_vg_quirk_table);
464-
if (!dmi_id)
465-
return -ENODEV;
466-
467-
card = &acp5x_8821_35l41_card;
468-
}
463+
dmi_id = dmi_first_match(acp5x_vg_quirk_table);
464+
if (!dmi_id || !dmi_id->driver_data)
465+
return -ENODEV;
469466

470467
machine = devm_kzalloc(dev, sizeof(*machine), GFP_KERNEL);
471468
if (!machine)
472469
return -ENOMEM;
473470

471+
card = dmi_id->driver_data;
474472
card->dev = dev;
475473
platform_set_drvdata(pdev, card);
476474
snd_soc_card_set_drvdata(card, machine);
@@ -482,17 +480,10 @@ static int acp5x_probe(struct platform_device *pdev)
482480
return 0;
483481
}
484482

485-
static const struct acpi_device_id acp5x_acpi_match[] = {
486-
{ "AMDI8821", (kernel_ulong_t)&acp5x_8821_98388_card },
487-
{},
488-
};
489-
MODULE_DEVICE_TABLE(acpi, acp5x_acpi_match);
490-
491483
static struct platform_driver acp5x_mach_driver = {
492484
.driver = {
493485
.name = DRV_NAME,
494486
.pm = &snd_soc_pm_ops,
495-
.acpi_match_table = acp5x_acpi_match,
496487
},
497488
.probe = acp5x_probe,
498489
};

sound/soc/amd/vangogh/pci-acp5x.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,13 @@ static int snd_acp5x_probe(struct pci_dev *pci,
130130
int ret, i;
131131
u32 addr, val;
132132

133-
/* Return if acp config flag is defined */
133+
/*
134+
* Return if ACP config flag is defined, except when board
135+
* supports SOF while it is not being enabled in kernel config.
136+
*/
134137
flag = snd_amd_acp_find_config(pci);
135-
if (flag != FLAG_AMD_LEGACY)
138+
if (flag != FLAG_AMD_LEGACY &&
139+
(flag != FLAG_AMD_SOF || IS_ENABLED(CONFIG_SND_SOC_SOF_AMD_VANGOGH)))
136140
return -ENODEV;
137141

138142
irqflags = IRQF_SHARED;
@@ -260,7 +264,7 @@ static int snd_acp5x_probe(struct pci_dev *pci,
260264
return ret;
261265
}
262266

263-
static int __maybe_unused snd_acp5x_suspend(struct device *dev)
267+
static int snd_acp5x_suspend(struct device *dev)
264268
{
265269
int ret;
266270
struct acp5x_dev_data *adata;
@@ -275,7 +279,7 @@ static int __maybe_unused snd_acp5x_suspend(struct device *dev)
275279
return ret;
276280
}
277281

278-
static int __maybe_unused snd_acp5x_resume(struct device *dev)
282+
static int snd_acp5x_resume(struct device *dev)
279283
{
280284
int ret;
281285
struct acp5x_dev_data *adata;
@@ -290,9 +294,8 @@ static int __maybe_unused snd_acp5x_resume(struct device *dev)
290294
}
291295

292296
static const struct dev_pm_ops acp5x_pm = {
293-
SET_RUNTIME_PM_OPS(snd_acp5x_suspend,
294-
snd_acp5x_resume, NULL)
295-
SET_SYSTEM_SLEEP_PM_OPS(snd_acp5x_suspend, snd_acp5x_resume)
297+
RUNTIME_PM_OPS(snd_acp5x_suspend, snd_acp5x_resume, NULL)
298+
SYSTEM_SLEEP_PM_OPS(snd_acp5x_suspend, snd_acp5x_resume)
296299
};
297300

298301
static void snd_acp5x_remove(struct pci_dev *pci)
@@ -328,7 +331,7 @@ static struct pci_driver acp5x_driver = {
328331
.probe = snd_acp5x_probe,
329332
.remove = snd_acp5x_remove,
330333
.driver = {
331-
.pm = &acp5x_pm,
334+
.pm = pm_ptr(&acp5x_pm),
332335
}
333336
};
334337

0 commit comments

Comments
 (0)