All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: arizona: Make logging of FLL calculations clearer
@ 2016-02-23 14:16 ` Richard Fitzgerald
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Fitzgerald @ 2016-02-23 14:16 UTC (permalink / raw)
  To: broonie; +Cc: lgirdwood, patches, alsa-devel, linux-kernel

The debug logging of FLL calculations was confusing. Values were
printed in hex without indicating this by a leading 0x, and
despite these normally being required in decimal. Also where the
register value isn't the actual value (it s a power-of-two or
0 means 1, 1 means 2, ...)  it was unclear whether the actual or
register value was shown.

This patch changes the log print so that all mathematical values
are shown in decimal, all register values are shown in hex with a
0x prefix, and where the register value isn't the actual integer
value the decimal integer value is shown in () after the hex
register value.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
---
 sound/soc/codecs/arizona.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index 913cfa8..92d22a0 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -2149,11 +2149,12 @@ static int arizona_calc_fll(struct arizona_fll *fll,
 		return -EINVAL;
 	}
 
-	arizona_fll_dbg(fll, "N=%x THETA=%x LAMBDA=%x\n",
+	arizona_fll_dbg(fll, "N=%d THETA=%d LAMBDA=%d\n",
 			cfg->n, cfg->theta, cfg->lambda);
-	arizona_fll_dbg(fll, "FRATIO=%x(%d) OUTDIV=%x REFCLK_DIV=%x\n",
-			cfg->fratio, cfg->fratio, cfg->outdiv, cfg->refdiv);
-	arizona_fll_dbg(fll, "GAIN=%d\n", cfg->gain);
+	arizona_fll_dbg(fll, "FRATIO=0x%x(%d) OUTDIV=%d REFCLK_DIV=0x%x(%d)\n",
+			cfg->fratio, ratio, cfg->outdiv,
+			cfg->refdiv, 1 << cfg->refdiv);
+	arizona_fll_dbg(fll, "GAIN=0x%x(%d)\n", cfg->gain, 1 << cfg->gain);
 
 	return 0;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH] ASoC: arizona: Make logging of FLL calculations clearer
@ 2016-02-23 14:16 ` Richard Fitzgerald
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Fitzgerald @ 2016-02-23 14:16 UTC (permalink / raw)
  To: broonie; +Cc: alsa-devel, patches, lgirdwood, linux-kernel

The debug logging of FLL calculations was confusing. Values were
printed in hex without indicating this by a leading 0x, and
despite these normally being required in decimal. Also where the
register value isn't the actual value (it s a power-of-two or
0 means 1, 1 means 2, ...)  it was unclear whether the actual or
register value was shown.

This patch changes the log print so that all mathematical values
are shown in decimal, all register values are shown in hex with a
0x prefix, and where the register value isn't the actual integer
value the decimal integer value is shown in () after the hex
register value.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
---
 sound/soc/codecs/arizona.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index 913cfa8..92d22a0 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -2149,11 +2149,12 @@ static int arizona_calc_fll(struct arizona_fll *fll,
 		return -EINVAL;
 	}
 
