浏览代码

ASoC: tlv320aic32x4: Fix mono playback

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.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
Markus Pargmann 11 年之前
父节点
当前提交
b44aa40f87
共有 2 个文件被更改,包括 12 次插入7 次删除
  1. 11 7
      sound/soc/codecs/tlv320aic32x4.c
  2. 1 0
      sound/soc/codecs/tlv320aic32x4.h

+ 11 - 7
sound/soc/codecs/tlv320aic32x4.c

@@ -450,6 +450,17 @@ static int aic32x4_hw_params(struct snd_pcm_substream *substream,
 	}
 	}
 	snd_soc_write(codec, AIC32X4_IFACE1, data);
 	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;
 	return 0;
 }
 }
 
 
@@ -606,13 +617,6 @@ static int aic32x4_probe(struct snd_soc_codec *codec)
 	}
 	}
 	snd_soc_write(codec, AIC32X4_CMMODE, tmp_reg);
 	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 */
 	/* 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);
 		snd_soc_write(codec, AIC32X4_LMICPGANIN, AIC32X4_LMICPGANIN_IN2R_10K);

+ 1 - 0
sound/soc/codecs/tlv320aic32x4.h

@@ -138,6 +138,7 @@
 #define AIC32X4_LDAC2RCHN		(0x02 << 4)
 #define AIC32X4_LDAC2RCHN		(0x02 << 4)
 #define AIC32X4_LDAC2LCHN		(0x01 << 4)
 #define AIC32X4_LDAC2LCHN		(0x01 << 4)
 #define AIC32X4_RDAC2RCHN		(0x01 << 2)
 #define AIC32X4_RDAC2RCHN		(0x01 << 2)
+#define AIC32X4_DAC_CHAN_MASK		0x3c
 
 
 #define AIC32X4_SSTEP2WCLK		0x01
 #define AIC32X4_SSTEP2WCLK		0x01
 #define AIC32X4_MUTEON			0x0C
 #define AIC32X4_MUTEON			0x0C