All of lore.kernel.org
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@ingics.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>,
	David Dajun Chen <dchen@diasemi.com>,
	Ashish Jangam <ashish.jangam@kpitcummins.com>,
	Mike Rapoport <mike@compulab.co.il>, Liam Girdwood <lrg@ti.com>,
	linux-kernel@vger.kernel.org
Subject: [RFC/RFT][PATCH 1/4] regulator: core: Allow specify activate_[reg|bit] for regmap based voltage_sel operations
Date: Thu, 13 Dec 2012 16:44:08 +0800	[thread overview]
Message-ID: <1355388248.31434.3.camel@phoenix> (raw)

Some DVM regulators needs to update activate_bit after setting vsel_reg to
initiate voltage change on the output.  This patch adds activate_reg and
activate_bit to struct regulator_desc and update
regulator_set_voltage_sel_regmap() to set activate_bit of activate_reg when
activate_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 0f65b24..2021086 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->activate_bit)
+		ret = regmap_update_bits(rdev->regmap, rdev->desc->activate_reg,
+					 rdev->desc->activate_bit,
+					 rdev->desc->activate_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..ba5a535 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
+ * @activate_reg: Register for initiate voltage change on the output when
+ *                using regulator_set_voltage_sel_regmap
+ * @activate_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 activate_reg;
+	unsigned int activate_bit;
 	unsigned int enable_reg;
 	unsigned int enable_mask;
 	unsigned int bypass_reg;
-- 
1.7.9.5




             reply	other threads:[~2012-12-13  8:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-13  8:44 Axel Lin [this message]
2012-12-13  8:45 ` [RFC/RFT][PATCH 2/4] regulator: 88pm8607: Use activate_[reg|bit] with regmap based voltage_sel operations Axel Lin
2012-12-13  8:47 ` [RFC/RFT][PATCH 3/4] regulator: da9052: " Axel Lin
2012-12-13  8:48 ` [RFC/RFT][PATCH 4/4] regulator: tps6586x: " Axel Lin
2012-12-13  8:48 ` [RFC/RFT][PATCH 1/4] regulator: core: Allow specify activate_[reg|bit] for " 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=1355388248.31434.3.camel@phoenix \
    --to=axel.lin@ingics.com \
    --cc=ashish.jangam@kpitcummins.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=dchen@diasemi.com \
    --cc=haojian.zhuang@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@ti.com \
    --cc=mike@compulab.co.il \
    /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.