From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: broonie@kernel.org
Cc: robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com,
ijc+devicetree@hellion.org.uk, galak@codeaurora.org,
rob@landley.net, sameo@linux.intel.com, lee.jones@linaro.org,
lgirdwood@gmail.com, patches@opensource.wolfsonmicro.com,
linux-kernel@vger.kernel.org
Subject: [PATCH 4/8] regulator: arizona-ldo1: Add processing of init_data from device tree
Date: Tue, 18 Mar 2014 10:49:13 +0000 [thread overview]
Message-ID: <1395139757-6907-5-git-send-email-ckeepax@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1395139757-6907-1-git-send-email-ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
Documentation/devicetree/bindings/mfd/arizona.txt | 7 +++++
drivers/regulator/arizona-ldo1.c | 26 +++++++++++++++++++++
2 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt b/Documentation/devicetree/bindings/mfd/arizona.txt
index 36a0c3d..d78f1aa 100644
--- a/Documentation/devicetree/bindings/mfd/arizona.txt
+++ b/Documentation/devicetree/bindings/mfd/arizona.txt
@@ -42,6 +42,13 @@ Optional properties:
the chip default will be used. If present exactly five values must
be specified.
+ - wlf,ldo1 : Initial data for the LDO1 regulator, as covered in
+ Documentation/devicetree/bindings/regulator/regulator.txt
+
+ - DCVDD-supply : Power supply, only needs to be specified if DCVDD is being
+ externally supplied. As covered in
+ Documentation/devicetree/bindings/regulator/regulator.txt
+
Example:
codec: wm5102@1a {
diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c
index 6379fd3..a67013f 100644
--- a/drivers/regulator/arizona-ldo1.c
+++ b/drivers/regulator/arizona-ldo1.c
@@ -19,6 +19,7 @@
#include <linux/platform_device.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/machine.h>
+#include <linux/regulator/of_regulator.h>
#include <linux/gpio.h>
#include <linux/slab.h>
@@ -184,9 +185,34 @@ static const struct regulator_init_data arizona_ldo1_default = {
static int arizona_ldo1_get_pdata(struct arizona *arizona,
struct regulator_config *config)
{
+ struct arizona_pdata *pdata = &arizona->pdata;
+ struct arizona_ldo1 *ldo1 = config->driver_data;
+ struct device_node *np_init, *np_dcvdd;
+
arizona_of_get_named_gpio(arizona, "wlf,ldoena", true,
&config->ena_gpio);
+ np_init = of_get_child_by_name(arizona->dev->of_node, "wlf,ldo1");
+ np_dcvdd = of_parse_phandle(arizona->dev->of_node, "DCVDD-supply", 0);
+
+ if (np_init) {
+ config->of_node = np_init;
+
+ pdata->ldo1 = of_get_regulator_init_data(arizona->dev, np_init);
+
+ if (np_dcvdd) {
+ if (np_dcvdd != np_init)
+ arizona->external_dcvdd = true;
+ } else {
+ pdata->ldo1->consumer_supplies = &ldo1->supply;
+ pdata->ldo1->num_consumer_supplies = 1;
+ }
+
+ config->init_data = pdata->ldo1;
+ } else if (np_dcvdd) {
+ arizona->external_dcvdd = true;
+ }
+
return 0;
}
#else
--
1.7.2.5
next prev parent reply other threads:[~2014-03-18 10:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-18 10:49 [PATCH 0/8] Arizona regulator updates Charles Keepax
2014-03-18 10:49 ` [PATCH 1/8] arizona: Correct small errors in the DT binding documentation Charles Keepax
2014-03-18 10:49 ` [PATCH 2/8] mfd: arizona: Factor out read of device tree GPIOs Charles Keepax
2014-03-18 10:49 ` [PATCH 3/8] regulator: arizona-ldo1: Move setup processing from arizona-core Charles Keepax
2014-03-18 11:10 ` Mark Brown
2014-03-18 14:11 ` Charles Keepax
2014-03-18 10:49 ` Charles Keepax [this message]
2014-03-18 11:15 ` [PATCH 4/8] regulator: arizona-ldo1: Add processing of init_data from device tree Mark Brown
2014-03-18 16:07 ` Charles Keepax
2014-03-18 16:19 ` Mark Brown
2014-03-18 10:49 ` [PATCH 5/8] regulator: arizona-micsupp: " Charles Keepax
2014-03-18 10:49 ` [PATCH 6/8] mfd: arizona: Add MICVDD to mapped regulators Charles Keepax
2014-03-18 10:49 ` [PATCH 7/8] mfd: wm8997: Add registers for high power mode Charles Keepax
2014-03-18 10:49 ` [PATCH 8/8] regulator: arizona-ldo1: Correct default regulator init_data Charles Keepax
2014-03-18 11:21 ` 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=1395139757-6907-5-git-send-email-ckeepax@opensource.wolfsonmicro.com \
--to=ckeepax@opensource.wolfsonmicro.com \
--cc=broonie@kernel.org \
--cc=galak@codeaurora.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=lee.jones@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=patches@opensource.wolfsonmicro.com \
--cc=pawel.moll@arm.com \
--cc=rob@landley.net \
--cc=robh+dt@kernel.org \
--cc=sameo@linux.intel.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
Powered by JetHome