* [PATCH resend] ASoC: fsl-ssi: Fix bitclock calculation for master mode
@ 2015-03-23 14:46 Marc Kleine-Budde
2015-03-25 16:58 ` Mark Brown
0 siblings, 1 reply; 3+ messages in thread
From: Marc Kleine-Budde @ 2015-03-23 14:46 UTC (permalink / raw)
To: alsa-devel
Cc: Sascha Hauer, broonie, Marc Kleine-Budde, linux-arm-kernel,
kernel
From: Sascha Hauer <s.hauer@pengutronix.de>
in fsl_ssi_set_bclk we are looking for the best divider by iterating
over all possible dividers. The divider is in the range 1..256, so
make this clear by using 'div' as name for the loop counter and iterate
from 1 to 256 instead of 0 to 255. This makes obvious that tmprate is
calculated wrong, it has to be freq * factor * div, not
freq * factor * (i + 2).
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
sound/soc/fsl/fsl_ssi.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index b9fabbf69db6..b8af08e49085 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -578,7 +578,7 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream,
struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(cpu_dai);
struct regmap *regs = ssi_private->regs;
int synchronous = ssi_private->cpu_dai_drv.symmetric_rates, ret;
- u32 pm = 999, div2, psr, stccr, mask, afreq, factor, i;
+ u32 pm = 999, div2, psr, stccr, mask, afreq, factor, div;
unsigned long clkrate, baudrate, tmprate;
u64 sub, savesub = 100000;
unsigned int freq;
@@ -602,8 +602,8 @@ 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);
+ for (div = 1; div < 256; div++) {
+ tmprate = freq * factor * div;
if (baudclk_is_used)
clkrate = clk_get_rate(ssi_private->baudclk);
@@ -618,7 +618,7 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream,
continue;
clkrate /= factor;
- afreq = clkrate / (i + 1);
+ afreq = clkrate / div;
if (freq == afreq)
sub = 0;
@@ -636,7 +636,7 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream,
if (sub < savesub) {
baudrate = tmprate;
savesub = sub;
- pm = i;
+ pm = div - 1;
}
/* We are lucky */
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH resend] ASoC: fsl-ssi: Fix bitclock calculation for master mode
2015-03-23 14:46 [PATCH resend] ASoC: fsl-ssi: Fix bitclock calculation for master mode Marc Kleine-Budde
@ 2015-03-25 16:58 ` Mark Brown
2015-03-25 21:44 ` Marc Kleine-Budde
0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2015-03-25 16:58 UTC (permalink / raw)
To: Marc Kleine-Budde; +Cc: alsa-devel, Sascha Hauer, linux-arm-kernel, kernel
[-- Attachment #1.1: Type: text/plain, Size: 330 bytes --]
On Mon, Mar 23, 2015 at 03:46:12PM +0100, Marc Kleine-Budde wrote:
> From: Sascha Hauer <s.hauer@pengutronix.de>
>
> in fsl_ssi_set_bclk we are looking for the best divider by iterating
> over all possible dividers. The divider is in the range 1..256, so
This doesn't apply against current code, please check and resend.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH resend] ASoC: fsl-ssi: Fix bitclock calculation for master mode
2015-03-25 16:58 ` Mark Brown
@ 2015-03-25 21:44 ` Marc Kleine-Budde
0 siblings, 0 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2015-03-25 21:44 UTC (permalink / raw)
To: Mark Brown; +Cc: alsa-devel, Sascha Hauer, linux-arm-kernel, kernel
[-- Attachment #1.1: Type: text/plain, Size: 823 bytes --]
On 03/25/2015 05:58 PM, Mark Brown wrote:
> On Mon, Mar 23, 2015 at 03:46:12PM +0100, Marc Kleine-Budde wrote:
>> From: Sascha Hauer <s.hauer@pengutronix.de>
>>
>> in fsl_ssi_set_bclk we are looking for the best divider by iterating
>> over all possible dividers. The divider is in the range 1..256, so
>
> This doesn't apply against current code, please check and resend.
The problem has been fixed by:
6c8ca30eec7b ASoC: fsl_ssi: Don't try to round-up for PM divisor
calculation
in the meantime.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-25 21:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-23 14:46 [PATCH resend] ASoC: fsl-ssi: Fix bitclock calculation for master mode Marc Kleine-Budde
2015-03-25 16:58 ` Mark Brown
2015-03-25 21:44 ` Marc Kleine-Budde
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox