Skip to contentSkip to conversation

ASoC: amd: acp: Add new machines and minor tweaks

PATCH Superseded Ajit Kumar Pandey 3 participants 7 messages Feb 22, 2022

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover ASoC: amd: acp: Add new machines and minor tweaks

This patch series will add sound card support for newer machines and done some minor tweaks related to legacy machine driver.

Ajit Kumar Pandey (3):
ASoC: amd: acp: Change card name for Guybrush Machine
ASoC: amd: acp-legacy: Add legacy card support for new machines
ASoC: amd: acp: Add DMIC machine driver ops

 sound/soc/amd/acp/acp-legacy-mach.c | 34 +++++++++++++++++++++++++++--
 sound/soc/amd/acp/acp-mach-common.c | 27 +++++++++++++++++++++++
 sound/soc/amd/acp/acp-renoir.c      | 19 +++++++++++++++-
 3 files changed, 77 insertions(+), 3 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/3 ASoC: amd: acp: Change card name for Guybrush Machine

Change sound card name for guybrush machine with rt5682 as primary codec and rt1019 amp to align with names given in UCM config.

---
 sound/soc/amd/acp/acp-legacy-mach.c | 4 ++--
 sound/soc/amd/acp/acp-renoir.c      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
sound/soc/amd/acp/acp-legacy-mach.c +2 -2
index 91140d15691b..50a5aa4d6da9 100644
@@ -96,7 +96,7 @@ static int acp_asoc_probe(struct platform_device *pdev)
 
 static const struct platform_device_id board_ids[] = {
 	{
-		.name = "rn_rt5682_rt1019",
+		.name = "acp3xalc56821019",
 		.driver_data = (kernel_ulong_t)&rt5682_rt1019_data,
 	},
 	{ }
@@ -113,5 +113,5 @@ module_platform_driver(acp_asoc_audio);
 
 MODULE_IMPORT_NS(SND_SOC_AMD_MACH);
 MODULE_DESCRIPTION("ACP chrome audio support");
-MODULE_ALIAS("platform:rn_rt5682_rt1019");
+MODULE_ALIAS("platform:acp3xalc56821019");
 MODULE_LICENSE("GPL v2");
sound/soc/amd/acp/acp-renoir.c +1 -1
index d06ad5ce7fec..b8dc25a1d31d 100644
@@ -47,7 +47,7 @@ static struct snd_soc_acpi_codecs amp_rt1019 = {
 static struct snd_soc_acpi_mach snd_soc_acpi_amd_acp_machines[] = {
 	{
 		.id = "10EC5682",
-		.drv_name = "rn_rt5682_rt1019",
+		.drv_name = "acp3xalc56821019",
 		.machine_quirk = snd_soc_acpi_codec_list,
 		.quirk_data = &amp_rt1019,
 	},
Signature · 1 line
2.25.1
maintainer
#2 lore raw

Re: [PATCH 1/3] ASoC: amd: acp: Change card name for Guybrush Machine

Quoted 2 lines · Ajit Kumar Pandey

Change sound card name for guybrush machine with rt5682 as primary codec and rt1019 amp to align with names given in UCM config.

It's a Chrome OS UCM config? I don't have this config in upstream.

Quoted 31 lines
---
  sound/soc/amd/acp/acp-legacy-mach.c | 4 ++--
  sound/soc/amd/acp/acp-renoir.c      | 2 +-
  2 files changed, 3 insertions(+), 3 deletions(-)
sound/soc/amd/acp/acp-legacy-mach.c +2 -2
index 91140d15691b..50a5aa4d6da9 100644
@@ -96,7 +96,7 @@ static int acp_asoc_probe(struct platform_device *pdev)
 
  static const struct platform_device_id board_ids[] = {
  	{
-		.name = "rn_rt5682_rt1019",
+		.name = "acp3xalc56821019",
  		.driver_data = (kernel_ulong_t)&rt5682_rt1019_data,
  	},
  	{ }
@@ -113,5 +113,5 @@ module_platform_driver(acp_asoc_audio);
 
  MODULE_IMPORT_NS(SND_SOC_AMD_MACH);
  MODULE_DESCRIPTION("ACP chrome audio support");
-MODULE_ALIAS("platform:rn_rt5682_rt1019");
+MODULE_ALIAS("platform:acp3xalc56821019");
  MODULE_LICENSE("GPL v2");
sound/soc/amd/acp/acp-renoir.c +0 -0
index d06ad5ce7fec..b8dc25a1d31d 100644

sound/soc/amd/acp/acp-renoir.c static struct snd_soc_acpi_codecs amp_rt1019 = { · line 50

Quoted 5 lines
sound/soc/amd/acp/acp-renoir.c +1 -1
@@ -47,7 +47,7 @@ static struct snd_soc_acpi_codecs amp_rt1019 = {
  static struct snd_soc_acpi_mach snd_soc_acpi_amd_acp_machines[] = {
  	{
  		.id = "10EC5682",
-		.drv_name = "rn_rt5682_rt1019",
+		.drv_name = "acp3xalc56821019",

I find this naming cryptic. Also, we have other ways to identify the exact driver / hardware configuration. It may make sense to have one driver name (like amd-acp3x) and use the sound card components to refine the hardware configuration for the user space. Your way will introduce a lot of new drivers.

Jaroslav

Signature · 2 lines
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
#3 lore raw

Re: [PATCH 1/3] ASoC: amd: acp: Change card name for Guybrush Machine

Quoted 7 lines · Jaroslav Kysela

[CAUTION: External Email]

Quoted 2 lines · Ajit Kumar Pandey

Change sound card name for guybrush machine with rt5682 as primary codec and rt1019 amp to align with names given in UCM config.

It's a Chrome OS UCM config? I don't have this config in upstream

Yes it's for Chrome OS UCM config only.

Quoted 43 lines
Quoted 32 lines

---
  sound/soc/amd/acp/acp-legacy-mach.c | 4 ++--
  sound/soc/amd/acp/acp-renoir.c      | 2 +-

  2 files changed, 3 insertions(+), 3 deletions(-)
sound/soc/amd/acp/acp-legacy-mach.c +2 -2
index 91140d15691b..50a5aa4d6da9 100644
@@ -96,7 +96,7 @@ static int acp_asoc_probe(struct platform_device *pdev)
 
   static const struct platform_device_id board_ids[] = {
       {
-             .name = "rn_rt5682_rt1019",
+             .name = "acp3xalc56821019",
               .driver_data = (kernel_ulong_t)&rt5682_rt1019_data,
       },
       { }
@@ -113,5 +113,5 @@ module_platform_driver(acp_asoc_audio);
 
   MODULE_IMPORT_NS(SND_SOC_AMD_MACH);
   MODULE_DESCRIPTION("ACP chrome audio support");
-MODULE_ALIAS("platform:rn_rt5682_rt1019");
+MODULE_ALIAS("platform:acp3xalc56821019");
   MODULE_LICENSE("GPL v2");
sound/soc/amd/acp/acp-renoir.c +0 -0
index d06ad5ce7fec..b8dc25a1d31d 100644

sound/soc/amd/acp/acp-renoir.c static struct snd_soc_acpi_codecs amp_rt1019 = { · line 50

Quoted 5 lines
sound/soc/amd/acp/acp-renoir.c +1 -1
@@ -47,7 +47,7 @@ static struct snd_soc_acpi_codecs amp_rt1019 = {
   static struct snd_soc_acpi_mach snd_soc_acpi_amd_acp_machines[] = {
       {
               .id = "10EC5682",
-             .drv_name = "rn_rt5682_rt1019",
+             .drv_name = "acp3xalc56821019",

I find this naming cryptic. Also, we have other ways to identify the exact driver / hardware configuration. It may make sense to have one driver name (like amd-acp3x) and use the sound card components to refine the hardware configuration for the user space. Your way will introduce a lot of new drivers.

Quoted 5 lines

                               Jaroslav

Signature · 2 lines
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

I agree that it's make more sense to have a unique driver name but that may require some additional code changes to identify hardware config and machine driver changes for sound card registration based on components. I'll surely look into this and try to refine our machine driver code in
near future but it would be nice if we merge this for now. We will upload new patch series soon to support unique naming.

#4 lore raw

PATCH 2/3 ASoC: amd: acp-legacy: Add legacy card support for new machines

In reply to Ajit Kumar Pandey

We have newer renoir platforms with different codecs combinations. Add struct in legacy machine driver and add to list of supported renoir machine to support sound card registration on platform with rt5682s as primary headset codec and max98360 and rt1019 as speaker amp codec.

---
 sound/soc/amd/acp/acp-legacy-mach.c | 30 +++++++++++++++++++++++++++++
 sound/soc/amd/acp/acp-renoir.c      | 17 ++++++++++++++++
 2 files changed, 47 insertions(+)
sound/soc/amd/acp/acp-legacy-mach.c +30 -0
index 50a5aa4d6da9..8118577d5620 100644
@@ -30,6 +30,26 @@ static struct acp_card_drvdata rt5682_rt1019_data = {
 	.gpio_spkr_en = EN_SPKR_GPIO_GB,
 };
 
+static struct acp_card_drvdata 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,
+	.gpio_spkr_en = EN_SPKR_GPIO_NONE,
+};
+
+static struct acp_card_drvdata rt5682s_rt1019_data = {
+	.hs_cpu_id = I2S_SP,
+	.amp_cpu_id = I2S_SP,
+	.dmic_cpu_id = DMIC,
+	.hs_codec_id = RT5682S,
+	.amp_codec_id = RT1019,
+	.dmic_codec_id = DMIC,
+	.gpio_spkr_en = EN_SPKR_GPIO_DW,
+};
+
 static const struct snd_kcontrol_new acp_controls[] = {
 	SOC_DAPM_PIN_SWITCH("Headphone Jack"),
 	SOC_DAPM_PIN_SWITCH("Headset Mic"),
@@ -99,6 +119,14 @@ static const struct platform_device_id board_ids[] = {
 		.name = "acp3xalc56821019",
 		.driver_data = (kernel_ulong_t)&rt5682_rt1019_data,
 	},
+	{
+		.name = "acp3xalc5682sm98360",
+		.driver_data = (kernel_ulong_t)&rt5682s_max_data,
+	},
+	{
+		.name = "acp3xalc5682s1019",
+		.driver_data = (kernel_ulong_t)&rt5682s_rt1019_data,
+	},
 	{ }
 };
 static struct platform_driver acp_asoc_audio = {
@@ -114,4 +142,6 @@ module_platform_driver(acp_asoc_audio);
 MODULE_IMPORT_NS(SND_SOC_AMD_MACH);
 MODULE_DESCRIPTION("ACP chrome audio support");
 MODULE_ALIAS("platform:acp3xalc56821019");
+MODULE_ALIAS("platform:acp3xalc5682sm98360");
+MODULE_ALIAS("platform:acp3xalc5682s1019");
 MODULE_LICENSE("GPL v2");
sound/soc/amd/acp/acp-renoir.c +17 -0
index b8dc25a1d31d..35d66454e5a3 100644
@@ -44,6 +44,11 @@ static struct snd_soc_acpi_codecs amp_rt1019 = {
 	.codecs = {"10EC1019"}
 };
 
+static struct snd_soc_acpi_codecs amp_max = {
+	.num_codecs = 1,
+	.codecs = {"MX98360A"}
+};
+
 static struct snd_soc_acpi_mach snd_soc_acpi_amd_acp_machines[] = {
 	{
 		.id = "10EC5682",
@@ -51,6 +56,18 @@ static struct snd_soc_acpi_mach snd_soc_acpi_amd_acp_machines[] = {
 		.machine_quirk = snd_soc_acpi_codec_list,
 		.quirk_data = &amp_rt1019,
 	},
+	{
+		.id = "RTL5682",
+		.drv_name = "acp3xalc5682sm98360",
+		.machine_quirk = snd_soc_acpi_codec_list,
+		.quirk_data = &amp_max,
+	},
+	{
+		.id = "RTL5682",
+		.drv_name = "acp3xalc5682s1019",
+		.machine_quirk = snd_soc_acpi_codec_list,
+		.quirk_data = &amp_rt1019,
+	},
 	{
 		.id = "AMDI1019",
 		.drv_name = "renoir-acp",
Signature · 1 line
2.25.1
#5 lore raw

Re: [PATCH 2/3] ASoC: amd: acp-legacy: Add legacy card support for new machines

Thank you for the patch! Yet something to improve:

Hi Ajit,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on broonie-sound/for-next]
[also build test ERROR on v5.17-rc5 next-20220217]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Ajit-Kumar-Pandey/ASoC-amd-acp-Add-new-machines-and-minor-tweaks/20220222-141552
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: x86_64-randconfig-r003-20220221 (https://download.01.org/0day-ci/archive/20220222/[email protected]/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/ca902de964769c2e605e5b2b7b91e95d1698f5bc
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Ajit-Kumar-Pandey/ASoC-amd-acp-Add-new-machines-and-minor-tweaks/20220222-141552
        git checkout ca902de964769c2e605e5b2b7b91e95d1698f5bc
        # save the config file to linux build tree
        mkdir build_dir
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

>> sound/soc/amd/acp/acp-legacy-mach.c:50:18: error: 'EN_SPKR_GPIO_DW' undeclared here (not in a function); did you mean 'EN_SPKR_GPIO_GB'?
      50 |  .gpio_spkr_en = EN_SPKR_GPIO_DW,
         |                  ^~~~~~~~~~~~~~~
         |                  EN_SPKR_GPIO_GB

vim +50 sound/soc/amd/acp/acp-legacy-mach.c

    42	
    43	static struct acp_card_drvdata rt5682s_rt1019_data = {
    44		.hs_cpu_id = I2S_SP,
    45		.amp_cpu_id = I2S_SP,
    46		.dmic_cpu_id = DMIC,
    47		.hs_codec_id = RT5682S,
    48		.amp_codec_id = RT1019,
    49		.dmic_codec_id = DMIC,
  > 50		.gpio_spkr_en = EN_SPKR_GPIO_DW,
    51	};
    52	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

#6 lore raw

PATCH 3/3 ASoC: amd: acp: Add DMIC machine driver ops

In reply to Ajit Kumar Pandey

Add dmic ops and startup callback to add snd_pcm_hw_constraint for pdm related device node.

---
 sound/soc/amd/acp/acp-mach-common.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
sound/soc/amd/acp/acp-mach-common.c +27 -0
index b45442a56c40..d3034ee2ff59 100644
@@ -291,6 +291,32 @@ static const struct snd_soc_ops acp_card_rt5682s_ops = {
 	.shutdown = acp_card_shutdown,
 };
 
+static const unsigned int dmic_channels[] = {
+	DUAL_CHANNEL, FOUR_CHANNEL,
+};
+
+static const struct snd_pcm_hw_constraint_list dmic_constraints_channels = {
+	.count = ARRAY_SIZE(dmic_channels),
+	.list = dmic_channels,
+	.mask = 0,
+};
+
+static int acp_card_dmic_startup(struct snd_pcm_substream *substream)
+{
+	struct snd_pcm_runtime *runtime = substream->runtime;
+
+	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
+				   &dmic_constraints_channels);
+	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
+				   &constraints_rates);
+
+	return 0;
+}
+
+static const struct snd_soc_ops acp_card_dmic_ops = {
+	.startup = acp_card_dmic_startup,
+};
+
 /* Declare RT1019 codec components */
 SND_SOC_DAILINK_DEF(rt1019,
 	DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10EC1019:00", "rt1019-aif"),
@@ -633,6 +659,7 @@ int acp_legacy_dai_links_create(struct snd_soc_card *card)
 		links[i].num_cpus = ARRAY_SIZE(pdm_dmic);
 		links[i].platforms = platform_component;
 		links[i].num_platforms = ARRAY_SIZE(platform_component);
+		links[i].ops = &acp_card_dmic_ops;
 		links[i].dpcm_capture = 1;
 	}
 
Signature · 1 line
2.25.1