Skip to contentSkip to conversation

ASoC: Intel: boards: add max98390 2/4 speakers support

PATCH Superseded Mac Chiang 2 participants 3 messages Sep 13, 2021 – Sep 14, 2021

Subsystems (4)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Mac Chiang

author
#0 lore raw

PATCH v2 1/1 ASoC: Intel: boards: add max98390 2/4 speakers support

These support 3 hw boards.
1. SSP2 connects max98390, 2 speakers.
2. SSP1 connects max98390, 2 or 4 speakers.

Left/Right speakers and 4 speakers tdm playback
add echo reference capture
add BT_OFFLOAD support
add DMI_OEM_STRING for board varients

---
Changes logs:
-- add clearer hw boards info
-- move Kconfig MAX98390 up, correct SSP2 wrong quirk -- modify snd_soc_dai_set_tdm_slot() supporting 2/4 dai codecs -- aligning topology name: sof-adl-rt5682-ssp0-max98390-ssp2.tplg

 sound/soc/intel/boards/Kconfig                |   1 +
 sound/soc/intel/boards/sof_maxim_common.c     | 170 ++++++++++++++++++
 sound/soc/intel/boards/sof_maxim_common.h     |  16 ++
 sound/soc/intel/boards/sof_rt5682.c           |  69 +++++++
 .../intel/common/soc-acpi-intel-adl-match.c   |  13 ++
 sound/soc/sof/sof-pci-dev.c                   |   9 +
 6 files changed, 278 insertions(+)
sound/soc/intel/boards/Kconfig +1 -0
index 61b71d6c44cf..9723d04cbe74 100644
@@ -466,6 +466,7 @@ config SND_SOC_INTEL_SOF_RT5682_MACH
 		    (MFD_INTEL_LPSS || COMPILE_TEST)) ||\
 		   (SND_SOC_SOF_BAYTRAIL && (X86_INTEL_LPSS || COMPILE_TEST))
 	select SND_SOC_MAX98373_I2C
+	select SND_SOC_MAX98390
 	select SND_SOC_RT1011
 	select SND_SOC_RT1015
 	select SND_SOC_RT1015P
sound/soc/intel/boards/sof_maxim_common.c +170 -0

176 lines not on this page · raw message

sound/soc/intel/boards/sof_maxim_common.h +16 -0
index 3ff5e8fec4de..412b9dd06bad 100644
@@ -24,6 +24,22 @@ int max_98373_spk_codec_init(struct snd_soc_pcm_runtime *rtd);
 void max_98373_set_codec_conf(struct snd_soc_card *card);
 int max_98373_trigger(struct snd_pcm_substream *substream, int cmd);
 
+/*
+ * Maxim MAX98390
+ */
+#define MAX_98390_CODEC_DAI     "max98390-aif1"
+#define MAX_98390_DEV0_NAME     "i2c-MX98390:00"
+#define MAX_98390_DEV1_NAME     "i2c-MX98390:01"
+#define MAX_98390_DEV2_NAME     "i2c-MX98390:02"
+#define MAX_98390_DEV3_NAME     "i2c-MX98390:03"
+
+extern struct snd_soc_dai_link_component max_98390_components[2];
+extern struct snd_soc_dai_link_component max_98390_4spk_components[4];
+extern struct snd_soc_ops max_98390_ops;
+extern const struct snd_soc_dapm_route max_98390_dapm_routes[];
+void max_98390_set_codec_conf(struct snd_soc_card *card, int ch);
+int max_98390_spk_codec_init(struct snd_soc_pcm_runtime *rtd);
+
 /*
  * Maxim MAX98357A/MAX98360A
  */
sound/soc/intel/boards/sof_rt5682.c +69 -0

111 lines not on this page · raw message

sound/soc/intel/common/soc-acpi-intel-adl-match.c +13 -0
index a0f6a69c7038..2db152998e4a 100644
@@ -280,6 +280,11 @@ static const struct snd_soc_acpi_codecs adl_max98357a_amp = {
 	.codecs = {"MX98357A"}
 };
 
