[PATCH] ASoC: tlv320aic3x: add dmic widget support

Gregory CLEMENT gregory.clement at bootlin.com
Fri Mar 11 11:06:27 CET 2022


This patch allows to use dmic to record sound.

This is a port from a variscite patch written by Eran Matityahu
<eran.m at variscite.com>.

Signed-off-by: Gregory CLEMENT <gregory.clement at bootlin.com>
---
 sound/soc/codecs/tlv320aic3x.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index d53037b1509d..426f92cc44da 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -296,6 +296,11 @@ static SOC_ENUM_SINGLE_DECL(aic3x_poweron_time_enum, HPOUT_POP_REDUCTION, 4,
 static const char * const aic3x_rampup_step[] = { "0ms", "1ms", "2ms", "4ms" };
 static SOC_ENUM_SINGLE_DECL(aic3x_rampup_step_enum, HPOUT_POP_REDUCTION, 2,
 			    aic3x_rampup_step);
+static const char * const aic3x_dmic_rates[] = { "off", "128x", "64x", "32x" };
+static SOC_ENUM_SINGLE_DECL(aic3x_dmic_rates_enum, AIC3X_ASD_INTF_CTRLA, 0,
+			    aic3x_dmic_rates);
+static const struct snd_kcontrol_new aic3x_dmic_rates_controls =
+	SOC_DAPM_ENUM("Route", aic3x_dmic_rates_enum);
 
 /*
  * DAC digital volumes. From -63.5 to 0 dB in 0.5 dB steps
@@ -751,6 +756,9 @@ static const struct snd_soc_dapm_widget aic3x_extra_dapm_widgets[] = {
 	SND_SOC_DAPM_INPUT("MIC3R"),
 	SND_SOC_DAPM_INPUT("LINE2L"),
 	SND_SOC_DAPM_INPUT("LINE2R"),
+
+	SND_SOC_DAPM_MUX("DMic Rate", SND_SOC_NOPM, 0, 0, &aic3x_dmic_rates_controls),
+	SND_SOC_DAPM_INPUT("DMIC"),
 };
 
 /* For tlv320aic3104 */
@@ -939,6 +947,12 @@ static const struct snd_soc_dapm_route intercon_extra[] = {
 	{"GPIO1 dmic modclk", NULL, "DMic Rate 64"},
 	{"GPIO1 dmic modclk", NULL, "DMic Rate 32"},
 
+	{"GPIO1 dmic modclk", NULL, "DMic Rate"},
+	{"DMic Rate", "128x", "DMIC"},
+	{"DMic Rate", "64x", "DMIC"},
+	{"DMic Rate", "32x", "DMIC"},
+	{"DMic Rate", "off", "DMIC"},
+
 	/* Left Line Output */
 	{"Left Line Mixer", "Line2L Bypass Switch", "Left Line2L Mux"},
 	{"Left Line Mixer", "Line2R Bypass Switch", "Right Line2R Mux"},
-- 
2.34.1



More information about the Alsa-devel mailing list