[PATCH 2/2] ASoC: mediatek: mt8192: support rt1015p_rt5682s

Jiaxin Yu jiaxin.yu at mediatek.com
Mon Feb 28 23:29:24 PST 2022


From: Jiaxin Yu <jiaxin.yu at mediatek.corp-partner.google.com>

Supports machines with rt1015p and rt5682s.  Uses new proposed compatible
string "mt8192_mt6359_rt1015p_rt5682s".

Signed-off-by: Jiaxin Yu <jiaxin.yu at mediatek.com>
---
 sound/soc/mediatek/Kconfig                    |  1 +
 .../mt8192/mt8192-mt6359-rt1015-rt5682.c      | 87 +++++++++++++++++--
 2 files changed, 83 insertions(+), 5 deletions(-)

diff --git a/sound/soc/mediatek/Kconfig b/sound/soc/mediatek/Kconfig
index d515613a79da..cacfbab4262d 100644
--- a/sound/soc/mediatek/Kconfig
+++ b/sound/soc/mediatek/Kconfig
@@ -176,6 +176,7 @@ config SND_SOC_MT8192_MT6359_RT1015_RT5682
 	select SND_SOC_RT1015
 	select SND_SOC_RT1015P
 	select SND_SOC_RT5682_I2C
+	select SND_SOC_RT5682S
 	select SND_SOC_DMIC
 	help
 	  This adds ASoC driver for Mediatek MT8192 boards
diff --git a/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c b/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c
index a606133951b7..17ca6db5cd64 100644
--- a/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c
+++ b/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c
@@ -31,6 +31,9 @@
 #define RT5682_CODEC_DAI	"rt5682-aif1"
 #define RT5682_DEV0_NAME	"rt5682.1-001a"
 