+static const struct snd_soc_acpi_codecs adl_max98390_amp = {
+	.num_codecs = 1,
+	.codecs = {"MX98390"}
+};
+
 struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = {
 	{
 		.id = "10EC5682",
@@ -297,6 +302,14 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = {
 		.sof_fw_filename = "sof-adl.ri",
 		.sof_tplg_filename = "sof-adl-max98357a-rt5682.tplg",
 	},
+	{
+		.id = "10EC5682",
+		.drv_name = "adl_max98390_rt5682",
+		.machine_quirk = snd_soc_acpi_codec_list,
+		.quirk_data = &adl_max98390_amp,
+		.sof_fw_filename = "sof-adl.ri",
+		.sof_tplg_filename = "sof-adl-max98390-rt5682.tplg",
+	},
 	{},
 };
 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_adl_machines);
sound/soc/sof/sof-pci-dev.c +9 -0
index bc9e70765678..be90a5f79766 100644
@@ -59,6 +59,15 @@ static const struct dmi_system_id sof_tplg_table[] = {
 		},
 		.driver_data = "sof-adl-rt5682-ssp0-max98373-ssp2.tplg",
 	},
+	{
+		.callback = sof_tplg_cb,
+		.matches = {
+			DMI_MATCH(DMI_PRODUCT_FAMILY, "Google_Brya"),
+			DMI_MATCH(DMI_OEM_STRING, "AUDIO-MAX98390_ALC5682I_I2S"),
+		},
+		.driver_data = "sof-adl-max98390-ssp2-rt5682-ssp0.tplg",
+	},
+
 	{}
 };
 
Signature · 1 line
2.20.1
#1 lore raw

I don't quite follow the initialization part. In the 4-ch case, you will setup control and widgets but...

Quoted 42 lines
sound/soc/intel/boards/sof_maxim_common.c +37 -0
+int max_98390_spk_codec_init(struct snd_soc_pcm_runtime *rtd)
+{
+	struct snd_soc_card *card = rtd->card;
+	int ret;
+
+	ret = snd_soc_dapm_new_controls(&card->dapm, max_98390_tt_dapm_widgets,
+						ARRAY_SIZE(max_98390_tt_dapm_widgets));
+	if (ret) {
+		dev_err(rtd->dev, "unable to add dapm controls, ret %d\n", ret);
+		/* Don't need to add routes if widget addition failed */
+		return ret;
+	}
+
+	ret = snd_soc_add_card_controls(card, max_98390_tt_kcontrols,
+						ARRAY_SIZE(max_98390_tt_kcontrols));
+	if (ret) {
+		dev_err(rtd->dev, "unable to add card controls, ret %d\n", ret);
+		return ret;
+	}
+
+	ret = snd_soc_dapm_add_routes(&card->dapm, max_98373_dapm_routes,
+					ARRAY_SIZE(max_98373_dapm_routes));
+	if (ret) {
+		dev_err(rtd->dev, "Speaker Left, Right  map addition failed: %d\n", ret);
+		return ret;
+	}
+
+	ret = snd_soc_dapm_add_routes(&card->dapm, max_98390_tt_dapm_routes,
+						ARRAY_SIZE(max_98390_tt_dapm_routes));
+	if (ret)
+		dev_err(rtd->dev, "Tweeter Speaker Left, Right map addition failed: %d\n", ret);
+
+	return ret;
+}
+EXPORT_SYMBOL_NS(max_98390_spk_codec_init, SND_SOC_INTEL_SOF_MAXIM_COMMON);
@@ -745,6 +778,21 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
 		} else if (sof_rt5682_quirk &
 				SOF_RT1011_SPEAKER_AMP_PRESENT) {
 			sof_rt1011_dai_link(&links[id]);
+		} else if (sof_rt5682_quirk &
+				SOF_MAX98390_SPEAKER_AMP_PRESENT) {

sound/soc/intel/boards/sof_maxim_common.c static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, · line 792

Quoted 10 lines
sound/soc/intel/boards/sof_maxim_common.c +10 -0
+			if (sof_rt5682_quirk &
+				SOF_MAX98390_TWEETER_SPEAKER_PRESENT) {
+				links[id].codecs = max_98390_4spk_components;
+				links[id].num_codecs = ARRAY_SIZE(max_98390_4spk_components);
+				links[id].init = max_98390_spk_codec_init;
+			} else {
+				links[id].codecs = max_98390_components;
+				links[id].num_codecs = ARRAY_SIZE(max_98390_components);
+				links[id].init = max_98373_spk_codec_init;
+			}

... in the 2 ch case you use this function

int max_98373_spk_codec_init(struct snd_soc_pcm_runtime *rtd)

{
	struct snd_soc_card *card = rtd->card;
	int ret;

	ret = snd_soc_dapm_add_routes(&card->dapm, max_98373_dapm_routes,
				      ARRAY_SIZE(max_98373_dapm_routes));
	if (ret)
		dev_err(rtd->dev, "Speaker map addition failed: %d\n", ret);
	return ret;
}

which only adds routes. Isn't there a need for widgets/controls for the 2 channel case as well?

It's also not good practice to mix the initialization of max98090 with a function with an explicit 98373 prefix. it's hard to maintain and error-prone. You might as well duplicate the function, if it's not used it will be removed while linking.

Quoted 86 lines
sound/soc/intel/boards/sof_rt5682.c +24 -0
+			links[id].ops = &max_98390_ops;
+			links[id].dpcm_capture = 1;
+
 		} else {
 			max_98357a_dai_link(&links[id]);
 		}
