* [PATCH 0/4] ASoC: tlv320aic32x4: Complete analog routing, Mixer Amp bypass, and volume controls
@ 2026-11-23 23:40 Gianfranco Mariotti
2026-11-23 23:40 ` [PATCH 1/4] ASoC: tlv320aic32x4: Add missing DAC and driver output mixer routes Gianfranco Mariotti
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Gianfranco Mariotti @ 2026-11-23 23:40 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Shenghao Ding, Kevin Lu, Baojun Xu, Sen Wang
Cc: Jaroslav Kysela, Takashi Iwai, linux-sound, linux-kernel,
Gianfranco Mariotti
The TLV320AIC32x4 driver currently exposes only a subset of the codec's
analog input/output routing switches and omits support for its Left and
Right Mixer Amplifiers (MAL/MAR) and analog bypass volume attenuators.
This series completes the analog DAPM topology and mixer controls per
the TI TLV320AIC3204 Application Reference Guide (SLAA557):
1. Add the missing cross-channel DAC negative terminal switches (L_DAC
to HPR, R_DAC to LOL) and output driver bridging switches (HPL to
HPR, LOR to LOL) used for mono differential headphone and line-out
configurations.
2. Model the Left and Right MicPGAs and Left/Right Mixer Amplifiers
(MAL/MAR, Page 1, Register 9 bits 1:0) in DAPM and wire their routing
switches into the HPL, HPR, LOL, and LOR output mixers for amplified
analog ADC/DAC bypass.
3. Add the non-linear analog bypass attenuation volume controls for
IN1L/IN1R-to-HPL/HPR (Page 1, Registers 22-23) and MAL/MAR (Page 1,
Registers 24-25) using piecewise DECLARE_TLV_DB_RANGE tables.
4. Expose the CM2_L and CM2_R common-mode resistor selections in bits
1:0 of AIC32X4_LMICPGANIN and AIC32X4_RMICPGANIN (Page 1, Registers
54 and 57).
Tested on two TI TLV320AIC3204 boards (one wiring IN1 with LOL/LOR, the
other wiring IN3 with HPL/HPR) across headphone, line-out, capture,
driver bridging, and MicPGA-to-MAL/MAR analog bypass configurations.
Since neither board wires both IN1 and HPL/HPR on the same codec, the
direct IN1-to-HP bypass volume control ('IN1 Bypass Playback Volume')
was verified via alsa-lib TLV dB conversion and live I2C register
readback (Page 1, Registers 22-23) rather than end-to-end analog audio.
Signed-off-by: Gianfranco Mariotti <gianfranco.mariotti94@gmail.com>
Gianfranco Mariotti (4):
ASoC: tlv320aic32x4: Add missing DAC and driver output mixer routes
ASoC: tlv320aic32x4: Add Left and Right Mixer Amplifier DAPM support
ASoC: tlv320aic32x4: Add IN1 and Mixer Amp analog bypass volume
controls
ASoC: tlv320aic32x4: Add CM2_L and CM2_R negative MicPGA input routing
sound/soc/codecs/tlv320aic32x4.c | 117 ++++++++++++++++++++++++++-----
sound/soc/codecs/tlv320aic32x4.h | 4 ++
2 files changed, 107 insertions(+), 14 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/4] ASoC: tlv320aic32x4: Add missing DAC and driver output mixer routes
2026-11-23 23:40 [PATCH 0/4] ASoC: tlv320aic32x4: Complete analog routing, Mixer Amp bypass, and volume controls Gianfranco Mariotti
@ 2026-11-23 23:40 ` Gianfranco Mariotti
2026-11-23 23:40 ` [PATCH 2/4] ASoC: tlv320aic32x4: Add Left and Right Mixer Amplifier DAPM support Gianfranco Mariotti
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Gianfranco Mariotti @ 2026-11-23 23:40 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Shenghao Ding, Kevin Lu, Baojun Xu, Sen Wang
Cc: Jaroslav Kysela, Takashi Iwai, linux-sound, linux-kernel,
Gianfranco Mariotti
The HPR and LOL output routing selection registers (Page 1, Registers 13
and 14) support routing the opposite DAC channel's negative
reconstruction filter terminal as well as bridging the HPL and LOR
output amplifier stages for mono differential configurations:
- AIC32X4_HPRROUTE bit 4: Left DAC negative terminal to HPR
- AIC32X4_HPRROUTE bit 0: HPL output driver to HPR
- AIC32X4_LOLROUTE bit 4: Right DAC negative terminal to LOL
- AIC32X4_LOLROUTE bit 0: LOR output driver to LOL
Add the corresponding DAPM mixer controls and routes, sourcing HPL/LOR
bridging from the HPL Power and LOR Power PGA widgets so the upstream
driver stage is powered when bridged.
Signed-off-by: Gianfranco Mariotti <gianfranco.mariotti94@gmail.com>
---
sound/soc/codecs/tlv320aic32x4.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c
index 875d934bb5c8d..f39856d0b1f19 100644
--- a/sound/soc/codecs/tlv320aic32x4.c
+++ b/sound/soc/codecs/tlv320aic32x4.c
@@ -323,12 +323,16 @@ static const struct snd_kcontrol_new hpl_output_mixer_controls[] = {
};
static const struct snd_kcontrol_new hpr_output_mixer_controls[] = {
+ SOC_DAPM_SINGLE("L_DAC Switch", AIC32X4_HPRROUTE, 4, 1, 0),
SOC_DAPM_SINGLE("R_DAC Switch", AIC32X4_HPRROUTE, 3, 1, 0),
SOC_DAPM_SINGLE("IN1_R Switch", AIC32X4_HPRROUTE, 2, 1, 0),
+ SOC_DAPM_SINGLE("HPL Switch", AIC32X4_HPRROUTE, 0, 1, 0),
};
static const struct snd_kcontrol_new lol_output_mixer_controls[] = {
+ SOC_DAPM_SINGLE("R_DAC Switch", AIC32X4_LOLROUTE, 4, 1, 0),
SOC_DAPM_SINGLE("L_DAC Switch", AIC32X4_LOLROUTE, 3, 1, 0),
+ SOC_DAPM_SINGLE("LOR Switch", AIC32X4_LOLROUTE, 0, 1, 0),
};
static const struct snd_kcontrol_new lor_output_mixer_controls[] = {
@@ -495,14 +499,18 @@ static const struct snd_soc_dapm_route aic32x4_dapm_routes[] = {
{"HPL Power", NULL, "HPL Output Mixer"},
{"HPL", NULL, "HPL Power"},
+ {"LOL Output Mixer", "R_DAC Switch", "Right DAC"},
{"LOL Output Mixer", "L_DAC Switch", "Left DAC"},
+ {"LOL Output Mixer", "LOR Switch", "LOR Power"},
{"LOL Power", NULL, "LOL Output Mixer"},
{"LOL", NULL, "LOL Power"},
/* Right Output */
+ {"HPR Output Mixer", "L_DAC Switch", "Left DAC"},
{"HPR Output Mixer", "R_DAC Switch", "Right DAC"},
{"HPR Output Mixer", "IN1_R Switch", "IN1_R"},
+ {"HPR Output Mixer", "HPL Switch", "HPL Power"},
{"HPR Power", NULL, "HPR Output Mixer"},
{"HPR", NULL, "HPR Power"},
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/4] ASoC: tlv320aic32x4: Add Left and Right Mixer Amplifier DAPM support
2026-11-23 23:40 [PATCH 0/4] ASoC: tlv320aic32x4: Complete analog routing, Mixer Amp bypass, and volume controls Gianfranco Mariotti
2026-11-23 23:40 ` [PATCH 1/4] ASoC: tlv320aic32x4: Add missing DAC and driver output mixer routes Gianfranco Mariotti
@ 2026-11-23 23:40 ` Gianfranco Mariotti
2026-11-23 23:40 ` [PATCH 3/4] ASoC: tlv320aic32x4: Add IN1 and Mixer Amp analog bypass volume controls Gianfranco Mariotti
2026-11-23 23:40 ` [PATCH 4/4] ASoC: tlv320aic32x4: Add CM2_L and CM2_R negative MicPGA input routing Gianfranco Mariotti
3 siblings, 0 replies; 5+ messages in thread
From: Gianfranco Mariotti @ 2026-11-23 23:40 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Shenghao Ding, Kevin Lu, Baojun Xu, Sen Wang
Cc: Jaroslav Kysela, Takashi Iwai, linux-sound, linux-kernel,
Gianfranco Mariotti
The TLV320AIC32x4 features Left and Right Mixer Amplifiers (MAL and MAR,
controlled by AIC32X4_OUTPWRCTL bits 1 and 0) that route amplified
signals from the Left and Right MicPGAs directly to the headphone and
line-out output mixers, bypassing the ADCs and DACs (TI SLAA557, Section
2.2.2 and Figure 2-1):
- AIC32X4_HPLROUTE bit 1 (MAL) and bit 0 (MAR)
- AIC32X4_HPRROUTE bit 1 (MAR)
- AIC32X4_LOLROUTE bit 1 (MAL)
- AIC32X4_LORROUTE bit 1 (MAR)
Insert Left MicPGA and Right MicPGA DAPM PGA widgets between the input
resistor muxes and the ADCs, feed MAL Power and MAR Power from the
respective MicPGAs, and wire the MAL/MAR switches into the HPL, HPR,
LOL, and LOR output mixers.
Signed-off-by: Gianfranco Mariotti <gianfranco.mariotti94@gmail.com>
---
sound/soc/codecs/tlv320aic32x4.c | 48 ++++++++++++++++++++++----------
1 file changed, 34 insertions(+), 14 deletions(-)
diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c
index f39856d0b1f19..9f90e41076992 100644
--- a/sound/soc/codecs/tlv320aic32x4.c
+++ b/sound/soc/codecs/tlv320aic32x4.c
@@ -320,23 +320,28 @@ static const struct snd_kcontrol_new aic32x4_snd_controls[] = {
static const struct snd_kcontrol_new hpl_output_mixer_controls[] = {
SOC_DAPM_SINGLE("L_DAC Switch", AIC32X4_HPLROUTE, 3, 1, 0),
SOC_DAPM_SINGLE("IN1_L Switch", AIC32X4_HPLROUTE, 2, 1, 0),
+ SOC_DAPM_SINGLE("MAL Switch", AIC32X4_HPLROUTE, 1, 1, 0),
+ SOC_DAPM_SINGLE("MAR Switch", AIC32X4_HPLROUTE, 0, 1, 0),
};
static const struct snd_kcontrol_new hpr_output_mixer_controls[] = {
SOC_DAPM_SINGLE("L_DAC Switch", AIC32X4_HPRROUTE, 4, 1, 0),
SOC_DAPM_SINGLE("R_DAC Switch", AIC32X4_HPRROUTE, 3, 1, 0),
SOC_DAPM_SINGLE("IN1_R Switch", AIC32X4_HPRROUTE, 2, 1, 0),
+ SOC_DAPM_SINGLE("MAR Switch", AIC32X4_HPRROUTE, 1, 1, 0),
SOC_DAPM_SINGLE("HPL Switch", AIC32X4_HPRROUTE, 0, 1, 0),
};
static const struct snd_kcontrol_new lol_output_mixer_controls[] = {
SOC_DAPM_SINGLE("R_DAC Switch", AIC32X4_LOLROUTE, 4, 1, 0),
SOC_DAPM_SINGLE("L_DAC Switch", AIC32X4_LOLROUTE, 3, 1, 0),
+ SOC_DAPM_SINGLE("MAL Switch", AIC32X4_LOLROUTE, 1, 1, 0),
SOC_DAPM_SINGLE("LOR Switch", AIC32X4_LOLROUTE, 0, 1, 0),
};
static const struct snd_kcontrol_new lor_output_mixer_controls[] = {
SOC_DAPM_SINGLE("R_DAC Switch", AIC32X4_LORROUTE, 3, 1, 0),
+ SOC_DAPM_SINGLE("MAR Switch", AIC32X4_LORROUTE, 1, 1, 0),
};
static const char * const resistor_text[] = {
@@ -424,6 +429,7 @@ static const struct snd_soc_dapm_widget aic32x4_dapm_widgets[] = {
&hpl_output_mixer_controls[0],
ARRAY_SIZE(hpl_output_mixer_controls)),
SND_SOC_DAPM_PGA("HPL Power", AIC32X4_OUTPWRCTL, 5, 0, NULL, 0),
+ SND_SOC_DAPM_PGA("MAL Power", AIC32X4_OUTPWRCTL, 1, 0, NULL, 0),
SND_SOC_DAPM_MIXER("LOL Output Mixer", SND_SOC_NOPM, 0, 0,
&lol_output_mixer_controls[0],
@@ -435,12 +441,14 @@ static const struct snd_soc_dapm_widget aic32x4_dapm_widgets[] = {
&hpr_output_mixer_controls[0],
ARRAY_SIZE(hpr_output_mixer_controls)),
SND_SOC_DAPM_PGA("HPR Power", AIC32X4_OUTPWRCTL, 4, 0, NULL, 0),
+ SND_SOC_DAPM_PGA("MAR Power", AIC32X4_OUTPWRCTL, 0, 0, NULL, 0),
SND_SOC_DAPM_MIXER("LOR Output Mixer", SND_SOC_NOPM, 0, 0,
&lor_output_mixer_controls[0],
ARRAY_SIZE(lor_output_mixer_controls)),
SND_SOC_DAPM_PGA("LOR Power", AIC32X4_OUTPWRCTL, 2, 0, NULL, 0),
SND_SOC_DAPM_ADC("Right ADC", "Right Capture", AIC32X4_ADCSETUP, 6, 0),
+ SND_SOC_DAPM_PGA("Right MicPGA", SND_SOC_NOPM, 0, 0, NULL, 0),
SND_SOC_DAPM_MUX("IN1_R to Right Mixer Positive Resistor", SND_SOC_NOPM, 0, 0,
in1r_to_rmixer_controls),
SND_SOC_DAPM_MUX("IN2_R to Right Mixer Positive Resistor", SND_SOC_NOPM, 0, 0,
@@ -457,6 +465,7 @@ static const struct snd_soc_dapm_widget aic32x4_dapm_widgets[] = {
in3l_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),
SND_SOC_DAPM_MUX("IN1_L to Left Mixer Positive Resistor", SND_SOC_NOPM, 0, 0,
in1l_to_lmixer_controls),
SND_SOC_DAPM_MUX("IN2_L to Left Mixer Positive Resistor", SND_SOC_NOPM, 0, 0,
@@ -495,12 +504,15 @@ static const struct snd_soc_dapm_route aic32x4_dapm_routes[] = {
/* Left Output */
{"HPL Output Mixer", "L_DAC Switch", "Left DAC"},
{"HPL Output Mixer", "IN1_L Switch", "IN1_L"},
+ {"HPL Output Mixer", "MAL Switch", "MAL Power"},
+ {"HPL Output Mixer", "MAR Switch", "MAR Power"},
{"HPL Power", NULL, "HPL Output Mixer"},
{"HPL", NULL, "HPL Power"},
{"LOL Output Mixer", "R_DAC Switch", "Right DAC"},
{"LOL Output Mixer", "L_DAC Switch", "Left DAC"},
+ {"LOL Output Mixer", "MAL Switch", "MAL Power"},
{"LOL Output Mixer", "LOR Switch", "LOR Power"},
{"LOL Power", NULL, "LOL Output Mixer"},
@@ -510,84 +522,92 @@ static const struct snd_soc_dapm_route aic32x4_dapm_routes[] = {
{"HPR Output Mixer", "L_DAC Switch", "Left DAC"},
{"HPR Output Mixer", "R_DAC Switch", "Right DAC"},
{"HPR Output Mixer", "IN1_R Switch", "IN1_R"},
+ {"HPR Output Mixer", "MAR Switch", "MAR Power"},
{"HPR Output Mixer", "HPL Switch", "HPL Power"},
{"HPR Power", NULL, "HPR Output Mixer"},
{"HPR", NULL, "HPR Power"},
{"LOR Output Mixer", "R_DAC Switch", "Right DAC"},
+ {"LOR Output Mixer", "MAR Switch", "MAR Power"},
{"LOR Power", NULL, "LOR Output Mixer"},
{"LOR", NULL, "LOR Power"},
/* Right Input */
- {"Right ADC", NULL, "IN1_R to Right Mixer Positive Resistor"},
+ {"Right ADC", NULL, "Right MicPGA"},
+ {"MAR Power", NULL, "Right MicPGA"},
+
+ {"Right MicPGA", NULL, "IN1_R to Right Mixer Positive Resistor"},
{"IN1_R to Right Mixer Positive Resistor", "10 kOhm", "IN1_R"},
{"IN1_R to Right Mixer Positive Resistor", "20 kOhm", "IN1_R"},
{"IN1_R to Right Mixer Positive Resistor", "40 kOhm", "IN1_R"},
- {"Right ADC", NULL, "IN2_R to Right Mixer Positive Resistor"},
+ {"Right MicPGA", NULL, "IN2_R to Right Mixer Positive Resistor"},
{"IN2_R to Right Mixer Positive Resistor", "10 kOhm", "IN2_R"},
{"IN2_R to Right Mixer Positive Resistor", "20 kOhm", "IN2_R"},
{"IN2_R to Right Mixer Positive Resistor", "40 kOhm", "IN2_R"},
- {"Right ADC", NULL, "IN3_R to Right Mixer Positive Resistor"},
+ {"Right MicPGA", NULL, "IN3_R to Right Mixer Positive Resistor"},
{"IN3_R to Right Mixer Positive Resistor", "10 kOhm", "IN3_R"},
{"IN3_R to Right Mixer Positive Resistor", "20 kOhm", "IN3_R"},
{"IN3_R to Right Mixer Positive Resistor", "40 kOhm", "IN3_R"},
- {"Right ADC", NULL, "IN2_L to Right Mixer Positive Resistor"},
+ {"Right MicPGA", NULL, "IN2_L to Right Mixer Positive Resistor"},
{"IN2_L to Right Mixer Positive Resistor", "10 kOhm", "IN2_L"},
{"IN2_L to Right Mixer Positive Resistor", "20 kOhm", "IN2_L"},
{"IN2_L to Right Mixer Positive Resistor", "40 kOhm", "IN2_L"},
- {"Right ADC", NULL, "CM_R to Right Mixer Negative Resistor"},
+ {"Right MicPGA", NULL, "CM_R to Right Mixer Negative Resistor"},
{"CM_R to Right Mixer Negative Resistor", "10 kOhm", "CM_R"},
{"CM_R to Right Mixer Negative Resistor", "20 kOhm", "CM_R"},
{"CM_R to Right Mixer Negative Resistor", "40 kOhm", "CM_R"},
- {"Right ADC", NULL, "IN1_L to Right Mixer Negative Resistor"},
+ {"Right MicPGA", NULL, "IN1_L to Right Mixer Negative Resistor"},
{"IN1_L to Right Mixer Negative Resistor", "10 kOhm", "IN1_L"},
{"IN1_L to Right Mixer Negative Resistor", "20 kOhm", "IN1_L"},
{"IN1_L to Right Mixer Negative Resistor", "40 kOhm", "IN1_L"},
- {"Right ADC", NULL, "IN3_L to Right Mixer Negative Resistor"},
+ {"Right MicPGA", NULL, "IN3_L to Right Mixer Negative Resistor"},
{"IN3_L to Right Mixer Negative Resistor", "10 kOhm", "IN3_L"},
{"IN3_L to Right Mixer Negative Resistor", "20 kOhm", "IN3_L"},
{"IN3_L to Right Mixer Negative Resistor", "40 kOhm", "IN3_L"},
/* Left Input */
- {"Left ADC", NULL, "IN1_L to Left Mixer Positive Resistor"},
+ {"Left ADC", NULL, "Left MicPGA"},
+ {"MAL Power", NULL, "Left MicPGA"},
+
+ {"Left MicPGA", NULL, "IN1_L to Left Mixer Positive Resistor"},
{"IN1_L to Left Mixer Positive Resistor", "10 kOhm", "IN1_L"},
{"IN1_L to Left Mixer Positive Resistor", "20 kOhm", "IN1_L"},
{"IN1_L to Left Mixer Positive Resistor", "40 kOhm", "IN1_L"},
- {"Left ADC", NULL, "IN2_L to Left Mixer Positive Resistor"},
+ {"Left MicPGA", NULL, "IN2_L to Left Mixer Positive Resistor"},
{"IN2_L to Left Mixer Positive Resistor", "10 kOhm", "IN2_L"},
{"IN2_L to Left Mixer Positive Resistor", "20 kOhm", "IN2_L"},
{"IN2_L to Left Mixer Positive Resistor", "40 kOhm", "IN2_L"},
- {"Left ADC", NULL, "IN3_L to Left Mixer Positive Resistor"},
+ {"Left MicPGA", NULL, "IN3_L to Left Mixer Positive Resistor"},
{"IN3_L to Left Mixer Positive Resistor", "10 kOhm", "IN3_L"},
{"IN3_L to Left Mixer Positive Resistor", "20 kOhm", "IN3_L"},
{"IN3_L to Left Mixer Positive Resistor", "40 kOhm", "IN3_L"},
- {"Left ADC", NULL, "IN1_R to Left Mixer Positive Resistor"},
+ {"Left MicPGA", NULL, "IN1_R to Left Mixer Positive Resistor"},
{"IN1_R to Left Mixer Positive Resistor", "10 kOhm", "IN1_R"},
{"IN1_R to Left Mixer Positive Resistor", "20 kOhm", "IN1_R"},
{"IN1_R to Left Mixer Positive Resistor", "40 kOhm", "IN1_R"},
- {"Left ADC", NULL, "CM_L to Left Mixer Negative Resistor"},
+ {"Left MicPGA", NULL, "CM_L to Left Mixer Negative Resistor"},
{"CM_L to Left Mixer Negative Resistor", "10 kOhm", "CM_L"},
{"CM_L to Left Mixer Negative Resistor", "20 kOhm", "CM_L"},
{"CM_L to Left Mixer Negative Resistor", "40 kOhm", "CM_L"},
- {"Left ADC", NULL, "IN2_R to Left Mixer Negative Resistor"},
+ {"Left MicPGA", NULL, "IN2_R to Left Mixer Negative Resistor"},
{"IN2_R to Left Mixer Negative Resistor", "10 kOhm", "IN2_R"},
{"IN2_R to Left Mixer Negative Resistor", "20 kOhm", "IN2_R"},
{"IN2_R to Left Mixer Negative Resistor", "40 kOhm", "IN2_R"},
- {"Left ADC", NULL, "IN3_R to Left Mixer Negative Resistor"},
+ {"Left MicPGA", NULL, "IN3_R to Left Mixer Negative Resistor"},
{"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"},
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/4] ASoC: tlv320aic32x4: Add IN1 and Mixer Amp analog bypass volume controls
2026-11-23 23:40 [PATCH 0/4] ASoC: tlv320aic32x4: Complete analog routing, Mixer Amp bypass, and volume controls Gianfranco Mariotti
2026-11-23 23:40 ` [PATCH 1/4] ASoC: tlv320aic32x4: Add missing DAC and driver output mixer routes Gianfranco Mariotti
2026-11-23 23:40 ` [PATCH 2/4] ASoC: tlv320aic32x4: Add Left and Right Mixer Amplifier DAPM support Gianfranco Mariotti
@ 2026-11-23 23:40 ` Gianfranco Mariotti
2026-11-23 23:40 ` [PATCH 4/4] ASoC: tlv320aic32x4: Add CM2_L and CM2_R negative MicPGA input routing Gianfranco Mariotti
3 siblings, 0 replies; 5+ messages in thread
From: Gianfranco Mariotti @ 2026-11-23 23:40 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Shenghao Ding, Kevin Lu, Baojun Xu, Sen Wang
Cc: Jaroslav Kysela, Takashi Iwai, linux-sound, linux-kernel,
Gianfranco Mariotti
The TLV320AIC32x4 provides analog bypass attenuators for both the direct
IN1L/IN1R-to-HPL/HPR bypass path (Page 1, Registers 22 and 23) and the
Left/Right Mixer Amplifier (MAL/MAR) path (Page 1, Registers 24 and 25):
- AIC32X4_IN1L2HPLVOL / AIC32X4_IN1R2HPRVOL: 0.0 dB (0x00) down to
-72.3 dB (0x74) and MUTE (0x75)
- AIC32X4_MALVOL / AIC32X4_MARVOL: 0.0 dB (0x00) down to -30.1 dB (0x27)
and MUTE (0x28)
Add the register definitions, piecewise DECLARE_TLV_DB_RANGE tables
approximating the non-linear TI SLAA557 curve within 0.1 dB while
staying under alsa-lib's 256-byte MAX_TLV_RANGE_SIZE limit, and the
corresponding Bypass Playback Volume controls.
Signed-off-by: Gianfranco Mariotti <gianfranco.mariotti94@gmail.com>
---
Note: Of the two TLV320AIC3204 boards used for testing, one wires IN1
with Line-Out (LOL/LOR) and the other wires IN3 with Headphone
(HPL/HPR). Since neither board wires both IN1 and HPL/HPR on the same
codec, 'IN1 Bypass Playback Volume' was verified via alsa-lib TLV dB
conversion and live I2C register readback (Page 1, Registers 22-23)
rather than end-to-end analog audio.
sound/soc/codecs/tlv320aic32x4.c | 37 ++++++++++++++++++++++++++++++++
sound/soc/codecs/tlv320aic32x4.h | 4 ++++
2 files changed, 41 insertions(+)
diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c
index 9f90e41076992..80ff52c6bbbe1 100644
--- a/sound/soc/codecs/tlv320aic32x4.c
+++ b/sound/soc/codecs/tlv320aic32x4.c
@@ -264,6 +264,39 @@ static DECLARE_TLV_DB_SCALE(tlv_adc_vol, -1200, 50, 0);
static DECLARE_TLV_DB_SCALE(tlv_tas_driver_gain, -5850, 50, 0);
static DECLARE_TLV_DB_SCALE(tlv_amp_vol, 0, 600, 1);
+/*
+ * IN1L/IN1R to HPL/HPR bypass attenuation (Page 1, Reg 22-23, inverted).
+ * Kept within alsa-lib MAX_TLV_RANGE_SIZE (256 bytes, max 10 items).
+ */
+static const DECLARE_TLV_DB_RANGE(tlv_in1_hp_vol,
+ 0, 0, TLV_DB_SCALE_ITEM(TLV_DB_GAIN_MUTE, 0, 1),
+ 1, 2, TLV_DB_SCALE_ITEM(-7230, 360, 0),
+ 3, 5, TLV_DB_SCALE_ITEM(-6612, 174, 0),
+ 6, 7, TLV_DB_SCALE_ITEM(-6020, 190, 0),
+ 8, 10, TLV_DB_SCALE_ITEM(-5667, 124, 0),
+ 11, 12, TLV_DB_SCALE_ITEM(-5370, 100, 0),
+ 13, 18, TLV_DB_SCALE_ITEM(-5240, 50, 0),
+ 19, 23, TLV_DB_SCALE_ITEM(-4921, 46, 0),
+ 24, 47, TLV_DB_SCALE_ITEM(-4670, 50, 0),
+ 48, 117, TLV_DB_SCALE_ITEM(-3450, 50, 0)
+);
+
+/*
+ * MAL/MAR Mixer Amplifier attenuation (Page 1, Reg 24-25, inverted).
+ * Kept within alsa-lib MAX_TLV_RANGE_SIZE (256 bytes, max 10 items).
+ */
+static const DECLARE_TLV_DB_RANGE(tlv_ma_vol,
+ 0, 0, TLV_DB_SCALE_ITEM(TLV_DB_GAIN_MUTE, 0, 1),
+ 1, 2, TLV_DB_SCALE_ITEM(-3010, 350, 0),
+ 3, 4, TLV_DB_SCALE_ITEM(-2410, 200, 0),
+ 5, 8, TLV_DB_SCALE_ITEM(-2050, 120, 0),
+ 9, 13, TLV_DB_SCALE_ITEM(-1602, 72, 0),
+ 14, 21, TLV_DB_SCALE_ITEM(-1251, 47, 0),
+ 22, 24, TLV_DB_SCALE_ITEM(-851, 34, 0),
+ 25, 34, TLV_DB_SCALE_ITEM(-715, 47, 0),
+ 35, 40, TLV_DB_SCALE_ITEM(-225, 45, 0)
+);
+
static const char * const lo_cm_text[] = {
"Full Chip", "1.65V",
};
@@ -291,6 +324,10 @@ static const struct snd_kcontrol_new aic32x4_snd_controls[] = {
SOC_DOUBLE_R("LO DAC Playback Switch", AIC32X4_LOLGAIN,
AIC32X4_LORGAIN, 6, 0x01, 1),
SOC_ENUM("LO Playback Common Mode Switch", lo_cm_enum),
+ SOC_DOUBLE_R_TLV("IN1 Bypass Playback Volume", AIC32X4_IN1L2HPLVOL,
+ AIC32X4_IN1R2HPRVOL, 0, 0x75, 1, tlv_in1_hp_vol),
+ SOC_DOUBLE_R_TLV("Mixer Amp Bypass Playback Volume", AIC32X4_MALVOL,
+ AIC32X4_MARVOL, 0, 0x28, 1, tlv_ma_vol),
SOC_DOUBLE_R("Mic PGA Switch", AIC32X4_LMICPGAVOL,
AIC32X4_RMICPGAVOL, 7, 0x01, 1),
diff --git a/sound/soc/codecs/tlv320aic32x4.h b/sound/soc/codecs/tlv320aic32x4.h
index d0c2e1002e99e..70ea13198002d 100644
--- a/sound/soc/codecs/tlv320aic32x4.h
+++ b/sound/soc/codecs/tlv320aic32x4.h
@@ -95,6 +95,10 @@ int aic32x4_register_clocks(struct device *dev, const char *mclk_name);
#define AIC32X4_LORGAIN AIC32X4_REG(1, 19)
#define AIC32X4_HEADSTART AIC32X4_REG(1, 20)
#define TAS2505_HPVOL AIC32X4_REG(1, 22)
+#define AIC32X4_IN1L2HPLVOL AIC32X4_REG(1, 22)
+#define AIC32X4_IN1R2HPRVOL AIC32X4_REG(1, 23)
+#define AIC32X4_MALVOL AIC32X4_REG(1, 24)
+#define AIC32X4_MARVOL AIC32X4_REG(1, 25)
#define TAS2505_SPK AIC32X4_REG(1, 45)
#define TAS2505_SPKVOL1 AIC32X4_REG(1, 46)
#define TAS2505_SPKVOL2 AIC32X4_REG(1, 48)
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 4/4] ASoC: tlv320aic32x4: Add CM2_L and CM2_R negative MicPGA input routing
2026-11-23 23:40 [PATCH 0/4] ASoC: tlv320aic32x4: Complete analog routing, Mixer Amp bypass, and volume controls Gianfranco Mariotti
` (2 preceding siblings ...)
2026-11-23 23:40 ` [PATCH 3/4] ASoC: tlv320aic32x4: Add IN1 and Mixer Amp analog bypass volume controls Gianfranco Mariotti
@ 2026-11-23 23:40 ` Gianfranco Mariotti
3 siblings, 0 replies; 5+ messages in thread
From: Gianfranco Mariotti @ 2026-11-23 23:40 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Shenghao Ding, Kevin Lu, Baojun Xu, Sen Wang
Cc: Jaroslav Kysela, Takashi Iwai, linux-sound, linux-kernel,
Gianfranco Mariotti
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@gmail.com>
---
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-23 23:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-23 23:40 [PATCH 0/4] ASoC: tlv320aic32x4: Complete analog routing, Mixer Amp bypass, and volume controls Gianfranco Mariotti
2026-11-23 23:40 ` [PATCH 1/4] ASoC: tlv320aic32x4: Add missing DAC and driver output mixer routes Gianfranco Mariotti
2026-11-23 23:40 ` [PATCH 2/4] ASoC: tlv320aic32x4: Add Left and Right Mixer Amplifier DAPM support Gianfranco Mariotti
2026-11-23 23:40 ` [PATCH 3/4] ASoC: tlv320aic32x4: Add IN1 and Mixer Amp analog bypass volume controls Gianfranco Mariotti
2026-11-23 23:40 ` [PATCH 4/4] ASoC: tlv320aic32x4: Add CM2_L and CM2_R negative MicPGA input routing Gianfranco Mariotti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®