Skip to contentSkip to conversation

ASoC: amd: Add support for RT5682 codec in machine driver

PATCH Superseded Vijendar Mukunda 2 participants 7 messages Mar 17, 2021 – Mar 22, 2021

Subsystems (3)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Vijendar Mukunda

author maintainer
#0 lore raw

PATCH v4 1/2 ASoC: amd: Add support for RT5682 codec in machine driver

Add support for RT5682 codec in machine driver.

---
v3->v4: fixed clk_prepare_enable() for wclk instead of bclk v2->v3: updated SPDX license
v1->v2: updated kconfig, spdx license, removed unnecessary initialization and updated comment

 sound/soc/amd/Kconfig                |   5 +-
 sound/soc/amd/acp-da7219-max98357a.c | 378 +++++++++++++++++++++++++++++++----
 2 files changed, 342 insertions(+), 41 deletions(-)
sound/soc/amd/Kconfig +3 -2
index a6ce000..43f5d29 100644
@@ -5,14 +5,15 @@ config SND_SOC_AMD_ACP
 	 This option enables ACP DMA support on AMD platform.
 
 config SND_SOC_AMD_CZ_DA7219MX98357_MACH
-	tristate "AMD CZ support for DA7219 and MAX9835"
+	tristate "AMD CZ support for DA7219, RT5682 and MAX9835"
 	select SND_SOC_DA7219
+	select SND_SOC_RT5682_I2C
 	select SND_SOC_MAX98357A
 	select SND_SOC_ADAU7002
 	select REGULATOR
 	depends on SND_SOC_AMD_ACP && I2C && GPIOLIB
 	help
-	 This option enables machine driver for DA7219 and MAX9835.
+	 This option enables machine driver for DA7219, RT5682 and MAX9835.
 
 config SND_SOC_AMD_CZ_RT5645_MACH
 	tristate "AMD CZ support for RT5645"
sound/soc/amd/acp-da7219-max98357a.c +339 -39

463 lines not on this page · raw message

Signature · 1 line
2.7.4
author maintainer
#1 lore raw

PATCH 2/2 ASoC: amd: fix multiple definition error

make W=1 ARCH=x86_64 error:
acp3x-rt5682-max9836.c:(.text+0x840): multiple definition of `soc_is_rltk_max'; sound/soc/amd/acp-da7219-max98357a.o:acp-da7219-max98357a.c:
(.text+0xd00):first defined here

---
 sound/soc/amd/acp-da7219-max98357a.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/amd/acp-da7219-max98357a.c +3 -3
index 7fca4e78..458d9fdca 100644
@@ -34,7 +34,7 @@ static struct clk *da7219_dai_bclk;
 static struct clk *rt5682_dai_wclk;
 static struct clk *rt5682_dai_bclk;
 extern bool bt_uart_enable;
-void *soc_is_rltk_max(struct device *dev);
+void *acp_soc_is_rltk_max(struct device *dev);
 
 static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd)
 {
@@ -666,7 +666,7 @@ static struct snd_soc_card cz_rt5682_card = {
 	.num_controls = ARRAY_SIZE(cz_mc_controls),
 };
 
-void *soc_is_rltk_max(struct device *dev)
+void *acp_soc_is_rltk_max(struct device *dev)
 {
 	const struct acpi_device_id *match;
 
@@ -715,7 +715,7 @@ static int cz_probe(struct platform_device *pdev)
 	struct regulator_dev *rdev;
 	struct device *dev = &pdev->dev;
 
-	card = (struct snd_soc_card *)soc_is_rltk_max(dev);
+	card = (struct snd_soc_card *)acp_soc_is_rltk_max(dev);
 	if (!card)
 		return -ENODEV;
 	if (!strcmp(card->name, "acpd7219m98357")) {
Signature · 1 line
2.7.4
maintainer
#2 lore raw

Re: [PATCH v1 2/2] ASoC: amd: fix multiple definition error

Quoted 5 lines · Vijendar Mukunda

make W=1 ARCH=x86_64 error:
acp3x-rt5682-max9836.c:(.text+0x840): multiple definition of `soc_is_rltk_max'; sound/soc/amd/acp-da7219-max98357a.o:acp-da7219-max98357a.c:
(.text+0xd00):first defined here