@@ -881,6 +929,14 @@ static int sof_audio_probe(struct platform_device *pdev)
 		sof_rt1011_codec_conf(&sof_audio_card_rt5682);
 	else if (sof_rt5682_quirk & SOF_RT1015P_SPEAKER_AMP_PRESENT)
 		sof_rt1015p_codec_conf(&sof_audio_card_rt5682);
+	else if (sof_rt5682_quirk & SOF_MAX98390_SPEAKER_AMP_PRESENT) {
+		if (sof_rt5682_quirk & SOF_MAX98390_TWEETER_SPEAKER_PRESENT)
+			max_98390_set_codec_conf(&sof_audio_card_rt5682,
+						ARRAY_SIZE(max_98390_4spk_components));
+		else
+			max_98390_set_codec_conf(&sof_audio_card_rt5682,
+						ARRAY_SIZE(max_98390_components));
+	}
 
 	if (sof_rt5682_quirk & SOF_SSP_BT_OFFLOAD_PRESENT)
 		sof_audio_card_rt5682.num_links++;
@@ -1007,6 +1063,18 @@ static const struct platform_device_id board_ids[] = {
 					SOF_RT5682_SSP_AMP(2) |
 					SOF_RT5682_NUM_HDMIDEV(4)),
 	},
+	{
+		.name = "adl_max98390_rt5682",
+		.driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN |
+					SOF_RT5682_SSP_CODEC(0) |
+					SOF_SPEAKER_AMP_PRESENT |
+					SOF_MAX98390_SPEAKER_AMP_PRESENT |
+					SOF_RT5682_SSP_AMP(1) |
+					SOF_RT5682_NUM_HDMIDEV(4) |
+					SOF_BT_OFFLOAD_SSP(2) |
+					SOF_SSP_BT_OFFLOAD_PRESENT),
+	},
+
 	{ }
 };
 MODULE_DEVICE_TABLE(platform, board_ids);
@@ -1026,6 +1094,7 @@ MODULE_DESCRIPTION("SOF Audio Machine driver");
 MODULE_AUTHOR("Bard Liao <[email protected]>");
 MODULE_AUTHOR("Sathya Prakash M R <[email protected]>");
 MODULE_AUTHOR("Brent Lu <[email protected]>");
+MODULE_AUTHOR("Mac Chiang <[email protected]>");
 MODULE_LICENSE("GPL v2");
 MODULE_IMPORT_NS(SND_SOC_INTEL_HDA_DSP_COMMON);
 MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_MAXIM_COMMON);
sound/soc/intel/common/soc-acpi-intel-adl-match.c +13 -0
index a0f6a69c7038..2db152998e4a 100644
@@ -280,6 +280,11 @@ static const struct snd_soc_acpi_codecs adl_max98357a_amp = {
 	.codecs = {"MX98357A"}
 };
 
+static const struct snd_soc_acpi_codecs adl_max98390_amp = {
+	.num_codecs = 1,
+	.codecs = {"MX98390"}
+};
+
 struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = {
 	{
 		.id = "10EC5682",
@@ -297,6 +302,14 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = {
 		.sof_fw_filename = "sof-adl.ri",
 		.sof_tplg_filename = "sof-adl-max98357a-rt5682.tplg",
 	},
+	{
+		.id = "10EC5682",
+		.drv_name = "adl_max98390_rt5682",
+		.machine_quirk = snd_soc_acpi_codec_list,
+		.quirk_data = &adl_max98390_amp,
+		.sof_fw_filename = "sof-adl.ri",
+		.sof_tplg_filename = "sof-adl-max98390-rt5682.tplg",
+	},
 	{},
 };
 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_adl_machines);
