Skip to content

Commit

Permalink
ASoC: fsl_ssi: Fix the incorrect limitation of the bit clock rate
Browse files Browse the repository at this point in the history
According to i.MX Reference Manual, the bit-clock frequency generated
by SSI must be never greater than 1/5 of the peripheral clock frequency.

This peripheral clock, however, is not baudclk but the IPG clock (i.e.
ssi_private->clk in the fsl_ssi driver).

So this patch just simply fixes the incorrect limitation applied to
the bit clock (baudclk) rate.

Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Nicolin Chen authored and Mark Brown committed Feb 11, 2015
1 parent bfa76d4 commit 541b03a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions sound/soc/fsl/fsl_ssi.c
Original file line number Diff line number Diff line change
Expand Up @@ -603,17 +603,20 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream,
factor = (div2 + 1) * (7 * psr + 1) * 2;

for (i = 0; i < 255; i++) {
/* The bclk rate must be smaller than 1/5 sysclk rate */
if (factor * (i + 1) < 5)
continue;

tmprate = freq * factor * (i + 2);

if (baudclk_is_used)
clkrate = clk_get_rate(ssi_private->baudclk);
else
clkrate = clk_round_rate(ssi_private->baudclk, tmprate);

/*
* Hardware limitation: The bclk rate must be
* never greater than 1/5 IPG clock rate
*/
if (clkrate * 5 > clk_get_rate(ssi_private->clk))
continue;

clkrate /= factor;
afreq = clkrate / (i + 1);

Expand Down

0 comments on commit 541b03a

Please sign in to comment.