Skip to contentSkip to conversation

ASoC: Add common modules support for ACP hw block

PATCH Superseded Ajit Kumar Pandey 2 participants 12 messages Oct 11, 2021 – Oct 12, 2021

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#1 lore raw

PATCH v2 1/8 ASoC: amd: Add common framework to support I2S on ACP SOC

In reply to Ajit Kumar Pandey

We are using legacy way of exposing dais and DMA configuration that requires separate driver modules for various ACP SOC with almost similar hw configuration. Moreover the legacy approach requires separate I2S and DMA module platform devices registration and need machine specific quirk to control various I2S endpoints. Add generic dai driver and platform driver for I2S controller on ACP hw block. This common framework can be used by various ACP platform devices that shares common specs.

---
 sound/soc/amd/Kconfig                |   2 +
 sound/soc/amd/Makefile               |   1 +
 sound/soc/amd/acp/Kconfig            |  18 ++
 sound/soc/amd/acp/Makefile           |  12 +
 sound/soc/amd/acp/acp-i2s.c          | 340 +++++++++++++++++++++++++++
 sound/soc/amd/acp/acp-platform.c     | 292 +++++++++++++++++++++++
 sound/soc/amd/acp/amd.h              | 140 +++++++++++
 sound/soc/amd/acp/chip_offset_byte.h |  76 ++++++
 8 files changed, 881 insertions(+)
 create mode 100644 sound/soc/amd/acp/Kconfig
 create mode 100644 sound/soc/amd/acp/Makefile
 create mode 100644 sound/soc/amd/acp/acp-i2s.c
 create mode 100644 sound/soc/amd/acp/acp-platform.c
 create mode 100644 sound/soc/amd/acp/amd.h
 create mode 100644 sound/soc/amd/acp/chip_offset_byte.h
sound/soc/amd/Kconfig +2 -0
index 49ff5e73e9ba..78e99cd25c37 100644
@@ -61,3 +61,5 @@ config SND_SOC_AMD_ACP5x
 
 	 By enabling this flag build will trigger for ACP PCI driver,
 	 ACP DMA driver, CPU DAI driver.
+
+source "sound/soc/amd/acp/Kconfig"
sound/soc/amd/Makefile +1 -0
index 07150d26f315..9878907c89a6 100644
@@ -11,3 +11,4 @@ obj-$(CONFIG_SND_SOC_AMD_ACP3x) += raven/
 obj-$(CONFIG_SND_SOC_AMD_RV_RT5682_MACH) += snd-soc-acp-rt5682-mach.o
 obj-$(CONFIG_SND_SOC_AMD_RENOIR) += renoir/
 obj-$(CONFIG_SND_SOC_AMD_ACP5x) += vangogh/
+obj-$(CONFIG_SND_SOC_AMD_ACP_COMMON) += acp/
sound/soc/amd/acp/Kconfig new file +18 -0
new file mode 100644
index 000000000000..6b993074e2c4
@@ -0,0 +1,18 @@
+# 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.
+#
+
+config SND_SOC_AMD_ACP_COMMON
+	tristate "AMD Audio ACP Common support"
+	select SND_AMD_ACP_CONFIG
+	help
+	  This option enables ACP support on AMD platform.
+
+config SND_SOC_AMD_ACP_I2S
+	tristate
+
+config SND_SOC_AMD_ACP_PCM
+	tristate
sound/soc/amd/acp/Makefile new file +12 -0
new file mode 100644
index 000000000000..b2e12659d97b
@@ -0,0 +1,12 @@
+# 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.
+
+#common acp driver
+snd-acp-pcm-objs     := acp-platform.o
+snd-acp-i2s-objs     := acp-i2s.o
+
+obj-$(CONFIG_SND_SOC_AMD_ACP_PCM) += snd-acp-pcm.o
+obj-$(CONFIG_SND_SOC_AMD_ACP_I2S) += snd-acp-i2s.o
sound/soc/amd/acp/acp-i2s.c new file +340 -0

340 lines not on this page · raw message

sound/soc/amd/acp/acp-platform.c new file +292 -0

292 lines not on this page · raw message

sound/soc/amd/acp/amd.h new file +140 -0

140 lines not on this page · raw message

sound/soc/amd/acp/chip_offset_byte.h new file +76 -0

