alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: broonie@opensource.wolfsonmicro.com
Cc: alsa-devel@alsa-project.org, tiwai@suse.de,
	patches@opensource.wolfsonmicro.com, lgirdwood@gmail.com,
	Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Subject: [PATCH v2 3/8] ASoC: arizona: Factor out check for enabled FLL
Date: Wed, 20 Feb 2013 17:28:36 +0000	[thread overview]
Message-ID: <1361381321-437-4-git-send-email-ckeepax@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1361381321-437-1-git-send-email-ckeepax@opensource.wolfsonmicro.com>

In preparation for additional features on the FLL this patch factors out
the code which checks if an FLL is currently enabled into a seperate
function.

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

diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index 03076ef..4640bcc 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -1074,12 +1074,27 @@ static void arizona_apply_fll(struct arizona *arizona, unsigned int base,
 			   ARIZONA_FLL1_CTRL_UPD | cfg->n);
 }
 
+static bool arizona_is_enabled_fll(struct arizona_fll *fll)
+{
+	struct arizona *arizona = fll->arizona;
+	unsigned int reg;
+	int ret;
+
+	ret = regmap_read(arizona->regmap, fll->base + 1, &reg);
+	if (ret != 0) {
+		arizona_fll_err(fll, "Failed to read current state: %d\n",
+				ret);
+		return ret;
+	}
+
+	return reg & ARIZONA_FLL1_ENA;
+}
+
 int arizona_set_fll(struct arizona_fll *fll, int source,
 		    unsigned int Fref, unsigned int Fout)
 {
 	struct arizona *arizona = fll->arizona;
 	struct arizona_fll_cfg ref, sync;
-	unsigned int reg;
 	bool ena;
 	int ret;
 
@@ -1111,13 +1126,7 @@ int arizona_set_fll(struct arizona_fll *fll, int source,
 		fll->sync_freq = Fref;
 	}
 
-	ret = regmap_read(arizona->regmap, fll->base + 1, &reg);
-	if (ret != 0) {
-		arizona_fll_err(fll, "Failed to read current state: %d\n",
-				ret);
-		return ret;
-	}
-	ena = reg & ARIZONA_FLL1_ENA;
+	ena = arizona_is_enabled_fll(fll);
 
 	if (Fout) {
 		regmap_update_bits(arizona->regmap, fll->base + 5,
-- 
1.7.2.5

  parent reply	other threads:[~2013-02-20 17:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-20 17:28 [PATCH v2 0/8] Add support for directly setting the FLL REFCLK Charles Keepax
2013-02-20 17:28 ` [PATCH v2 1/8] ASoC: arizona: Move selection of FLL REFCLK into init Charles Keepax
2013-02-20 17:28 ` [PATCH v2 2/8] ASoC: arizona: Tidy up SYNCCLK selection and cache values Charles Keepax
2013-02-20 17:28 ` Charles Keepax [this message]
2013-02-20 17:28 ` [PATCH v2 4/8] ASoC: arizona: Factor out FLL disable Charles Keepax
2013-02-20 17:28 ` [PATCH v2 5/8] ASoC: arizona: Factor out FLL enable Charles Keepax
2013-02-20 17:28 ` [PATCH v2 6/8] ASoC: arizona: Improve suppression of noop FLL updates Charles Keepax
2013-02-20 17:28 ` [PATCH v2 7/8] ASoC: arizona: Add support for directly setting the FLL REFCLK Charles Keepax
2013-02-20 17:28 ` [PATCH v2 8/8] ASoC: arizona: Add convience define for clearing SYNCCLK Charles Keepax
2013-02-20 17:33 ` [PATCH v2 0/8] Add support for directly setting the FLL REFCLK 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=1361381321-437-4-git-send-email-ckeepax@opensource.wolfsonmicro.com \
    --to=ckeepax@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=lgirdwood@gmail.com \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=tiwai@suse.de \
    /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;
as well as URLs for NNTP newsgroup(s).