Skip to contentSkip to conversation

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

PATCH RESEND Superseded Mac Chiang 2 participants 3 messages Nov 22, 2021 – Nov 23, 2021

Subsystems (4)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Mac Chiang

author
#0 lore raw

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

support 2 hw boards.
1. SSP2 connects max98390, 2 speakers.
2. SSP1 connects max98390, 2/4 speakers.

2 or 4 speakers playback
add echo reference capture
add bt offload support
add DMI_OEM_STRING for board variants
add ALC5682I-VS support

---
changes in resend v3:
- use .comp_ids to scan acpi support ALC5682I-VD or ALC5682I-VS

---
 sound/soc/intel/boards/Kconfig                |   1 +
 sound/soc/intel/boards/sof_maxim_common.c     | 180 ++++++++++++++++++
 sound/soc/intel/boards/sof_maxim_common.h     |  16 ++
 sound/soc/intel/boards/sof_rt5682.c           |  84 ++++++++
 .../intel/common/soc-acpi-intel-adl-match.c   |  21 ++
 sound/soc/sof/sof-pci-dev.c                   |   9 +
 6 files changed, 311 insertions(+)
sound/soc/intel/boards/Kconfig +1 -0
index 849445fcc05d..34ccefcc30c7 100644
@@ -467,6 +467,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 +180 -0

192 lines not on this page · raw message

sound/soc/intel/boards/sof_maxim_common.h +16 -0
index 3ff5e8fec4de..7a8c53049e4d 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 const struct snd_soc_ops max_98390_ops;
+
+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 +84 -0

132 lines not on this page · raw message

sound/soc/intel/common/soc-acpi-intel-adl-match.c +21 -0
index fde310e5724b..0d04166b9d64 100644
@@ -379,6 +379,11 @@ static const struct snd_soc_acpi_codecs adl_rt1019p_amp = {
 	.codecs = {"RTL1019"}
 };
 
+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[] = {
 	{
 		.comp_ids = &adl_rt5682_rt5682s_hp,
@@ -434,6 +439,22 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = {
 		.sof_fw_filename = "sof-adl.ri",
 		.sof_tplg_filename = "sof-adl-nau8825.tplg",
 	},
+	{
+		.comp_ids = &adl_rt5682_rt5682s_hp,
+		.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",
+	},
+	{
+		.comp_ids = &adl_rt5682_rt5682s_hp,
+		.drv_name = "adl_mx98390_rt5682s",
+		.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

This is technically not a 'RESEND, v3' since it's different from v3. Please don't do this.

Quoted 3 lines

---
changes in resend v3:
- use .comp_ids to scan acpi support ALC5682I-VD or ALC5682I-VS

and this indeed shows you modified the code...

Quoted 18 lines
sound/soc/intel/common/soc-acpi-intel-adl-match.c +11 -0
+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[] = {
 	{
 		.comp_ids = &adl_rt5682_rt5682s_hp,
@@ -434,6 +439,22 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = {
 		.sof_fw_filename = "sof-adl.ri",
 		.sof_tplg_filename = "sof-adl-nau8825.tplg",
 	},
+	{
+		.comp_ids = &adl_rt5682_rt5682s_hp,
+		.drv_name = "adl_max98390_rt5682",
+		.machine_quirk = snd_soc_acpi_codec_list,
+		.quirk_data = &adl_max98390_amp,
+		.sof_fw_filename = "sof-adl.ri",

sound/soc/intel/common/soc-acpi-intel-adl-match.c struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = { · line 457

Quoted 10 lines
sound/soc/intel/common/soc-acpi-intel-adl-match.c +10 -0
+		.sof_tplg_filename = "sof-adl-max98390-rt5682.tplg",
+	},
+	{
+		.comp_ids = &adl_rt5682_rt5682s_hp,
+		.drv_name = "adl_mx98390_rt5682s",
+		.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",
+	},

I don't follow the last two entries.. They use

the same 'comp_ids':

static const struct snd_soc_acpi_codecs adl_rt5682_rt5682s_hp = {
	.num_codecs = 2,
	.codecs = {"10EC5682", "RTL5682"},
};

the same machine quirk:
snd_soc_acpi_codec_list,

the same quirk_data:
&adl_max98390_amp,

but a different driver.
.drv_name = "adl_max98390_rt5682",
.drv_name = "adl_mx98390_rt5682s",

it looks like the second entry will never be selected.

Can you please explain how this works if it's intentional or double-check if this is correct. I think it's a copy-paste from the case where the amplifier is different, but here only the headset codec is different.

#2 lore raw
Quoted 8 lines

This is technically not a 'RESEND, v3' since it's different from v3. Please don't do this.

Quoted 3 lines

---
changes in resend v3:
- use .comp_ids to scan acpi support ALC5682I-VD or ALC5682I-VS

and this indeed shows you modified the code...

Sorry for the confusion. My mistakes... It is not a resend case because I did changes. I will send new one and also fix below you mention.

Quoted 50 lines

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

Quoted 9 lines
sound/soc/intel/common/soc-acpi-intel-adl-match.c +5 -0
+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[] = {
 	{
 		.comp_ids = &adl_rt5682_rt5682s_hp, @@ -434,6 +439,22

@@ struct

Quoted 10 lines

snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = {

sound/soc/intel/common/soc-acpi-intel-adl-match.c +6 -0
 		.sof_fw_filename = "sof-adl.ri",
 		.sof_tplg_filename = "sof-adl-nau8825.tplg",
 	},
+	{
+		.comp_ids = &adl_rt5682_rt5682s_hp,
+		.drv_name = "adl_max98390_rt5682",
+		.machine_quirk = snd_soc_acpi_codec_list,
+		.quirk_data = &adl_max98390_amp,
+		.sof_fw_filename = "sof-adl.ri",

sound/soc/intel/common/soc-acpi-intel-adl-match.c struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = { · line 457

Quoted 10 lines
sound/soc/intel/common/soc-acpi-intel-adl-match.c +10 -0
+		.sof_tplg_filename = "sof-adl-max98390-rt5682.tplg",
+	},
+	{
+		.comp_ids = &adl_rt5682_rt5682s_hp,
+		.drv_name = "adl_mx98390_rt5682s",
+		.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",
+	},

I don't follow the last two entries.. They use

the same 'comp_ids':

static const struct snd_soc_acpi_codecs adl_rt5682_rt5682s_hp = {
	.num_codecs = 2,
	.codecs = {"10EC5682", "RTL5682"},
};

the same machine quirk:
snd_soc_acpi_codec_list,

the same quirk_data:
&adl_max98390_amp,

but a different driver.
.drv_name = "adl_max98390_rt5682",
.drv_name = "adl_mx98390_rt5682s",

Quoted 5 lines

it looks like the second entry will never be selected.

Can you please explain how this works if it's intentional or double-check if this is correct. I think it's a copy-paste from the case where the amplifier is different, but here only the headset codec is different.

Yes, you are right! Here is only hp difference. I don't have to copy two. With single drv_name and remove the redundant entry in sof_rt5682 board_id table.