76 lines not on this page · raw message

Signature · 1 line
2.25.1
#0 lore raw

v2 cover ASoC: Add common modules support for ACP hw block

Changes since v1:
- Fixes Kconfig indent as per kernel coding style guidelines.
- Updated _GPL suffix for all exported symbol.
- As suggested added separate machine ops for each codecs in machine driver
- Add sound card support for newer codecs

Ajit Kumar Pandey (8):
ASoC: amd: Add common framework to support I2S on ACP SOC
ASoC: amd: acp: Add I2S support on Renoir platform
ASoC: amd: acp: Add callback for machine driver on ACP
ASoC: amd: acp: Add generic machine driver support for ACP cards
ASoC: amd: acp: Add legacy sound card support for Chrome audio
ASoC: amd: acp: Add SOF audio support on Chrome board
ASoC: amd: acp: Add support for Maxim amplifier codec
ASoC: amd: acp: Add support for RT5682-VS codec

 sound/soc/amd/Kconfig                |   2 +
 sound/soc/amd/Makefile               |   1 +
 sound/soc/amd/acp/Kconfig            |  50 +++
 sound/soc/amd/acp/Makefile           |  26 ++
 sound/soc/amd/acp/acp-i2s.c          | 340 +++++++++++++++
 sound/soc/amd/acp/acp-legacy-mach.c  | 104 +++++
 sound/soc/amd/acp/acp-mach-common.c  | 596 +++++++++++++++++++++++++++
 sound/soc/amd/acp/acp-mach.h         |  57 +++
 sound/soc/amd/acp/acp-platform.c     | 315 ++++++++++++++
 sound/soc/amd/acp/acp-renoir.c       | 144 +++++++
 sound/soc/amd/acp/acp-sof-mach.c     | 131 ++++++
 sound/soc/amd/acp/amd.h              | 146 +++++++
 sound/soc/amd/acp/chip_offset_byte.h |  76 ++++
 13 files changed, 1988 insertions(+)
 create mode 100644 sound/soc/amd/acp/Kconfig
 create mode 100644 sound/soc/amd/acp/Makefile
 create mode 100644 sound/soc/amd/acp/acp-i2s.c
 create mode 100644 sound/soc/amd/acp/acp-legacy-mach.c
 create mode 100644 sound/soc/amd/acp/acp-mach-common.c
 create mode 100644 sound/soc/amd/acp/acp-mach.h
 create mode 100644 sound/soc/amd/acp/acp-platform.c
 create mode 100644 sound/soc/amd/acp/acp-renoir.c
 create mode 100644 sound/soc/amd/acp/acp-sof-mach.c
 create mode 100644 sound/soc/amd/acp/amd.h
 create mode 100644 sound/soc/amd/acp/chip_offset_byte.h
Signature · 1 line
2.25.1
#4 lore raw

PATCH v2 2/8 ASoC: amd: acp: Add I2S support on Renoir platform

Add I2S dai driver for Renoir platform and register with common acp framework to support non dsp I2S use case on Renoir.

---
 sound/soc/amd/acp/Kconfig      |   8 ++
 sound/soc/amd/acp/Makefile     |   5 ++
 sound/soc/amd/acp/acp-renoir.c | 141 +++++++++++++++++++++++++++++++++
 3 files changed, 154 insertions(+)
 create mode 100644 sound/soc/amd/acp/acp-renoir.c
sound/soc/amd/acp/Kconfig +8 -0
index 6b993074e2c4..5ad468b06914 100644
@@ -16,3 +16,11 @@ config SND_SOC_AMD_ACP_I2S
 
 config SND_SOC_AMD_ACP_PCM
 	tristate
+
+config SND_AMD_ASOC_RENOIR
+	tristate "AMD ACP ASOC Renoir Support"
+	select SND_SOC_AMD_ACP_PCM
+	select SND_SOC_AMD_ACP_I2S
+	depends on X86 && PCI
+	help
+	  This option enables Renoir I2S support on AMD platform.
sound/soc/amd/acp/Makefile +5 -0
index b2e12659d97b..42bff3515f24 100644
@@ -8,5 +8,10 @@
 snd-acp-pcm-objs     := acp-platform.o
 snd-acp-i2s-objs     := acp-i2s.o
 
