From: Lee Jones <lee.jones@linaro.org>
To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org
Cc: arnd@arndb.de, linus.walleij@stericsson.com,
srinidhi.kasagar@stericsson.com, broonie@linaro.org,
Lee Jones <lee.jones@linaro.org>
Subject: [PATCH 07/10] regulator: ab8500-ext: Provide a set_voltage call-back operation
Date: Fri, 7 Jun 2013 17:11:25 +0100 [thread overview]
Message-ID: <1370621488-18130-8-git-send-email-lee.jones@linaro.org> (raw)
In-Reply-To: <1370621488-18130-1-git-send-email-lee.jones@linaro.org>
When registering regulators which have a single voltage through Device
Tree, the framework insists that the specified voltage is actually set.
Well in order to do that we need to provide this call-back, where we
check that the value is sane and return without error. Not that the
selector isn't populated, but in our case list_voltage doesn't actually
use it, so we're good.
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
drivers/regulator/ab8500-ext.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/drivers/regulator/ab8500-ext.c b/drivers/regulator/ab8500-ext.c
index b4d4547..e4975bc 100644
--- a/drivers/regulator/ab8500-ext.c
+++ b/drivers/regulator/ab8500-ext.c
@@ -229,6 +229,28 @@ static unsigned int ab8500_ext_regulator_get_mode(struct regulator_dev *rdev)
return ret;
}
+static int ab8500_ext_set_voltage(struct regulator_dev *rdev, int min_uV,
+ int max_uV, unsigned *selector)
+{
+ struct regulation_constraints *regu_constraints = rdev->constraints;
+
+ if (!regu_constraints) {
+ dev_err(rdev_get_dev(rdev), "No regulator constraints\n");
+ return -EINVAL;
+ }
+
+ if (regu_constraints->min_uV == min_uV &&
+ regu_constraints->max_uV == max_uV)
+ return 0;
+
+ dev_err(rdev_get_dev(rdev),
+ "Requested min %duV max %duV != constrained min %duV max %duV\n",
+ min_uV, max_uV,
+ regu_constraints->min_uV, regu_constraints->max_uV);
+
+ return -EINVAL;
+}
+
static int ab8500_ext_list_voltage(struct regulator_dev *rdev,
unsigned selector)
{
@@ -252,6 +274,7 @@ static struct regulator_ops ab8500_ext_regulator_ops = {
.is_enabled = ab8500_ext_regulator_is_enabled,
.set_mode = ab8500_ext_regulator_set_mode,
.get_mode = ab8500_ext_regulator_get_mode,
+ .set_voltage = ab8500_ext_set_voltage,
.list_voltage = ab8500_ext_list_voltage,
};
--
1.7.10.4
next prev parent reply other threads:[~2013-06-07 16:12 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-07 16:11 [PATCH 00/10] regulator: ab8500-ext: Refactorings Lee Jones
2013-06-07 16:11 ` [PATCH 01/10] ARM: ux500: Add Device Tree nodes for AB8500 External regulators Lee Jones
2013-06-10 15:17 ` Linus Walleij
2013-06-07 16:11 ` [PATCH 02/10] ARM: ux500: Provide a supply name for the AB8500 AUX regulators to use Lee Jones
2013-06-10 15:18 ` Linus Walleij
2013-06-07 16:11 ` [PATCH 03/10] ARM: ux500: Supply external regulator names for Snowball's DT Lee Jones
2013-06-07 16:11 ` [PATCH 04/10] ARM: ux500: Provide the supply regulator through consumers Lee Jones
2013-06-07 16:11 ` [PATCH 05/10] mfd: ab8500-core: Add AB8500 external regulators as MFD devices Lee Jones
2013-06-07 16:11 ` [PATCH 06/10] regulator: ab8500: Ensure AB8500 external registers are probed first Lee Jones
2013-06-07 16:51 ` Mark Brown
2013-06-07 16:11 ` Lee Jones [this message]
2013-06-07 16:52 ` [PATCH 07/10] regulator: ab8500-ext: Provide a set_voltage call-back operation Mark Brown
2013-06-07 16:11 ` [PATCH 08/10] regulator: ab8500-ext: Register as a device in its own right Lee Jones
2013-06-11 11:50 ` Mark Brown
2013-06-07 16:11 ` [PATCH 09/10] regulator: ab8500-ext: Enable for Device Tree Lee Jones
2013-06-11 11:52 ` Mark Brown
2013-06-07 16:11 ` [PATCH 10/10] regulator: ab8500: Provide supply names for the AUX regulators Lee Jones
2013-06-10 14:35 ` [PATCH 00/10] regulator: ab8500-ext: Refactorings Linus Walleij
2013-06-10 15:12 ` Lee Jones
2013-06-10 15:25 ` Mark Brown
2013-06-10 15:46 ` Lee Jones
2013-06-10 16:25 ` 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=1370621488-18130-8-git-send-email-lee.jones@linaro.org \
--to=lee.jones@linaro.org \
--cc=arnd@arndb.de \
--cc=broonie@linaro.org \
--cc=linus.walleij@stericsson.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=srinidhi.kasagar@stericsson.com \
/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
all inboxes | Powered by JetHome®