sound/soc/sof/sof-pci-dev.c +0 -0
index bc9e70765678..be90a5f79766 100644
@@ -59,6 +59,15 @@ static const struct dmi_system_id sof_tplg_table[] = {
 		},
 		.driver_data = "sof-adl-rt5682-ssp0-max98373-ssp2.tplg",

sound/soc/sof/sof-pci-dev.c static const struct dmi_system_id sof_tplg_table[] = { · line 70

Quoted 10 lines
sound/soc/sof/sof-pci-dev.c +9 -0
 	},
+	{
+		.callback = sof_tplg_cb,
+		.matches = {
+			DMI_MATCH(DMI_PRODUCT_FAMILY, "Google_Brya"),
+			DMI_MATCH(DMI_OEM_STRING, "AUDIO-MAX98390_ALC5682I_I2S"),
+		},
+		.driver_data = "sof-adl-max98390-ssp2-rt5682-ssp0.tplg",
+	},
+

I am still relatively confused since you still have two alternatives for topology but you described three configurations.

#2 lore raw
Quoted 87 lines

I don't quite follow the initialization part. In the 4-ch case, you will setup control and widgets but...

sound/soc/intel/boards/sof_maxim_common.c void max_98373_set_codec_conf(struct snd_soc_card *card)

Quoted 5 lines
sound/soc/intel/boards/sof_maxim_common.c +5 -0
+int max_98390_spk_codec_init(struct snd_soc_pcm_runtime *rtd) {
+	struct snd_soc_card *card = rtd->card;
+	int ret;
+
+	ret = snd_soc_dapm_new_controls(&card->dapm,

max_98390_tt_dapm_widgets,

Quoted 1 line

+

	ARRAY_SIZE(max_98390_tt_dapm_widgets));

Review

Quoted 2 lines
(quoted diff) +2 -0
+	if (ret) {
+		dev_err(rtd->dev, "unable to add dapm controls, ret %d\n",

ret);

sound/soc/intel/boards/sof_maxim_common.c void max_98373_set_codec_conf(struct snd_soc_card *card) · line 272

Quoted 6 lines
sound/soc/intel/boards/sof_maxim_common.c +6 -0
+		/* Don't need to add routes if widget addition failed */
+		return ret;
+	}
+
+	ret = snd_soc_add_card_controls(card, max_98390_tt_kcontrols,
+
	ARRAY_SIZE(max_98390_tt_kcontrols));

Review

Quoted 2 lines
(quoted diff) +2 -0
+	if (ret) {
+		dev_err(rtd->dev, "unable to add card controls, ret %d\n",

ret);

sound/soc/intel/boards/sof_maxim_common.c void max_98373_set_codec_conf(struct snd_soc_card *card)

Quoted 4 lines
sound/soc/intel/boards/sof_maxim_common.c +4 -0
+		return ret;
+	}
+
+	ret = snd_soc_dapm_add_routes(&card->dapm,

max_98373_dapm_routes,

Quoted 1 line

+

	ARRAY_SIZE(max_98373_dapm_routes));

Review

Quoted 2 lines
(quoted diff) +2 -0
+	if (ret) {
+		dev_err(rtd->dev, "Speaker Left, Right  map addition failed:

%d\n", ret);

sound/soc/intel/boards/sof_maxim_common.c void max_98373_set_codec_conf(struct snd_soc_card *card)

Quoted 4 lines
sound/soc/intel/boards/sof_maxim_common.c +4 -0
+		return ret;
+	}
+
+	ret = snd_soc_dapm_add_routes(&card->dapm,

max_98390_tt_dapm_routes,

Quoted 1 line

+

	ARRAY_SIZE(max_98390_tt_dapm_routes));

Review

Quoted 2 lines
(quoted diff) +2 -0
+	if (ret)
+		dev_err(rtd->dev, "Tweeter Speaker Left, Right map addition

failed:

sound/soc/intel/boards/sof_maxim_common.c static struct snd_soc_dai_link

Quoted 8 lines

+%d\n", ret);

sound/soc/intel/boards/sof_maxim_common.c +5 -0
+
+	return ret;
+}
+EXPORT_SYMBOL_NS(max_98390_spk_codec_init,
+SND_SOC_INTEL_SOF_MAXIM_COMMON);
@@ -745,6 +778,21 @@ static struct snd_soc_dai_link

*sof_card_dai_links_create(struct device *dev,

sound/soc/intel/boards/sof_rt5682.c static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, · line 795

Quoted 7 lines
sound/soc/intel/boards/sof_rt5682.c +4 -0
 		} else if (sof_rt5682_quirk &
 				SOF_RT1011_SPEAKER_AMP_PRESENT) {
 			sof_rt1011_dai_link(&links[id]);
+		} else if (sof_rt5682_quirk &
+				SOF_MAX98390_SPEAKER_AMP_PRESENT) {
+			if (sof_rt5682_quirk &
+
	SOF_MAX98390_TWEETER_SPEAKER_PRESENT) {

Review static struct snd_soc_dai_link · line 785

Quoted 1 line
(quoted diff) +1 -0
+				links[id].codecs =

max_98390_4spk_components;

Review static struct snd_soc_dai_link · line 786

Quoted 1 line
(quoted diff) +1 -0
+				links[id].num_codecs =

ARRAY_SIZE(max_98390_4spk_components);

sound/soc/intel/boards/sof_rt5682.c static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,

Quoted 4 lines
sound/soc/intel/boards/sof_rt5682.c +4 -0
+				links[id].init = max_98390_spk_codec_init;
+			} else {
+				links[id].codecs = max_98390_components;
+				links[id].num_codecs =

ARRAY_SIZE(max_98390_components);

sound/soc/intel/boards/sof_rt5682.c static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, · line 792

Quoted 2 lines
sound/soc/intel/boards/sof_rt5682.c +2 -0
+				links[id].init = max_98373_spk_codec_init;
+			}

... in the 2 ch case you use this function

int max_98373_spk_codec_init(struct snd_soc_pcm_runtime *rtd) {
	struct snd_soc_card *card = rtd->card;
	int ret;

	ret = snd_soc_dapm_add_routes(&card->dapm,
max_98373_dapm_routes,
				      ARRAY_SIZE(max_98373_dapm_routes));
	if (ret)
		dev_err(rtd->dev, "Speaker map addition failed: %d\n", ret);
	return ret;
}
Quoted 2 lines

which only adds routes. Isn't there a need for widgets/controls for the 2 channel case as well?

2 channels controls/widgets already exist in sof_controls[] and sof_widgets[] from sof_rt5682.c

Quoted 5 lines

It's also not good practice to mix the initialization of max98090 with a function with an explicit 98373 prefix. it's hard to maintain and error-prone. You might as well duplicate the function, if it's not used it will be removed while linking.

I am not sure whether I understand your suggestions.
When both using links[id].init = max_98390_spk_codec_init;
I can only think out add 2 spk dapm initially then check if 4 codec existing by using acpi_dev_present with uid. If no good, any example I can refer to?

int max_98390_spk_codec_init(struct snd_soc_pcm_runtime *rtd, int num_amps)

{
        struct snd_soc_card *card = rtd->card;
        int ret;

        ret = snd_soc_dapm_add_routes(&card->dapm, max_98390_dapm_routes,
                                        ARRAY_SIZE(max_98390_dapm_routes));

if (ret)
dev_err(rtd->dev, "Speaker map addition failed: %d\n", ret);

        if (acpi_dev_present("MX98390", "3", -1)) {
            ret = snd_soc_dapm_new_controls(&card->dapm, max_98390_tt_dapm_widgets,
                                                             ARRAY_SIZE(max_98390_tt_dapm_widgets));
	if (ret) {
	        dev_err(rtd->dev, "unable to add dapm controls, ret %d\n", ret);
	        /* Don't need to add routes if widget addition failed */
	        return ret;
	}
	
	ret = snd_soc_add_card_controls(card, max_98390_tt_kcontrols,
	                                        ARRAY_SIZE(max_98390_tt_kcontrols));
	if (ret) {
	        dev_err(rtd->dev, "unable to add card controls, ret %d\n", ret);
	        return ret;
	}
	
	ret = snd_soc_dapm_add_routes(&card->dapm, max_98390_tt_dapm_routes,
	                                        ARRAY_SIZE(max_98390_tt_dapm_routes));
	if (ret)
	        dev_err(rtd->dev, "Tweeter Speaker Left, Right map addition failed: %d\n", ret);
        }
        return ret;
} 
Quoted 108 lines

sound/soc/intel/boards/sof_rt5682.c static int sof_audio_probe(struct platform_device

Quoted 7 lines
sound/soc/intel/boards/sof_rt5682.c +3 -0
+			links[id].ops = &max_98390_ops;
+			links[id].dpcm_capture = 1;
+
 		} else {
 			max_98357a_dai_link(&links[id]);
 		}
@@ -881,6 +929,14 @@ static int sof_audio_probe(struct platform_device

*pdev)

sound/soc/intel/boards/sof_rt5682.c static int sof_audio_probe(struct platform_device *pdev)

Quoted 4 lines
sound/soc/intel/boards/sof_rt5682.c +1 -0
 		sof_rt1011_codec_conf(&sof_audio_card_rt5682);
 	else if (sof_rt5682_quirk & SOF_RT1015P_SPEAKER_AMP_PRESENT)
 		sof_rt1015p_codec_conf(&sof_audio_card_rt5682);
+	else if (sof_rt5682_quirk & SOF_MAX98390_SPEAKER_AMP_PRESENT)

{

sound/soc/intel/boards/sof_rt5682.c static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, · line 783

Quoted 1 line
sound/soc/intel/boards/sof_rt5682.c +1 -0
+		if (sof_rt5682_quirk &

SOF_MAX98390_TWEETER_SPEAKER_PRESENT)

Review static int sof_audio_probe(struct platform_device · line 934

Quoted 1 line
(quoted diff) +1 -0
+
	max_98390_set_codec_conf(&sof_audio_card_rt5682,

Review static int sof_audio_probe(struct platform_device · line 935

Quoted 1 line
(quoted diff) +1 -0
+
	ARRAY_SIZE(max_98390_4spk_components));

Review static int sof_audio_probe(struct platform_device · line 937

Quoted 2 lines
(quoted diff) +2 -0
+		else
+
	max_98390_set_codec_conf(&sof_audio_card_rt5682,

Review static int sof_audio_probe(struct platform_device · line 938

Quoted 1 line
(quoted diff) +1 -0
+
	ARRAY_SIZE(max_98390_components));

sound/soc/intel/boards/sof_rt5682.c static const struct platform_device_id

Quoted 5 lines
sound/soc/intel/boards/sof_rt5682.c +1 -0
+	}
 
 	if (sof_rt5682_quirk & SOF_SSP_BT_OFFLOAD_PRESENT)
 		sof_audio_card_rt5682.num_links++;
@@ -1007,6 +1063,18 @@ static const struct platform_device_id

board_ids[] = {

sound/soc/intel/boards/sof_rt5682.c static const struct platform_device_id board_ids[] = { · line 1077

Quoted 9 lines
sound/soc/intel/boards/sof_rt5682.c +6 -0
 					SOF_RT5682_SSP_AMP(2) |
 					SOF_RT5682_NUM_HDMIDEV(4)),
 	},
+	{
+		.name = "adl_max98390_rt5682",
+		.driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN |
+					SOF_RT5682_SSP_CODEC(0) |
+					SOF_SPEAKER_AMP_PRESENT |
+
	SOF_MAX98390_SPEAKER_AMP_PRESENT |
Quoted 10 lines
sound/soc/intel/boards/sof_rt5682.c +6 -0
+					SOF_RT5682_SSP_AMP(1) |
+					SOF_RT5682_NUM_HDMIDEV(4) |
+					SOF_BT_OFFLOAD_SSP(2) |
+					SOF_SSP_BT_OFFLOAD_PRESENT),
+	},
+
 	{ }
 };
 MODULE_DEVICE_TABLE(platform, board_ids); @@ -1026,6 +1094,7 @@

MODULE_DESCRIPTION("SOF Audio Machine driver");

MODULE_AUTHOR("Bard

sound/soc/intel/common/soc-acpi-intel-adl-match.c static const struct snd_soc_acpi_codecs

Quoted 13 lines

Liao <[email protected]>"); MODULE_AUTHOR("Sathya Prakash M R <[email protected]>"); MODULE_AUTHOR("Brent Lu <[email protected]>");

sound/soc/intel/boards/sof_rt5682.c +1 -0
+MODULE_AUTHOR("Mac Chiang <[email protected]>");
 MODULE_LICENSE("GPL v2");
 MODULE_IMPORT_NS(SND_SOC_INTEL_HDA_DSP_COMMON);
 MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_MAXIM_COMMON);
sound/soc/intel/common/soc-acpi-intel-adl-match.c +0 -0
index a0f6a69c7038..2db152998e4a 100644
@@ -280,6 +280,11 @@ static const struct snd_soc_acpi_codecs

adl_max98357a_amp = {

sound/soc/intel/common/soc-acpi-intel-adl-match.c struct snd_soc_acpi_mach

Quoted 12 lines
sound/soc/intel/common/soc-acpi-intel-adl-match.c +5 -0
 	.codecs = {"MX98357A"}
 };
 
+static const struct snd_soc_acpi_codecs adl_max98390_amp = {
+	.num_codecs = 1,
+	.codecs = {"MX98390"}
+};
+
 struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = {
 	{
 		.id = "10EC5682",
@@ -297,6 +302,14 @@ struct snd_soc_acpi_mach

snd_soc_acpi_intel_adl_machines[] = {

sound/soc/sof/sof-pci-dev.c static const struct dmi_system_id sof_tplg_table[] =

Quoted 19 lines
sound/soc/intel/common/soc-acpi-intel-adl-match.c +8 -0
 		.sof_fw_filename = "sof-adl.ri",
 		.sof_tplg_filename = "sof-adl-max98357a-rt5682.tplg",
 	},
+	{
+		.id = "10EC5682",
+		.drv_name = "adl_max98390_rt5682",
+		.machine_quirk = snd_soc_acpi_codec_list,
+		.quirk_data = &adl_max98390_amp,
+		.sof_fw_filename = "sof-adl.ri",
+		.sof_tplg_filename = "sof-adl-max98390-rt5682.tplg",
+	},
 	{},
 };
 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_adl_machines);
sound/soc/sof/sof-pci-dev.c +0 -0
index bc9e70765678..be90a5f79766 100644
@@ -59,6 +59,15 @@ static const struct dmi_system_id sof_tplg_table[] =

{

sound/soc/sof/sof-pci-dev.c static const struct dmi_system_id sof_tplg_table[] = {

Quoted 7 lines
sound/soc/sof/sof-pci-dev.c +4 -0
 		},
 		.driver_data = "sof-adl-rt5682-ssp0-max98373-ssp2.tplg",
 	},
+	{
+		.callback = sof_tplg_cb,
+		.matches = {
+			DMI_MATCH(DMI_PRODUCT_FAMILY,

"Google_Brya"),

sound/soc/sof/sof-pci-dev.c static const struct dmi_system_id sof_tplg_table[] = · line 66

Quoted 1 line
sound/soc/sof/sof-pci-dev.c +1 -0
+			DMI_MATCH(DMI_OEM_STRING, "AUDIO-

MAX98390_ALC5682I_I2S"),

Quoted 7 lines

sound/soc/sof/sof-pci-dev.c static const struct dmi_system_id sof_tplg_table[] = { · line 70

Quoted 4 lines
sound/soc/sof/sof-pci-dev.c +4 -0
+		},
+		.driver_data = "sof-adl-max98390-ssp2-rt5682-ssp0.tplg",
+	},
+

I am still relatively confused since you still have two alternatives for topology but you described three configurations.

3rd hw board without quirk, so it is applying SSP1 2 speakers which declare in board_id[].

        {
                .name = "adl_max98390_rt5682",
                .driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN |
                                        SOF_RT5682_SSP_CODEC(0) |
                                        SOF_SPEAKER_AMP_PRESENT |
                                        SOF_MAX98390_SPEAKER_AMP_PRESENT |
                                        SOF_RT5682_SSP_AMP(1) |
                                        SOF_RT5682_NUM_HDMIDEV(4) |
                                        SOF_BT_OFFLOAD_SSP(2) |
                                        SOF_SSP_BT_OFFLOAD_PRESENT),
        },