summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/max98926.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2016-02-17 08:46:07 +0800
committerMark Brown <broonie@kernel.org>2016-02-17 13:11:27 +0000
commitcffee535f0b09ab0801cbec01a8ae81595aa99bc (patch)
treebd86d5ecd64979a0db3a8b3e2af191fb596f6814 /sound/soc/codecs/max98926.c
parenta2e2876aa0bab5939daf1cb20ef07ebf38744c1f (diff)
ASoC: max98926: Fix blr_clk_ratio calculation
Current code calculates blr_clk_ratio before setting max98926->ch_size, fix it. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: anish kumar <yesanishhere@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/max98926.c')
-rw-r--r--sound/soc/codecs/max98926.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sound/soc/codecs/max98926.c b/sound/soc/codecs/max98926.c
index 66884ebdf2bb..5245e107de30 100644
--- a/sound/soc/codecs/max98926.c
+++ b/sound/soc/codecs/max98926.c
@@ -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,