Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cffee535 authored by Axel Lin's avatar Axel Lin Committed by Mark Brown
Browse files

ASoC: max98926: Fix blr_clk_ratio calculation



Current code calculates blr_clk_ratio before setting max98926->ch_size, fix
it.

Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Acked-by: default avataranish kumar <yesanishhere@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent a2e2876a
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -383,8 +383,7 @@ static int max98926_dai_hw_params(struct snd_pcm_substream *substream,
	int rate = params_rate(params), i;
	struct snd_soc_codec *codec = dai->codec;
	struct max98926_priv *max98926 = snd_soc_codec_get_drvdata(codec);
	/* BCLK/LRCLK ratio calculation */
	int blr_clk_ratio = params_channels(params) * max98926->ch_size;
	int blr_clk_ratio;

	switch (params_format(params)) {
	case SNDRV_PCM_FORMAT_S16_LE:
@@ -414,6 +413,9 @@ static int max98926_dai_hw_params(struct snd_pcm_substream *substream,
		return -EINVAL;
	}

	/* BCLK/LRCLK ratio calculation */
	blr_clk_ratio = params_channels(params) * max98926->ch_size;

	switch (blr_clk_ratio) {
	case 32:
		regmap_update_bits(max98926->regmap,