From: Daniel Baluta <daniel.baluta@oss.nxp.com>
To: broonie@kernel.org, alsa-devel@alsa-project.org
Cc: pierre-louis.bossart@linux.intel.com, lgirdwood@gmail.com,
daniel.baluta@nxp.com, daniel.baluta@gmail.com,
AjitKumar.Pandey@amd.com, Balakishore.pati@amd.com,
vsreddy@amd.com, Julian.Schroeder@amd.com,
vishnuvardhanrao.ravulapati@amd.com,
linux-kernel@vger.kernel.org, yc.hung@mediatek.com,
linux-mediatek@lists.infradead.org,
Bard Liao <bard.liao@intel.com>,
Kai Vehmanen <kai.vehmanen@linux.intel.com>
Subject: [PATCH 07/21] ASoC: amd: Add module to determine ACP configuration
Date: Wed, 17 Nov 2021 11:37:20 +0200 [thread overview]
Message-ID: <20211117093734.17407-8-daniel.baluta@oss.nxp.com> (raw)
In-Reply-To: <20211117093734.17407-1-daniel.baluta@oss.nxp.com>
From: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
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>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
---
sound/soc/amd/Kconfig | 6 +++
sound/soc/amd/Makefile | 2 +
sound/soc/amd/acp-config.c | 81 +++++++++++++++++++++++++++++++++++++
sound/soc/amd/mach-config.h | 29 +++++++++++++
4 files changed, 118 insertions(+)
create mode 100644 sound/soc/amd/acp-config.c
create mode 100644 sound/soc/amd/mach-config.h
diff --git a/sound/soc/amd/Kconfig b/sound/soc/amd/Kconfig
index 2c6af3f8f296..092966ff5ea7 100644
--- a/sound/soc/amd/Kconfig
+++ b/sound/soc/amd/Kconfig
@@ -96,4 +96,10 @@ config SND_SOC_AMD_YC_MACH
Say m if you have such a device.
If unsure select "N".
+config SND_AMD_ACP_CONFIG
+ tristate "AMD ACP configuration selection"
+ help
+ This option adds an auto detection to determine which ACP
+ driver modules to use
+
source "sound/soc/amd/acp/Kconfig"
diff --git a/sound/soc/amd/Makefile b/sound/soc/amd/Makefile
index f1d42bbda709..4b1f77930a4a 100644
--- a/sound/soc/amd/Makefile
+++ b/sound/soc/amd/Makefile
@@ -3,6 +3,7 @@ acp_audio_dma-objs := acp-pcm-dma.o
snd-soc-acp-da7219mx98357-mach-objs := acp-da7219-max98357a.o
snd-soc-acp-rt5645-mach-objs := acp-rt5645.o
snd-soc-acp-rt5682-mach-objs := acp3x-rt5682-max9836.o
+snd-acp-config-objs := acp-config.o
obj-$(CONFIG_SND_SOC_AMD_ACP) += acp_audio_dma.o
obj-$(CONFIG_SND_SOC_AMD_CZ_DA7219MX98357_MACH) += snd-soc-acp-da7219mx98357-mach.o
@@ -13,3 +14,4 @@ obj-$(CONFIG_SND_SOC_AMD_RENOIR) += renoir/
obj-$(CONFIG_SND_SOC_AMD_ACP5x) += vangogh/
obj-$(CONFIG_SND_SOC_AMD_ACP6x) += yc/
obj-$(CONFIG_SND_SOC_AMD_ACP_COMMON) += acp/
+obj-$(CONFIG_SND_AMD_ACP_CONFIG) += snd-acp-config.o
diff --git a/sound/soc/amd/acp-config.c b/sound/soc/amd/acp-config.c
new file mode 100644
index 000000000000..c9abbb46b6f5
--- /dev/null
+++ b/sound/soc/amd/acp-config.c
@@ -0,0 +1,81 @@
+// 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 "../sof/amd/acp.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"),
+ },
+ },
+ {}
+ },
+ },
+};
+
+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");
diff --git a/sound/soc/amd/mach-config.h b/sound/soc/amd/mach-config.h
new file mode 100644
index 000000000000..608f1e199775
--- /dev/null
+++ b/sound/soc/amd/mach-config.h
@@ -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
--
2.27.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
next prev parent reply other threads:[~2021-11-17 9:39 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-17 9:37 [PATCH 00/21] ASoC: SOF: Platform updates for AMD and Mediatek Daniel Baluta
2021-11-17 9:37 ` [PATCH 01/21] ASoC: SOF: amd: Add Renoir ACP HW support Daniel Baluta
2021-11-17 9:37 ` [PATCH 02/21] ASoC: SOF: amd: Add helper callbacks for ACP's DMA configuration Daniel Baluta
2021-11-17 9:37 ` [PATCH 03/21] ASoC: SOF: amd: Add fw loader and renoir dsp ops to load firmware Daniel Baluta
2021-11-17 9:37 ` [PATCH 04/21] ASoC: SOF: amd: Add IPC support for ACP IP block Daniel Baluta
2021-11-17 9:37 ` [PATCH 05/21] ASoC: SOF: amd: Add dai driver dsp ops callback for Renoir Daniel Baluta
2021-11-17 9:37 ` [PATCH 06/21] ASoC: SOF: amd: Add PCM stream callback for Renoir dai's Daniel Baluta
2021-11-17 9:37 ` Daniel Baluta [this message]
2021-11-30 16:41 ` [PATCH 07/21] ASoC: amd: Add module to determine ACP configuration Geert Uytterhoeven
2021-11-30 16:49 ` Pierre-Louis Bossart
2021-11-30 17:05 ` Mark Brown
2021-11-30 17:41 ` Daniel Baluta
2021-12-01 10:20 ` Geert Uytterhoeven
2021-11-17 9:37 ` [PATCH 08/21] ASoC: SOF: amd: Add machine driver dsp ops for Renoir platform Daniel Baluta
2021-11-17 9:37 ` [PATCH 09/21] ASoC: SOF: amd: Add Renoir PCI driver interface Daniel Baluta
2021-11-17 9:37 ` [PATCH 10/21] ASoC: amd: acp-config: Remove legacy acpi based machine struct Daniel Baluta
2021-11-17 9:37 ` [PATCH 11/21] ASoC: SOF: topology: Add support for AMD ACP DAIs Daniel Baluta
2021-11-17 9:37 ` [PATCH 12/21] ASoC: SOF: amd: Add trace logger support Daniel Baluta
2021-11-17 9:37 ` [PATCH 13/21] ASoC: SOF: amd: Add support for SOF firmware authentication Daniel Baluta
2021-11-17 19:08 ` Curtis Malainey
2021-11-17 9:37 ` [PATCH 14/21] ASoC: SOF: mediatek: Add mt8195 hardware support Daniel Baluta
2021-11-17 9:37 ` [PATCH 15/21] ASoC: SOF: tokens: add token for Mediatek AFE Daniel Baluta
2021-11-17 9:37 ` [PATCH 16/21] ASoC: SOF: topology: Add support for Mediatek AFE DAI Daniel Baluta
2021-11-17 17:29 ` Mark Brown
2021-11-17 17:32 ` Daniel Baluta
2021-11-18 9:34 ` Daniel Baluta
2021-11-18 9:48 ` Daniel Baluta
2021-11-17 9:37 ` [PATCH 17/21] ASoC: SOF: mediatek: Add fw loader and mt8195 dsp ops to load firmware Daniel Baluta
2021-11-17 9:37 ` [PATCH 18/21] ASoC: SOF: Add mt8195 device descriptor Daniel Baluta
2021-11-17 9:37 ` [PATCH 19/21] ASoC: SOF: mediatek: Add dai driver dsp ops callback for mt8195 Daniel Baluta
2021-11-17 9:37 ` [PATCH 20/21] ASoC: SOF: mediatek: Add mt8195 dsp clock support Daniel Baluta
2021-11-17 9:37 ` [PATCH 21/21] ASoC: SOF: mediatek: Add DSP system PM callback for mt8195 Daniel Baluta
2021-11-17 22:31 ` [PATCH 00/21] ASoC: SOF: Platform updates for AMD and Mediatek Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211117093734.17407-8-daniel.baluta@oss.nxp.com \
--to=daniel.baluta@oss.nxp.com \
--cc=AjitKumar.Pandey@amd.com \
--cc=Balakishore.pati@amd.com \
--cc=Julian.Schroeder@amd.com \
--cc=alsa-devel@alsa-project.org \
--cc=bard.liao@intel.com \
--cc=broonie@kernel.org \
--cc=daniel.baluta@gmail.com \
--cc=daniel.baluta@nxp.com \
--cc=kai.vehmanen@linux.intel.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=vishnuvardhanrao.ravulapati@amd.com \
--cc=vsreddy@amd.com \
--cc=yc.hung@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox