Commit f51daa78 authored by Mark Brown's avatar Mark Brown

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.
parents 7a27dbf7 576f3aef
......@@ -307,4 +307,5 @@ struct snd_soc_acpi_mach snd_soc_acpi_amd_acp63_sof_machines[] = {
};
EXPORT_SYMBOL(snd_soc_acpi_amd_acp63_sof_machines);
MODULE_DESCRIPTION("AMD ACP Machine Configuration Module");
MODULE_LICENSE("Dual BSD/GPL");
......@@ -1773,4 +1773,5 @@ int acp_legacy_dai_links_create(struct snd_soc_card *card)
}
EXPORT_SYMBOL_NS_GPL(acp_legacy_dai_links_create, SND_SOC_AMD_MACH);
MODULE_DESCRIPTION("AMD ACP Common Machine driver");
MODULE_LICENSE("GPL v2");
......@@ -439,7 +439,15 @@ static const struct dmi_system_id acp5x_vg_quirk_table[] = {
.matches = {
DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Valve"),
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Jupiter"),
}
},
.driver_data = (void *)&acp5x_8821_35l41_card,
},
{
.matches = {
DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Valve"),
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Galileo"),
},
.driver_data = (void *)&acp5x_8821_98388_card,
},
{}
};
......@@ -452,25 +460,15 @@ static int acp5x_probe(struct platform_device *pdev)
struct snd_soc_card *card;
int ret;
card = (struct snd_soc_card *)device_get_match_data(dev);
if (!card) {
/*
* This is normally the result of directly probing the driver
* in pci-acp5x through platform_device_register_full(), which
* is necessary for the CS35L41 variant, as it doesn't support
* ACPI probing and relies on DMI quirks.
*/
dmi_id = dmi_first_match(acp5x_vg_quirk_table);
if (!dmi_id)
return -ENODEV;
card = &acp5x_8821_35l41_card;
}
dmi_id = dmi_first_match(acp5x_vg_quirk_table);
if (!dmi_id || !dmi_id->driver_data)
return -ENODEV;
machine = devm_kzalloc(dev, sizeof(*machine), GFP_KERNEL);
if (!machine)
return -ENOMEM;
card = dmi_id->driver_data;
card->dev = dev;
platform_set_drvdata(pdev, card);
snd_soc_card_set_drvdata(card, machine);
......@@ -482,17 +480,10 @@ static int acp5x_probe(struct platform_device *pdev)
return 0;
}
static const struct acpi_device_id acp5x_acpi_match[] = {
{ "AMDI8821", (kernel_ulong_t)&acp5x_8821_98388_card },
{},
};
MODULE_DEVICE_TABLE(acpi, acp5x_acpi_match);
static struct platform_driver acp5x_mach_driver = {
.driver = {
.name = DRV_NAME,
.pm = &snd_soc_pm_ops,
.acpi_match_table = acp5x_acpi_match,
},
.probe = acp5x_probe,
};
......
......@@ -130,9 +130,13 @@ static int snd_acp5x_probe(struct pci_dev *pci,
int ret, i;
u32 addr, val;
/* Return if acp config flag is defined */
/*
* Return if ACP config flag is defined, except when board
* supports SOF while it is not being enabled in kernel config.
*/
flag = snd_amd_acp_find_config(pci);
if (flag != FLAG_AMD_LEGACY)
if (flag != FLAG_AMD_LEGACY &&
(flag != FLAG_AMD_SOF || IS_ENABLED(CONFIG_SND_SOC_SOF_AMD_VANGOGH)))
return -ENODEV;
irqflags = IRQF_SHARED;
......@@ -260,7 +264,7 @@ static int snd_acp5x_probe(struct pci_dev *pci,
return ret;
}
static int __maybe_unused snd_acp5x_suspend(struct device *dev)
static int snd_acp5x_suspend(struct device *dev)
{
int ret;
struct acp5x_dev_data *adata;
......@@ -275,7 +279,7 @@ static int __maybe_unused snd_acp5x_suspend(struct device *dev)
return ret;
}
static int __maybe_unused snd_acp5x_resume(struct device *dev)
static int snd_acp5x_resume(struct device *dev)
{
int ret;
struct acp5x_dev_data *adata;
......@@ -290,9 +294,8 @@ static int __maybe_unused snd_acp5x_resume(struct device *dev)
}
static const struct dev_pm_ops acp5x_pm = {
SET_RUNTIME_PM_OPS(snd_acp5x_suspend,
snd_acp5x_resume, NULL)
SET_SYSTEM_SLEEP_PM_OPS(snd_acp5x_suspend, snd_acp5x_resume)
RUNTIME_PM_OPS(snd_acp5x_suspend, snd_acp5x_resume, NULL)
SYSTEM_SLEEP_PM_OPS(snd_acp5x_suspend, snd_acp5x_resume)
};
static void snd_acp5x_remove(struct pci_dev *pci)
......@@ -328,7 +331,7 @@ static struct pci_driver acp5x_driver = {
.probe = snd_acp5x_probe,
.remove = snd_acp5x_remove,
.driver = {
.pm = &acp5x_pm,
.pm = pm_ptr(&acp5x_pm),
}
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment