* [PATCH] ASoC: fsl_ssi: Don't try to round-up for PM divisor calculation
@ 2015-02-15 9:37 Nicolin Chen
2015-02-24 8:26 ` Mark Brown
0 siblings, 1 reply; 5+ messages in thread
From: Nicolin Chen @ 2015-02-15 9:37 UTC (permalink / raw)
To: broonie
Cc: alsa-devel, lgirdwood, tiwai, perex, linux-kernel, timur, mpa,
shengjiu.wang, zidan.wang, scerveau
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] ASoC: fsl_ssi: Don't try to round-up for PM divisor calculation
2015-02-15 9:37 Nicolin Chen
@ 2015-02-24 8:26 ` Mark Brown
2015-02-24 9:13 ` Nicolin Chen
0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2015-02-24 8:26 UTC (permalink / raw)
To: Nicolin Chen
Cc: alsa-devel, lgirdwood, tiwai, perex, linux-kernel, timur, mpa,
shengjiu.wang, zidan.wang, scerveau
[-- Attachment #1: Type: text/plain, Size: 218 bytes --]
On Sun, Feb 15, 2015 at 01:37:11AM -0800, Nicolin Chen wrote:
> According to i.MX6 Series Reference Manual, the formula to calculate
> the sys clock is
This doesn't apply against current code, pleae check and resend.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ASoC: fsl_ssi: Don't try to round-up for PM divisor calculation
2015-02-24 8:26 ` Mark Brown
@ 2015-02-24 9:13 ` Nicolin Chen
0 siblings, 0 replies; 5+ messages in thread
From: Nicolin Chen @ 2015-02-24 9:13 UTC (permalink / raw)
To: Mark Brown
Cc: alsa-devel, lgirdwood, tiwai, perex, linux-kernel, timur, mpa,
shengjiu.wang, zidan.wang, scerveau
On Tue, Feb 24, 2015 at 05:26:42PM +0900, Mark Brown wrote:
> On Sun, Feb 15, 2015 at 01:37:11AM -0800, Nicolin Chen wrote:
> > According to i.MX6 Series Reference Manual, the formula to calculate
> > the sys clock is
>
> This doesn't apply against current code, pleae check and resend.
That's strange...I downloaded it from Patchwork and tried to apply
it on the latest for-next. It doesn't give me any error...
And I git-formated a new one but it doesn't look so different from
the one in the maillist...
Thank you
Nicolin
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] ASoC: fsl_ssi: Don't try to round-up for PM divisor calculation
@ 2015-03-05 5:05 Nicolin Chen
2015-03-05 12:23 ` Mark Brown
0 siblings, 1 reply; 5+ messages in thread
From: Nicolin Chen @ 2015-03-05 5:05 UTC (permalink / raw)
To: broonie
Cc: lgirdwood, timur, perex, tiwai, alsa-devel, linuxppc-dev,
linux-kernel
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>
---
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 05575f4..6b0c8f7 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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] ASoC: fsl_ssi: Don't try to round-up for PM divisor calculation
2015-03-05 5:05 [PATCH] ASoC: fsl_ssi: Don't try to round-up for PM divisor calculation Nicolin Chen
@ 2015-03-05 12:23 ` Mark Brown
0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2015-03-05 12:23 UTC (permalink / raw)
To: Nicolin Chen
Cc: lgirdwood, timur, perex, tiwai, alsa-devel, linuxppc-dev,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 170 bytes --]
On Wed, Mar 04, 2015 at 09:05:04PM -0800, Nicolin Chen wrote:
> According to i.MX6 Series Reference Manual, the formula to calculate
> the sys clock is
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-03-05 12:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-05 5:05 [PATCH] ASoC: fsl_ssi: Don't try to round-up for PM divisor calculation Nicolin Chen
2015-03-05 12:23 ` Mark Brown
-- strict thread matches above, loose matches on Subject: below --
2015-02-15 9:37 Nicolin Chen
2015-02-24 8:26 ` Mark Brown
2015-02-24 9:13 ` Nicolin Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox