lkml.org 
[lkml]   [2014]   [Apr]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 2/6] regulator: arizona-ldo1: Move setup processing from arizona-core
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.

> 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@linaro.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 linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2014-04-15 12:21    [W:0.073 / U:40.328 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site