* [PATCH 1/8] arizona: Correct small errors in the DT binding documentation
2014-03-18 10:49 [PATCH 0/8] Arizona regulator updates Charles Keepax
@ 2014-03-18 10:49 ` Charles Keepax
2014-03-18 10:49 ` [PATCH 2/8] mfd: arizona: Factor out read of device tree GPIOs Charles Keepax
` (6 subsequent siblings)
7 siblings, 0 replies; 15+ messages in thread
From: Charles Keepax @ 2014-03-18 10:49 UTC (permalink / raw)
To: broonie
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob,
sameo, lee.jones, lgirdwood, patches, linux-kernel
This patch does not alter the binding at all it only brings the
documentation up to date with the existing binding.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
Documentation/devicetree/bindings/mfd/arizona.txt | 23 +++++++++++---------
1 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt b/Documentation/devicetree/bindings/mfd/arizona.txt
index 0e295c9..36a0c3d 100644
--- a/Documentation/devicetree/bindings/mfd/arizona.txt
+++ b/Documentation/devicetree/bindings/mfd/arizona.txt
@@ -5,9 +5,10 @@ of analogue I/O.
Required properties:
- - compatible : one of the following chip-specific strings:
- "wlf,wm5102"
- "wlf,wm5110"
+ - compatible : One of the following chip-specific strings:
+ "wlf,wm5102"
+ "wlf,wm5110"
+ "wlf,wm8997"
- reg : I2C slave address when connected using I2C, chip select number when
using SPI.
@@ -25,8 +26,9 @@ Required properties:
- #gpio-cells : Must be 2. The first cell is the pin number and the
second cell is used to specify optional parameters (currently unused).
- - AVDD1-supply, DBVDD1-supply, DBVDD2-supply, DBVDD3-supply, CPVDD-supply,
- SPKVDDL-supply, SPKVDDR-supply : power supplies for the device, as covered
+ - AVDD-supply, DBVDD1-supply, DBVDD2-supply, DBVDD3-supply (wm5102, wm5110),
+ CPVDD-supply, SPKVDDL-supply (wm5102, wm5110), SPKVDDR-supply (wm5102,
+ wm5110), SPKVDD-supply (wm8997) : Power supplies for the device, as covered
in Documentation/devicetree/bindings/regulator/regulator.txt
Optional properties:
@@ -46,6 +48,7 @@ codec: wm5102@1a {
compatible = "wlf,wm5102";
reg = <0x1a>;
interrupts = <347>;
+ interrupt-controller;
#interrupt-cells = <2>;
interrupt-parent = <&gic>;
@@ -53,10 +56,10 @@ codec: wm5102@1a {
#gpio-cells = <2>;
wlf,gpio-defaults = <
- 0x00000000, /* AIF1TXLRCLK */
- 0xffffffff,
- 0xffffffff,
- 0xffffffff,
- 0xffffffff,
+ 0x00000000 /* AIF1TXLRCLK */
+ 0xffffffff
+ 0xffffffff
+ 0xffffffff
+ 0xffffffff
>;
};
--
1.7.2.5
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH 2/8] mfd: arizona: Factor out read of device tree GPIOs
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 ` Charles Keepax
2014-03-18 10:49 ` [PATCH 3/8] regulator: arizona-ldo1: Move setup processing from arizona-core Charles Keepax
` (5 subsequent siblings)
7 siblings, 0 replies; 15+ messages in thread
From: Charles Keepax @ 2014-03-18 10:49 UTC (permalink / raw)
To: broonie
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob,
sameo, lee.jones, lgirdwood, patches, linux-kernel
Factor out the reading of GPIOs for the Arizona devices into a helper
function.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
drivers/mfd/arizona-core.c | 33 ++++++++++++++++++++++++---------
include/linux/mfd/arizona/core.h | 3 +++
2 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
index a45aab9..97eafce 100644
--- a/drivers/mfd/arizona-core.c
+++ b/drivers/mfd/arizona-core.c
@@ -512,19 +512,34 @@ int arizona_of_get_type(struct device *dev)
}
EXPORT_SYMBOL_GPL(arizona_of_get_type);
+int arizona_of_get_named_gpio(struct arizona *arizona, const char *prop,
+ bool mandatory, int *gpio)
+{
+ int ret;
+
+ ret = of_get_named_gpio(arizona->dev->of_node, prop, 0);
+ *gpio = ret;
+ if (ret >= 0)
+ return ret;
+
+ *gpio = 0;
+
+ if (mandatory)
+ dev_err(arizona->dev,
+ "Mandatory DT gpio %s missing/malformed: %d\n",
+ prop, ret);
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(arizona_of_get_named_gpio);
+
static int arizona_of_get_core_pdata(struct arizona *arizona)
{
+ struct arizona_pdata *pdata = &arizona->pdata;
int ret, i;
- arizona->pdata.reset = of_get_named_gpio(arizona->dev->of_node,
- "wlf,reset", 0);
- if (arizona->pdata.reset < 0)
- arizona->pdata.reset = 0;
-
- arizona->pdata.ldoena = of_get_named_gpio(arizona->dev->of_node,
- "wlf,ldoena", 0);
- if (arizona->pdata.ldoena < 0)
- arizona->pdata.ldoena = 0;
+ arizona_of_get_named_gpio(arizona, "wlf,reset", true, &pdata->reset);
+ arizona_of_get_named_gpio(arizona, "wlf,ldoena", true, &pdata->ldoena);
ret = of_property_read_u32_array(arizona->dev->of_node,
"wlf,gpio-defaults",
diff --git a/include/linux/mfd/arizona/core.h b/include/linux/mfd/arizona/core.h
index 5cf8b91..16150cc 100644
--- a/include/linux/mfd/arizona/core.h
+++ b/include/linux/mfd/arizona/core.h
@@ -124,4 +124,7 @@ int wm5102_patch(struct arizona *arizona);
int wm5110_patch(struct arizona *arizona);
int wm8997_patch(struct arizona *arizona);
+extern int arizona_of_get_named_gpio(struct arizona *arizona, const char *prop,
+ bool mandatory, int *gpio);
+
#endif
--
1.7.2.5
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH 3/8] regulator: arizona-ldo1: Move setup processing from arizona-core
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 ` Charles Keepax
2014-03-18 11:10 ` Mark Brown
2014-03-18 10:49 ` [PATCH 4/8] regulator: arizona-ldo1: Add processing of init_data from device tree Charles Keepax
` (4 subsequent siblings)
7 siblings, 1 reply; 15+ messages in thread
From: Charles Keepax @ 2014-03-18 10:49 UTC (permalink / raw)
To: broonie
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob,
sameo, lee.jones, lgirdwood, patches, linux-kernel
It is more idiomatic to process things relating to the regulator in its
driver. This patch moves both processing of device tree relating to the
regulator and checking if the regulator is external from arizona-core
into the regulator driver.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
drivers/mfd/arizona-core.c | 9 --------
drivers/regulator/arizona-ldo1.c | 41 +++++++++++++++++++++++++++++++++----
2 files changed, 36 insertions(+), 14 deletions(-)
diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
index 97eafce..0bab354 100644
--- a/drivers/mfd/arizona-core.c
+++ b/drivers/mfd/arizona-core.c
@@ -539,7 +539,6 @@ static int arizona_of_get_core_pdata(struct arizona *arizona)
int ret, i;
arizona_of_get_named_gpio(arizona, "wlf,reset", true, &pdata->reset);
- arizona_of_get_named_gpio(arizona, "wlf,ldoena", true, &pdata->ldoena);
ret = of_property_read_u32_array(arizona->dev->of_node,
"wlf,gpio-defaults",
@@ -870,14 +869,6 @@ int arizona_dev_init(struct arizona *arizona)
arizona->pdata.gpio_defaults[i]);
}
- /*
- * LDO1 can only be used to supply DCVDD so if it has no
- * consumers then DCVDD is supplied externally.
- */
- if (arizona->pdata.ldo1 &&
- arizona->pdata.ldo1->num_consumer_supplies == 0)
- arizona->external_dcvdd = true;
-
pm_runtime_set_autosuspend_delay(arizona->dev, 100);
pm_runtime_use_autosuspend(arizona->dev);
pm_runtime_enable(arizona->dev);
diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c
index 4f6c205..6379fd3 100644
--- a/drivers/regulator/arizona-ldo1.c
+++ b/drivers/regulator/arizona-ldo1.c
@@ -180,6 +180,38 @@ static const struct regulator_init_data arizona_ldo1_default = {
.num_consumer_supplies = 1,
};
+#ifdef CONFIG_OF
+static int arizona_ldo1_get_pdata(struct arizona *arizona,
+ struct regulator_config *config)
+{
+ arizona_of_get_named_gpio(arizona, "wlf,ldoena", true,
+ &config->ena_gpio);
+
+ return 0;
+}
+#else
+static inline int arizona_ldo1_get_pdata(struct arizona *arizona,
+ struct regulator_config *config)
+{
+ struct arizona_pdata *pdata = &arizona->pdata;
+
+ config->ena_gpio = arizona->pdata.ldoena;
+
+ if (pdata->ldo1) {
+ config->init_data = pdata->ldo1;
+
+ /*
+ * LDO1 can only be used to supply DCVDD so if it has no
+ * consumers then DCVDD is supplied externally.
+ */
+ if (pdata->ldo1->num_consumer_supplies == 0)
+ arizona->external_dcvdd = true;
+ }
+
+ return 0;
+}
+#endif
+
static int arizona_ldo1_probe(struct platform_device *pdev)
{
struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
@@ -219,12 +251,11 @@ static int arizona_ldo1_probe(struct platform_device *pdev)
config.dev = arizona->dev;
config.driver_data = ldo1;
config.regmap = arizona->regmap;
- config.ena_gpio = arizona->pdata.ldoena;
+ config.init_data = &ldo1->init_data;
- if (arizona->pdata.ldo1)
- config.init_data = arizona->pdata.ldo1;
- else
- config.init_data = &ldo1->init_data;
+ ret = arizona_ldo1_get_pdata(arizona, &config);
+ if (ret < 0)
+ return ret;
ldo1->regulator = devm_regulator_register(&pdev->dev, desc, &config);
if (IS_ERR(ldo1->regulator)) {
--
1.7.2.5
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [PATCH 3/8] regulator: arizona-ldo1: Move setup processing from arizona-core
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
0 siblings, 1 reply; 15+ messages in thread
From: Mark Brown @ 2014-03-18 11:10 UTC (permalink / raw)
To: Charles Keepax
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob,
sameo, lee.jones, lgirdwood, patches, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 702 bytes --]
On Tue, Mar 18, 2014 at 10:49:12AM +0000, Charles Keepax wrote:
> +#ifdef CONFIG_OF
> +static int arizona_ldo1_get_pdata(struct arizona *arizona,
> + struct regulator_config *config)
> +{
> + arizona_of_get_named_gpio(arizona, "wlf,ldoena", true,
> + &config->ena_gpio);
> +
> + return 0;
> +}
> +#else
> +static inline int arizona_ldo1_get_pdata(struct arizona *arizona,
> + struct regulator_config *config)
> +{
> + struct arizona_pdata *pdata = &arizona->pdata;
> +
> + config->ena_gpio = arizona->pdata.ldoena;
This breaks non-DT systems booting a kernel which has DT support
compiled in. It's also more than simple code motion which is what the
changelog claimed this was doing.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH 3/8] regulator: arizona-ldo1: Move setup processing from arizona-core
2014-03-18 11:10 ` Mark Brown
@ 2014-03-18 14:11 ` Charles Keepax
0 siblings, 0 replies; 15+ messages in thread
From: Charles Keepax @ 2014-03-18 14:11 UTC (permalink / raw)
To: Mark Brown
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob,
sameo, lee.jones, lgirdwood, patches, linux-kernel
On Tue, Mar 18, 2014 at 11:10:49AM +0000, Mark Brown wrote:
> On Tue, Mar 18, 2014 at 10:49:12AM +0000, Charles Keepax wrote:
>
> > +#ifdef CONFIG_OF
> > +static int arizona_ldo1_get_pdata(struct arizona *arizona,
> > + struct regulator_config *config)
> > +{
> > + arizona_of_get_named_gpio(arizona, "wlf,ldoena", true,
> > + &config->ena_gpio);
> > +
> > + return 0;
> > +}
> > +#else
> > +static inline int arizona_ldo1_get_pdata(struct arizona *arizona,
> > + struct regulator_config *config)
> > +{
> > + struct arizona_pdata *pdata = &arizona->pdata;
> > +
> > + config->ena_gpio = arizona->pdata.ldoena;
>
> This breaks non-DT systems booting a kernel which has DT support
> compiled in. It's also more than simple code motion which is what the
> changelog claimed this was doing.
Oops.. sorry that is a good point I will respin these.
Thanks,
Charles
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 4/8] regulator: arizona-ldo1: Add processing of init_data from device tree
2014-03-18 10:49 [PATCH 0/8] Arizona regulator updates Charles Keepax
` (2 preceding siblings ...)
2014-03-18 10:49 ` [PATCH 3/8] regulator: arizona-ldo1: Move setup processing from arizona-core Charles Keepax
@ 2014-03-18 10:49 ` Charles Keepax
2014-03-18 11:15 ` Mark Brown
2014-03-18 10:49 ` [PATCH 5/8] regulator: arizona-micsupp: " Charles Keepax
` (3 subsequent siblings)
7 siblings, 1 reply; 15+ messages in thread
From: Charles Keepax @ 2014-03-18 10:49 UTC (permalink / raw)
To: broonie
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob,
sameo, lee.jones, lgirdwood, patches, linux-kernel
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
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [PATCH 4/8] regulator: arizona-ldo1: Add processing of init_data from device tree
2014-03-18 10:49 ` [PATCH 4/8] regulator: arizona-ldo1: Add processing of init_data from device tree Charles Keepax
@ 2014-03-18 11:15 ` Mark Brown
2014-03-18 16:07 ` Charles Keepax
0 siblings, 1 reply; 15+ messages in thread
From: Mark Brown @ 2014-03-18 11:15 UTC (permalink / raw)
To: Charles Keepax
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob,
sameo, lee.jones, lgirdwood, patches, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 515 bytes --]
On Tue, Mar 18, 2014 at 10:49:13AM +0000, Charles Keepax wrote:
> + - wlf,ldo1 : Initial data for the LDO1 regulator, as covered in
> + Documentation/devicetree/bindings/regulator/regulator.txt
We don't normally prefix the names of the regulator data with a vendor.
> + np_init = of_get_child_by_name(arizona->dev->of_node, "wlf,ldo1");
You're missing an of_node_put() for this and if you're going to use
hungarian notation please use a convention other people use. Calling
things _node seems more common.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 4/8] regulator: arizona-ldo1: Add processing of init_data from device tree
2014-03-18 11:15 ` Mark Brown
@ 2014-03-18 16:07 ` Charles Keepax
2014-03-18 16:19 ` Mark Brown
0 siblings, 1 reply; 15+ messages in thread
From: Charles Keepax @ 2014-03-18 16:07 UTC (permalink / raw)
To: Mark Brown
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob,
sameo, lee.jones, lgirdwood, patches, linux-kernel
On Tue, Mar 18, 2014 at 11:15:42AM +0000, Mark Brown wrote:
> On Tue, Mar 18, 2014 at 10:49:13AM +0000, Charles Keepax wrote:
>
> > + - wlf,ldo1 : Initial data for the LDO1 regulator, as covered in
> > + Documentation/devicetree/bindings/regulator/regulator.txt
>
> We don't normally prefix the names of the regulator data with a vendor.
>
> > + np_init = of_get_child_by_name(arizona->dev->of_node, "wlf,ldo1");
>
> You're missing an of_node_put() for this and if you're going to use
> hungarian notation please use a convention other people use. Calling
> things _node seems more common.
The DCVDD one needs an of_node_put but I am not sure this one
does. As it will be copied into the regulator device of_node by
the regulator core so wont of_node_put be called when the device
is destroyed? Admittedly I haven't checked that but seems
sensible that the device structure would put its of_node when it
closes down.
Thanks,
Charles
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 4/8] regulator: arizona-ldo1: Add processing of init_data from device tree
2014-03-18 16:07 ` Charles Keepax
@ 2014-03-18 16:19 ` Mark Brown
0 siblings, 0 replies; 15+ messages in thread
From: Mark Brown @ 2014-03-18 16:19 UTC (permalink / raw)
To: Charles Keepax
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob,
sameo, lee.jones, lgirdwood, patches, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 883 bytes --]
On Tue, Mar 18, 2014 at 04:07:01PM +0000, Charles Keepax wrote:
> On Tue, Mar 18, 2014 at 11:15:42AM +0000, Mark Brown wrote:
> > On Tue, Mar 18, 2014 at 10:49:13AM +0000, Charles Keepax wrote:
> > > + np_init = of_get_child_by_name(arizona->dev->of_node, "wlf,ldo1");
> > You're missing an of_node_put() for this and if you're going to use
> > hungarian notation please use a convention other people use. Calling
> > things _node seems more common.
> The DCVDD one needs an of_node_put but I am not sure this one
> does. As it will be copied into the regulator device of_node by
> the regulator core so wont of_node_put be called when the device
> is destroyed? Admittedly I haven't checked that but seems
> sensible that the device structure would put its of_node when it
> closes down.
You just took an extra reference by calling of_get_child_by_name(), you
need to free it.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 5/8] regulator: arizona-micsupp: Add processing of init_data from device tree
2014-03-18 10:49 [PATCH 0/8] Arizona regulator updates Charles Keepax
` (3 preceding siblings ...)
2014-03-18 10:49 ` [PATCH 4/8] regulator: arizona-ldo1: Add processing of init_data from device tree Charles Keepax
@ 2014-03-18 10:49 ` Charles Keepax
2014-03-18 10:49 ` [PATCH 6/8] mfd: arizona: Add MICVDD to mapped regulators Charles Keepax
` (2 subsequent siblings)
7 siblings, 0 replies; 15+ messages in thread
From: Charles Keepax @ 2014-03-18 10:49 UTC (permalink / raw)
To: broonie
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob,
sameo, lee.jones, lgirdwood, patches, linux-kernel
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
Documentation/devicetree/bindings/mfd/arizona.txt | 6 ++-
drivers/regulator/arizona-micsupp.c | 47 +++++++++++++++++++--
2 files changed, 47 insertions(+), 6 deletions(-)
diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt b/Documentation/devicetree/bindings/mfd/arizona.txt
index d78f1aa..88c1c0f 100644
--- a/Documentation/devicetree/bindings/mfd/arizona.txt
+++ b/Documentation/devicetree/bindings/mfd/arizona.txt
@@ -44,9 +44,11 @@ Optional properties:
- wlf,ldo1 : Initial data for the LDO1 regulator, as covered in
Documentation/devicetree/bindings/regulator/regulator.txt
+ - wlf,micvdd : Initial data for the MICVDD 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
+ - DCVDD-supply, MICVDD-supply : Power supplies, only need to be specified if
+ they are being externally supplied. As covered in
Documentation/devicetree/bindings/regulator/regulator.txt
Example:
diff --git a/drivers/regulator/arizona-micsupp.c b/drivers/regulator/arizona-micsupp.c
index 034ece7..1d5bd8d 100644
--- a/drivers/regulator/arizona-micsupp.c
+++ b/drivers/regulator/arizona-micsupp.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>
#include <linux/workqueue.h>
@@ -195,6 +196,44 @@ static const struct regulator_init_data arizona_micsupp_ext_default = {
.num_consumer_supplies = 1,
};
+#ifdef CONFIG_OF
+static int arizona_micsupp_get_pdata(struct arizona *arizona,
+ struct regulator_config *config)
+{
+ struct arizona_pdata *pdata = &arizona->pdata;
+ struct arizona_micsupp *micsupp = config->driver_data;
+ struct device_node *np_init, *np_micvdd;
+
+ np_init = of_get_child_by_name(arizona->dev->of_node, "wlf,micvdd");
+ np_micvdd = of_parse_phandle(arizona->dev->of_node, "MICVDD-supply", 0);
+
+ if (np_init) {
+ config->of_node = np_init;
+
+ pdata->micvdd = of_get_regulator_init_data(arizona->dev,
+ np_init);
+
+ if (!np_micvdd) {
+ pdata->micvdd->consumer_supplies = &micsupp->supply;
+ pdata->micvdd->num_consumer_supplies = 1;
+ }
+
+ config->init_data = pdata->micvdd;
+ }
+
+ return 0;
+}
+#else
+static inline int arizona_micsupp_get_pdata(struct arizona *arizona,
+ struct regulator_config *config)
+{
+ if (arizona->pdata.micvdd)
+ config->init_data = arizona->pdata.micvdd;
+
+ return 0;
+}
+#endif
+
static int arizona_micsupp_probe(struct platform_device *pdev)
{
struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
@@ -235,11 +274,11 @@ static int arizona_micsupp_probe(struct platform_device *pdev)
config.dev = arizona->dev;
config.driver_data = micsupp;
config.regmap = arizona->regmap;
+ config.init_data = &micsupp->init_data;
- if (arizona->pdata.micvdd)
- config.init_data = arizona->pdata.micvdd;
- else
- config.init_data = &micsupp->init_data;
+ ret = arizona_micsupp_get_pdata(arizona, &config);
+ if (ret < 0)
+ return ret;
/* Default to regulated mode until the API supports bypass */
regmap_update_bits(arizona->regmap, ARIZONA_MIC_CHARGE_PUMP_1,
--
1.7.2.5
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH 6/8] mfd: arizona: Add MICVDD to mapped regulators
2014-03-18 10:49 [PATCH 0/8] Arizona regulator updates Charles Keepax
` (4 preceding siblings ...)
2014-03-18 10:49 ` [PATCH 5/8] regulator: arizona-micsupp: " Charles Keepax
@ 2014-03-18 10:49 ` 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
7 siblings, 0 replies; 15+ messages in thread
From: Charles Keepax @ 2014-03-18 10:49 UTC (permalink / raw)
To: broonie
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob,
sameo, lee.jones, lgirdwood, patches, linux-kernel
Currently, MICVDD only binds because it is both the regulator name and
the consumer name and we will always match against the regulator name
regardless of the consumer device. If the regulator was renamed using
the init_data ASoC will no longer be able to locate the supply, as it
will be looking on the CODEC device where as the MICVDD consumer is on
the Arizona device. Add a mapping as we do for the other regulators.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
drivers/mfd/arizona-core.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
index 0bab354..06e3f1b 100644
--- a/drivers/mfd/arizona-core.c
+++ b/drivers/mfd/arizona-core.c
@@ -589,6 +589,7 @@ static const char *wm5102_supplies[] = {
"CPVDD",
"SPKVDDL",
"SPKVDDR",
+ "MICVDD",
};
static const struct mfd_cell wm5102_devs[] = {
--
1.7.2.5
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH 7/8] mfd: wm8997: Add registers for high power mode
2014-03-18 10:49 [PATCH 0/8] Arizona regulator updates Charles Keepax
` (5 preceding siblings ...)
2014-03-18 10:49 ` [PATCH 6/8] mfd: arizona: Add MICVDD to mapped regulators Charles Keepax
@ 2014-03-18 10:49 ` Charles Keepax
2014-03-18 10:49 ` [PATCH 8/8] regulator: arizona-ldo1: Correct default regulator init_data Charles Keepax
7 siblings, 0 replies; 15+ messages in thread
From: Charles Keepax @ 2014-03-18 10:49 UTC (permalink / raw)
To: broonie
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob,
sameo, lee.jones, lgirdwood, patches, linux-kernel
Some output configurations can require a 50Mhz SYSCLK which requires
DCVDD to be 1.8V. This patch adds the registers necessary for
supporting this operational mode.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
drivers/mfd/wm8997-tables.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/mfd/wm8997-tables.c b/drivers/mfd/wm8997-tables.c
index 5aa8076..c9c6519 100644
--- a/drivers/mfd/wm8997-tables.c
+++ b/drivers/mfd/wm8997-tables.c
@@ -846,6 +846,7 @@ static bool wm8997_readable_register(struct device *dev, unsigned int reg)
case ARIZONA_RATE_ESTIMATOR_3:
case ARIZONA_RATE_ESTIMATOR_4:
case ARIZONA_RATE_ESTIMATOR_5:
+ case ARIZONA_DYNAMIC_FREQUENCY_SCALING_1:
case ARIZONA_FLL1_CONTROL_1:
case ARIZONA_FLL1_CONTROL_2:
case ARIZONA_FLL1_CONTROL_3:
@@ -880,6 +881,7 @@ static bool wm8997_readable_register(struct device *dev, unsigned int reg)
case ARIZONA_FLL2_GPIO_CLOCK:
case ARIZONA_MIC_CHARGE_PUMP_1:
case ARIZONA_LDO1_CONTROL_1:
+ case ARIZONA_LDO1_CONTROL_2:
case ARIZONA_LDO2_CONTROL_1:
case ARIZONA_MIC_BIAS_CTRL_1:
case ARIZONA_MIC_BIAS_CTRL_2:
--
1.7.2.5
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH 8/8] regulator: arizona-ldo1: Correct default regulator init_data
2014-03-18 10:49 [PATCH 0/8] Arizona regulator updates Charles Keepax
` (6 preceding siblings ...)
2014-03-18 10:49 ` [PATCH 7/8] mfd: wm8997: Add registers for high power mode Charles Keepax
@ 2014-03-18 10:49 ` Charles Keepax
2014-03-18 11:21 ` Mark Brown
7 siblings, 1 reply; 15+ messages in thread
From: Charles Keepax @ 2014-03-18 10:49 UTC (permalink / raw)
To: broonie
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob,
sameo, lee.jones, lgirdwood, patches, linux-kernel
Both 5102 and 8997 have the regulator capable of supplying 1.8V, and the
voltage step from the 5110 regulator is different from what is specified
in the default description. This patch updates the default regulator
description to match 5110 and selects the 1.8V capable description for
8997.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
drivers/regulator/arizona-ldo1.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c
index a67013f..9a3c292 100644
--- a/drivers/regulator/arizona-ldo1.c
+++ b/drivers/regulator/arizona-ldo1.c
@@ -154,11 +154,9 @@ static const struct regulator_desc arizona_ldo1 = {
.vsel_reg = ARIZONA_LDO1_CONTROL_1,
.vsel_mask = ARIZONA_LDO1_VSEL_MASK,
- .bypass_reg = ARIZONA_LDO1_CONTROL_1,
- .bypass_mask = ARIZONA_LDO1_BYPASS,
.min_uV = 900000,
- .uV_step = 50000,
- .n_voltages = 7,
+ .uV_step = 25000,
+ .n_voltages = 13,
.enable_time = 500,
.owner = THIS_MODULE,
@@ -261,6 +259,7 @@ static int arizona_ldo1_probe(struct platform_device *pdev)
*/
switch (arizona->type) {
case WM5102:
+ case WM8997:
desc = &arizona_ldo1_hc;
ldo1->init_data = arizona_ldo1_dvfs;
break;
--
1.7.2.5
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [PATCH 8/8] regulator: arizona-ldo1: Correct default regulator init_data
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
0 siblings, 0 replies; 15+ messages in thread
From: Mark Brown @ 2014-03-18 11:21 UTC (permalink / raw)
To: Charles Keepax
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob,
sameo, lee.jones, lgirdwood, patches, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 429 bytes --]
On Tue, Mar 18, 2014 at 10:49:17AM +0000, Charles Keepax wrote:
> Both 5102 and 8997 have the regulator capable of supplying 1.8V, and the
> voltage step from the 5110 regulator is different from what is specified
> in the default description. This patch updates the default regulator
> description to match 5110 and selects the 1.8V capable description for
> 8997.
Applied, thanks. This should probably have been two patches.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread