]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ASoC: arizona: Ensure we clock two channels for I2S mode
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 5 Mar 2013 06:17:47 +0000 (14:17 +0800)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 13 Mar 2013 19:03:17 +0000 (19:03 +0000)
I2S requires stereo clocking even for mono data.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/codecs/arizona.c

index 0c70d503fd322353387990b86d0e4a1ed88241af..2b0803ec82347b560f8aed278ab5a6e557b3d3bf 100644 (file)
@@ -818,7 +818,7 @@ static int arizona_hw_params(struct snd_pcm_substream *substream,
        struct arizona *arizona = priv->arizona;
        int base = dai->driver->base;
        const int *rates;
-       int i, ret;
+       int i, ret, val;
        int chan_limit = arizona->pdata.max_channels_clocked[dai->id - 1];
        int bclk, lrclk, wl, frame, bclk_target;
 
@@ -834,6 +834,13 @@ static int arizona_hw_params(struct snd_pcm_substream *substream,
                bclk_target *= chan_limit;
        }
 
+       /* Force stereo for I2S mode */
+       val = snd_soc_read(codec, base + ARIZONA_AIF_FORMAT);
+       if (params_channels(params) == 1 && (val & ARIZONA_AIF1_FMT_MASK)) {
+               arizona_aif_dbg(dai, "Forcing stereo mode\n");
+               bclk_target *= 2;
+       }
+
        for (i = 0; i < ARRAY_SIZE(arizona_44k1_bclk_rates); i++) {
                if (rates[i] >= bclk_target &&
                    rates[i] % params_rate(params) == 0) {