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

Ajit Kumar Pandey AjitKumar.Pandey at amd.com
Thu Sep 30 15:24:17 CEST 2021


Add a new codec id for MAX98360A amplifier in codec list and define
maxim components and audio route in common machine driver code.

Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey at amd.com>
---
 sound/soc/amd/acp/Kconfig           |  1 +
 sound/soc/amd/acp/acp-mach-common.c | 21 +++++++++++++++++++++
 sound/soc/amd/acp/acp-mach.h        |  1 +
 3 files changed, 23 insertions(+)

diff --git a/sound/soc/amd/acp/Kconfig b/sound/soc/amd/acp/Kconfig
index 55dda516a0d0..8257b8e1e7cc 100644
--- a/sound/soc/amd/acp/Kconfig
+++ b/sound/soc/amd/acp/Kconfig
@@ -30,6 +30,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
diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c
index cc507c520317..80c6cd220674 100644
--- a/sound/soc/amd/acp/acp-mach-common.c
+++ b/sound/soc/amd/acp/acp-mach-common.c
@@ -91,6 +91,14 @@ static struct snd_soc_codec_conf rt1019_conf[] = {
 	},
 };
 
+/* 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"},
+};
+
 /* Declare DMIC codec components */
 SND_SOC_DAILINK_DEF(dmic_codec,
 		DAILINK_COMP_ARRAY(COMP_CODEC("dmic-codec", "dmic-hifi")));
@@ -248,6 +256,9 @@ static int acp_asoc_amp_init(struct snd_soc_pcm_runtime *rtd)
 	case RT1019:
 		return snd_soc_dapm_add_routes(&rtd->card->dapm, rt1019_map_lr,
 					       ARRAY_SIZE(rt1019_map_lr));
+	case MAX98360A:
+		return snd_soc_dapm_add_routes(&rtd->card->dapm, max98360a_map,
+					       ARRAY_SIZE(max98360a_map));
 	default:
 		dev_err(card->dev, "Invalid AMP id: %d\n", drvdata->amp_codec_id);
 		return -EINVAL;
@@ -286,6 +297,8 @@ static int acp_card_amp_hw_params(struct snd_pcm_substream *substream,
 				return ret;
 			}
 		break;
+	case MAX98360A:
+		break;
 	default:
 		dev_err(card->dev, "Invalid AMP id: %d\n", drvdata->amp_codec_id);
 		return -EINVAL;
@@ -414,6 +427,10 @@ 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);
+		}
 		i++;
 	}
 
@@ -499,6 +516,10 @@ 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);
+		}
 	}
 
 	card->dai_link = links;
diff --git a/sound/soc/amd/acp/acp-mach.h b/sound/soc/amd/acp/acp-mach.h
index 464fb7eb802d..b6a43d1b9ad4 100644
--- a/sound/soc/amd/acp/acp-mach.h
+++ b/sound/soc/amd/acp/acp-mach.h
@@ -35,6 +35,7 @@ enum codec_endpoints {
 	DUMMY = 0,
 	RT5682,
 	RT1019,
+	MAX98360A,
 };
 
 struct acp_card_drvdata {
-- 
2.25.1



More information about the Alsa-devel mailing list