In general you should put fixes at the start of the patch series, or if this is a fix for patch 1 that was spotted by the bot when it was posted on the list then you should just roll your fix into new versions of patch 1.

author maintainer
#3 lore raw

Re: [PATCH v1 2/2] ASoC: amd: fix multiple definition error

Quoted 7 lines · Mark Brown
Quoted 5 lines · Vijendar Mukunda

make W=1 ARCH=x86_64 error:
acp3x-rt5682-max9836.c:(.text+0x840): multiple definition of `soc_is_rltk_max'; sound/soc/amd/acp-da7219-max98357a.o:acp-da7219-max98357a.c:
(.text+0xd00):first defined here

Quoted 5 lines

In general you should put fixes at the start of the patch series, or if this is a fix for patch 1 that was spotted by the bot when it was posted on the list then you should just roll your fix into new versions of patch 1.

We will roll this fix into new version of patch I

maintainer
#4 lore raw
In reply to Vijendar Mukunda

sound/soc/amd/acp-da7219-max98357a.c line 4

Quoted 6 lines · Vijendar Mukunda

+++ b/sound/soc/amd/acp-da7219-max98357a.c

sound/soc/amd/acp-da7219-max98357a.c +0 -4
@@ -1,27 +1,8 @@
-/*
- * Machine driver for AMD ACP Audio engine using DA7219 & MAX98357 codec
- *
- * Copyright 2017 Advanced Micro Devices, Inc.

The conversion to SPDX really feels like it should at least be called out in the changelog, and probably a separate change.

sound/soc/amd/acp-da7219-max98357a.c static void da7219_clk_disable(void) · line 185

Quoted 8 lines
sound/soc/amd/acp-da7219-max98357a.c +8 -0
+	/*
+	 * Set wclk to 48000 because the rate constraint of this driver is
+	 * 48000. ADAU7002 spec: "The ADAU7002 requires a BCLK rate that is
+	 * minimum of 64x the LRCLK sample rate." RT5682 is the only clk
+	 * source so for all codecs we have to limit bclk to 64X lrclk.
+	 */
+	clk_set_rate(rt5682_dai_wclk, 48000);
+	clk_set_rate(rt5682_dai_bclk, 48000 * 64);

The driver should really check the return value of clk_set_rate(), it can fail.

author maintainer
#5 lore raw
Quoted 11 lines · Mark Brown

sound/soc/amd/acp-da7219-max98357a.c line 4

Quoted 6 lines · Vijendar Mukunda

+++ b/sound/soc/amd/acp-da7219-max98357a.c

sound/soc/amd/acp-da7219-max98357a.c +0 -4
@@ -1,27 +1,8 @@
-/*
- * Machine driver for AMD ACP Audio engine using DA7219 & MAX98357 codec
- *
- * Copyright 2017 Advanced Micro Devices, Inc.

The conversion to SPDX really feels like it should at least be called out in the changelog, and probably a separate change.

will upload SPDX changes as a separate patch.

Quoted 12 lines

sound/soc/amd/acp-da7219-max98357a.c static void da7219_clk_disable(void) · line 185

Quoted 8 lines
sound/soc/amd/acp-da7219-max98357a.c +8 -0
+	/*
+	 * Set wclk to 48000 because the rate constraint of this driver is
+	 * 48000. ADAU7002 spec: "The ADAU7002 requires a BCLK rate that is
+	 * minimum of 64x the LRCLK sample rate." RT5682 is the only clk
+	 * source so for all codecs we have to limit bclk to 64X lrclk.
+	 */
+	clk_set_rate(rt5682_dai_wclk, 48000);
+	clk_set_rate(rt5682_dai_bclk, 48000 * 64);

The driver should really check the return value of clk_set_rate(), it can fail.

We will add checks for return value of clk_set_rate() and will upload new version

maintainer
#6 lore raw
In reply to Vijendar Mukunda
Quoted 1 line · Vijendar Mukunda

Add support for RT5682 codec in machine driver.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/2] ASoC: amd: Add support for RT5682 codec in machine driver

      commit: 7e71b48f9e27e437ca523432ea285c2585a539dc

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark