All of lore.kernel.org
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: broonie@kernel.org
Cc: alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com,
	lee.jones@linaro.org, lgirdwood@gmail.com, sameo@linux.intel.com
Subject: [PATCH 2/9] ASoC: arizona: Add defines for FLL configuration constants
Date: Fri,  7 Mar 2014 16:34:18 +0000	[thread overview]
Message-ID: <1394210065-23941-3-git-send-email-ckeepax@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1394210065-23941-1-git-send-email-ckeepax@opensource.wolfsonmicro.com>

Improve readability by adding defines for some of the constants
associated with FLL configuration.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
 sound/soc/codecs/arizona.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index e4c1c9e..e6f8290 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -53,6 +53,12 @@
 #define ARIZONA_AIF_RX_ENABLES                  0x1A
 #define ARIZONA_AIF_FORCE_WRITE                 0x1B
 
+#define ARIZONA_FLL_MAX_FREF   13500000
+#define ARIZONA_FLL_MIN_FVCO   90000000
+#define ARIZONA_FLL_MAX_REFDIV 8
+#define ARIZONA_FLL_MIN_OUTDIV 2
+#define ARIZONA_FLL_MAX_OUTDIV 7
+
 #define arizona_fll_err(_fll, fmt, ...) \
 	dev_err(_fll->arizona->dev, "FLL%d: " fmt, _fll->id, ##__VA_ARGS__)
 #define arizona_fll_warn(_fll, fmt, ...) \
@@ -1399,11 +1405,11 @@ static int arizona_calc_fll(struct arizona_fll *fll,
 	/* Fref must be <=13.5MHz */
 	div = 1;
 	cfg->refdiv = 0;
-	while ((Fref / div) > 13500000) {
+	while ((Fref / div) > ARIZONA_FLL_MAX_FREF) {
 		div *= 2;
 		cfg->refdiv++;
 
-		if (div > 8) {
+		if (div > ARIZONA_FLL_MAX_REFDIV) {
 			arizona_fll_err(fll,
 					"Can't scale %dMHz in to <=13.5MHz\n",
 					Fref);
@@ -1415,10 +1421,10 @@ static int arizona_calc_fll(struct arizona_fll *fll,
 	Fref /= div;
 
 	/* Fvco should be over the targt; don't check the upper bound */
-	div = 2;
-	while (Fout * div < 90000000 * fll->vco_mult) {
+	div = ARIZONA_FLL_MIN_OUTDIV;
+	while (Fout * div < ARIZONA_FLL_MIN_FVCO * fll->vco_mult) {
 		div++;
-		if (div > 7) {
+		if (div > ARIZONA_FLL_MAX_OUTDIV) {
 			arizona_fll_err(fll, "No FLL_OUTDIV for Fout=%uHz\n",
 					Fout);
 			return -EINVAL;
-- 
1.7.2.5

  parent reply	other threads:[~2014-03-07 16:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-07 16:34 [PATCH 0/9] Update FLL calculations on Arizona devices Charles Keepax
2014-03-07 16:34 ` [PATCH 1/9] ASoC: arizona: An OUTDIV of 1 is not valid, avoid this Charles Keepax
2014-03-07 16:34 ` Charles Keepax [this message]
2014-03-07 16:34 ` [PATCH 3/9] ASoC: arizona: Move set of OUTDIV in to arizona_apply_fll Charles Keepax
2014-03-07 16:34 ` [PATCH 4/9] ASoC: arizona: Move calculation of FLL configuration Charles Keepax
2014-03-09  8:26   ` Mark Brown
2014-03-10  9:11     ` Charles Keepax
2014-03-10 13:27     ` Charles Keepax
2014-03-07 16:34 ` [PATCH 5/9] ASoC: arizona: Don't pass Fout into arizona_calc_fll Charles Keepax
2014-03-07 16:34 ` [PATCH 6/9] ASoC: arizona: Calculate OUTDIV first Charles Keepax
2014-03-07 16:34 ` [PATCH 7/9] ASoC: arizona: Calculate FLL gain last Charles Keepax
2014-03-07 16:34 ` [PATCH 8/9] mfd: arizona: Add support for new fratio encoding Charles Keepax
2014-03-07 16:34 ` [PATCH 9/9] ASoC: arizona: Support new fratio encoding on the wm5110 rev D Charles Keepax
2014-03-09  8:28 ` [PATCH 0/9] Update FLL calculations on Arizona devices 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=1394210065-23941-3-git-send-email-ckeepax@opensource.wolfsonmicro.com \
    --to=ckeepax@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=sameo@linux.intel.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 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.