From: Nicolin Chen <nicoleotsuka@gmail.com>
To: broonie@kernel.org
Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, tiwai@suse.de,
perex@perex.cz, linux-kernel@vger.kernel.org, timur@tabi.org,
mpa@pengutronix.de, shengjiu.wang@freescale.com,
zidan.wang@freescale.com, scerveau@voxtok.com
Subject: [PATCH] ASoC: fsl_ssi: Don't try to round-up for PM divisor calculation
Date: Sun, 15 Feb 2015 01:37:11 -0800 [thread overview]
Message-ID: <1423993031-29474-1-git-send-email-nicoleotsuka@gmail.com> (raw)
According to i.MX6 Series Reference Manual, the formula to calculate
the sys clock is
sysclk rate = bclk rate * (div2 + 1) * (7 * psr + 1) * (pm + 1) * 2
Commit aafa85e71a75 ("ASoC: fsl_ssi: Add DAI master mode support for
SSI on i.MX series") added the divisor calculation which relies on
the clk_round_rate(). However, at that time, clk_round_rate() didn't
provide closest clock rates for some cases because it might not use
a correct rounding policy. So using the original formula (pm + 1) for
PM divisor was not able to give us a desired clock rate. And then we
used (pm + 2) to do the trick.
However, the clk-divider driver has been refined a lot since commit
b11d282dbea2 ("clk: divider: fix rate calculation for fractional rates")
Now using (pm + 2) trick would result an incorrect clock rate.
So this patch fixes the problem by removing the useless trick.
Reported-by: Stephane Cerveau <scerveau@voxtok.com>
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
---
[ I also checked that only 3.18 stable tree has the refinements for
clk-divider driver, so I guess it might not be able to apply to
previous long-term trees if being treated as bug fix. -- Nicolin ]
sound/soc/fsl/fsl_ssi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index d7365c5..3e7c644 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -603,7 +603,7 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream,
factor = (div2 + 1) * (7 * psr + 1) * 2;
for (i = 0; i < 255; i++) {
- tmprate = freq * factor * (i + 2);
+ tmprate = freq * factor * (i + 1);
if (baudclk_is_used)
clkrate = clk_get_rate(ssi_private->baudclk);
--
1.9.1
next reply other threads:[~2015-02-15 9:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-15 9:37 Nicolin Chen [this message]
2015-02-24 8:26 ` [PATCH] ASoC: fsl_ssi: Don't try to round-up for PM divisor calculation Mark Brown
2015-02-24 9:13 ` Nicolin Chen
-- strict thread matches above, loose matches on Subject: below --
2015-03-05 5:05 Nicolin Chen
2015-03-05 12:23 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1423993031-29474-1-git-send-email-nicoleotsuka@gmail.com \
--to=nicoleotsuka@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpa@pengutronix.de \
--cc=perex@perex.cz \
--cc=scerveau@voxtok.com \
--cc=shengjiu.wang@freescale.com \
--cc=timur@tabi.org \
--cc=tiwai@suse.de \
--cc=zidan.wang@freescale.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox