Commit 1de3821a authored by Markus Pargmann's avatar Markus Pargmann Committed by Mark Brown

regulator: Set ena_gpio_initialized in regulator drivers

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: default avatarMarkus Pargmann <mpa@pengutronix.de>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 76f439df
...@@ -260,6 +260,8 @@ static int arizona_ldo1_probe(struct platform_device *pdev) ...@@ -260,6 +260,8 @@ static int arizona_ldo1_probe(struct platform_device *pdev)
ret = arizona_ldo1_of_get_pdata(arizona, &config); ret = arizona_ldo1_of_get_pdata(arizona, &config);
if (ret < 0) if (ret < 0)
return ret; return ret;
config.ena_gpio_initialized = true;
} }
} }
......
...@@ -157,8 +157,11 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev) ...@@ -157,8 +157,11 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
drvdata->desc.fixed_uV = config->microvolts; drvdata->desc.fixed_uV = config->microvolts;
if (config->gpio >= 0) if (config->gpio >= 0) {
cfg.ena_gpio = config->gpio; cfg.ena_gpio = config->gpio;
if (pdev->dev.of_node)
cfg.ena_gpio_initialized = true;
}
cfg.ena_gpio_invert = !config->enable_high; cfg.ena_gpio_invert = !config->enable_high;
if (config->enabled_at_boot) { if (config->enabled_at_boot) {
if (config->enable_high) if (config->enable_high)
......
...@@ -322,8 +322,10 @@ static int gpio_regulator_probe(struct platform_device *pdev) ...@@ -322,8 +322,10 @@ static int gpio_regulator_probe(struct platform_device *pdev)
cfg.driver_data = drvdata; cfg.driver_data = drvdata;
cfg.of_node = np; cfg.of_node = np;
if (config->enable_gpio >= 0) if (config->enable_gpio >= 0) {
cfg.ena_gpio = config->enable_gpio; cfg.ena_gpio = config->enable_gpio;
cfg.ena_gpio_initialized = true;
}
cfg.ena_gpio_invert = !config->enable_high; cfg.ena_gpio_invert = !config->enable_high;
if (config->enabled_at_boot) { if (config->enabled_at_boot) {
if (config->enable_high) if (config->enable_high)
......
...@@ -225,6 +225,8 @@ static int max8952_pmic_probe(struct i2c_client *client, ...@@ -225,6 +225,8 @@ static int max8952_pmic_probe(struct i2c_client *client,
config.of_node = client->dev.of_node; config.of_node = client->dev.of_node;
config.ena_gpio = pdata->gpio_en; config.ena_gpio = pdata->gpio_en;
if (client->dev.of_node)
config.ena_gpio_initialized = true;
if (pdata->reg_data->constraints.boot_on) if (pdata->reg_data->constraints.boot_on)
config.ena_gpio_flags |= GPIOF_OUT_INIT_HIGH; config.ena_gpio_flags |= GPIOF_OUT_INIT_HIGH;
......
...@@ -886,6 +886,7 @@ static int s2mps11_pmic_probe(struct platform_device *pdev) ...@@ -886,6 +886,7 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
config.regmap = iodev->regmap_pmic; config.regmap = iodev->regmap_pmic;
config.driver_data = s2mps11; config.driver_data = s2mps11;
config.ena_gpio_flags = GPIOF_OUT_INIT_HIGH; config.ena_gpio_flags = GPIOF_OUT_INIT_HIGH;
config.ena_gpio_initialized = true;
for (i = 0; i < s2mps11->rdev_num; i++) { for (i = 0; i < s2mps11->rdev_num; i++) {
struct regulator_dev *regulator; struct regulator_dev *regulator;
......
...@@ -950,6 +950,7 @@ static int s5m8767_pmic_probe(struct platform_device *pdev) ...@@ -950,6 +950,7 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
config.of_node = pdata->regulators[i].reg_node; config.of_node = pdata->regulators[i].reg_node;
config.ena_gpio = -EINVAL; config.ena_gpio = -EINVAL;
config.ena_gpio_flags = 0; config.ena_gpio_flags = 0;
config.ena_gpio_initialized = true;
if (gpio_is_valid(pdata->regulators[i].ext_control_gpio)) if (gpio_is_valid(pdata->regulators[i].ext_control_gpio))
s5m8767_regulator_config_ext_control(s5m8767, s5m8767_regulator_config_ext_control(s5m8767,
&pdata->regulators[i], &config); &pdata->regulators[i], &config);
......
...@@ -312,6 +312,7 @@ static void tps65090_configure_regulator_config( ...@@ -312,6 +312,7 @@ static void tps65090_configure_regulator_config(
gpio_flag = GPIOF_OUT_INIT_HIGH; gpio_flag = GPIOF_OUT_INIT_HIGH;
config->ena_gpio = tps_pdata->gpio; config->ena_gpio = tps_pdata->gpio;
config->ena_gpio_initialized = true;
config->ena_gpio_flags = gpio_flag; config->ena_gpio_flags = gpio_flag;
} }
} }
......
...@@ -145,10 +145,12 @@ static int wm8994_ldo_probe(struct platform_device *pdev) ...@@ -145,10 +145,12 @@ static int wm8994_ldo_probe(struct platform_device *pdev)
config.driver_data = ldo; config.driver_data = ldo;
config.regmap = wm8994->regmap; config.regmap = wm8994->regmap;
config.init_data = &ldo->init_data; config.init_data = &ldo->init_data;
if (pdata) if (pdata) {
config.ena_gpio = pdata->ldo[id].enable; 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 = wm8994->pdata.ldo[id].enable;
config.ena_gpio_initialized = true;
}
/* Use default constraints if none set up */ /* Use default constraints if none set up */
if (!pdata || !pdata->ldo[id].init_data || wm8994->dev->of_node) { if (!pdata || !pdata->ldo[id].init_data || wm8994->dev->of_node) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment