regulator: wm8994: Use GPIO parsed from DT when registering regulators
authorSylwester Nawrocki <s.nawrocki@samsung.com>
Thu, 11 Apr 2013 16:36:57 +0000 (18:36 +0200)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Thu, 11 Apr 2013 16:56:21 +0000 (17:56 +0100)
Ensure the regulators are registered with a GPIO parsed from the device
tree when available.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/regulator/wm8994-regulator.c

index f03fbf1..a612c35 100644 (file)
@@ -149,9 +149,11 @@ static int wm8994_ldo_probe(struct platform_device *pdev)
        config.init_data = &ldo->init_data;
        if (pdata)
                config.ena_gpio = pdata->ldo[id].enable;
+       else if (wm8994->dev->of_node)
+               config.ena_gpio = wm8994->pdata.ldo[id].enable;
 
        /* Use default constraints if none set up */
-       if (!pdata || !pdata->ldo[id].init_data) {
+       if (!pdata || !pdata->ldo[id].init_data || wm8994->dev->of_node) {
                dev_dbg(wm8994->dev, "Using default init data, supply %s %s\n",
                        ldo->supply.dev_name, ldo->supply.supply);