Skip to contentSkip to conversation

ASoC: arizona: Ensure we clock two channels for I2S mode

PATCH New Mark Brown 1 participant 1 message Mar 13, 2013

Subsystems (3)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 ASoC: arizona: Ensure we clock two channels for I2S mode

I2S requires stereo clocking even for mono data.

---
 sound/soc/codecs/arizona.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
sound/soc/codecs/arizona.c +8 -1
index 0c70d503..2b0803e 100644
@@ -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) {
Signature · 1 line
1.7.10.4