sunxi: add support for 4.1
[openwrt.git] / target / linux / sunxi / patches-4.1 / 166-asoc-sunxi-fix-distortion-on-16bit-mono.patch
1 From f8517e7d836269f5fa1e1049394104417d3a7357 Mon Sep 17 00:00:00 2001
2 From: "B.R. Oake" <broake@openmailbox.org>
3 Date: Sat, 6 Sep 2014 14:58:50 +0000
4 Subject: [PATCH] ASoC: sunxi-codec: Fix distortion on 16-bit mono
5
6 Patch to remove distortion on 16-bit mono, based on the linux-sunxi-3.4
7 code.
8
9 Signed-off-by: Hans de Goede <hdegoede@redhat.com>
10 ---
11  sound/soc/sunxi/sunxi-codec.c | 4 +---
12  1 file changed, 1 insertion(+), 3 deletions(-)
13
14 diff --git a/sound/soc/sunxi/sunxi-codec.c b/sound/soc/sunxi/sunxi-codec.c
15 index 67f978e..77a191b 100644
16 --- a/sound/soc/sunxi/sunxi-codec.c
17 +++ b/sound/soc/sunxi/sunxi-codec.c
18 @@ -215,9 +215,6 @@ static int sunxi_codec_prepare(struct snd_pcm_substream *substream,
19                         regmap_update_bits(priv->regmap, SUNXI_DAC_FIFOC, 0x1 << SUNXI_DAC_FIFOC_FIR_VERSION, 0x1 << SUNXI_DAC_FIFOC_FIR_VERSION);
20                 }
21  
22 -               /* set TX FIFO MODE - 0 works for both 16 and 24 bits */
23 -               regmap_update_bits(priv->regmap, SUNXI_DAC_FIFOC, 0x1 << SUNXI_DAC_FIFOC_TX_FIFO_MODE, 0x0 << SUNXI_DAC_FIFOC_TX_FIFO_MODE);
24 -
25                 /* send last sample when DAC FIFO under run */
26                 regmap_update_bits(priv->regmap, SUNXI_DAC_FIFOC, 0x1 << SUNXI_DAC_FIFOC_SEND_LASAT, 0x0 << SUNXI_DAC_FIFOC_SEND_LASAT);
27         } else {
28 @@ -329,6 +326,7 @@ static int sunxi_codec_hw_params(struct snd_pcm_substream *substream,
29                 regmap_update_bits(priv->regmap, SUNXI_DAC_FIFOC, 7 << SUNXI_DAC_FIFOC_DAC_FS, hwrate << SUNXI_DAC_FIFOC_DAC_FS);
30                 regmap_update_bits(priv->regmap, SUNXI_DAC_FIFOC, 1 << SUNXI_DAC_FIFOC_MONO_EN, is_mono << SUNXI_DAC_FIFOC_MONO_EN);
31                 regmap_update_bits(priv->regmap, SUNXI_DAC_FIFOC, 1 << SUNXI_DAC_FIFOC_TX_SAMPLE_BITS, is_24bit << SUNXI_DAC_FIFOC_TX_SAMPLE_BITS);
32 +               regmap_update_bits(priv->regmap, SUNXI_DAC_FIFOC, 1 << SUNXI_DAC_FIFOC_TX_FIFO_MODE, !is_24bit << SUNXI_DAC_FIFOC_TX_FIFO_MODE);
33                 if (is_24bit)
34                         priv->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
35                 else