forked from tiwai/sound
Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
ASoC: amd: Add module to determine ACP configuration
ACP hw block configuration differs across various distributions and hence it's required to register different drivers module for distributions. For now we support three ACP drivers: * ACP without SOF use case * ACP with SOF use case * ACP with SOF use case for DMIC and non SOF for I2S endpoints As all above driver registers with common PCI ID for ACP hw block we need code to determine ACP configuration and auto select driver module. This patch expose function that return configuration flag based on dmi checks for a system. ACP driver module probe register platform device based on such configuration flag to avoid conflict with other ACP drivers probed for same PCI ID. Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
- Loading branch information
1 parent
a90c7bc
commit ea7fee23e309c699cb1716ceb121b6c8a5a485da
Showing
4 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) | ||
| // | ||
| // This file is provided under a dual BSD/GPLv2 license. When using or | ||
| // redistributing this file, you may do so under either license. | ||
| // | ||
| // Copyright(c) 2021 Advanced Micro Devices, Inc. | ||
| // | ||
| // Authors: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com> | ||
| // | ||
|
|
||
| /* ACP machine configuration module */ | ||
|
|
||
| #include <linux/acpi.h> | ||
| #include <linux/bits.h> | ||
| #include <linux/dmi.h> | ||
| #include <linux/module.h> | ||
| #include <linux/pci.h> | ||
|
|
||
| #include "mach-config.h" | ||
|
|
||
| static int acp_quirk_data; | ||
|
|
||
| static const struct config_entry config_table[] = { | ||
| { | ||
| .flags = FLAG_AMD_SOF, | ||
| .device = ACP_PCI_DEV_ID, | ||
| .dmi_table = (const struct dmi_system_id []) { | ||
| { | ||
| .matches = { | ||
| DMI_MATCH(DMI_SYS_VENDOR, "AMD"), | ||
| DMI_MATCH(DMI_PRODUCT_NAME, "Majolica-CZN"), | ||
| }, | ||
| }, | ||
| {} | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| static int snd_amd_acp_find_config(struct pci_dev *pci) | ||
| { | ||
| const struct config_entry *table = config_table; | ||
| u16 device = pci->device; | ||
| int i; | ||
|
|
||
| for (i = 0; i < ARRAY_SIZE(config_table); i++, table++) { | ||
| if (table->device != device) | ||
| continue; | ||
| if (table->dmi_table && !dmi_check_system(table->dmi_table)) | ||
| continue; | ||
| acp_quirk_data = table->flags; | ||
| return table->flags; | ||
| } | ||
|
|
||
| return 0; | ||
| } | ||
| EXPORT_SYMBOL(snd_amd_acp_find_config); | ||
|
|
||
| struct snd_soc_acpi_mach snd_soc_acpi_amd_sof_machines[] = { | ||
| { | ||
| .id = "AMDI1019", | ||
| .drv_name = "renoir-dsp", | ||
| .pdata = (void *)&acp_quirk_data, | ||
| .fw_filename = "sof-rn.ri", | ||
| .sof_tplg_filename = "sof-acp.tplg", | ||
| }, | ||
| {}, | ||
| }; | ||
| EXPORT_SYMBOL(snd_soc_acpi_amd_sof_machines); | ||
|
|
||
| struct snd_soc_acpi_mach snd_soc_acpi_amd_acp_machines[] = { | ||
| { | ||
| .id = "AMDI1019", | ||
| .drv_name = "renoir-acp", | ||
| .pdata = (void *)&acp_quirk_data, | ||
| }, | ||
| {}, | ||
| }; | ||
| EXPORT_SYMBOL(snd_soc_acpi_amd_acp_machines); | ||
|
|
||
| MODULE_LICENSE("Dual BSD/GPL"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ | ||
| /* | ||
| * This file is provided under a dual BSD/GPLv2 license. When using or | ||
| * redistributing this file, you may do so under either license. | ||
| * | ||
| * Copyright(c) 2021 Advanced Micro Devices, Inc. All rights reserved. | ||
| * | ||
| * Author: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com> | ||
| */ | ||
| #ifndef __AMD_MACH_CONFIG_H | ||
| #define __AMD_MACH_CONFIG_H | ||
|
|
||
| #include <sound/soc-acpi.h> | ||
|
|
||
| #define FLAG_AMD_SOF BIT(1) | ||
| #define FLAG_AMD_SOF_ONLY_DMIC BIT(2) | ||
|
|
||
| #define ACP_PCI_DEV_ID 0x15E2 | ||
|
|
||
| extern struct snd_soc_acpi_mach snd_soc_acpi_amd_sof_machines[]; | ||
| extern struct snd_soc_acpi_mach snd_soc_acpi_amd_acp_machines[]; | ||
|
|
||
| struct config_entry { | ||
| u32 flags; | ||
| u16 device; | ||
| const struct dmi_system_id *dmi_table; | ||
| }; | ||
|
|
||
| #endif |