public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] regulator: core: Allow specify apply_[reg|bit] for regmap based voltage_sel operations
@ 2012-12-18  1:30 Axel Lin
  2012-12-18  1:31 ` [PATCH 2/4] regulator: 88pm8607: Use apply_[reg|bit] with " Axel Lin
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Axel Lin @ 2012-12-18  1:30 UTC (permalink / raw)
  To: Mark Brown
  Cc: Haojian Zhuang, David Dajun Chen, Ashish Jangam, Mike Rapoport,
	Liam Girdwood, linux-kernel

Some DVM regulators needs to update apply_bit after setting vsel_reg to
initiate voltage change on the output.  This patch adds apply_reg and
apply_bit to struct regulator_desc and update
regulator_set_voltage_sel_regmap() to set apply_bit of apply_reg when
apply_bit is set.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/core.c         |   12 +++++++++++-
 include/linux/regulator/driver.h |    6 ++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index a35858e..9afcdda3 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2074,10 +2074,20 @@ EXPORT_SYMBOL_GPL(regulator_get_voltage_sel_regmap);
  */
 int regulator_set_voltage_sel_regmap(struct regulator_dev *rdev, unsigned sel)
 {
+	int ret;
+
 	sel <<= ffs(rdev->desc->vsel_mask) - 1;
 
-	return regmap_update_bits(rdev->regmap, rdev->desc->vsel_reg,
+	ret = regmap_update_bits(rdev->regmap, rdev->desc->vsel_reg,
 				  rdev->desc->vsel_mask, sel);
+	if (ret)
+		return ret;
+
+	if (rdev->desc->apply_bit)
+		ret = regmap_update_bits(rdev->regmap, rdev->desc->apply_reg,
+					 rdev->desc->apply_bit,
+					 rdev->desc->apply_bit);
+	return ret;
 }
 EXPORT_SYMBOL_GPL(regulator_set_voltage_sel_regmap);
 
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index d10bb0f..23070fd 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -193,6 +193,10 @@ enum regulator_type {
  *
  * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_
  * @vsel_mask: Mask for register bitfield used for selector
+ * @apply_reg: Register for initiate voltage change on the output when
+ *                using regulator_set_voltage_sel_regmap
+ * @apply_bit: Register bitfield used for initiate voltage change on the
+ *                output when using regulator_set_voltage_sel_regmap
  * @enable_reg: Register for control when using regmap enable/disable ops
  * @enable_mask: Mask for control when using regmap enable/disable ops
  *
@@ -218,6 +222,8 @@ struct regulator_desc {
 
 	unsigned int vsel_reg;
 	unsigned int vsel_mask;
+	unsigned int apply_reg;
+	unsigned int apply_bit;
 	unsigned int enable_reg;
 	unsigned int enable_mask;
 	unsigned int bypass_reg;
-- 
1.7.9.5




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

end of thread, other threads:[~2013-10-02 11:28 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-18  1:30 [PATCH 1/4] regulator: core: Allow specify apply_[reg|bit] for regmap based voltage_sel operations Axel Lin
2012-12-18  1:31 ` [PATCH 2/4] regulator: 88pm8607: Use apply_[reg|bit] with " Axel Lin
2012-12-21 15:58   ` Haojian Zhuang
2012-12-18  1:32 ` [PATCH 3/4] regulator: da9052: " Axel Lin
2013-10-02 10:15   ` Michael Grzeschik
2013-10-02 11:28     ` Mark Brown
2012-12-18  1:34 ` [PATCH 4/4] regulator: tps6586x: " Axel Lin
2012-12-21 15:53 ` [PATCH 1/4] regulator: core: Allow specify apply_[reg|bit] for " Haojian Zhuang
2012-12-24 16:34 ` Mark Brown
2012-12-25  0:38   ` Haojian Zhuang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox