Skip to contentSkip to conversation

ASoC: tlv320aic32x4 bugfixes

PATCH Applied Markus Pargmann 2 participants 5 messages Jan 15, 2014

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

cover ASoC: tlv320aic32x4 bugfixes

Hi,

Another round of tlv320aic32x4 bugfixes.

I will send some more non-bugfix patches for this codec next week including the DT compatibles we talked about.

Regards,

Markus

Markus Pargmann (3):
ASoC: tlv320aic32x4: Fix regmap range_min
ASoC: tlv320aic32x4: Fix mono playback
ASoC: tlv320aic32x4: Fix MICPGA input configuration

 sound/soc/codecs/tlv320aic32x4.c | 30 ++++++++++++++++++------------
 sound/soc/codecs/tlv320aic32x4.h |  3 +++
 2 files changed, 21 insertions(+), 12 deletions(-)
Signature · 1 line
1.8.5.2
#1 lore raw

PATCH 1/3 ASoC: tlv320aic32x4: Fix regmap range_min

range_min is the lowest address in the virtual register range. This is the first register with address 0, not the first register of page 1.

Currently all writes to page 1 are mapped to page 0, so the codec fails to operate.

---
 sound/soc/codecs/tlv320aic32x4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/tlv320aic32x4.c +1 -1
index 6941fa9..385dec1 100644
@@ -267,7 +267,7 @@ static const struct regmap_range_cfg aic32x4_regmap_pages[] = {
 		.selector_mask  = 0xff,
 		.window_start = 0,
 		.window_len = 128,
-		.range_min = AIC32X4_PAGE1,
+		.range_min = 0,
 		.range_max = AIC32X4_RMICPGAVOL,
 	},
 };
Signature · 1 line
1.8.5.2
maintainer Applied
#2 lore raw

Re: [PATCH 1/3] ASoC: tlv320aic32x4: Fix regmap range_min

Quoted 2 lines · Markus Pargmann

range_min is the lowest address in the virtual register range. This is the first register with address 0, not the first register of page 1.

Applied, thanks.

#3 lore raw

PATCH 2/3 ASoC: tlv320aic32x4: Fix mono playback

In reply to Markus Pargmann

Playback of a mono stream should output the same stream on both channels. At the moment only the left analog signal is valid, the right one is just noise.

This patch maps the left digital channel onto both DACs when receiving a mono stream.

---
 sound/soc/codecs/tlv320aic32x4.c | 18 +++++++++++-------
 sound/soc/codecs/tlv320aic32x4.h |  1 +
 2 files changed, 12 insertions(+), 7 deletions(-)
sound/soc/codecs/tlv320aic32x4.c +11 -7
index 385dec1..ee9ad05 100644
@@ -450,6 +450,17 @@ static int aic32x4_hw_params(struct snd_pcm_substream *substream,
 	}
 	snd_soc_write(codec, AIC32X4_IFACE1, data);
 
+	if (params_channels(params) == 1) {
+		data = AIC32X4_RDAC2LCHN | AIC32X4_LDAC2LCHN;
+	} else {
+		if (aic32x4->swapdacs)
+			data = AIC32X4_RDAC2LCHN | AIC32X4_LDAC2RCHN;
+		else
+			data = AIC32X4_LDAC2LCHN | AIC32X4_RDAC2RCHN;
+	}
+	snd_soc_update_bits(codec, AIC32X4_DACSETUP, AIC32X4_DAC_CHAN_MASK,
+			data);
+
 	return 0;
 }
 
@@ -606,13 +617,6 @@ static int aic32x4_probe(struct snd_soc_codec *codec)
 	}
 	snd_soc_write(codec, AIC32X4_CMMODE, tmp_reg);
 
