[alsa-devel] [PATCH] ASoC: zx-i2s: fix harsh noise with 16-bit audio
From: Shawn Guo shawn.guo@linaro.org
The audio parameter setup in zx_i2s_hw_params() works fine with 32-bit samples, but for 16-bit ones, all we can hear is harsh noises. As suggested by vendor driver code, DMA burst size and TS width should always be 32 bits, no matter audio sample is 16-bit or 32-bit.
Follow the suggestion above to fix the harsh noise issue seen with 16-bit audio samples.
Signed-off-by: Shawn Guo shawn.guo@linaro.org --- sound/soc/zte/zx-i2s.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sound/soc/zte/zx-i2s.c b/sound/soc/zte/zx-i2s.c index a865f37c2a56..a7f7a56e0a2d 100644 --- a/sound/soc/zte/zx-i2s.c +++ b/sound/soc/zte/zx-i2s.c @@ -226,11 +226,12 @@ static int zx_i2s_hw_params(struct snd_pcm_substream *substream, struct zx_i2s_info *i2s = snd_soc_dai_get_drvdata(socdai); struct snd_dmaengine_dai_dma_data *dma_data; unsigned int lane, ch_num, len, ret = 0; + unsigned int ts_width = 32; unsigned long val; unsigned long chn_cfg;
dma_data = snd_soc_dai_get_dma_data(socdai, substream); - dma_data->addr_width = params_width(params) >> 3; + dma_data->addr_width = ts_width >> 3;
val = readl_relaxed(i2s->reg_base + ZX_I2S_TIMING_CTRL); val &= ~(ZX_I2S_TIMING_TS_WIDTH_MASK | ZX_I2S_TIMING_DATA_SIZE_MASK | @@ -251,7 +252,7 @@ static int zx_i2s_hw_params(struct snd_pcm_substream *substream, dev_err(socdai->dev, "Unknown data format\n"); return -EINVAL; } - val |= ZX_I2S_TIMING_TS_WIDTH(len) | ZX_I2S_TIMING_DATA_SIZE(len); + val |= ZX_I2S_TIMING_TS_WIDTH(ts_width) | ZX_I2S_TIMING_DATA_SIZE(len);
ch_num = params_channels(params); switch (ch_num) {
The patch
ASoC: zx-i2s: fix harsh noise with 16-bit audio
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From 6a9a440681f2170b9a07b1cf28c6aa7532c307c8 Mon Sep 17 00:00:00 2001
From: Shawn Guo shawn.guo@linaro.org Date: Sat, 27 May 2017 15:50:44 +0800 Subject: [PATCH] ASoC: zx-i2s: fix harsh noise with 16-bit audio
The audio parameter setup in zx_i2s_hw_params() works fine with 32-bit samples, but for 16-bit ones, all we can hear is harsh noises. As suggested by vendor driver code, DMA burst size and TS width should always be 32 bits, no matter audio sample is 16-bit or 32-bit.
Follow the suggestion above to fix the harsh noise issue seen with 16-bit audio samples.
Signed-off-by: Shawn Guo shawn.guo@linaro.org Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/zte/zx-i2s.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sound/soc/zte/zx-i2s.c b/sound/soc/zte/zx-i2s.c index a865f37c2a56..a7f7a56e0a2d 100644 --- a/sound/soc/zte/zx-i2s.c +++ b/sound/soc/zte/zx-i2s.c @@ -226,11 +226,12 @@ static int zx_i2s_hw_params(struct snd_pcm_substream *substream, struct zx_i2s_info *i2s = snd_soc_dai_get_drvdata(socdai); struct snd_dmaengine_dai_dma_data *dma_data; unsigned int lane, ch_num, len, ret = 0; + unsigned int ts_width = 32; unsigned long val; unsigned long chn_cfg;
dma_data = snd_soc_dai_get_dma_data(socdai, substream); - dma_data->addr_width = params_width(params) >> 3; + dma_data->addr_width = ts_width >> 3;
val = readl_relaxed(i2s->reg_base + ZX_I2S_TIMING_CTRL); val &= ~(ZX_I2S_TIMING_TS_WIDTH_MASK | ZX_I2S_TIMING_DATA_SIZE_MASK | @@ -251,7 +252,7 @@ static int zx_i2s_hw_params(struct snd_pcm_substream *substream, dev_err(socdai->dev, "Unknown data format\n"); return -EINVAL; } - val |= ZX_I2S_TIMING_TS_WIDTH(len) | ZX_I2S_TIMING_DATA_SIZE(len); + val |= ZX_I2S_TIMING_TS_WIDTH(ts_width) | ZX_I2S_TIMING_DATA_SIZE(len);
ch_num = params_channels(params); switch (ch_num) {
participants (2)
-
Mark Brown
-
Shawn Guo