Skip to contentSkip to conversation

ASoC: max98090/91: added new ALSA routes and widgets

PATCH In review Sharique Mohammad 2 participants 4 messages Oct 15, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 ASoC: max98090/91: added new ALSA routes and widgets

The widgets and routes for max98091 were not available, although the compatible flag has max98091 but only max98090 routes were present. So, new routes for max98091 has been added.

Also, the digital microphone M1(IN1/IN2) and digital microphone M2(IN5/IN6) could not be enabled or disabled from amixer controls. So, widgets have been added, and now a user can from amixer controls enable/disable the digital mics.

---
 sound/soc/codecs/max98090.c | 55 +++++++++++++++++++++++++++++++++----
 1 file changed, 49 insertions(+), 6 deletions(-)
sound/soc/codecs/max98090.c +49 -6
index 22177c1ce160..77994539c3a8 100644
@@ -817,6 +817,16 @@ static SOC_ENUM_SINGLE_VIRT_DECL(dmic_mux_enum, dmic_mux_text);
 static const struct snd_kcontrol_new max98090_dmic_mux =
 	SOC_DAPM_ENUM("DMIC Mux", dmic_mux_enum);
 
+static const char * const dmic_mX_mux_text[] = { "Enable", "Disable" };
+
+static SOC_ENUM_SINGLE_VIRT_DECL(dmic_m1_enum, dmic_mX_mux_text);
+static const struct snd_kcontrol_new max98090_dmic_m1_mux =
+	SOC_DAPM_ENUM("DMIC M1 Mux", dmic_m1_enum);
+
+static SOC_ENUM_SINGLE_VIRT_DECL(dmic_m2_enum, dmic_mX_mux_text);
+static const struct snd_kcontrol_new max98090_dmic_m2_mux =
+	SOC_DAPM_ENUM("DMIC M2 Mux", dmic_m2_enum);
+
 /* LINEA mixer switch */
 static const struct snd_kcontrol_new max98090_linea_mixer_controls[] = {
 	SOC_DAPM_SINGLE("IN1 Switch", M98090_REG_LINE_INPUT_CONFIG,
@@ -1106,6 +1116,9 @@ static const struct snd_soc_dapm_widget max98090_dapm_widgets[] = {
 
 	SND_SOC_DAPM_MUX("DMIC Mux", SND_SOC_NOPM, 0, 0, &max98090_dmic_mux),
 
+	SND_SOC_DAPM_MUX("DMIC M1 Mux", SND_SOC_NOPM, 0, 0,
+		&max98090_dmic_m1_mux),
+
 	SND_SOC_DAPM_PGA_E("MIC1 Input", M98090_REG_MIC1_INPUT_LEVEL,
 		M98090_MIC_PA1EN_SHIFT, 0, NULL, 0, max98090_micinput_event,
 		SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
@@ -1234,9 +1247,21 @@ static const struct snd_soc_dapm_widget max98091_dapm_widgets[] = {
 	SND_SOC_DAPM_INPUT("DMIC4"),
 
 	SND_SOC_DAPM_SUPPLY("DMIC3_ENA", M98090_REG_DIGITAL_MIC_ENABLE,
-		 M98090_DIGMIC3_SHIFT, 0, NULL, 0),
+		 M98090_DIGMIC3_SHIFT, 0, max98090_shdn_event,
+			SND_SOC_DAPM_POST_PMU),
 	SND_SOC_DAPM_SUPPLY("DMIC4_ENA", M98090_REG_DIGITAL_MIC_ENABLE,
-		 M98090_DIGMIC4_SHIFT, 0, NULL, 0),
+		 M98090_DIGMIC4_SHIFT, 0, max98090_shdn_event,
+			 SND_SOC_DAPM_POST_PMU),
+	SND_SOC_DAPM_SUPPLY("DMIC34 DC Blocking", M98090_REG_FILTER_CONFIG,
+		M98090_FLT_DMIC34HPF_SHIFT, 0, NULL, 0),
+
+	SND_SOC_DAPM_MUX("DMIC M2 Mux", SND_SOC_NOPM, 0, 0,
+		&max98090_dmic_m2_mux),
+
+	SND_SOC_DAPM_AIF_OUT("AIFOUT2L", "HiFi Capture", 2,
+		SND_SOC_NOPM, 0, 0),
+	SND_SOC_DAPM_AIF_OUT("AIFOUT2R", "HiFi Capture", 3,
+		SND_SOC_NOPM, 0, 0),
 };
 
 static const struct snd_soc_dapm_route max98090_dapm_routes[] = {
@@ -1300,10 +1325,12 @@ static const struct snd_soc_dapm_route max98090_dapm_routes[] = {
 	{"ADCL", NULL, "SHDN"},
 	{"ADCR", NULL, "SHDN"},
 
+	{"DMIC M1 Mux", "Enable", "DMICL"},
+	{"DMIC M1 Mux", "Enable", "DMICR"},
+
 	{"DMIC Mux", "ADC", "ADCL"},
 	{"DMIC Mux", "ADC", "ADCR"},
-	{"DMIC Mux", "DMIC", "DMICL"},
-	{"DMIC Mux", "DMIC", "DMICR"},
+	{"DMIC Mux", "DMIC", "DMIC M1 Mux"},
 
 	{"LBENL Mux", "Normal", "DMIC Mux"},
 	{"LBENL Mux", "Loopback", "LTENL Mux"},
@@ -1425,8 +1452,24 @@ static const struct snd_soc_dapm_route max98091_dapm_routes[] = {
 	/* DMIC inputs */
 	{"DMIC3", NULL, "DMIC3_ENA"},
 	{"DMIC4", NULL, "DMIC4_ENA"},
-	{"DMIC3", NULL, "AHPF"},
-	{"DMIC4", NULL, "AHPF"},
+
+	{"DMIC3", NULL, "DMIC3_ENA"},
+	{"DMIC3", NULL, "DMIC4_ENA"},
+	{"DMIC4", NULL, "DMIC3_ENA"},
+	{"DMIC4", NULL, "DMIC4_ENA"},
+	{"DMIC3", NULL, "DMIC34 DC Blocking"},
+	{"DMIC4", NULL, "DMIC34 DC Blocking"},
+
+	{"DMIC M2 Mux", "Enable", "DMIC3"},
+	{"DMIC M2 Mux", "Enable", "DMIC4"},
+
+	{"AIFOUT2L", NULL, "DMIC M2 Mux"},
+	{"AIFOUT2R", NULL, "DMIC M2 Mux"},
+
+	{"AIFOUT2L", NULL, "SHDN"},
+	{"AIFOUT2R", NULL, "SHDN"},
+	{"AIFOUT2L", NULL, "SDOEN"},
+	{"AIFOUT2R", NULL, "SDOEN"},
 };
 
 static int max98090_add_widgets(struct snd_soc_component *component)
Signature · 1 line
2.30.5
#1 lore raw

PATCH 2/3 ASoC: max98090/91: fixed wrong channel constraint for .capture

max98091 with functionality of supporting two digital stereo mics together, the number of channels supported increases to 4. In the current code the channels_max in .capture of the DAI structure "struct snd_soc_dai_driver max98090_dai" is 2, now with this patch it has been increases to 4.

---
 sound/soc/codecs/max98090.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/max98090.c +1 -1
index 77994539c3a8..0eeea6c1974d 100644
@@ -2410,7 +2410,7 @@ static struct snd_soc_dai_driver max98090_dai = {
 	.capture = {
 		.stream_name = "HiFi Capture",
 		.channels_min = 1,
-		.channels_max = 2,
+		.channels_max = 4,
 		.rates = MAX98090_RATES,
 		.formats = MAX98090_FORMATS,
 	},
Signature · 1 line
2.30.5
#2 lore raw

PATCH 3/3 ASoC: max98090/91: added a comment for the users and fixed an extra space

In reply to Sharique Mohammad

added a comment that may be of help for the users of max98090/91 and fixed and extra space.

---
 sound/soc/codecs/max98090.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/codecs/max98090.c +5 -1
index 0eeea6c1974d..386ef0caa6bf 100644
@@ -1708,6 +1708,10 @@ static int max98090_dai_set_fmt(struct snd_soc_dai *codec_dai,
 		 * for Bit Clock Invert (BCI). The inverted logic is only
 		 * seen for the case of TDM mode. The remaining cases have
 		 * normal logic.
+		 *
+		 * If one hears noise in audio, try commenting below code and
+		 * then try again. Also, try playing around with register 0xC1
+		 * record tdm slot.
 		 */
 		if (tdm_regval)
 			regval ^= M98090_BCI_MASK;
@@ -2414,7 +2418,7 @@ static struct snd_soc_dai_driver max98090_dai = {
 		.rates = MAX98090_RATES,
 		.formats = MAX98090_FORMATS,
 	},
-	 .ops = &max98090_dai_ops,
+	.ops = &max98090_dai_ops,
 };
 
 static int max98090_probe(struct snd_soc_component *component)
Signature · 1 line
2.30.5
maintainer
#3 lore raw
In reply to Sharique Mohammad
Quoted 3 lines · Sharique Mohammad

The widgets and routes for max98091 were not available, although the compatible flag has max98091 but only max98090 routes were present. So, new routes for max98091 has been added.

The additional routes should really only be added on the max98091, otherwise systems with the max98090 will also see them. There's a bunch of other drivers for device families in the tree, you can see how they handle them.

Quoted 4 lines

Also, the digital microphone M1(IN1/IN2) and digital microphone M2(IN5/IN6) could not be enabled or disabled from amixer controls. So, widgets have been added, and now a user can from amixer controls enable/disable the digital mics.

This sounds like a separate fix so should be a separate patch.