Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1475295

[PATCH 3/6] ASoC: arizona: Avoid changing SYNC_ENA whilst the FLL_ENA is set

From Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Newsgroups linux.kernel
Subject [PATCH 3/6] ASoC: arizona: Avoid changing SYNC_ENA whilst the FLL_ENA is set
Date 2016-09-02 18:00 +0200
Message-ID <scZ2Q-1kr-71@gated-at.bofh.it> (permalink)
References <scZ2O-1kr-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


For best performance changing the synchroniser state whilst the FLL is
running should be avoided. As this has been done fairly regularly in
practice rather than hard preventing this, simply improve the FLL enable
sequence and give a warning if the user changes the synchroniser state.

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

diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index 463979f4..be24387 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -2209,12 +2209,15 @@ static int arizona_enable_fll(struct arizona_fll *fll)
 	struct arizona *arizona = fll->arizona;
 	bool use_sync = false;
 	int already_enabled = arizona_is_enabled_fll(fll, fll->base);
+	int sync_enabled = arizona_is_enabled_fll(fll, fll->base + 0x10);
 	struct arizona_fll_cfg cfg;
 	int i;
 	unsigned int val;
 
 	if (already_enabled < 0)
 		return already_enabled;
+	if (sync_enabled < 0)
+		return sync_enabled;
 
 	if (already_enabled) {
 		/* Facilitate smooth refclk across the transition */
@@ -2259,6 +2262,9 @@ static int arizona_enable_fll(struct arizona_fll *fll)
 		return -EINVAL;
 	}
 
+	if (already_enabled && !!sync_enabled != use_sync)
+		arizona_fll_warn(fll, "Synchroniser changed on active FLL\n");
+
 	/*
 	 * Increase the bandwidth if we're not using a low frequency
 	 * sync source.
@@ -2274,12 +2280,12 @@ static int arizona_enable_fll(struct arizona_fll *fll)
 	if (!already_enabled)
 		pm_runtime_get_sync(arizona->dev);
 
-	regmap_update_bits_async(arizona->regmap, fll->base + 1,
-				 ARIZONA_FLL1_ENA, ARIZONA_FLL1_ENA);
 	if (use_sync)
 		regmap_update_bits_async(arizona->regmap, fll->base + 0x11,
 					 ARIZONA_FLL1_SYNC_ENA,
 					 ARIZONA_FLL1_SYNC_ENA);
+	regmap_update_bits_async(arizona->regmap, fll->base + 1,
+				 ARIZONA_FLL1_ENA, ARIZONA_FLL1_ENA);
 
 	if (already_enabled)
 		regmap_update_bits_async(arizona->regmap, fll->base + 1,
-- 
2.1.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/6] Arizona FLL fixes and Clocking Improvements Charles Keepax <ckeepax@opensource.wolfsonmicro.com> - 2016-09-02 18:00 +0200
  [PATCH 4/6] mfd: arizona: Add gating of external MCLKn clocks Charles Keepax <ckeepax@opensource.wolfsonmicro.com> - 2016-09-02 18:00 +0200
  [PATCH 1/6] ASoC: arizona: Correct handling of FLL theta in synchroniser mode Charles Keepax <ckeepax@opensource.wolfsonmicro.com> - 2016-09-02 18:00 +0200
    Applied "ASoC: arizona: Correct handling of FLL theta in synchroniser mode" to the asoc tree Mark Brown <broonie@kernel.org> - 2016-09-03 13:10 +0200
  [PATCH 6/6] ASoC: arizona: Add gating for source clocks of the FLLs Charles Keepax <ckeepax@opensource.wolfsonmicro.com> - 2016-09-02 18:00 +0200
    Re: [PATCH 6/6] ASoC: arizona: Add gating for source clocks of the FLLs Sylwester Nawrocki <s.nawrocki@samsung.com> - 2016-09-05 10:20 +0200
  [PATCH 3/6] ASoC: arizona: Avoid changing SYNC_ENA whilst the FLL_ENA is set Charles Keepax <ckeepax@opensource.wolfsonmicro.com> - 2016-09-02 18:00 +0200
  [PATCH 5/6] ASoC: arizona: Add gating for clock when used for direct MCLK Charles Keepax <ckeepax@opensource.wolfsonmicro.com> - 2016-09-02 18:00 +0200
    Re: [PATCH 5/6] ASoC: arizona: Add gating for clock when used for  direct MCLK Sylwester Nawrocki <s.nawrocki@samsung.com> - 2016-09-05 10:20 +0200
  [PATCH 2/6] ASoC: arizona: Allow specification of base for arizona_is_enabled_fll Charles Keepax <ckeepax@opensource.wolfsonmicro.com> - 2016-09-02 18:00 +0200

csiph-web