* [PATCH 0/6] Arizona Regulator Updates v5 @ 2014-04-01 8:27 Charles Keepax 2014-04-01 8:27 ` [PATCH 1/6] mfd: arizona: Factor out read of device tree GPIOs Charles Keepax ` (5 more replies) 0 siblings, 6 replies; 16+ messages in thread From: Charles Keepax @ 2014-04-01 8:27 UTC (permalink / raw) To: broonie Cc: lee.jones, robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob, sameo, lgirdwood, ckeepax, devicetree, linux-kernel Hi, This series of patches are small fixes/improvements to the Arizona regulators. The main thing added is proper device tree bindings for getting the regulator init_data. Changes Since v4: - Added a subnode section in the binding documentation and moved the sub-node documentation into that. Thanks, Charles Charles Keepax (6): mfd: arizona: Factor out read of device tree GPIOs regulator: arizona-ldo1: Move setup processing from arizona-core regulator: arizona-ldo1: Add processing of init_data from device tree mfd: arizona: Update DT binding to support LDO1 init_data regulator: arizona-micsupp: Add processing of init_data from device tree mfd: arizona: Update DT binding to support MICVDD init_data Documentation/devicetree/bindings/mfd/arizona.txt | 10 +++ drivers/mfd/arizona-core.c | 43 +++++++----- drivers/regulator/arizona-ldo1.c | 73 +++++++++++++++++++++ drivers/regulator/arizona-micsupp.c | 53 +++++++++++++++ include/linux/mfd/arizona/core.h | 3 + 5 files changed, 165 insertions(+), 17 deletions(-) -- 1.7.2.5 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 1/6] mfd: arizona: Factor out read of device tree GPIOs 2014-04-01 8:27 [PATCH 0/6] Arizona Regulator Updates v5 Charles Keepax @ 2014-04-01 8:27 ` Charles Keepax 2014-04-15 10:25 ` Lee Jones 2014-04-01 8:27 ` [PATCH 2/6] regulator: arizona-ldo1: Move setup processing from arizona-core Charles Keepax ` (4 subsequent siblings) 5 siblings, 1 reply; 16+ messages in thread From: Charles Keepax @ 2014-04-01 8:27 UTC (permalink / raw) To: broonie Cc: lee.jones, robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob, sameo, lgirdwood, ckeepax, devicetree, linux-kernel This patch factors 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..8ad4373 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] 16+ messages in thread
* Re: [PATCH 1/6] mfd: arizona: Factor out read of device tree GPIOs 2014-04-01 8:27 ` [PATCH 1/6] mfd: arizona: Factor out read of device tree GPIOs Charles Keepax @ 2014-04-15 10:25 ` Lee Jones 2014-04-15 13:01 ` Charles Keepax 0 siblings, 1 reply; 16+ messages in thread From: Lee Jones @ 2014-04-15 10:25 UTC (permalink / raw) To: Charles Keepax Cc: broonie, robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob, sameo, lgirdwood, devicetree, linux-kernel On Tue, 01 Apr 2014, Charles Keepax wrote: > This patch factors 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..8ad4373 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; > +} Hmm.. me no likey! How about: +void arizona_of_get_named_gpio(struct arizona *arizona, const char *prop, + bool mandatory, int *gpio) +{ + *gpio = of_get_named_gpio(arizona->dev->of_node, prop, 0); + if (*gpio < 0) { + if (mandatory) + dev_err(arizona->dev, + "Mandatory DT gpio %s missing/malformed: %d\n", + prop, *gpio); + *gpio = 0; + } +} > +EXPORT_SYMBOL_GPL(arizona_of_get_named_gpio); > + Are you sure you're going to use this externally? NB: I haven't looked at the remainder of the set yet. > 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); I guess this pdata is populated by DT? -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/6] mfd: arizona: Factor out read of device tree GPIOs 2014-04-15 10:25 ` Lee Jones @ 2014-04-15 13:01 ` Charles Keepax [not found] ` <20140415130140.GA27294-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> 0 siblings, 1 reply; 16+ messages in thread From: Charles Keepax @ 2014-04-15 13:01 UTC (permalink / raw) To: Lee Jones Cc: broonie-DgEjT+Ai2ygdnm+yROfE0A, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg, galak-sgV2jX0FEOL9JmXXK+q4OQ, rob-VoJi6FS/r0vR7s880joybQ, sameo-VuQAYsv1563Yd54FQh9/CA, lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Tue, Apr 15, 2014 at 11:25:27AM +0100, Lee Jones wrote: > On Tue, 01 Apr 2014, Charles Keepax wrote: > > > This patch factors out the reading of GPIOs for the Arizona devices > > into a helper function. > > > > Signed-off-by: Charles Keepax <ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> > > --- > > 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..8ad4373 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; > > +} > > Hmm.. me no likey! > > How about: > > +void arizona_of_get_named_gpio(struct arizona *arizona, const char *prop, > + bool mandatory, int *gpio) > +{ > + *gpio = of_get_named_gpio(arizona->dev->of_node, prop, 0); > + if (*gpio < 0) { > + if (mandatory) > + dev_err(arizona->dev, > + "Mandatory DT gpio %s missing/malformed: %d\n", > + prop, *gpio); > + *gpio = 0; > + } > +} Indeed that is nicer I will respin and change it. > > > +EXPORT_SYMBOL_GPL(arizona_of_get_named_gpio); > > + > > Are you sure you're going to use this externally? > > NB: I haven't looked at the remainder of the set yet. Yeah we move the ldoena gpio into the LDO driver, and later we will be adding a polarity GPIO into the extcon driver. > > > 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); > > I guess this pdata is populated by DT? Yeah that is correct, the Arizona driver populates the pdata from the DT then the rest of the driver just uses the pdata in both DT and pdata cases. Thanks, Charles -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 16+ messages in thread
[parent not found: <20140415130140.GA27294-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>]
* Re: [PATCH 1/6] mfd: arizona: Factor out read of device tree GPIOs [not found] ` <20140415130140.GA27294-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> @ 2014-04-16 9:25 ` Lee Jones 0 siblings, 0 replies; 16+ messages in thread From: Lee Jones @ 2014-04-16 9:25 UTC (permalink / raw) To: Charles Keepax Cc: broonie-DgEjT+Ai2ygdnm+yROfE0A, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg, galak-sgV2jX0FEOL9JmXXK+q4OQ, rob-VoJi6FS/r0vR7s880joybQ, sameo-VuQAYsv1563Yd54FQh9/CA, lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA > > > This patch factors out the reading of GPIOs for the Arizona devices > > > into a helper function. > > > > > > Signed-off-by: Charles Keepax <ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxiMEWR6Nv5iY@public.gmane.orgm> > > > --- > > > drivers/mfd/arizona-core.c | 33 ++++++++++++++++++++++++--------- > > > include/linux/mfd/arizona/core.h | 3 +++ > > > 2 files changed, 27 insertions(+), 9 deletions(-) [...] > > > +EXPORT_SYMBOL_GPL(arizona_of_get_named_gpio); > > > + > > > > Are you sure you're going to use this externally? > > > > NB: I haven't looked at the remainder of the set yet. > > Yeah we move the ldoena gpio into the LDO driver, and later we > will be adding a polarity GPIO into the extcon driver. Okay, just checking. > > > 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); > > > > I guess this pdata is populated by DT? > > Yeah that is correct, the Arizona driver populates the pdata from > the DT then the rest of the driver just uses the pdata in both DT > and pdata cases. Sounds ugly when you put it like that, but I know that a _lot_ of other drivers do the same thing. -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 2/6] regulator: arizona-ldo1: Move setup processing from arizona-core 2014-04-01 8:27 [PATCH 0/6] Arizona Regulator Updates v5 Charles Keepax 2014-04-01 8:27 ` [PATCH 1/6] mfd: arizona: Factor out read of device tree GPIOs Charles Keepax @ 2014-04-01 8:27 ` Charles Keepax [not found] ` <1396340845-24060-3-git-send-email-ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> [not found] ` <1396340845-24060-1-git-send-email-ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> ` (3 subsequent siblings) 5 siblings, 1 reply; 16+ messages in thread From: Charles Keepax @ 2014-04-01 8:27 UTC (permalink / raw) To: broonie Cc: lee.jones, robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob, sameo, lgirdwood, ckeepax, devicetree, 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 | 12 +++--------- drivers/regulator/arizona-ldo1.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c index 8ad4373..0096261 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", @@ -671,6 +670,9 @@ int arizona_dev_init(struct arizona *arizona) return -EINVAL; } + /* Mark DCVDD as external, LDO1 driver will clear if internal */ + arizona->external_dcvdd = true; + ret = mfd_add_devices(arizona->dev, -1, early_devs, ARRAY_SIZE(early_devs), NULL, 0, NULL); if (ret != 0) { @@ -870,14 +872,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 b1033d3..211af83 100644 --- a/drivers/regulator/arizona-ldo1.c +++ b/drivers/regulator/arizona-ldo1.c @@ -178,6 +178,22 @@ static const struct regulator_init_data arizona_ldo1_default = { .num_consumer_supplies = 1, }; +#ifdef CONFIG_OF +static int arizona_ldo1_of_get_pdata(struct arizona *arizona) +{ + struct arizona_pdata *pdata = &arizona->pdata; + + arizona_of_get_named_gpio(arizona, "wlf,ldoena", true, &pdata->ldoena); + + return 0; +} +#else +static inline int arizona_ldo1_of_get_pdata(struct arizona *arizona) +{ + return 0; +} +#endif + static int arizona_ldo1_probe(struct platform_device *pdev) { struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); @@ -186,6 +202,8 @@ static int arizona_ldo1_probe(struct platform_device *pdev) struct arizona_ldo1 *ldo1; int ret; + arizona->external_dcvdd = false; + ldo1 = devm_kzalloc(&pdev->dev, sizeof(*ldo1), GFP_KERNEL); if (!ldo1) return -ENOMEM; @@ -216,6 +234,13 @@ static int arizona_ldo1_probe(struct platform_device *pdev) config.dev = arizona->dev; config.driver_data = ldo1; config.regmap = arizona->regmap; + + if (!dev_get_platdata(arizona->dev)) { + ret = arizona_ldo1_of_get_pdata(arizona); + if (ret < 0) + return ret; + } + config.ena_gpio = arizona->pdata.ldoena; if (arizona->pdata.ldo1) @@ -223,6 +248,13 @@ static int arizona_ldo1_probe(struct platform_device *pdev) else config.init_data = &ldo1->init_data; + /* + * LDO1 can only be used to supply DCVDD so if it has no + * consumers then DCVDD is supplied externally. + */ + if (config.init_data->num_consumer_supplies == 0) + arizona->external_dcvdd = true; + ldo1->regulator = devm_regulator_register(&pdev->dev, desc, &config); if (IS_ERR(ldo1->regulator)) { ret = PTR_ERR(ldo1->regulator); -- 1.7.2.5 ^ permalink raw reply related [flat|nested] 16+ messages in thread
[parent not found: <1396340845-24060-3-git-send-email-ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>]
* Re: [PATCH 2/6] regulator: arizona-ldo1: Move setup processing from arizona-core [not found] ` <1396340845-24060-3-git-send-email-ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> @ 2014-04-15 10:12 ` Lee Jones 2014-04-15 12:13 ` Mark Brown 2014-04-15 13:10 ` Charles Keepax 0 siblings, 2 replies; 16+ messages in thread From: Lee Jones @ 2014-04-15 10:12 UTC (permalink / raw) To: Charles Keepax Cc: broonie-DgEjT+Ai2ygdnm+yROfE0A, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg, galak-sgV2jX0FEOL9JmXXK+q4OQ, rob-VoJi6FS/r0vR7s880joybQ, sameo-VuQAYsv1563Yd54FQh9/CA, lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Tue, 01 Apr 2014, Charles Keepax wrote: > 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-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> > --- > drivers/mfd/arizona-core.c | 12 +++--------- > drivers/regulator/arizona-ldo1.c | 32 ++++++++++++++++++++++++++++++++ > 2 files changed, 35 insertions(+), 9 deletions(-) [...] > diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c > index b1033d3..211af83 100644 > --- a/drivers/regulator/arizona-ldo1.c > +++ b/drivers/regulator/arizona-ldo1.c > @@ -178,6 +178,22 @@ static const struct regulator_init_data arizona_ldo1_default = { > .num_consumer_supplies = 1, > }; > > +#ifdef CONFIG_OF > +static int arizona_ldo1_of_get_pdata(struct arizona *arizona) > +{ > + struct arizona_pdata *pdata = &arizona->pdata; > + > + arizona_of_get_named_gpio(arizona, "wlf,ldoena", true, &pdata->ldoena); > + > + return 0; > +} > +#else > +static inline int arizona_ldo1_of_get_pdata(struct arizona *arizona) > +{ > + return 0; > +} > +#endif > + I think "if (IS_ENABLED(CONFIG_OF))" is preferred now, but I guess that's up to Mark. > static int arizona_ldo1_probe(struct platform_device *pdev) > { > struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); > @@ -186,6 +202,8 @@ static int arizona_ldo1_probe(struct platform_device *pdev) > struct arizona_ldo1 *ldo1; > int ret; > > + arizona->external_dcvdd = false; > + > ldo1 = devm_kzalloc(&pdev->dev, sizeof(*ldo1), GFP_KERNEL); > if (!ldo1) > return -ENOMEM; > @@ -216,6 +234,13 @@ static int arizona_ldo1_probe(struct platform_device *pdev) > config.dev = arizona->dev; > config.driver_data = ldo1; > config.regmap = arizona->regmap; > + > + if (!dev_get_platdata(arizona->dev)) { Here ^ > + ret = arizona_ldo1_of_get_pdata(arizona); > + if (ret < 0) > + return ret; > + } > + For the MFD changes: Acked-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> Mark, Post acceptance, I'd prefer to create an IB for this patch-set. -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 2/6] regulator: arizona-ldo1: Move setup processing from arizona-core 2014-04-15 10:12 ` Lee Jones @ 2014-04-15 12:13 ` Mark Brown 2014-04-15 13:10 ` Charles Keepax 1 sibling, 0 replies; 16+ messages in thread From: Mark Brown @ 2014-04-15 12:13 UTC (permalink / raw) To: Lee Jones Cc: Charles Keepax, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg, galak-sgV2jX0FEOL9JmXXK+q4OQ, rob-VoJi6FS/r0vR7s880joybQ, sameo-VuQAYsv1563Yd54FQh9/CA, lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 263 bytes --] On Tue, Apr 15, 2014 at 11:12:00AM +0100, Lee Jones wrote: > On Tue, 01 Apr 2014, Charles Keepax wrote: > > +#ifdef CONFIG_OF > I think "if (IS_ENABLED(CONFIG_OF))" is preferred now, but I guess > that's up to Mark. Yes, it doesn't matter for booleans though. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 2/6] regulator: arizona-ldo1: Move setup processing from arizona-core 2014-04-15 10:12 ` Lee Jones 2014-04-15 12:13 ` Mark Brown @ 2014-04-15 13:10 ` Charles Keepax 1 sibling, 0 replies; 16+ messages in thread From: Charles Keepax @ 2014-04-15 13:10 UTC (permalink / raw) To: Lee Jones Cc: broonie, robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob, sameo, lgirdwood, devicetree, linux-kernel On Tue, Apr 15, 2014 at 11:12:00AM +0100, Lee Jones wrote: > On Tue, 01 Apr 2014, Charles Keepax wrote: > > > 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 | 12 +++--------- > > drivers/regulator/arizona-ldo1.c | 32 ++++++++++++++++++++++++++++++++ > > 2 files changed, 35 insertions(+), 9 deletions(-) > > [...] > > > diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c > > index b1033d3..211af83 100644 > > --- a/drivers/regulator/arizona-ldo1.c > > +++ b/drivers/regulator/arizona-ldo1.c > > @@ -178,6 +178,22 @@ static const struct regulator_init_data arizona_ldo1_default = { > > .num_consumer_supplies = 1, > > }; > > > > +#ifdef CONFIG_OF > > +static int arizona_ldo1_of_get_pdata(struct arizona *arizona) > > +{ > > + struct arizona_pdata *pdata = &arizona->pdata; > > + > > + arizona_of_get_named_gpio(arizona, "wlf,ldoena", true, &pdata->ldoena); > > + > > + return 0; > > +} > > +#else > > +static inline int arizona_ldo1_of_get_pdata(struct arizona *arizona) > > +{ > > + return 0; > > +} > > +#endif > > + > > I think "if (IS_ENABLED(CONFIG_OF))" is preferred now, but I guess > that's up to Mark. I am happy to respin if this is preferred. Thanks, Charles ^ permalink raw reply [flat|nested] 16+ messages in thread
[parent not found: <1396340845-24060-1-git-send-email-ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>]
* [PATCH 3/6] regulator: arizona-ldo1: Add processing of init_data from device tree [not found] ` <1396340845-24060-1-git-send-email-ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> @ 2014-04-01 8:27 ` Charles Keepax 0 siblings, 0 replies; 16+ messages in thread From: Charles Keepax @ 2014-04-01 8:27 UTC (permalink / raw) To: broonie-DgEjT+Ai2ygdnm+yROfE0A Cc: lee.jones-QSEj5FYQhm4dnm+yROfE0A, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg, galak-sgV2jX0FEOL9JmXXK+q4OQ, rob-VoJi6FS/r0vR7s880joybQ, sameo-VuQAYsv1563Yd54FQh9/CA, lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA Signed-off-by: Charles Keepax <ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> --- drivers/regulator/arizona-ldo1.c | 47 +++++++++++++++++++++++++++++++++++-- 1 files changed, 44 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c index 211af83..e23a95f 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> @@ -179,19 +180,56 @@ static const struct regulator_init_data arizona_ldo1_default = { }; #ifdef CONFIG_OF -static int arizona_ldo1_of_get_pdata(struct arizona *arizona) +static int arizona_ldo1_of_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 *init_node, *dcvdd_node; + struct regulator_init_data *init_data; arizona_of_get_named_gpio(arizona, "wlf,ldoena", true, &pdata->ldoena); + init_node = of_get_child_by_name(arizona->dev->of_node, "ldo1"); + dcvdd_node = of_parse_phandle(arizona->dev->of_node, "DCVDD-supply", 0); + + if (init_node) { + config->of_node = init_node; + + init_data = of_get_regulator_init_data(arizona->dev, init_node); + + if (init_data) { + init_data->consumer_supplies = &ldo1->supply; + init_data->num_consumer_supplies = 1; + + if (dcvdd_node && dcvdd_node != init_node) + arizona->external_dcvdd = true; + + pdata->ldo1 = init_data; + } + } else if (dcvdd_node) { + arizona->external_dcvdd = true; + } + + of_node_put(dcvdd_node); + return 0; } + +static void arizona_ldo1_of_put_pdata(struct regulator_config *config) +{ + of_node_put(config->of_node); +} #else -static inline int arizona_ldo1_of_get_pdata(struct arizona *arizona) +static inline int arizona_ldo1_of_get_pdata(struct arizona *arizona, + struct regulator_config *config) { return 0; } + +static inline void arizona_ldo1_of_put_pdata(struct regulator_config *config) +{ +} #endif static int arizona_ldo1_probe(struct platform_device *pdev) @@ -236,7 +274,7 @@ static int arizona_ldo1_probe(struct platform_device *pdev) config.regmap = arizona->regmap; if (!dev_get_platdata(arizona->dev)) { - ret = arizona_ldo1_of_get_pdata(arizona); + ret = arizona_ldo1_of_get_pdata(arizona, &config); if (ret < 0) return ret; } @@ -263,6 +301,9 @@ static int arizona_ldo1_probe(struct platform_device *pdev) return ret; } + if (!dev_get_platdata(arizona->dev)) + arizona_ldo1_of_put_pdata(&config); + platform_set_drvdata(pdev, ldo1); return 0; -- 1.7.2.5 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 4/6] mfd: arizona: Update DT binding to support LDO1 init_data 2014-04-01 8:27 [PATCH 0/6] Arizona Regulator Updates v5 Charles Keepax ` (2 preceding siblings ...) [not found] ` <1396340845-24060-1-git-send-email-ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> @ 2014-04-01 8:27 ` Charles Keepax 2014-04-01 8:27 ` [PATCH 5/6] regulator: arizona-micsupp: Add processing of init_data from device tree Charles Keepax 2014-04-01 8:27 ` [PATCH 6/6] mfd: arizona: Update DT binding to support MICVDD init_data Charles Keepax 5 siblings, 0 replies; 16+ messages in thread From: Charles Keepax @ 2014-04-01 8:27 UTC (permalink / raw) To: broonie Cc: lee.jones, robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob, sameo, lgirdwood, ckeepax, devicetree, linux-kernel Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> --- Documentation/devicetree/bindings/mfd/arizona.txt | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt b/Documentation/devicetree/bindings/mfd/arizona.txt index 0e295c9..aa16489 100644 --- a/Documentation/devicetree/bindings/mfd/arizona.txt +++ b/Documentation/devicetree/bindings/mfd/arizona.txt @@ -40,6 +40,14 @@ Optional properties: the chip default will be used. If present exactly five values must be specified. + - DCVDD-supply : Power supply, only needs to be specified if DCVDD is being + externally supplied. As covered in + Documentation/devicetree/bindings/regulator/regulator.txt + +Optional subnodes: + - ldo1 : Initial data for the LDO1 regulator, as covered in + Documentation/devicetree/bindings/regulator/regulator.txt + Example: codec: wm5102@1a { -- 1.7.2.5 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 5/6] regulator: arizona-micsupp: Add processing of init_data from device tree 2014-04-01 8:27 [PATCH 0/6] Arizona Regulator Updates v5 Charles Keepax ` (3 preceding siblings ...) 2014-04-01 8:27 ` [PATCH 4/6] mfd: arizona: Update DT binding to support LDO1 init_data Charles Keepax @ 2014-04-01 8:27 ` Charles Keepax 2014-04-01 8:27 ` [PATCH 6/6] mfd: arizona: Update DT binding to support MICVDD init_data Charles Keepax 5 siblings, 0 replies; 16+ messages in thread From: Charles Keepax @ 2014-04-01 8:27 UTC (permalink / raw) To: broonie Cc: lee.jones, robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob, sameo, lgirdwood, ckeepax, devicetree, linux-kernel Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> --- drivers/regulator/arizona-micsupp.c | 53 +++++++++++++++++++++++++++++++++++ 1 files changed, 53 insertions(+), 0 deletions(-) diff --git a/drivers/regulator/arizona-micsupp.c b/drivers/regulator/arizona-micsupp.c index 6fdd9bf..5225470 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,49 @@ static const struct regulator_init_data arizona_micsupp_ext_default = { .num_consumer_supplies = 1, }; +#ifdef CONFIG_OF +static int arizona_micsupp_of_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; + struct regulator_init_data *init_data; + + np = of_get_child_by_name(arizona->dev->of_node, "micvdd"); + + if (np) { + config->of_node = np; + + init_data = of_get_regulator_init_data(arizona->dev, np); + + if (init_data) { + init_data->consumer_supplies = &micsupp->supply; + init_data->num_consumer_supplies = 1; + + pdata->micvdd = init_data; + } + } + + return 0; +} + +static void arizona_micsupp_of_put_pdata(struct regulator_config *config) +{ + of_node_put(config->of_node); +} +#else +static inline int arizona_micsupp_of_get_pdata(struct arizona *arizona, + struct regulator_config *config) +{ + return 0; +} + +static inline void arizona_micsupp_of_put_pdata(struct regulator_config *config) +{ +} +#endif + static int arizona_micsupp_probe(struct platform_device *pdev) { struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); @@ -234,6 +278,12 @@ static int arizona_micsupp_probe(struct platform_device *pdev) config.driver_data = micsupp; config.regmap = arizona->regmap; + if (!dev_get_platdata(arizona->dev)) { + ret = arizona_micsupp_of_get_pdata(arizona, &config); + if (ret < 0) + return ret; + } + if (arizona->pdata.micvdd) config.init_data = arizona->pdata.micvdd; else @@ -253,6 +303,9 @@ static int arizona_micsupp_probe(struct platform_device *pdev) return ret; } + if (!dev_get_platdata(arizona->dev)) + arizona_micsupp_of_put_pdata(&config); + platform_set_drvdata(pdev, micsupp); return 0; -- 1.7.2.5 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 6/6] mfd: arizona: Update DT binding to support MICVDD init_data 2014-04-01 8:27 [PATCH 0/6] Arizona Regulator Updates v5 Charles Keepax ` (4 preceding siblings ...) 2014-04-01 8:27 ` [PATCH 5/6] regulator: arizona-micsupp: Add processing of init_data from device tree Charles Keepax @ 2014-04-01 8:27 ` Charles Keepax 5 siblings, 0 replies; 16+ messages in thread From: Charles Keepax @ 2014-04-01 8:27 UTC (permalink / raw) To: broonie Cc: lee.jones, robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob, sameo, lgirdwood, ckeepax, devicetree, linux-kernel Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> --- Documentation/devicetree/bindings/mfd/arizona.txt | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt b/Documentation/devicetree/bindings/mfd/arizona.txt index aa16489..10f87a29 100644 --- a/Documentation/devicetree/bindings/mfd/arizona.txt +++ b/Documentation/devicetree/bindings/mfd/arizona.txt @@ -40,13 +40,15 @@ Optional properties: the chip default will be used. If present exactly five values must be specified. - - 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 Optional subnodes: - ldo1 : Initial data for the LDO1 regulator, as covered in Documentation/devicetree/bindings/regulator/regulator.txt + - micvdd : Initial data for the MICVDD regulator, as covered in + Documentation/devicetree/bindings/regulator/regulator.txt Example: -- 1.7.2.5 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 0/6] Arizona Regulator Updates v6 @ 2014-04-16 9:01 Charles Keepax 2014-04-16 9:01 ` [PATCH 3/6] regulator: arizona-ldo1: Add processing of init_data from device tree Charles Keepax 0 siblings, 1 reply; 16+ messages in thread From: Charles Keepax @ 2014-04-16 9:01 UTC (permalink / raw) To: broonie-DgEjT+Ai2ygdnm+yROfE0A Cc: lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg, galak-sgV2jX0FEOL9JmXXK+q4OQ, rdunlap-wEGCiKHe2LqWVfeAwA7xHQ, sameo-VuQAYsv1563Yd54FQh9/CA, lee.jones-QSEj5FYQhm4dnm+yROfE0A, linux-kernel-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E Hi, This series of patches are small fixes/improvements to the Arizona regulators. The main thing added is proper device tree bindings for getting the regulator init_data. Changes Since v5: - Use IS_ENABLED rather than ifdef for OF specific code - Tidy up arizona_of_get_named_gpio base on comments by Lee Jones Thanks, Charles Charles Keepax (6): mfd: arizona: Factor out read of device tree GPIOs regulator: arizona-ldo1: Move setup processing from arizona-core regulator: arizona-ldo1: Add processing of init_data from device tree mfd: arizona: Update DT binding to support LDO1 init_data regulator: arizona-micsupp: Add processing of init_data from device tree mfd: arizona: Update DT binding to support MICVDD init_data Documentation/devicetree/bindings/mfd/arizona.txt | 10 ++++ drivers/mfd/arizona-core.c | 41 +++++++++------ drivers/regulator/arizona-ldo1.c | 57 +++++++++++++++++++++ drivers/regulator/arizona-micsupp.c | 37 +++++++++++++ include/linux/mfd/arizona/core.h | 3 + 5 files changed, 131 insertions(+), 17 deletions(-) -- 1.7.2.5 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 3/6] regulator: arizona-ldo1: Add processing of init_data from device tree 2014-04-16 9:01 [PATCH 0/6] Arizona Regulator Updates v6 Charles Keepax @ 2014-04-16 9:01 ` Charles Keepax [not found] ` <1397638902-7576-4-git-send-email-ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> 0 siblings, 1 reply; 16+ messages in thread From: Charles Keepax @ 2014-04-16 9:01 UTC (permalink / raw) To: broonie Cc: lgirdwood, robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rdunlap, sameo, lee.jones, linux-kernel, devicetree, ckeepax Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> --- drivers/regulator/arizona-ldo1.c | 34 ++++++++++++++++++++++++++++++++-- 1 files changed, 32 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c index 2248733..d3787e1 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> @@ -178,12 +179,39 @@ static const struct regulator_init_data arizona_ldo1_default = { .num_consumer_supplies = 1, }; -static int arizona_ldo1_of_get_pdata(struct arizona *arizona) +static int arizona_ldo1_of_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 *init_node, *dcvdd_node; + struct regulator_init_data *init_data; pdata->ldoena = arizona_of_get_named_gpio(arizona, "wlf,ldoena", true); + init_node = of_get_child_by_name(arizona->dev->of_node, "ldo1"); + dcvdd_node = of_parse_phandle(arizona->dev->of_node, "DCVDD-supply", 0); + + if (init_node) { + config->of_node = init_node; + + init_data = of_get_regulator_init_data(arizona->dev, init_node); + + if (init_data) { + init_data->consumer_supplies = &ldo1->supply; + init_data->num_consumer_supplies = 1; + + if (dcvdd_node && dcvdd_node != init_node) + arizona->external_dcvdd = true; + + pdata->ldo1 = init_data; + } + } else if (dcvdd_node) { + arizona->external_dcvdd = true; + } + + of_node_put(dcvdd_node); + return 0; } @@ -230,7 +258,7 @@ static int arizona_ldo1_probe(struct platform_device *pdev) if (IS_ENABLED(CONFIG_OF)) { if (!dev_get_platdata(arizona->dev)) { - ret = arizona_ldo1_of_get_pdata(arizona); + ret = arizona_ldo1_of_get_pdata(arizona, &config); if (ret < 0) return ret; } @@ -258,6 +286,8 @@ static int arizona_ldo1_probe(struct platform_device *pdev) return ret; } + of_node_put(config.of_node); + platform_set_drvdata(pdev, ldo1); return 0; -- 1.7.2.5 ^ permalink raw reply related [flat|nested] 16+ messages in thread
[parent not found: <1397638902-7576-4-git-send-email-ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>]
* Re: [PATCH 3/6] regulator: arizona-ldo1: Add processing of init_data from device tree [not found] ` <1397638902-7576-4-git-send-email-ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> @ 2014-04-18 17:39 ` Mark Brown 0 siblings, 0 replies; 16+ messages in thread From: Mark Brown @ 2014-04-18 17:39 UTC (permalink / raw) To: Charles Keepax Cc: lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg, galak-sgV2jX0FEOL9JmXXK+q4OQ, rdunlap-wEGCiKHe2LqWVfeAwA7xHQ, sameo-VuQAYsv1563Yd54FQh9/CA, lee.jones-QSEj5FYQhm4dnm+yROfE0A, linux-kernel-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 343 bytes --] On Wed, Apr 16, 2014 at 10:01:39AM +0100, Charles Keepax wrote: > Signed-off-by: Charles Keepax <ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> Applied, but again you really need better changelogs - processing of init_data for what? For most regulators init_data is handled totally transparently so this isn't normal. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 0/6] Arizona Regulator Updates v4 @ 2014-03-31 11:59 Charles Keepax [not found] ` <1396267187-30580-1-git-send-email-ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> 0 siblings, 1 reply; 16+ messages in thread From: Charles Keepax @ 2014-03-31 11:59 UTC (permalink / raw) To: broonie Cc: lee.jones, robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, rob, sameo, lgirdwood, ckeepax, devicetree, linux-kernel Hi, This series of patches are small fixes/improvements to the Arizona regulators. The main thing added is proper device tree bindings for getting the regulator init_data. Changes Since v3: - We now only process the DT information if there is no pdata, similar to arizona-core. - DT binding documention factored out into a seperate patch as requested. Thanks, Charles Charles Keepax (6): mfd: arizona: Factor out read of device tree GPIOs regulator: arizona-ldo1: Move setup processing from arizona-core regulator: arizona-ldo1: Add processing of init_data from device tree mfd: arizona: Update DT binding to support LDO1 init_data regulator: arizona-micsupp: Add processing of init_data from device tree mfd: arizona: Update DT binding to support MICVDD init_data Documentation/devicetree/bindings/mfd/arizona.txt | 9 +++ drivers/mfd/arizona-core.c | 43 +++++++----- drivers/regulator/arizona-ldo1.c | 73 +++++++++++++++++++++ drivers/regulator/arizona-micsupp.c | 53 +++++++++++++++ include/linux/mfd/arizona/core.h | 3 + 5 files changed, 164 insertions(+), 17 deletions(-) -- 1.7.2.5 ^ permalink raw reply [flat|nested] 16+ messages in thread
[parent not found: <1396267187-30580-1-git-send-email-ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>]
* [PATCH 3/6] regulator: arizona-ldo1: Add processing of init_data from device tree [not found] ` <1396267187-30580-1-git-send-email-ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> @ 2014-03-31 11:59 ` Charles Keepax 0 siblings, 0 replies; 16+ messages in thread From: Charles Keepax @ 2014-03-31 11:59 UTC (permalink / raw) To: broonie-DgEjT+Ai2ygdnm+yROfE0A Cc: lee.jones-QSEj5FYQhm4dnm+yROfE0A, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg, galak-sgV2jX0FEOL9JmXXK+q4OQ, rob-VoJi6FS/r0vR7s880joybQ, sameo-VuQAYsv1563Yd54FQh9/CA, lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA Signed-off-by: Charles Keepax <ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> --- drivers/regulator/arizona-ldo1.c | 47 +++++++++++++++++++++++++++++++++++-- 1 files changed, 44 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c index 211af83..e23a95f 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> @@ -179,19 +180,56 @@ static const struct regulator_init_data arizona_ldo1_default = { }; #ifdef CONFIG_OF -static int arizona_ldo1_of_get_pdata(struct arizona *arizona) +static int arizona_ldo1_of_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 *init_node, *dcvdd_node; + struct regulator_init_data *init_data; arizona_of_get_named_gpio(arizona, "wlf,ldoena", true, &pdata->ldoena); + init_node = of_get_child_by_name(arizona->dev->of_node, "ldo1"); + dcvdd_node = of_parse_phandle(arizona->dev->of_node, "DCVDD-supply", 0); + + if (init_node) { + config->of_node = init_node; + + init_data = of_get_regulator_init_data(arizona->dev, init_node); + + if (init_data) { + init_data->consumer_supplies = &ldo1->supply; + init_data->num_consumer_supplies = 1; + + if (dcvdd_node && dcvdd_node != init_node) + arizona->external_dcvdd = true; + + pdata->ldo1 = init_data; + } + } else if (dcvdd_node) { + arizona->external_dcvdd = true; + } + + of_node_put(dcvdd_node); + return 0; } + +static void arizona_ldo1_of_put_pdata(struct regulator_config *config) +{ + of_node_put(config->of_node); +} #else -static inline int arizona_ldo1_of_get_pdata(struct arizona *arizona) +static inline int arizona_ldo1_of_get_pdata(struct arizona *arizona, + struct regulator_config *config) { return 0; } + +static inline void arizona_ldo1_of_put_pdata(struct regulator_config *config) +{ +} #endif static int arizona_ldo1_probe(struct platform_device *pdev) @@ -236,7 +274,7 @@ static int arizona_ldo1_probe(struct platform_device *pdev) config.regmap = arizona->regmap; if (!dev_get_platdata(arizona->dev)) { - ret = arizona_ldo1_of_get_pdata(arizona); + ret = arizona_ldo1_of_get_pdata(arizona, &config); if (ret < 0) return ret; } @@ -263,6 +301,9 @@ static int arizona_ldo1_probe(struct platform_device *pdev) return ret; } + if (!dev_get_platdata(arizona->dev)) + arizona_ldo1_of_put_pdata(&config); + platform_set_drvdata(pdev, ldo1); return 0; -- 1.7.2.5 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 16+ messages in thread
end of thread, other threads:[~2014-04-18 17:39 UTC | newest] Thread overview: 16+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-04-01 8:27 [PATCH 0/6] Arizona Regulator Updates v5 Charles Keepax 2014-04-01 8:27 ` [PATCH 1/6] mfd: arizona: Factor out read of device tree GPIOs Charles Keepax 2014-04-15 10:25 ` Lee Jones 2014-04-15 13:01 ` Charles Keepax [not found] ` <20140415130140.GA27294-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> 2014-04-16 9:25 ` Lee Jones 2014-04-01 8:27 ` [PATCH 2/6] regulator: arizona-ldo1: Move setup processing from arizona-core Charles Keepax [not found] ` <1396340845-24060-3-git-send-email-ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> 2014-04-15 10:12 ` Lee Jones 2014-04-15 12:13 ` Mark Brown 2014-04-15 13:10 ` Charles Keepax [not found] ` <1396340845-24060-1-git-send-email-ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> 2014-04-01 8:27 ` [PATCH 3/6] regulator: arizona-ldo1: Add processing of init_data from device tree Charles Keepax 2014-04-01 8:27 ` [PATCH 4/6] mfd: arizona: Update DT binding to support LDO1 init_data Charles Keepax 2014-04-01 8:27 ` [PATCH 5/6] regulator: arizona-micsupp: Add processing of init_data from device tree Charles Keepax 2014-04-01 8:27 ` [PATCH 6/6] mfd: arizona: Update DT binding to support MICVDD init_data Charles Keepax -- strict thread matches above, loose matches on Subject: below -- 2014-04-16 9:01 [PATCH 0/6] Arizona Regulator Updates v6 Charles Keepax 2014-04-16 9:01 ` [PATCH 3/6] regulator: arizona-ldo1: Add processing of init_data from device tree Charles Keepax [not found] ` <1397638902-7576-4-git-send-email-ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> 2014-04-18 17:39 ` Mark Brown 2014-03-31 11:59 [PATCH 0/6] Arizona Regulator Updates v4 Charles Keepax [not found] ` <1396267187-30580-1-git-send-email-ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> 2014-03-31 11:59 ` [PATCH 3/6] regulator: arizona-ldo1: Add processing of init_data from device tree Charles Keepax
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).