-	arizona_fll_dbg(fll, "N=%x THETA=%x LAMBDA=%x\n",
+	arizona_fll_dbg(fll, "N=%d THETA=%d LAMBDA=%d\n",
 			cfg->n, cfg->theta, cfg->lambda);
-	arizona_fll_dbg(fll, "FRATIO=%x(%d) OUTDIV=%x REFCLK_DIV=%x\n",
-			cfg->fratio, cfg->fratio, cfg->outdiv, cfg->refdiv);
-	arizona_fll_dbg(fll, "GAIN=%d\n", cfg->gain);
+	arizona_fll_dbg(fll, "FRATIO=0x%x(%d) OUTDIV=%d REFCLK_DIV=0x%x(%d)\n",
+			cfg->fratio, ratio, cfg->outdiv,
+			cfg->refdiv, 1 << cfg->refdiv);
+	arizona_fll_dbg(fll, "GAIN=0x%x(%d)\n", cfg->gain, 1 << cfg->gain);
 
 	return 0;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] ASoC: arizona: Make logging of FLL calculations clearer
  2016-02-23 14:16 ` Richard Fitzgerald
  (?)
@ 2016-02-24  4:08 ` Mark Brown
  2016-02-24 17:39     ` Richard Fitzgerald
  -1 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2016-02-24  4:08 UTC (permalink / raw)
  To: Richard Fitzgerald; +Cc: lgirdwood, patches, alsa-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 648 bytes --]

On Tue, Feb 23, 2016 at 02:16:32PM +0000, Richard Fitzgerald wrote:
> The debug logging of FLL calculations was confusing. Values were
> printed in hex without indicating this by a leading 0x, and
> despite these normally being required in decimal. Also where the
> register value isn't the actual value (it s a power-of-two or
> 0 means 1, 1 means 2, ...)  it was unclear whether the actual or
> register value was shown.

I think that stuff was originally based on the way the datasheets quote
things:

> -	arizona_fll_dbg(fll, "FRATIO=%x(%d) OUTDIV=%x REFCLK_DIV=%x\n",

the hex(decimal) but there is certainly very familiar from some of
those.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Applied "ASoC: arizona: Make logging of FLL calculations clearer" to the asoc tree
  2016-02-23 14:16 ` Richard Fitzgerald
  (?)
  (?)
@ 2016-02-24  4:15 ` Mark Brown
  -1 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2016-02-24  4:15 UTC (permalink / raw)
  To: Richard Fitzgerald, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: arizona: Make logging of FLL calculations clearer

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 2595b7fe1aa3a1dfc47e549b39f7c35c5ce8a56d Mon Sep 17 00:00:00 2001
From: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Date: Tue, 23 Feb 2016 14:16:32 +0000
Subject: [PATCH] ASoC: arizona: Make logging of FLL calculations clearer

The debug logging of FLL calculations was confusing. Values were
printed in hex without indicating this by a leading 0x, and
despite these normally being required in decimal. Also where the
register value isn't the actual value (it s a power-of-two or
0 means 1, 1 means 2, ...)  it was unclear whether the actual or
register value was shown.

This patch changes the log print so that all mathematical values
are shown in decimal, all register values are shown in hex with a
0x prefix, and where the register value isn't the actual integer
value the decimal integer value is shown in () after the hex
register value.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/arizona.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index a32cfb85f1ca..dd926f4da409 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -2108,11 +2108,12 @@ static int arizona_calc_fll(struct arizona_fll *fll,
 		return -EINVAL;
 	}
 
-	arizona_fll_dbg(fll, "N=%x THETA=%x LAMBDA=%x\n",
+	arizona_fll_dbg(fll, "N=%d THETA=%d LAMBDA=%d\n",
 			cfg->n, cfg->theta, cfg->lambda);
-	arizona_fll_dbg(fll, "FRATIO=%x(%d) OUTDIV=%x REFCLK_DIV=%x\n",
-			cfg->fratio, cfg->fratio, cfg->outdiv, cfg->refdiv);
-	arizona_fll_dbg(fll, "GAIN=%d\n", cfg->gain);
+	arizona_fll_dbg(fll, "FRATIO=0x%x(%d) OUTDIV=%d REFCLK_DIV=0x%x(%d)\n",
+			cfg->fratio, ratio, cfg->outdiv,
+			cfg->refdiv, 1 << cfg->refdiv);
+	arizona_fll_dbg(fll, "GAIN=0x%x(%d)\n", cfg->gain, 1 << cfg->gain);
 
 	return 0;
 
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] ASoC: arizona: Make logging of FLL calculations clearer
  2016-02-24  4:08 ` Mark Brown
