2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-23 20:53:53 +08:00

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

I2S requires stereo clocking even for mono data.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
Mark Brown 2013-03-05 14:17:47 +08:00
parent 3f341f741d
commit 76bf969e6f

View File

@ -818,7 +818,7 @@ static int arizona_hw_params(struct snd_pcm_substream *substream,
struct arizona *arizona = priv->arizona; struct arizona *arizona = priv->arizona;
int base = dai->driver->base; int base = dai->driver->base;
const int *rates; const int *rates;
int i, ret; int i, ret, val;
int chan_limit = arizona->pdata.max_channels_clocked[dai->id - 1]; int chan_limit = arizona->pdata.max_channels_clocked[dai->id - 1];
int bclk, lrclk, wl, frame, bclk_target; 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; 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++) { for (i = 0; i < ARRAY_SIZE(arizona_44k1_bclk_rates); i++) {
if (rates[i] >= bclk_target && if (rates[i] >= bclk_target &&
rates[i] % params_rate(params) == 0) { rates[i] % params_rate(params) == 0) {