Commit 1f1e60c9 authored by Zidan Wang's avatar Zidan Wang Committed by Mark Brown

ASoC: cs42xx8: fix the noise in the right dac channel with mono playback

When playback mono wav with record in background, there will be some
nosie in the right dac channel. It seems that the ADC data has been
routed to the dac channel.

The cs42888 have 8 dac channels, it's appropriate to mute the unused
dac channels, and the noise will disappear.

Steps to reproduce this issue:
arecord -D hw:0,0 -f S16_LE -r 48000 -c 1 a.wav &
aplay -Dhw:0,0 audio48k16M.wav
Signed-off-by: default avatarZidan Wang <zidan.wang@freescale.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 92e963f5
...@@ -44,6 +44,7 @@ struct cs42xx8_priv { ...@@ -44,6 +44,7 @@ struct cs42xx8_priv {
bool slave_mode; bool slave_mode;
unsigned long sysclk; unsigned long sysclk;
u32 tx_channels;
}; };
/* -127.5dB to 0dB with step of 0.5dB */ /* -127.5dB to 0dB with step of 0.5dB */
...@@ -257,6 +258,9 @@ static int cs42xx8_hw_params(struct snd_pcm_substream *substream, ...@@ -257,6 +258,9 @@ static int cs42xx8_hw_params(struct snd_pcm_substream *substream,
u32 ratio = cs42xx8->sysclk / params_rate(params); u32 ratio = cs42xx8->sysclk / params_rate(params);
u32 i, fm, val, mask; u32 i, fm, val, mask;
if (tx)
cs42xx8->tx_channels = params_channels(params);
for (i = 0; i < ARRAY_SIZE(cs42xx8_ratios); i++) { for (i = 0; i < ARRAY_SIZE(cs42xx8_ratios); i++) {
if (cs42xx8_ratios[i].ratio == ratio) if (cs42xx8_ratios[i].ratio == ratio)
break; break;
...@@ -283,9 +287,11 @@ static int cs42xx8_digital_mute(struct snd_soc_dai *dai, int mute) ...@@ -283,9 +287,11 @@ static int cs42xx8_digital_mute(struct snd_soc_dai *dai, int mute)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_codec *codec = dai->codec;
struct cs42xx8_priv *cs42xx8 = snd_soc_codec_get_drvdata(codec); struct cs42xx8_priv *cs42xx8 = snd_soc_codec_get_drvdata(codec);
u8 dac_unmute = cs42xx8->tx_channels ?
~((0x1 << cs42xx8->tx_channels) - 1) : 0;
regmap_update_bits(cs42xx8->regmap, CS42XX8_DACMUTE, regmap_write(cs42xx8->regmap, CS42XX8_DACMUTE,
CS42XX8_DACMUTE_ALL, mute ? CS42XX8_DACMUTE_ALL : 0); mute ? CS42XX8_DACMUTE_ALL : dac_unmute);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment