aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaud Mouiche <arnaud.mouiche@invoxia.com>2016-05-03 08:13:56 -0400
committerMark Brown <broonie@kernel.org>2016-05-13 07:15:31 -0400
commite09745f2e6a1f692fc63db01850aacf025475aad (patch)
tree6969a42a0099bff415ec033dbd6f258285b648d5
parent48a260eec301fd7a112d1737ca2755d91558a349 (diff)
ASoC: fsl_ssi: The IPG/5 limitation concerns the bitclk, not the sysclk.
im6sl reference manual 47.7.4: " Bit clock - Used to serially clock the data bits in and out of the SSI port. This clock is either generated internally (from SSI's sys clock) or taken from external clock source (through the Tx/Rx clock ports). [...] Care should be taken to ensure that the bit clock frequency (either internally generated by dividing the SSI's sys clock or sourced from external device through Tx/Rx clock ports) is never greater than 1/5 of the ipg_clk (from CCM) frequency. " Since, in master mode, the sysclk is a multiple of bitclk, we can easily reach a high sysclk value, whereas keeping a reasonable bitclk. ex: 8ch x 16bit x 48kHz = 6144000, requires a 24576000 sysclk (PM=1) yet ipg_clk/5 = 66Mhz/5 = 13.2 Signed-off-by: Arnaud Mouiche <arnaud.mouiche@invoxia.com> Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com> Tested-by: Caleb Crome <caleb@crome.org> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/fsl/fsl_ssi.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 8d5f3c192de2..86229c8902d2 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -670,6 +670,15 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream,
670 if (IS_ERR(ssi_private->baudclk)) 670 if (IS_ERR(ssi_private->baudclk))
671 return -EINVAL; 671 return -EINVAL;
672 672
673 /*
674 * Hardware limitation: The bclk rate must be
675 * never greater than 1/5 IPG clock rate
676 */
677 if (freq * 5 > clk_get_rate(ssi_private->clk)) {
678 dev_err(cpu_dai->dev, "bitclk > ipgclk/5\n");
679 return -EINVAL;
680 }
681
673 baudclk_is_used = ssi_private->baudclk_streams & ~(BIT(substream->stream)); 682 baudclk_is_used = ssi_private->baudclk_streams & ~(BIT(substream->stream));
674 683
675 /* It should be already enough to divide clock by setting pm alone */ 684 /* It should be already enough to divide clock by setting pm alone */
@@ -686,13 +695,6 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream,
686 else 695 else
687 clkrate = clk_round_rate(ssi_private->baudclk, tmprate); 696 clkrate = clk_round_rate(ssi_private->baudclk, tmprate);
688 697
689 /*
690 * Hardware limitation: The bclk rate must be
691 * never greater than 1/5 IPG clock rate
692 */
693 if (clkrate * 5 > clk_get_rate(ssi_private->clk))
694 continue;
695
696 clkrate /= factor; 698 clkrate /= factor;
697 afreq = clkrate / (i + 1); 699 afreq = clkrate / (i + 1);
698 700