+#platform specific driver
+snd-acp-renoir-objs     := acp-renoir.o
+
 obj-$(CONFIG_SND_SOC_AMD_ACP_PCM) += snd-acp-pcm.o
 obj-$(CONFIG_SND_SOC_AMD_ACP_I2S) += snd-acp-i2s.o
+
+obj-$(CONFIG_SND_AMD_ASOC_RENOIR) += snd-acp-renoir.o
sound/soc/amd/acp/acp-renoir.c new file +141 -0

141 lines not on this page · raw message

Signature · 1 line
2.25.1
#5 lore raw

PATCH v2 3/8 ASoC: amd: acp: Add callback for machine driver on ACP

In reply to Ajit Kumar Pandey

Add method to select and register machine driver for acp platform based on ACPI ID.

---
 sound/soc/amd/acp/acp-platform.c | 23 +++++++++++++++++++++++
 sound/soc/amd/acp/acp-renoir.c   |  3 +++
 sound/soc/amd/acp/amd.h          |  6 ++++++
 3 files changed, 32 insertions(+)
sound/soc/amd/acp/acp-platform.c +23 -0
index e79c05276d5f..75003d0a41e3 100644
@@ -67,6 +67,27 @@ static const struct snd_pcm_hardware acp_pcm_hardware_capture = {
 	.periods_max = CAPTURE_MAX_NUM_PERIODS,
 };
 