-	/* Do DACs need to be swapped? */
-	if (aic32x4->swapdacs) {
-		snd_soc_write(codec, AIC32X4_DACSETUP, AIC32X4_LDAC2RCHN | AIC32X4_RDAC2LCHN);
-	} else {
-		snd_soc_write(codec, AIC32X4_DACSETUP, AIC32X4_LDAC2LCHN | AIC32X4_RDAC2RCHN);
-	}
-
 	/* Mic PGA routing */
 	if (aic32x4->micpga_routing & AIC32X4_MICPGA_ROUTE_LMIC_IN2R_10K) {
 		snd_soc_write(codec, AIC32X4_LMICPGANIN, AIC32X4_LMICPGANIN_IN2R_10K);
sound/soc/codecs/tlv320aic32x4.h +1 -0
index 3577422..83795af 100644
@@ -138,6 +138,7 @@
 #define AIC32X4_LDAC2RCHN		(0x02 << 4)
 #define AIC32X4_LDAC2LCHN		(0x01 << 4)
 #define AIC32X4_RDAC2RCHN		(0x01 << 2)
+#define AIC32X4_DAC_CHAN_MASK		0x3c
 
 #define AIC32X4_SSTEP2WCLK		0x01
 #define AIC32X4_MUTEON			0x0C
Signature · 1 line
1.8.5.2
#4 lore raw

PATCH 3/3 ASoC: tlv320aic32x4: Fix MICPGA input configuration

In reply to Markus Pargmann

Currently the Negative Terminal Input Routing Configuration is only set when there is a special routing configuration. If we don't use one of the inputs IN1 or IN2 as negative terminal input, the PGA and recording does not work.

This patch adds a route from CM1L/CM1R to the PGA as negative input by default. With this configuration the PGA can amplify all input signals and line-in/mic works again.

---
 sound/soc/codecs/tlv320aic32x4.c | 10 ++++++----
 sound/soc/codecs/tlv320aic32x4.h |  2 ++
 2 files changed, 8 insertions(+), 4 deletions(-)
sound/soc/codecs/tlv320aic32x4.c +6 -4
index ee9ad05..688151b 100644
@@ -618,12 +618,14 @@ static int aic32x4_probe(struct snd_soc_codec *codec)
 	snd_soc_write(codec, AIC32X4_CMMODE, tmp_reg);
 
 	/* Mic PGA routing */
-	if (aic32x4->micpga_routing & AIC32X4_MICPGA_ROUTE_LMIC_IN2R_10K) {
+	if (aic32x4->micpga_routing & AIC32X4_MICPGA_ROUTE_LMIC_IN2R_10K)
 		snd_soc_write(codec, AIC32X4_LMICPGANIN, AIC32X4_LMICPGANIN_IN2R_10K);
-	}
-	if (aic32x4->micpga_routing & AIC32X4_MICPGA_ROUTE_RMIC_IN1L_10K) {
+	else
+		snd_soc_write(codec, AIC32X4_LMICPGANIN, AIC32X4_LMICPGANIN_CM1L_10K);
+	if (aic32x4->micpga_routing & AIC32X4_MICPGA_ROUTE_RMIC_IN1L_10K)
 		snd_soc_write(codec, AIC32X4_RMICPGANIN, AIC32X4_RMICPGANIN_IN1L_10K);
-	}
+	else
+		snd_soc_write(codec, AIC32X4_RMICPGANIN, AIC32X4_RMICPGANIN_CM1R_10K);
 
 	aic32x4_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
 
sound/soc/codecs/tlv320aic32x4.h +2 -0
index 83795af..995f033 100644
@@ -120,7 +120,9 @@
 #define AIC32X4_MICBIAS_2075V		0x60
 
 #define AIC32X4_LMICPGANIN_IN2R_10K	0x10
+#define AIC32X4_LMICPGANIN_CM1L_10K	0x40
 #define AIC32X4_RMICPGANIN_IN1L_10K	0x10
+#define AIC32X4_RMICPGANIN_CM1R_10K	0x40
 
 #define AIC32X4_LMICPGAVOL_NOGAIN	0x80
 #define AIC32X4_RMICPGAVOL_NOGAIN	0x80
Signature · 1 line
1.8.5.2