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>

authored by Markus Pargmann and committed by Mark Brown b44aa40f 7552f34a

+12 -7
+11 -7
sound/soc/codecs/tlv320aic32x4.c
··· 450 } 451 snd_soc_write(codec, AIC32X4_IFACE1, data); 452 453 return 0; 454 } 455 ··· 616 tmp_reg |= AIC32X4_LDOIN2HP; 617 } 618 snd_soc_write(codec, AIC32X4_CMMODE, tmp_reg); 619 - 620 - /* Do DACs need to be swapped? */ 621 - if (aic32x4->swapdacs) { 622 - snd_soc_write(codec, AIC32X4_DACSETUP, AIC32X4_LDAC2RCHN | AIC32X4_RDAC2LCHN); 623 - } else { 624 - snd_soc_write(codec, AIC32X4_DACSETUP, AIC32X4_LDAC2LCHN | AIC32X4_RDAC2RCHN); 625 - } 626 627 /* Mic PGA routing */ 628 if (aic32x4->micpga_routing & AIC32X4_MICPGA_ROUTE_LMIC_IN2R_10K) {
··· 450 } 451 snd_soc_write(codec, AIC32X4_IFACE1, data); 452 453 + if (params_channels(params) == 1) { 454 + data = AIC32X4_RDAC2LCHN | AIC32X4_LDAC2LCHN; 455 + } else { 456 + if (aic32x4->swapdacs) 457 + data = AIC32X4_RDAC2LCHN | AIC32X4_LDAC2RCHN; 458 + else 459 + data = AIC32X4_LDAC2LCHN | AIC32X4_RDAC2RCHN; 460 + } 461 + snd_soc_update_bits(codec, AIC32X4_DACSETUP, AIC32X4_DAC_CHAN_MASK, 462 + data); 463 + 464 return 0; 465 } 466 ··· 605 tmp_reg |= AIC32X4_LDOIN2HP; 606 } 607 snd_soc_write(codec, AIC32X4_CMMODE, tmp_reg); 608 609 /* Mic PGA routing */ 610 if (aic32x4->micpga_routing & AIC32X4_MICPGA_ROUTE_LMIC_IN2R_10K) {
+1
sound/soc/codecs/tlv320aic32x4.h
··· 138 #define AIC32X4_LDAC2RCHN (0x02 << 4) 139 #define AIC32X4_LDAC2LCHN (0x01 << 4) 140 #define AIC32X4_RDAC2RCHN (0x01 << 2) 141 142 #define AIC32X4_SSTEP2WCLK 0x01 143 #define AIC32X4_MUTEON 0x0C
··· 138 #define AIC32X4_LDAC2RCHN (0x02 << 4) 139 #define AIC32X4_LDAC2LCHN (0x01 << 4) 140 #define AIC32X4_RDAC2RCHN (0x01 << 2) 141 + #define AIC32X4_DAC_CHAN_MASK 0x3c 142 143 #define AIC32X4_SSTEP2WCLK 0x01 144 #define AIC32X4_MUTEON 0x0C