+int acp_machine_select(struct acp_dev_data *adata)
+{
+	struct snd_soc_acpi_mach *mach;
+	int size;
+
+	size = sizeof(*adata->machines);
+	mach = snd_soc_acpi_find_machine(adata->machines);
+	if (!mach) {
+		dev_err(adata->dev, "warning: No matching ASoC machine driver found\n");
+		return -EINVAL;
+	}
+
+	adata->mach_dev = platform_device_register_data(adata->dev, mach->drv_name,
+							PLATFORM_DEVID_NONE, mach, size);
+	if (!adata->mach_dev)
+		dev_warn(adata->dev, "Unable to register Machine device\n");
+
+	return 0;
+}
+EXPORT_SYMBOL_NS_GPL(acp_machine_select, SND_SOC_ACP_COMMON);
+
 static irqreturn_t i2s_irq_handler(int irq, void *data)
 {
 	struct acp_dev_data *adata = data;
@@ -283,6 +304,8 @@ int acp_platform_unregister(struct device *dev)
 {
 	struct acp_dev_data *adata = dev_get_drvdata(dev);
 
+	if (adata->mach_dev)
+		platform_device_unregister(adata->mach_dev);
 	return 0;
 }
 EXPORT_SYMBOL_NS_GPL(acp_platform_unregister, SND_SOC_ACP_COMMON);
sound/soc/amd/acp/acp-renoir.c +3 -0
index c7fbf71e4669..82faae1b110b 100644
@@ -111,6 +111,9 @@ static int renoir_audio_probe(struct platform_device *pdev)
 	adata->dai_driver = acp_renoir_dai;
 	adata->num_dai = ARRAY_SIZE(acp_renoir_dai);
 
+	adata->machines = snd_soc_acpi_amd_acp_machines;
+	acp_machine_select(adata);
+
 	dev_set_drvdata(dev, adata);
 	acp_platform_register(dev);
 
sound/soc/amd/acp/amd.h +6 -0
index ecb53285526c..3532f4d3ccff 100644
@@ -90,6 +90,9 @@ struct acp_dev_data {
 	int num_dai;
 
 	struct acp_stream *stream[ACP_MAX_STREAM];
+
+	struct snd_soc_acpi_mach *machines;
+	struct platform_device *mach_dev;
 };
 
 extern const struct snd_soc_dai_ops asoc_acp_cpu_dai_ops;
@@ -98,6 +101,9 @@ int asoc_acp_i2s_probe(struct snd_soc_dai *dai);
 int acp_platform_register(struct device *dev);
 int acp_platform_unregister(struct device *dev);
 
+int acp_machine_select(struct acp_dev_data *adata);
+extern struct snd_soc_acpi_mach snd_soc_acpi_amd_acp_machines[];
+
 static inline u64 acp_get_byte_count(struct acp_dev_data *adata, int dai_id, int direction)
 {
 	u64 byte_count, low = 0, high = 0;
Signature · 1 line
2.25.1
#6 lore raw

PATCH v2 4/8 ASoC: amd: acp: Add generic machine driver support for ACP cards

In reply to Ajit Kumar Pandey

We have machines with different audio endpoints configurations across various distributions. We need to support multiple sound cards for different combinations of I2S instance and codecs hw. Now we also need to support SOF-DSP endpoints based sound cards. All such card combinations slightly differs in terms of machine ops callback. This patch adds ACP generic machine driver module that exposes method to create ACP cards dai links and define new ops for audio endpoints configurations. Initially we have added dailink support for RT5682 and RT1019 codec connection with ACP I2S_SP instance. We will add newer codecs in this module to use this for all AMD's ACP block sound cards supports in future.

---
 sound/soc/amd/acp/Kconfig           |  10 +
 sound/soc/amd/acp/Makefile          |   5 +
 sound/soc/amd/acp/acp-mach-common.c | 467 ++++++++++++++++++++++++++++
 sound/soc/amd/acp/acp-mach.h        |  55 ++++
 4 files changed, 537 insertions(+)
 create mode 100644 sound/soc/amd/acp/acp-mach-common.c
 create mode 100644 sound/soc/amd/acp/acp-mach.h
sound/soc/amd/acp/Kconfig +10 -0
index 5ad468b06914..5cb7115662d2 100644
@@ -24,3 +24,13 @@ config SND_AMD_ASOC_RENOIR
 	depends on X86 && PCI
 	help
 	  This option enables Renoir I2S support on AMD platform.
+
+config SND_SOC_AMD_MACH_COMMON
+	tristate
+	select CLK_FIXED_FCH
+	select SND_SOC_RT5682_I2C
+	select SND_SOC_DMIC
+	select SND_SOC_RT1019
+	depends on X86 && PCI && I2C
+	help
+	  This option enables common Machine driver module for ACP.
sound/soc/amd/acp/Makefile +5 -0
index 42bff3515f24..a477a18272bf 100644
@@ -11,7 +11,12 @@ snd-acp-i2s-objs     := acp-i2s.o
 #platform specific driver
 snd-acp-renoir-objs     := acp-renoir.o
 
+#machine specific driver
+snd-acp-mach-objs     := acp-mach-common.o
+
 obj-$(CONFIG_SND_SOC_AMD_ACP_PCM) += snd-acp-pcm.o
 obj-$(CONFIG_SND_SOC_AMD_ACP_I2S) += snd-acp-i2s.o
 
 obj-$(CONFIG_SND_AMD_ASOC_RENOIR) += snd-acp-renoir.o
+
+obj-$(CONFIG_SND_SOC_AMD_MACH_COMMON) += snd-acp-mach.o
sound/soc/amd/acp/acp-mach-common.c new file +467 -0

467 lines not on this page · raw message

sound/soc/amd/acp/acp-mach.h new file +55 -0

55 lines not on this page · raw message

Signature · 1 line
2.25.1
#7 lore raw

PATCH v2 5/8 ASoC: amd: acp: Add legacy sound card support for Chrome audio

In reply to Ajit Kumar Pandey

Renoir based Chrome board has RT5682 as primary headset codec and RT1019 amp device connected to I2SSP ACP i2s controller. Add driver to register legacy sound card devices on Chrome board.

---
 sound/soc/amd/acp/Kconfig           |   6 ++
 sound/soc/amd/acp/Makefile          |   2 +
 sound/soc/amd/acp/acp-legacy-mach.c | 104 ++++++++++++++++++++++++++++
 3 files changed, 112 insertions(+)
 create mode 100644 sound/soc/amd/acp/acp-legacy-mach.c
sound/soc/amd/acp/Kconfig +6 -0
index 5cb7115662d2..2b9440372346 100644
@@ -34,3 +34,9 @@ config SND_SOC_AMD_MACH_COMMON
 	depends on X86 && PCI && I2C
 	help
 	  This option enables common Machine driver module for ACP.
+
+config SND_SOC_AMD_LEGACY_MACH
+	tristate "AMD Legacy Machine Driver Support"
+	select SND_SOC_AMD_MACH_COMMON
+	help
+	 This option enables legacy sound card support for ACP audio.
sound/soc/amd/acp/Makefile +2 -0
index a477a18272bf..aef6f981c770 100644
@@ -13,6 +13,7 @@ snd-acp-renoir-objs     := acp-renoir.o
 
 #machine specific driver
 snd-acp-mach-objs     := acp-mach-common.o
+snd-acp-legacy-mach-objs     := acp-legacy-mach.o
 
 obj-$(CONFIG_SND_SOC_AMD_ACP_PCM) += snd-acp-pcm.o
 obj-$(CONFIG_SND_SOC_AMD_ACP_I2S) += snd-acp-i2s.o
@@ -20,3 +21,4 @@ obj-$(CONFIG_SND_SOC_AMD_ACP_I2S) += snd-acp-i2s.o
 obj-$(CONFIG_SND_AMD_ASOC_RENOIR) += snd-acp-renoir.o
 
 obj-$(CONFIG_SND_SOC_AMD_MACH_COMMON) += snd-acp-mach.o
+obj-$(CONFIG_SND_SOC_AMD_LEGACY_MACH) += snd-acp-legacy-mach.o
sound/soc/amd/acp/acp-legacy-mach.c new file +104 -0

104 lines not on this page · raw message

Signature · 1 line
2.25.1
#9 lore raw

PATCH v2 6/8 ASoC: amd: acp: Add SOF audio support on Chrome board

In reply to Ajit Kumar Pandey

Chrome board has RT5682 codec and RT1019 amp connected to I2S SP controller on ACP hw. Also it support DMIC capture endpoints with inbuilt pdm controller on ACP hw block. Add driver module to create backend dai links for sof dsp core. We pass driver data with audio end points configuration to register sound cards and create device nodes for all audio endpoints.

---
 sound/soc/amd/acp/Kconfig        |   6 ++
 sound/soc/amd/acp/Makefile       |   2 +
 sound/soc/amd/acp/acp-sof-mach.c | 103 +++++++++++++++++++++++++++++++
 3 files changed, 111 insertions(+)
 create mode 100644 sound/soc/amd/acp/acp-sof-mach.c
sound/soc/amd/acp/Kconfig +6 -0
index 2b9440372346..d170672927ef 100644
@@ -40,3 +40,9 @@ config SND_SOC_AMD_LEGACY_MACH
 	select SND_SOC_AMD_MACH_COMMON
 	help
 	 This option enables legacy sound card support for ACP audio.
+
+config SND_SOC_AMD_SOF_MACH
+	tristate "AMD SOF Machine Driver Support"
+	select SND_SOC_AMD_MACH_COMMON
+	help
+	  This option enables SOF sound card support for ACP audio.
sound/soc/amd/acp/Makefile +2 -0
index aef6f981c770..16c144c2965c 100644
@@ -14,6 +14,7 @@ snd-acp-renoir-objs     := acp-renoir.o
 #machine specific driver
 snd-acp-mach-objs     := acp-mach-common.o
 snd-acp-legacy-mach-objs     := acp-legacy-mach.o
+snd-acp-sof-mach-objs     := acp-sof-mach.o
 
 obj-$(CONFIG_SND_SOC_AMD_ACP_PCM) += snd-acp-pcm.o
 obj-$(CONFIG_SND_SOC_AMD_ACP_I2S) += snd-acp-i2s.o
@@ -22,3 +23,4 @@ obj-$(CONFIG_SND_AMD_ASOC_RENOIR) += snd-acp-renoir.o
 
 obj-$(CONFIG_SND_SOC_AMD_MACH_COMMON) += snd-acp-mach.o
 obj-$(CONFIG_SND_SOC_AMD_LEGACY_MACH) += snd-acp-legacy-mach.o
+obj-$(CONFIG_SND_SOC_AMD_SOF_MACH) += snd-acp-sof-mach.o
sound/soc/amd/acp/acp-sof-mach.c new file +103 -0

103 lines not on this page · raw message

Signature · 1 line
2.25.1
#10 lore raw

PATCH v2 7/8 ASoC: amd: acp: Add support for Maxim amplifier codec

In reply to Ajit Kumar Pandey

In newer chrome boards we have max98360a as an amplifier codec. Add support for max98360a in generic machine driver and configure driver data to enable SOF sound card support on newer boards .

---
 sound/soc/amd/acp/Kconfig           |  1 +
 sound/soc/amd/acp/acp-mach-common.c | 37 +++++++++++++++++++++++++++++
 sound/soc/amd/acp/acp-mach.h        |  1 +
 sound/soc/amd/acp/acp-sof-mach.c    | 14 +++++++++++
 4 files changed, 53 insertions(+)
sound/soc/amd/acp/Kconfig +1 -0
index d170672927ef..04d8df7a6e11 100644
@@ -31,6 +31,7 @@ config SND_SOC_AMD_MACH_COMMON
 	select SND_SOC_RT5682_I2C
 	select SND_SOC_DMIC
 	select SND_SOC_RT1019
+	select SND_SOC_MAX98357A
 	depends on X86 && PCI && I2C
 	help
 	  This option enables common Machine driver module for ACP.
sound/soc/amd/acp/acp-mach-common.c +37 -0
index 5dda2d92a5aa..b9d77d761cca 100644
@@ -274,6 +274,31 @@ static const struct snd_soc_ops acp_card_rt1019_ops = {
 	.hw_params = acp_card_rt1019_hw_params,
 };
 
+/* Declare Maxim codec components */
+SND_SOC_DAILINK_DEF(max98360a,
+	DAILINK_COMP_ARRAY(COMP_CODEC("MX98360A:00", "HiFi")));
+
+static const struct snd_soc_dapm_route max98360a_map[] = {
+	{"Spk", NULL, "Speaker"},
+};
+
+static int acp_card_maxim_init(struct snd_soc_pcm_runtime *rtd)
+{
+	struct snd_soc_card *card = rtd->card;
+	struct acp_card_drvdata *drvdata = card->drvdata;
+
+	if (drvdata->amp_codec_id != MAX98360A)
+		return -EINVAL;
+
+	return snd_soc_dapm_add_routes(&rtd->card->dapm, max98360a_map,
+				       ARRAY_SIZE(max98360a_map));
+}
+
+static const struct snd_soc_ops acp_card_maxim_ops = {
+	.startup = acp_card_amp_startup,
+	.shutdown = acp_card_shutdown,
+};
+
 /* Declare DMIC codec components */
 SND_SOC_DAILINK_DEF(dmic_codec,
 		DAILINK_COMP_ARRAY(COMP_CODEC("dmic-codec", "dmic-hifi")));
@@ -371,6 +396,12 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card)
 			card->codec_conf = rt1019_conf;
 			card->num_configs = ARRAY_SIZE(rt1019_conf);
 		}
