Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH 1/3] ASoC: max98090/91: added new ALSA routes and widgets
@ 2025-10-15  9:36 Sharique Mohammad
  2025-10-15  9:36 ` [PATCH 2/3] ASoC: max98090/91: fixed wrong channel constraint for .capture Sharique Mohammad
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sharique Mohammad @ 2025-10-15  9:36 UTC (permalink / raw)
  To: linux-sound; +Cc: perex, broonie, lgirdwood, 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.

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.

Signed-off-by: Sharique Mohammad <sharq0406@gmail.com>
---
 sound/soc/codecs/max98090.c | 55 +++++++++++++++++++++++++++++++++----
 1 file changed, 49 insertions(+), 6 deletions(-)

diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index 22177c1ce160..77994539c3a8 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -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)
-- 
2.30.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] ASoC: max98090/91: fixed wrong channel constraint for .capture
  2025-10-15  9:36 [PATCH 1/3] ASoC: max98090/91: added new ALSA routes and widgets Sharique Mohammad
@ 2025-10-15  9:36 ` Sharique Mohammad
  2025-10-15  9:36 ` [PATCH 3/3] ASoC: max98090/91: added a comment for the users and fixed an extra space Sharique Mohammad
  2025-10-15 10:35 ` [PATCH 1/3] ASoC: max98090/91: added new ALSA routes and widgets Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Sharique Mohammad @ 2025-10-15  9:36 UTC (permalink / raw)
  To: linux-sound; +Cc: perex, broonie, lgirdwood, Sharique Mohammad

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.

Signed-off-by: Sharique Mohammad <sharq0406@gmail.com>
---
 sound/soc/codecs/max98090.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index 77994539c3a8..0eeea6c1974d 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -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,
 	},
-- 
2.30.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] ASoC: max98090/91: added a comment for the users and fixed an extra space
  2025-10-15  9:36 [PATCH 1/3] ASoC: max98090/91: added new ALSA routes and widgets Sharique Mohammad
  2025-10-15  9:36 ` [PATCH 2/3] ASoC: max98090/91: fixed wrong channel constraint for .capture Sharique Mohammad
@ 2025-10-15  9:36 ` Sharique Mohammad
  2025-10-15 10:35 ` [PATCH 1/3] ASoC: max98090/91: added new ALSA routes and widgets Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Sharique Mohammad @ 2025-10-15  9:36 UTC (permalink / raw)
  To: linux-sound; +Cc: perex, broonie, lgirdwood, Sharique Mohammad

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

Signed-off-by: Sharique Mohammad <sharq0406@gmail.com>
---
 sound/soc/codecs/max98090.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index 0eeea6c1974d..386ef0caa6bf 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -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)
-- 
2.30.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] ASoC: max98090/91: added new ALSA routes and widgets
  2025-10-15  9:36 [PATCH 1/3] ASoC: max98090/91: added new ALSA routes and widgets Sharique Mohammad
  2025-10-15  9:36 ` [PATCH 2/3] ASoC: max98090/91: fixed wrong channel constraint for .capture Sharique Mohammad
  2025-10-15  9:36 ` [PATCH 3/3] ASoC: max98090/91: added a comment for the users and fixed an extra space Sharique Mohammad
@ 2025-10-15 10:35 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2025-10-15 10:35 UTC (permalink / raw)
  To: Sharique Mohammad; +Cc: linux-sound, perex, lgirdwood

[-- Attachment #1: Type: text/plain, Size: 785 bytes --]

On Wed, Oct 15, 2025 at 11:36:26AM +0200, Sharique Mohammad wrote:
> 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.

> 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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-10-15 10:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-15  9:36 [PATCH 1/3] ASoC: max98090/91: added new ALSA routes and widgets Sharique Mohammad
2025-10-15  9:36 ` [PATCH 2/3] ASoC: max98090/91: fixed wrong channel constraint for .capture Sharique Mohammad
2025-10-15  9:36 ` [PATCH 3/3] ASoC: max98090/91: added a comment for the users and fixed an extra space Sharique Mohammad
2025-10-15 10:35 ` [PATCH 1/3] ASoC: max98090/91: added new ALSA routes and widgets Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox