<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p>[Sorry for the top-posting]</p>
<p><br>
</p>
<p>The driver currently has:</p>
<p><br>
</p>
<p></p>
<div><span style="white-space:pre"></span>/*</div>
<div><span style="white-space:pre"></span>* Hardware limitation: The bclk rate must be</div>
<div><span style="white-space:pre"></span>* never greater than 1/5 IPG clock rate</div>
<div><span style="white-space:pre"></span>*/</div>
<div><span style="white-space:pre"></span>if (freq * 5 > clk_get_rate(ssi_private->clk)) {</div>
<div><span style="white-space:pre"></span>dev_err(cpu_dai->dev, "bitclk > ipgclk/5\n");</div>
<div><span style="white-space:pre"></span>return -EINVAL;</div>
<div><span style="white-space:pre"></span>}</div>
<br>
<p></p>
<p>Isn't this properly taking care of the clock restriction?</p>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Lukasz Majewski <lukma@denx.de><br>
<b>Sent:</b> Sunday, September 3, 2017 8:05:01 AM<br>
<b>To:</b> Timur Tabi; Nicolin Chen; Xiubo Li; Fabio Estevam; Liam Girdwood; Mark Brown; Jaroslav Kysela; Takashi Iwai<br>
<b>Cc:</b> alsa-devel@alsa-project.org; linuxppc-dev@lists.ozlabs.org; linux-kernel@vger.kernel.org; Lukasz Majewski<br>
<b>Subject:</b> [PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">The problem is visible in the following setup (on the imx6q):<br>
"simple-audio-card" -> ssi2 -> I2S + I2C -> codec<br>
<br>
The function call log (simple-card probe -> CONFIG_SND_SIMPLE_CARD):<br>
<br>
asoc_simple_card_init_dai() @ sound/soc/generic/simple-card-utils.c<br>
snd_soc_dai_set_sysclk()<br>
fsl_ssi_set_dai_sysclk() @ sound/soc/fsl/fsl_ssi.c<br>
<br>
The last call is changing the bit clock (BCLK) frequency to SSI's IP<br>
block clock (ipg = 66 MHz) [1].<br>
This is wrong, since IMX SSI block requires the I2S BCLK to be less<br>
than 1/5 of [1].<br>
<br>
As a result the driver initialization passes without any errors, but the<br>
speaker-test test case breaks.<br>
<br>
This commit checks if the fsl_ssi_set_dai_sysclk() frequency passed is<br>
not equal to [1].<br>
<br>
Signed-off-by: Lukasz Majewski <lukma@denx.de><br>
---<br>
 sound/soc/fsl/fsl_ssi.c | 2 ++<br>
 1 file changed, 2 insertions(+)<br>
<br>
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c<br>
index 173cb84..1186fa9 100644<br>
--- a/sound/soc/fsl/fsl_ssi.c<br>
+++ b/sound/soc/fsl/fsl_ssi.c<br>
@@ -809,6 +809,8 @@ static int fsl_ssi_set_dai_sysclk(struct snd_soc_dai *cpu_dai,<br>
                 int clk_id, unsigned int freq, int dir)<br>
 {<br>
         struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(cpu_dai);<br>
+       if (clk_get_rate(ssi_private->clk) == freq)<br>
+               return 0;<br>
 <br>
         ssi_private->bitclk_freq = freq;<br>
 <br>
-- <br>
2.1.4<br>
<br>
</div>
</span></font>
</body>
</html>