+		if (drv_data->amp_codec_id == MAX98360A) {
+			links[i].codecs = max98360a;
+			links[i].num_codecs = ARRAY_SIZE(max98360a);
+			links[i].ops = &acp_card_maxim_ops;
+			links[i].init = acp_card_maxim_init;
+		}
 		i++;
 	}
 
@@ -455,6 +486,12 @@ int acp_legacy_dai_links_create(struct snd_soc_card *card)
 			card->codec_conf = rt1019_conf;
 			card->num_configs = ARRAY_SIZE(rt1019_conf);
 		}
+		if (drv_data->amp_codec_id == MAX98360A) {
+			links[i].codecs = max98360a;
+			links[i].num_codecs = ARRAY_SIZE(max98360a);
+			links[i].ops = &acp_card_maxim_ops;
+			links[i].init = acp_card_maxim_init;
+		}
 	}
 
 	card->dai_link = links;
sound/soc/amd/acp/acp-mach.h +1 -0
index 464fb7eb802d..b6a43d1b9ad4 100644
@@ -35,6 +35,7 @@ enum codec_endpoints {
 	DUMMY = 0,
 	RT5682,
 	RT1019,
+	MAX98360A,
 };
 
 struct acp_card_drvdata {
sound/soc/amd/acp/acp-sof-mach.c +14 -0
index e143aa24afb3..f7103beedf32 100644
@@ -29,6 +29,15 @@ static struct acp_card_drvdata sof_rt5682_rt1019_data = {
 	.dmic_codec_id = DMIC,
 };
 
+static struct acp_card_drvdata sof_rt5682_max_data = {
+	.hs_cpu_id = I2S_SP,
+	.amp_cpu_id = I2S_SP,
+	.dmic_cpu_id = DMIC,
+	.hs_codec_id = RT5682,
+	.amp_codec_id = MAX98360A,
+	.dmic_codec_id = DMIC,
+};
+
 static const struct snd_kcontrol_new acp_controls[] = {
 	SOC_DAPM_PIN_SWITCH("Headphone Jack"),
 	SOC_DAPM_PIN_SWITCH("Headset Mic"),
@@ -85,6 +94,10 @@ static const struct platform_device_id board_ids[] = {
 		.name = "rt5682-rt1019",
 		.driver_data = (kernel_ulong_t)&sof_rt5682_rt1019_data
 	},
+	{
+		.name = "rt5682-max",
+		.driver_data = (kernel_ulong_t)&sof_rt5682_max_data
+	},
 	{ }
 };
 static struct platform_driver acp_asoc_audio = {
@@ -100,4 +113,5 @@ module_platform_driver(acp_asoc_audio);
 MODULE_IMPORT_NS(SND_SOC_AMD_MACH);
 MODULE_DESCRIPTION("ACP chrome SOF audio support");
 MODULE_ALIAS("platform:rt5682-rt1019");
+MODULE_ALIAS("platform:rt5682-max");
 MODULE_LICENSE("GPL v2");
Signature · 1 line
2.25.1
#11 lore raw

PATCH v2 8/8 ASoC: amd: acp: Add support for RT5682-VS codec

In reply to Ajit Kumar Pandey

In newer variants primary codec is rt5682vs. Add support for newer codec variants in generic machine driver module and define driver data to register SOF sound card.

---
 sound/soc/amd/acp/Kconfig           |  1 +
 sound/soc/amd/acp/acp-mach-common.c | 96 +++++++++++++++++++++++++++++
 sound/soc/amd/acp/acp-mach.h        |  1 +
 sound/soc/amd/acp/acp-sof-mach.c    | 14 +++++
 4 files changed, 112 insertions(+)
sound/soc/amd/acp/Kconfig +1 -0
index 04d8df7a6e11..3279894414da 100644
@@ -32,6 +32,7 @@ config SND_SOC_AMD_MACH_COMMON
 	select SND_SOC_DMIC
 	select SND_SOC_RT1019
 	select SND_SOC_MAX98357A
+	select SND_SOC_RT5682S
 	depends on X86 && PCI && I2C
 	help
 	  This option enables common Machine driver module for ACP.
sound/soc/amd/acp/acp-mach-common.c +96 -0

120 lines not on this page · raw message

sound/soc/amd/acp/acp-mach.h +1 -0
index b6a43d1b9ad4..5dc47cfbff10 100644
@@ -36,6 +36,7 @@ enum codec_endpoints {
 	RT5682,
 	RT1019,
 	MAX98360A,
+	RT5682S,
 };
 
 struct acp_card_drvdata {
sound/soc/amd/acp/acp-sof-mach.c +14 -0
index f7103beedf32..854eb7214cea 100644
@@ -38,6 +38,15 @@ static struct acp_card_drvdata sof_rt5682_max_data = {
 	.dmic_codec_id = DMIC,
 };
 
+static struct acp_card_drvdata sof_rt5682s_max_data = {
+	.hs_cpu_id = I2S_SP,
+	.amp_cpu_id = I2S_SP,
+	.dmic_cpu_id = DMIC,
+	.hs_codec_id = RT5682S,
+	.amp_codec_id = MAX98360A,
+	.dmic_codec_id = DMIC,
+};
+
 static const struct snd_kcontrol_new acp_controls[] = {
 	SOC_DAPM_PIN_SWITCH("Headphone Jack"),
 	SOC_DAPM_PIN_SWITCH("Headset Mic"),
@@ -98,6 +107,10 @@ static const struct platform_device_id board_ids[] = {
 		.name = "rt5682-max",
 		.driver_data = (kernel_ulong_t)&sof_rt5682_max_data
 	},
+	{
+		.name = "rt5682s-max",
+		.driver_data = (kernel_ulong_t)&sof_rt5682s_max_data
+	},
 	{ }
 };
 static struct platform_driver acp_asoc_audio = {
@@ -114,4 +127,5 @@ MODULE_IMPORT_NS(SND_SOC_AMD_MACH);
 MODULE_DESCRIPTION("ACP chrome SOF audio support");
 MODULE_ALIAS("platform:rt5682-rt1019");
 MODULE_ALIAS("platform:rt5682-max");
+MODULE_ALIAS("platform:rt5682s-max");
 MODULE_LICENSE("GPL v2");
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH v2 1/8] ASoC: amd: Add common framework to support I2S on ACP SOC

In reply to Ajit Kumar Pandey
Quoted 26 lines · Ajit Kumar Pandey

We are using legacy way of exposing dais and DMA configuration that requires separate driver modules for various ACP SOC with almost similar hw configuration. Moreover the legacy approach requires separate I2S and DMA module platform devices registration and need machine specific quirk to control various I2S endpoints. Add generic dai driver and platform driver for I2S controller on ACP hw block. This common framework can be used by various ACP platform devices that shares common specs.

---

sound/soc/amd/acp/Kconfig new file +8 -0
new file mode 100644
index 000000000000..6b993074e2c4
@@ -0,0 +1,18 @@
+# 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.
+#
+
+config SND_SOC_AMD_ACP_COMMON

sound/soc/amd/acp/Kconfig line 18

Quoted 10 lines
sound/soc/amd/acp/Kconfig new file +10 -0
+	tristate "AMD Audio ACP Common support"
+	select SND_AMD_ACP_CONFIG
+	help
+	  This option enables ACP support on AMD platform.
+
+config SND_SOC_AMD_ACP_I2S
+	tristate
+
+config SND_SOC_AMD_ACP_PCM
+	tristate

Hi,
I don't see anything that tells us what "ACP" is. Please add that somewhere -- either in the Kconfig file or at least in the commit description.

thanks.

Signature · 1 line
~Randy
#8 lore raw

Re: [PATCH v2 5/8] ASoC: amd: acp: Add legacy sound card support for Chrome audio

In reply to Ajit Kumar Pandey
Quoted 5 lines · Ajit Kumar Pandey
sound/soc/amd/acp/Kconfig +0 -0
index 5cb7115662d2..2b9440372346 100644

sound/soc/amd/acp/Kconfig config SND_SOC_AMD_MACH_COMMON · line 42

Quoted 9 lines
sound/soc/amd/acp/Kconfig +6 -0
@@ -34,3 +34,9 @@ config SND_SOC_AMD_MACH_COMMON
  	depends on X86 && PCI && I2C
  	help
  	  This option enables common Machine driver module for ACP.
+
+config SND_SOC_AMD_LEGACY_MACH
+	tristate "AMD Legacy Machine Driver Support"
+	select SND_SOC_AMD_MACH_COMMON
+	help
+	 This option enables legacy sound card support for ACP audio.

Add one more space just before "This" to conform to kernel Kconfig style, please.

Signature · 1 line
~Randy
#3 lore raw

Re: [PATCH v2 1/8] ASoC: amd: Add common framework to support I2S on ACP SOC

In reply to Randy Dunlap
Quoted 45 lines · Randy Dunlap

[CAUTION: External Email]

Quoted 26 lines · Ajit Kumar Pandey

We are using legacy way of exposing dais and DMA configuration that requires separate driver modules for various ACP SOC with almost similar hw configuration. Moreover the legacy approach requires separate I2S and DMA module platform devices registration and need machine specific quirk to control various I2S endpoints. Add generic dai driver and platform driver for I2S controller on ACP hw block. This common framework can be used by various ACP platform devices that shares common specs.

---

sound/soc/amd/acp/Kconfig new file +8 -0
new file mode 100644
index 000000000000..6b993074e2c4
@@ -0,0 +1,18 @@
+# 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.
+#
+
+config SND_SOC_AMD_ACP_COMMON

sound/soc/amd/acp/Kconfig line 18

Quoted 10 lines
sound/soc/amd/acp/Kconfig new file +10 -0
+     tristate "AMD Audio ACP Common support"
+     select SND_AMD_ACP_CONFIG
+     help
+       This option enables ACP support on AMD platform.
+
+config SND_SOC_AMD_ACP_I2S
+     tristate
+
+config SND_SOC_AMD_ACP_PCM
+     tristate

Hi,
I don't see anything that tells us what "ACP" is. Please add that somewhere -- either in the Kconfig file or at least in the commit description.

Quoted 4 lines

thanks.

Signature · 1 line
~Randy

ACP stands for Audio Coprocessor in AMD platforms, will update Kconfig text with that in v3 patch chain