[PATCH 4/4] ASoC: tlv320aic32x4: Add CM2_L and CM2_R negative MicPGA input routing
From: Gianfranco Mariotti
Date: Mon Nov 23 2026 - 18:41:13 EST
The Left and Right MicPGA negative terminal input routing configuration
registers (AIC32X4_LMICPGANIN and AIC32X4_RMICPGANIN, Page 1, Registers
54 and 57) expose a second common-mode resistor selection (CM2L / CM2R)
in bits 1:0 alongside CM1L / CM1R in bits 7:6.
Add the CM2_L and CM2_R DAPM mux controls, widgets, and routes while
keeping the existing CM_L and CM_R names unchanged to preserve ABI
compatibility with existing userspace configurations.
Signed-off-by: Gianfranco Mariotti <gianfranco.mariotti94@xxxxxxxxx>
---
sound/soc/codecs/tlv320aic32x4.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c
index 80ff52c6bbbe1..4fdac637ea472 100644
--- a/sound/soc/codecs/tlv320aic32x4.c
+++ b/sound/soc/codecs/tlv320aic32x4.c
@@ -394,6 +394,7 @@ static SOC_ENUM_SINGLE_DECL(in1r_lpga_p_enum, AIC32X4_LMICPGAPIN, 0, resistor_te
static SOC_ENUM_SINGLE_DECL(cml_lpga_n_enum, AIC32X4_LMICPGANIN, 6, resistor_text);
static SOC_ENUM_SINGLE_DECL(in2r_lpga_n_enum, AIC32X4_LMICPGANIN, 4, resistor_text);
static SOC_ENUM_SINGLE_DECL(in3r_lpga_n_enum, AIC32X4_LMICPGANIN, 2, resistor_text);
+static SOC_ENUM_SINGLE_DECL(cm2l_lpga_n_enum, AIC32X4_LMICPGANIN, 0, resistor_text);
static const struct snd_kcontrol_new in1l_to_lmixer_controls[] = {
SOC_DAPM_ENUM("IN1_L L+ Switch", in1l_lpga_p_enum),
@@ -423,6 +424,10 @@ static const struct snd_kcontrol_new in3r_to_lmixer_controls[] = {
SOC_DAPM_ENUM("IN3_R L- Switch", in3r_lpga_n_enum),
};
+static const struct snd_kcontrol_new cm2l_to_lmixer_controls[] = {
+ SOC_DAPM_ENUM("CM2_L L- Switch", cm2l_lpga_n_enum),
+};
+
/* Right mixer pins */
static SOC_ENUM_SINGLE_DECL(in1r_rpga_p_enum, AIC32X4_RMICPGAPIN, 6, resistor_text);
static SOC_ENUM_SINGLE_DECL(in2r_rpga_p_enum, AIC32X4_RMICPGAPIN, 4, resistor_text);
@@ -431,6 +436,7 @@ static SOC_ENUM_SINGLE_DECL(in2l_rpga_p_enum, AIC32X4_RMICPGAPIN, 0, resistor_te
static SOC_ENUM_SINGLE_DECL(cmr_rpga_n_enum, AIC32X4_RMICPGANIN, 6, resistor_text);
static SOC_ENUM_SINGLE_DECL(in1l_rpga_n_enum, AIC32X4_RMICPGANIN, 4, resistor_text);
static SOC_ENUM_SINGLE_DECL(in3l_rpga_n_enum, AIC32X4_RMICPGANIN, 2, resistor_text);
+static SOC_ENUM_SINGLE_DECL(cm2r_rpga_n_enum, AIC32X4_RMICPGANIN, 0, resistor_text);
static const struct snd_kcontrol_new in1r_to_rmixer_controls[] = {
SOC_DAPM_ENUM("IN1_R R+ Switch", in1r_rpga_p_enum),
@@ -460,6 +466,10 @@ static const struct snd_kcontrol_new in3l_to_rmixer_controls[] = {
SOC_DAPM_ENUM("IN3_L R- Switch", in3l_rpga_n_enum),
};
+static const struct snd_kcontrol_new cm2r_to_rmixer_controls[] = {
+ SOC_DAPM_ENUM("CM2_R R- Switch", cm2r_rpga_n_enum),
+};
+
static const struct snd_soc_dapm_widget aic32x4_dapm_widgets[] = {
SND_SOC_DAPM_DAC("Left DAC", "Left Playback", AIC32X4_DACSETUP, 7, 0),
SND_SOC_DAPM_MIXER("HPL Output Mixer", SND_SOC_NOPM, 0, 0,
@@ -500,6 +510,8 @@ static const struct snd_soc_dapm_widget aic32x4_dapm_widgets[] = {
in1l_to_rmixer_controls),
SND_SOC_DAPM_MUX("IN3_L to Right Mixer Negative Resistor", SND_SOC_NOPM, 0, 0,
in3l_to_rmixer_controls),
+ SND_SOC_DAPM_MUX("CM2_R to Right Mixer Negative Resistor", SND_SOC_NOPM, 0, 0,
+ cm2r_to_rmixer_controls),
SND_SOC_DAPM_ADC("Left ADC", "Left Capture", AIC32X4_ADCSETUP, 7, 0),
SND_SOC_DAPM_PGA("Left MicPGA", SND_SOC_NOPM, 0, 0, NULL, 0),
@@ -517,6 +529,8 @@ static const struct snd_soc_dapm_widget aic32x4_dapm_widgets[] = {
in2r_to_lmixer_controls),
SND_SOC_DAPM_MUX("IN3_R to Left Mixer Negative Resistor", SND_SOC_NOPM, 0, 0,
in3r_to_lmixer_controls),
+ SND_SOC_DAPM_MUX("CM2_L to Left Mixer Negative Resistor", SND_SOC_NOPM, 0, 0,
+ cm2l_to_lmixer_controls),
SND_SOC_DAPM_SUPPLY("Mic Bias", AIC32X4_MICBIAS, 6, 0, mic_bias_event,
SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
@@ -610,6 +624,11 @@ static const struct snd_soc_dapm_route aic32x4_dapm_routes[] = {
{"IN3_L to Right Mixer Negative Resistor", "20 kOhm", "IN3_L"},
{"IN3_L to Right Mixer Negative Resistor", "40 kOhm", "IN3_L"},
+ {"Right MicPGA", NULL, "CM2_R to Right Mixer Negative Resistor"},
+ {"CM2_R to Right Mixer Negative Resistor", "10 kOhm", "CM_R"},
+ {"CM2_R to Right Mixer Negative Resistor", "20 kOhm", "CM_R"},
+ {"CM2_R to Right Mixer Negative Resistor", "40 kOhm", "CM_R"},
+
/* Left Input */
{"Left ADC", NULL, "Left MicPGA"},
{"MAL Power", NULL, "Left MicPGA"},
@@ -648,6 +667,11 @@ static const struct snd_soc_dapm_route aic32x4_dapm_routes[] = {
{"IN3_R to Left Mixer Negative Resistor", "10 kOhm", "IN3_R"},
{"IN3_R to Left Mixer Negative Resistor", "20 kOhm", "IN3_R"},
{"IN3_R to Left Mixer Negative Resistor", "40 kOhm", "IN3_R"},
+
+ {"Left MicPGA", NULL, "CM2_L to Left Mixer Negative Resistor"},
+ {"CM2_L to Left Mixer Negative Resistor", "10 kOhm", "CM_L"},
+ {"CM2_L to Left Mixer Negative Resistor", "20 kOhm", "CM_L"},
+ {"CM2_L to Left Mixer Negative Resistor", "40 kOhm", "CM_L"},
};
const struct regmap_range_cfg aic32x4_regmap_pages[] = {
--
2.25.1