+#define RT5682S_CODEC_DAI	"rt5682s-aif1"
+#define RT5682S_DEV0_NAME	"rt5682s.1-001a"
+
 struct mt8192_mt6359_priv {
 	struct snd_soc_jack headset_jack;
 	struct snd_soc_jack hdmi_jack;
@@ -632,18 +635,30 @@ SND_SOC_DAILINK_DEFS(i2s7,
 		     DAILINK_COMP_ARRAY(COMP_DUMMY()),
 		     DAILINK_COMP_ARRAY(COMP_EMPTY()));
 
-SND_SOC_DAILINK_DEFS(i2s8,
+SND_SOC_DAILINK_DEFS(i2s8_rt5682,
 		     DAILINK_COMP_ARRAY(COMP_CPU("I2S8")),
 		     DAILINK_COMP_ARRAY(COMP_CODEC(RT5682_DEV0_NAME,
 						   RT5682_CODEC_DAI)),
 		     DAILINK_COMP_ARRAY(COMP_EMPTY()));
 
-SND_SOC_DAILINK_DEFS(i2s9,
+SND_SOC_DAILINK_DEFS(i2s8_rt5682s,
+		     DAILINK_COMP_ARRAY(COMP_CPU("I2S8")),
+		     DAILINK_COMP_ARRAY(COMP_CODEC(RT5682S_DEV0_NAME,
+						   RT5682S_CODEC_DAI)),
+		     DAILINK_COMP_ARRAY(COMP_EMPTY()));
+
+SND_SOC_DAILINK_DEFS(i2s9_rt5682,
 		     DAILINK_COMP_ARRAY(COMP_CPU("I2S9")),
 		     DAILINK_COMP_ARRAY(COMP_CODEC(RT5682_DEV0_NAME,
 						   RT5682_CODEC_DAI)),
 		     DAILINK_COMP_ARRAY(COMP_EMPTY()));
 
+SND_SOC_DAILINK_DEFS(i2s9_rt5682s,
+		     DAILINK_COMP_ARRAY(COMP_CPU("I2S9")),
+		     DAILINK_COMP_ARRAY(COMP_CODEC(RT5682S_DEV0_NAME,
+						   RT5682S_CODEC_DAI)),
+		     DAILINK_COMP_ARRAY(COMP_EMPTY()));
+
 SND_SOC_DAILINK_DEFS(connsys_i2s,
 		     DAILINK_COMP_ARRAY(COMP_CPU("CONNSYS_I2S")),
 		     DAILINK_COMP_ARRAY(COMP_DUMMY()),
@@ -961,7 +976,6 @@ static struct snd_soc_dai_link mt8192_mt6359_dai_links[] = {
 		.ignore_suspend = 1,
 		.init = mt8192_rt5682_init,
 		.be_hw_params_fixup = mt8192_i2s_hw_params_fixup,
-		SND_SOC_DAILINK_REG(i2s8),
 		.ops = &mt8192_rt5682_i2s_ops,
 	},
 	{
@@ -970,7 +984,6 @@ static struct snd_soc_dai_link mt8192_mt6359_dai_links[] = {
 		.dpcm_playback = 1,
 		.ignore_suspend = 1,
 		.be_hw_params_fixup = mt8192_i2s_hw_params_fixup,
-		SND_SOC_DAILINK_REG(i2s9),
 		.ops = &mt8192_rt5682_i2s_ops,
 	},
 	{
@@ -1100,6 +1113,19 @@ static struct snd_soc_card mt8192_mt6359_rt1015p_rt5682_card = {
 	.num_dapm_routes = ARRAY_SIZE(mt8192_mt6359_rt1015p_rt5682_routes),
 };
 
+static struct snd_soc_card mt8192_mt6359_rt1015p_rt5682s_card = {
+	.name = "mt8192_mt6359_rt1015p_rt5682s",
+	.owner = THIS_MODULE,
+	.dai_link = mt8192_mt6359_dai_links,
+	.num_links = ARRAY_SIZE(mt8192_mt6359_dai_links),
+	.controls = mt8192_mt6359_rt1015p_rt5682_controls,
+	.num_controls = ARRAY_SIZE(mt8192_mt6359_rt1015p_rt5682_controls),
+	.dapm_widgets = mt8192_mt6359_rt1015p_rt5682_widgets,
+	.num_dapm_widgets = ARRAY_SIZE(mt8192_mt6359_rt1015p_rt5682_widgets),
+	.dapm_routes = mt8192_mt6359_rt1015p_rt5682_routes,
+	.num_dapm_routes = ARRAY_SIZE(mt8192_mt6359_rt1015p_rt5682_routes),
+};
+
 static int mt8192_mt6359_dev_probe(struct platform_device *pdev)
 {
 	struct snd_soc_card *card;
@@ -1139,7 +1165,8 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev)
 				dai_link->platforms = i2s3_rt1015_platforms;
 				dai_link->num_platforms =
 					ARRAY_SIZE(i2s3_rt1015_platforms);
-			} else if (card == &mt8192_mt6359_rt1015p_rt5682_card) {
+			} else if (card == &mt8192_mt6359_rt1015p_rt5682_card ||
+				   card == &mt8192_mt6359_rt1015p_rt5682s_card) {
 				dai_link->cpus = i2s3_rt1015p_cpus;
 				dai_link->num_cpus =
 					ARRAY_SIZE(i2s3_rt1015p_cpus);
@@ -1150,6 +1177,52 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev)
 				dai_link->num_platforms =
 					ARRAY_SIZE(i2s3_rt1015p_platforms);
 			}
+		} else if (strcmp(dai_link->name, "I2S8") == 0) {
+			if (card == &mt8192_mt6359_rt1015_rt5682_card ||
+			    card == &mt8192_mt6359_rt1015p_rt5682_card) {
+				dai_link->cpus = i2s8_rt5682_cpus;
+				dai_link->num_cpus =
+					ARRAY_SIZE(i2s8_rt5682_cpus);
+				dai_link->codecs = i2s8_rt5682_codecs;
+				dai_link->num_codecs =
+					ARRAY_SIZE(i2s8_rt5682_codecs);
+				dai_link->platforms = i2s8_rt5682_platforms;
+				dai_link->num_platforms =
+					ARRAY_SIZE(i2s8_rt5682_platforms);
+			} else if (card == &mt8192_mt6359_rt1015p_rt5682s_card) {
+				dai_link->cpus = i2s8_rt5682s_cpus;
+				dai_link->num_cpus =
+					ARRAY_SIZE(i2s8_rt5682s_cpus);
+				dai_link->codecs = i2s8_rt5682s_codecs;
+				dai_link->num_codecs =
+					ARRAY_SIZE(i2s8_rt5682s_codecs);
+				dai_link->platforms = i2s8_rt5682s_platforms;
+				dai_link->num_platforms =
+					ARRAY_SIZE(i2s8_rt5682s_platforms);
+			}
+		} else if (strcmp(dai_link->name, "I2S9") == 0) {
+			if (card == &mt8192_mt6359_rt1015_rt5682_card ||
+			    card == &mt8192_mt6359_rt1015p_rt5682_card) {
+				dai_link->cpus = i2s9_rt5682_cpus;
+				dai_link->num_cpus =
+					ARRAY_SIZE(i2s9_rt5682_cpus);
+				dai_link->codecs = i2s9_rt5682_codecs;
+				dai_link->num_codecs =
+					ARRAY_SIZE(i2s9_rt5682_codecs);
+				dai_link->platforms = i2s9_rt5682_platforms;
+				dai_link->num_platforms =
+					ARRAY_SIZE(i2s9_rt5682_platforms);
+			} else if (card == &mt8192_mt6359_rt1015p_rt5682s_card) {
+				dai_link->cpus = i2s9_rt5682s_cpus;
+				dai_link->num_cpus =
+					ARRAY_SIZE(i2s9_rt5682s_cpus);
+				dai_link->codecs = i2s9_rt5682s_codecs;
+				dai_link->num_codecs =
+					ARRAY_SIZE(i2s9_rt5682s_codecs);
+				dai_link->platforms = i2s9_rt5682s_platforms;
+				dai_link->num_platforms =
+					ARRAY_SIZE(i2s9_rt5682s_platforms);
+			}
 		}
 
 		if (hdmi_codec && strcmp(dai_link->name, "TDM") == 0) {
@@ -1185,6 +1258,10 @@ static const struct of_device_id mt8192_mt6359_dt_match[] = {
 		.compatible = "mediatek,mt8192_mt6359_rt1015p_rt5682",
 		.data = &mt8192_mt6359_rt1015p_rt5682_card,
 	},
+	{
+		.compatible = "mediatek,mt8192_mt6359_rt1015p_rt5682s",
+		.data = &mt8192_mt6359_rt1015p_rt5682s_card,
+	},
 	{}
 };
 #endif
-- 
2.18.0




More information about the Linux-mediatek mailing list