All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/4] mfd: arizona: Factor out SYSCLK enable from wm5102 hardware patch
@ 2015-03-17 16:11 Charles Keepax
  2015-03-17 16:11 ` [PATCH v2 2/4] mfd: wm5110: Add register patch required for low power sleep Charles Keepax
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Charles Keepax @ 2015-03-17 16:11 UTC (permalink / raw)
  To: lee.jones, broonie; +Cc: sameo, lgirdwood, patches, linux-kernel

wm5102 applies a custom hardware boot sequence, for this the SYSCLK
needs to be enabled. This patch factors out the code that enables
SYSCLK for this sequence such that it can be used for other boot time
operations that require SYSCLK.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---

Changes since v1:
 - Added some comments in patch 4 to explain the exact regulator voltage
   ranges
 - Removed the reset patch, whilst I work on the suggestions by Mark, the
   rest of the series is useful in its own right and doesn't need to be
   blocked by that

Thanks,
Charles

 drivers/mfd/arizona-core.c |   48 ++++++++++++++++++++++++++++---------------
 1 files changed, 31 insertions(+), 17 deletions(-)

diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
index 6ca6dfa..ef1f8aa 100644
--- a/drivers/mfd/arizona-core.c
+++ b/drivers/mfd/arizona-core.c
@@ -250,7 +250,8 @@ static int arizona_wait_for_boot(struct arizona *arizona)
 	return ret;
 }
 
-static int arizona_apply_hardware_patch(struct arizona* arizona)
+static int arizona_exec_with_sysclk(struct arizona *arizona,
+				    int (*exec)(struct arizona *))
 {
 	unsigned int fll, sysclk;
 	int ret, err;
@@ -292,23 +293,8 @@ static int arizona_apply_hardware_patch(struct arizona* arizona)
 		goto err_fll;
 	}
 
-	/* Start the write sequencer and wait for it to finish */
-	ret = regmap_write(arizona->regmap, ARIZONA_WRITE_SEQUENCER_CTRL_0,
-			ARIZONA_WSEQ_ENA | ARIZONA_WSEQ_START | 160);
-	if (ret != 0) {
-		dev_err(arizona->dev, "Failed to start write sequencer: %d\n",
-			ret);
-		goto err_sysclk;
-	}
-	ret = arizona_poll_reg(arizona, 5, ARIZONA_WRITE_SEQUENCER_CTRL_1,
-			       ARIZONA_WSEQ_BUSY, 0);
-	if (ret != 0) {
-		regmap_write(arizona->regmap, ARIZONA_WRITE_SEQUENCER_CTRL_0,
-				ARIZONA_WSEQ_ABORT);
-		ret = -ETIMEDOUT;
-	}
+	ret = exec(arizona);
 
-err_sysclk:
 	err = regmap_write(arizona->regmap, ARIZONA_SYSTEM_CLOCK_1, sysclk);
 	if (err != 0) {
 		dev_err(arizona->dev,
@@ -330,6 +316,34 @@ err_fll:
 		return err;
 }
 
+static int arizona_hardware_patch_wseq(struct arizona *arizona)
+{
+	int ret;
+
+	/* Start the write sequencer and wait for it to finish */
+	ret = regmap_write(arizona->regmap, ARIZONA_WRITE_SEQUENCER_CTRL_0,
+			ARIZONA_WSEQ_ENA | ARIZONA_WSEQ_START | 160);
+	if (ret != 0) {
+		dev_err(arizona->dev, "Failed to start write sequencer: %d\n",
+			ret);
+		return ret;
+	}
+	ret = arizona_poll_reg(arizona, 5, ARIZONA_WRITE_SEQUENCER_CTRL_1,
+			       ARIZONA_WSEQ_BUSY, 0);
+	if (ret != 0) {
+		regmap_write(arizona->regmap, ARIZONA_WRITE_SEQUENCER_CTRL_0,
+				ARIZONA_WSEQ_ABORT);
+		ret = -ETIMEDOUT;
+	}
+
+	return ret;
+}
+
+static inline int arizona_apply_hardware_patch(struct arizona *arizona)
+{
+	return arizona_exec_with_sysclk(arizona, arizona_hardware_patch_wseq);
+}
+
 #ifdef CONFIG_PM
 static int arizona_runtime_resume(struct device *dev)
 {
-- 
1.7.2.5


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

end of thread, other threads:[~2015-03-23 14:50 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-17 16:11 [PATCH v2 1/4] mfd: arizona: Factor out SYSCLK enable from wm5102 hardware patch Charles Keepax
2015-03-17 16:11 ` [PATCH v2 2/4] mfd: wm5110: Add register patch required for low power sleep Charles Keepax
2015-03-23 14:13   ` Lee Jones
2015-03-23 14:22     ` Charles Keepax
2015-03-23 14:50       ` Lee Jones
2015-03-17 16:11 ` [PATCH v2 3/4] regulator: arizona-ldo1: Add additional supported voltage Charles Keepax
2015-03-17 16:11 ` [PATCH v2 4/4] mfd: wm5110: Set DCVDD voltage to 1.175V before entering sleep mode Charles Keepax
2015-03-17 17:06   ` Mark Brown
2015-03-23 14:15   ` Lee Jones
2015-03-23 13:52 ` [PATCH v2 1/4] mfd: arizona: Factor out SYSCLK enable from wm5102 hardware patch Lee Jones
2015-03-23 14:36   ` Charles Keepax
2015-03-23 14:48     ` Lee Jones

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.