summaryrefslogtreecommitdiffstats
path: root/sound/soc/zte
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2017-05-27 03:50:44 -0400
committerMark Brown <broonie@kernel.org>2017-05-29 09:17:17 -0400
commit6a9a440681f2170b9a07b1cf28c6aa7532c307c8 (patch)
treeda97d21ca9e0b6daf620ed57719aa344e96c26cc /sound/soc/zte
parent2ea659a9ef488125eb46da6eb571de5eae5c43f6 (diff)
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>
Diffstat (limited to 'sound/soc/zte')
-rw-r--r--sound/soc/zte/zx-i2s.c5
1 files 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,
226 struct zx_i2s_info *i2s = snd_soc_dai_get_drvdata(socdai); 226 struct zx_i2s_info *i2s = snd_soc_dai_get_drvdata(socdai);
227 struct snd_dmaengine_dai_dma_data *dma_data; 227 struct snd_dmaengine_dai_dma_data *dma_data;
228 unsigned int lane, ch_num, len, ret = 0; 228 unsigned int lane, ch_num, len, ret = 0;
229 unsigned int ts_width = 32;
229 unsigned long val; 230 unsigned long val;
230 unsigned long chn_cfg; 231 unsigned long chn_cfg;
231 232
232 dma_data = snd_soc_dai_get_dma_data(socdai, substream); 233 dma_data = snd_soc_dai_get_dma_data(socdai, substream);
233 dma_data->addr_width = params_width(params) >> 3; 234 dma_data->addr_width = ts_width >> 3;
234 235
235 val = readl_relaxed(i2s->reg_base + ZX_I2S_TIMING_CTRL); 236 val = readl_relaxed(i2s->reg_base + ZX_I2S_TIMING_CTRL);
236 val &= ~(ZX_I2S_TIMING_TS_WIDTH_MASK | ZX_I2S_TIMING_DATA_SIZE_MASK | 237 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,
251 dev_err(socdai->dev, "Unknown data format\n"); 252 dev_err(socdai->dev, "Unknown data format\n");
252 return -EINVAL; 253 return -EINVAL;
253 } 254 }
254 val |= ZX_I2S_TIMING_TS_WIDTH(len) | ZX_I2S_TIMING_DATA_SIZE(len); 255 val |= ZX_I2S_TIMING_TS_WIDTH(ts_width) | ZX_I2S_TIMING_DATA_SIZE(len);
255 256
256 ch_num = params_channels(params); 257 ch_num = params_channels(params);
257 switch (ch_num) { 258 switch (ch_num) {