regulator: Set ena_gpio_initialized in regulator drivers
authorMarkus Pargmann <mpa@pengutronix.de>
Mon, 3 Nov 2014 18:12:04 +0000 (19:12 +0100)
committerMark Brown <broonie@kernel.org>
Fri, 7 Nov 2014 11:30:25 +0000 (11:30 +0000)
This patch sets ena_gpio_initialized for all drivers which set a
ena_gpio from parsed DT properties. Drivers using pdata may get zero
initialized pdata and therefore copy a 0 into the regulator_config
ena_gpio field.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/arizona-ldo1.c
drivers/regulator/fixed.c
drivers/regulator/gpio-regulator.c
drivers/regulator/max8952.c
drivers/regulator/s2mps11.c
drivers/regulator/s5m8767.c
drivers/regulator/tps65090-regulator.c
drivers/regulator/wm8994-regulator.c

index 4c9db589f6c138ff0ce4c63607c353e7360946ea..559e7ea9dcf37fda7d19b41d58fa8668b802f9d6 100644 (file)
@@ -260,6 +260,8 @@ static int arizona_ldo1_probe(struct platform_device *pdev)
                        ret = arizona_ldo1_of_get_pdata(arizona, &config);
                        if (ret < 0)
                                return ret;
+
+                       config.ena_gpio_initialized = true;
                }
        }
 
index 354105eff1f80ed392951b41518e3062eac70582..17f6a7d331f843d3e5dbf76b227d5a8ef5b42a78 100644 (file)
@@ -157,8 +157,11 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
 
        drvdata->desc.fixed_uV = config->microvolts;
 
-       if (config->gpio >= 0)
+       if (config->gpio >= 0) {
                cfg.ena_gpio = config->gpio;
+               if (pdev->dev.of_node)
+                       cfg.ena_gpio_initialized = true;
+       }
        cfg.ena_gpio_invert = !config->enable_high;
        if (config->enabled_at_boot) {
                if (config->enable_high)
index 989b23b377c0d2bb511227749e871ce72f46398b..5da0125fac6ad50655fb231b72e3439289c26c93 100644 (file)
@@ -322,8 +322,10 @@ static int gpio_regulator_probe(struct platform_device *pdev)
        cfg.driver_data = drvdata;
        cfg.of_node = np;
 
-       if (config->enable_gpio >= 0)
+       if (config->enable_gpio >= 0) {
                cfg.ena_gpio = config->enable_gpio;
+               cfg.ena_gpio_initialized = true;
+       }
        cfg.ena_gpio_invert = !config->enable_high;
        if (config->enabled_at_boot) {
                if (config->enable_high)
index f7f9efcfedb7ac1dcd66a64845805a56a9a07604..dec57fb9cd1c6eb4e9bab004d214a4a9064ed84f 100644 (file)
@@ -225,6 +225,8 @@ static int max8952_pmic_probe(struct i2c_client *client,
        config.of_node = client->dev.of_node;
 
        config.ena_gpio = pdata->gpio_en;
+       if (client->dev.of_node)
+               config.ena_gpio_initialized = true;
        if (pdata->reg_data->constraints.boot_on)
                config.ena_gpio_flags |= GPIOF_OUT_INIT_HIGH;
 
index adab82d5279f0696319f53d04e30b07615121dbb..b4ae022091eb657440e89cb49aa844d37faab4ad 100644 (file)
@@ -886,6 +886,7 @@ common_reg:
        config.regmap = iodev->regmap_pmic;
        config.driver_data = s2mps11;
        config.ena_gpio_flags = GPIOF_OUT_INIT_HIGH;
+       config.ena_gpio_initialized = true;
        for (i = 0; i < s2mps11->rdev_num; i++) {
                struct regulator_dev *regulator;
 
index 0ab5cbeeb797adda5a6c89e8a9608531cb4a8fdb..4225df68dd4dcf1c779e38b94bd10f6ce791e40f 100644 (file)
@@ -950,6 +950,7 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
                config.of_node = pdata->regulators[i].reg_node;
                config.ena_gpio = -EINVAL;
                config.ena_gpio_flags = 0;
+               config.ena_gpio_initialized = true;
                if (gpio_is_valid(pdata->regulators[i].ext_control_gpio))
                        s5m8767_regulator_config_ext_control(s5m8767,
                                        &pdata->regulators[i], &config);
index d5df1e9ad1da659a230e4765ad2ea73292faef06..2e92aa8718cc51e66bde7397471bad109a7ec914 100644 (file)
@@ -312,6 +312,7 @@ static void tps65090_configure_regulator_config(
                        gpio_flag = GPIOF_OUT_INIT_HIGH;
 
                config->ena_gpio = tps_pdata->gpio;
+               config->ena_gpio_initialized = true;
                config->ena_gpio_flags = gpio_flag;
        }
 }
index c24346db8a71139e202c60464317e4fc03123253..88f5064e412b74a802c00c28855376d35c054237 100644 (file)
@@ -145,10 +145,12 @@ static int wm8994_ldo_probe(struct platform_device *pdev)
        config.driver_data = ldo;
        config.regmap = wm8994->regmap;
        config.init_data = &ldo->init_data;
-       if (pdata)
+       if (pdata) {
                config.ena_gpio = pdata->ldo[id].enable;
-       else if (wm8994->dev->of_node)
+       } else if (wm8994->dev->of_node) {
                config.ena_gpio = wm8994->pdata.ldo[id].enable;
+               config.ena_gpio_initialized = true;
+       }
 
        /* Use default constraints if none set up */
        if (!pdata || !pdata->ldo[id].init_data || wm8994->dev->of_node) {