@ 2016-02-24 17:39     ` Richard Fitzgerald
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Fitzgerald @ 2016-02-24 17:39 UTC (permalink / raw)
  To: Mark Brown; +Cc: lgirdwood, patches, alsa-devel, linux-kernel

On 24/02/16 04:08, Mark Brown wrote:
> On Tue, Feb 23, 2016 at 02:16:32PM +0000, Richard Fitzgerald wrote:
>> The debug logging of FLL calculations was confusing. Values were
>> printed in hex without indicating this by a leading 0x, and
>> despite these normally being required in decimal. Also where the
>> register value isn't the actual value (it s a power-of-two or
>> 0 means 1, 1 means 2, ...)  it was unclear whether the actual or
>> register value was shown.
> I think that stuff was originally based on the way the datasheets quote
> things:
>
>> -	arizona_fll_dbg(fll, "FRATIO=%x(%d) OUTDIV=%x REFCLK_DIV=%x\n",
> the hex(decimal) but there is certainly very familiar from some of
> those.
Indeed, and it was fine on the first codec. Now we've got various 
revisions of the FLL with some fields having different meanings, human 
error started to creep into interpreting the debug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ASoC: arizona: Make logging of FLL calculations clearer
@ 2016-02-24 17:39     ` Richard Fitzgerald
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Fitzgerald @ 2016-02-24 17:39 UTC (permalink / raw)
  To: Mark Brown; +Cc: lgirdwood, patches, alsa-devel, linux-kernel

On 24/02/16 04:08, Mark Brown wrote:
> On Tue, Feb 23, 2016 at 02:16:32PM +0000, Richard Fitzgerald wrote:
>> The debug logging of FLL calculations was confusing. Values were
>> printed in hex without indicating this by a leading 0x, and
>> despite these normally being required in decimal. Also where the
>> register value isn't the actual value (it s a power-of-two or
>> 0 means 1, 1 means 2, ...)  it was unclear whether the actual or
>> register value was shown.
> I think that stuff was originally based on the way the datasheets quote
> things:
>
>> -	arizona_fll_dbg(fll, "FRATIO=%x(%d) OUTDIV=%x REFCLK_DIV=%x\n",
> the hex(decimal) but there is certainly very familiar from some of
> those.
Indeed, and it was fine on the first codec. Now we've got various 
revisions of the FLL with some fields having different meanings, human 
error started to creep into interpreting the debug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ASoC: arizona: Make logging of FLL calculations clearer
  2016-02-24 17:39     ` Richard Fitzgerald
  (?)
@ 2016-02-25  1:53     ` Mark Brown
  -1 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2016-02-25  1:53 UTC (permalink / raw)
  To: Richard Fitzgerald; +Cc: lgirdwood, patches, alsa-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 726 bytes --]

On Wed, Feb 24, 2016 at 05:39:32PM +0000, Richard Fitzgerald wrote:
> On 24/02/16 04:08, Mark Brown wrote:

> >I think that stuff was originally based on the way the datasheets quote
> >things:

> >>-	arizona_fll_dbg(fll, "FRATIO=%x(%d) OUTDIV=%x REFCLK_DIV=%x\n",
> >the hex(decimal) but there is certainly very familiar from some of
> >those.

> Indeed, and it was fine on the first codec. Now we've got various revisions
> of the FLL with some fields having different meanings, human error started
> to creep into interpreting the debug.

I'm not saying it's a bad idea to change it, just pointing out where
it's likely to have come from (and the fact that the way the datasheets
were writing this was always a bit weird).

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-02-25  1:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-23 14:16 [PATCH] ASoC: arizona: Make logging of FLL calculations clearer Richard Fitzgerald
2016-02-23 14:16 ` Richard Fitzgerald
2016-02-24  4:08 ` Mark Brown
2016-02-24 17:39   ` Richard Fitzgerald
2016-02-24 17:39     ` Richard Fitzgerald
2016-02-25  1:53     ` Mark Brown
2016-02-24  4:15 ` Applied "ASoC: arizona: Make logging of FLL calculations clearer" to the asoc tree Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.