ASoC: Fix kirkwood i2s mono playback
authorarnaud.patard@rtp-net.org <arnaud.patard@rtp-net.org>
Sun, 11 Jul 2010 21:28:31 +0000 (23:28 +0200)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 13 Jul 2010 11:37:09 +0000 (12:37 +0100)
Kirkwood controller needs to be informed if the audio stream is mono
or not. Failing to do so will result in playing at the wrong speed.

Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/kirkwood/kirkwood-i2s.c
sound/soc/kirkwood/kirkwood.h

index 0fdc7db7a469ed52f8cbb344539ade08eef2c60d..d80ea1ff7b0e5d6df097d5cd11e413373f0da59c 100644 (file)
@@ -153,6 +153,15 @@ static int kirkwood_i2s_hw_params(struct snd_pcm_substream *substream,
        default:
                return -EINVAL;
        }
+
+       if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+               value &= ~KIRKWOOD_PLAYCTL_MONO_MASK;
+               if (params_channels(params) == 1)
+                       value |= KIRKWOOD_PLAYCTL_MONO_BOTH;
+               else
+                       value |= KIRKWOOD_PLAYCTL_MONO_OFF;
+       }
+
        writel(i2s_value, priv->io+i2s_reg);
        writel(value, priv->io+reg);
 
index b6e4f68d71dd21f0e7cf037970abd49c439c517b..bb6e6a5648c9b73687900b28ec9f6d12e770412d 100644 (file)
@@ -49,6 +49,9 @@
 #define KIRKWOOD_PLAYCTL_BURST_32              (1<<11)
 #define KIRKWOOD_PLAYCTL_PAUSE                 (1<<9)
 #define KIRKWOOD_PLAYCTL_SPDIF_MUTE            (1<<8)
+#define KIRKWOOD_PLAYCTL_MONO_MASK             (3<<5)
+#define KIRKWOOD_PLAYCTL_MONO_BOTH             (3<<5)
+#define KIRKWOOD_PLAYCTL_MONO_OFF              (0<<5)
 #define KIRKWOOD_PLAYCTL_I2S_MUTE              (1<<7)
 #define KIRKWOOD_PLAYCTL_SPDIF_EN              (1<<4)
 #define KIRKWOOD_PLAYCTL_I2S_EN                (1<<3)