* [PATCH v3 0/4] regulator: Fix core behaviour for gpio 0, remaining patches
@ 2014-11-03 18:12 Markus Pargmann
2014-11-03 18:12 ` [PATCH v3 1/4] regulator: Set ena_gpio_initialized in regulator drivers Markus Pargmann
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Markus Pargmann @ 2014-11-03 18:12 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
here are the remaining patches of the series. Version 3 contains some fixes for
the first three patches. I added another patch which fixes a problem I noticed
in the tps65090 driver.
Changes in v3:
- Moved the ena_gpio_initialized initialization out of the loop for s2m/s5m
drivers.
- Fixed a of_node check in max8952
- Fixed ena_gpio_initialized for the 'fixed' regulator to only be set for
gpios from DT
Best regards,
Markus
Markus Pargmann (4):
regulator: Set ena_gpio_initialized in regulator drivers
regulator: fixed: Use gpio_is_valid
regulator: gpio: Use gpio_is_valid
regulator: tps65090: Fix gpio initialization
drivers/regulator/arizona-ldo1.c | 2 ++
drivers/regulator/fixed.c | 5 ++++-
drivers/regulator/gpio-regulator.c | 4 +++-
drivers/regulator/max8952.c | 2 ++
drivers/regulator/s2mps11.c | 1 +
drivers/regulator/s5m8767.c | 1 +
drivers/regulator/tps65090-regulator.c | 4 ++++
drivers/regulator/wm8994-regulator.c | 6 ++++--
8 files changed, 21 insertions(+), 4 deletions(-)
--
2.1.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 1/4] regulator: Set ena_gpio_initialized in regulator drivers
2014-11-03 18:12 [PATCH v3 0/4] regulator: Fix core behaviour for gpio 0, remaining patches Markus Pargmann
@ 2014-11-03 18:12 ` Markus Pargmann
2014-11-03 18:12 ` [PATCH v3 2/4] regulator: fixed: Use gpio_is_valid Markus Pargmann
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Markus Pargmann @ 2014-11-03 18:12 UTC (permalink / raw)
To: linux-arm-kernel
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>
---
drivers/regulator/arizona-ldo1.c | 2 ++
drivers/regulator/fixed.c | 5 ++++-
drivers/regulator/gpio-regulator.c | 4 +++-
drivers/regulator/max8952.c | 2 ++
drivers/regulator/s2mps11.c | 1 +
drivers/regulator/s5m8767.c | 1 +
drivers/regulator/tps65090-regulator.c | 1 +
drivers/regulator/wm8994-regulator.c | 6 ++++--
8 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c
index 4c9db589f6c1..559e7ea9dcf3 100644
--- a/drivers/regulator/arizona-ldo1.c
+++ b/drivers/regulator/arizona-ldo1.c
@@ -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;
}
}
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index 354105eff1f8..17f6a7d331f8 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -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)
diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c
index 989b23b377c0..5da0125fac6a 100644
--- a/drivers/regulator/gpio-regulator.c
+++ b/drivers/regulator/gpio-regulator.c
@@ -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)
diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c
index f7f9efcfedb7..dec57fb9cd1c 100644
--- a/drivers/regulator/max8952.c
+++ b/drivers/regulator/max8952.c
@@ -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;
diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index adab82d5279f..b4ae022091eb 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -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;
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
index 0ab5cbeeb797..4225df68dd4d 100644
--- a/drivers/regulator/s5m8767.c
+++ b/drivers/regulator/s5m8767.c
@@ -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);
diff --git a/drivers/regulator/tps65090-regulator.c b/drivers/regulator/tps65090-regulator.c
index d5df1e9ad1da..2e92aa8718cc 100644
--- a/drivers/regulator/tps65090-regulator.c
+++ b/drivers/regulator/tps65090-regulator.c
@@ -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;
}
}
diff --git a/drivers/regulator/wm8994-regulator.c b/drivers/regulator/wm8994-regulator.c
index c24346db8a71..88f5064e412b 100644
--- a/drivers/regulator/wm8994-regulator.c
+++ b/drivers/regulator/wm8994-regulator.c
@@ -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) {
--
2.1.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v3 2/4] regulator: fixed: Use gpio_is_valid
2014-11-03 18:12 [PATCH v3 0/4] regulator: Fix core behaviour for gpio 0, remaining patches Markus Pargmann
2014-11-03 18:12 ` [PATCH v3 1/4] regulator: Set ena_gpio_initialized in regulator drivers Markus Pargmann
@ 2014-11-03 18:12 ` Markus Pargmann
2014-11-03 18:12 ` [PATCH v3 3/4] regulator: gpio: " Markus Pargmann
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Markus Pargmann @ 2014-11-03 18:12 UTC (permalink / raw)
To: linux-arm-kernel
Use gpio_is_valid instead of an explicit comparison with 0.
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
drivers/regulator/fixed.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index 17f6a7d331f8..709fba19e596 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -157,7 +157,7 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
drvdata->desc.fixed_uV = config->microvolts;
- if (config->gpio >= 0) {
+ if (gpio_is_valid(config->gpio)) {
cfg.ena_gpio = config->gpio;
if (pdev->dev.of_node)
cfg.ena_gpio_initialized = true;
--
2.1.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v3 3/4] regulator: gpio: Use gpio_is_valid
2014-11-03 18:12 [PATCH v3 0/4] regulator: Fix core behaviour for gpio 0, remaining patches Markus Pargmann
2014-11-03 18:12 ` [PATCH v3 1/4] regulator: Set ena_gpio_initialized in regulator drivers Markus Pargmann
2014-11-03 18:12 ` [PATCH v3 2/4] regulator: fixed: Use gpio_is_valid Markus Pargmann
@ 2014-11-03 18:12 ` Markus Pargmann
2014-11-03 18:12 ` [PATCH v3 4/4] regulator: tps65090: Fix gpio initialization Markus Pargmann
2014-11-07 11:30 ` [PATCH v3 0/4] regulator: Fix core behaviour for gpio 0, remaining patches Mark Brown
4 siblings, 0 replies; 6+ messages in thread
From: Markus Pargmann @ 2014-11-03 18:12 UTC (permalink / raw)
To: linux-arm-kernel
Use gpio_is_valid instead of an explicit comparison with 0.
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
drivers/regulator/gpio-regulator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c
index 5da0125fac6a..86546c1c32c4 100644
--- a/drivers/regulator/gpio-regulator.c
+++ b/drivers/regulator/gpio-regulator.c
@@ -322,7 +322,7 @@ static int gpio_regulator_probe(struct platform_device *pdev)
cfg.driver_data = drvdata;
cfg.of_node = np;
- if (config->enable_gpio >= 0) {
+ if (gpio_is_valid(config->enable_gpio)) {
cfg.ena_gpio = config->enable_gpio;
cfg.ena_gpio_initialized = true;
}
--
2.1.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v3 4/4] regulator: tps65090: Fix gpio initialization
2014-11-03 18:12 [PATCH v3 0/4] regulator: Fix core behaviour for gpio 0, remaining patches Markus Pargmann
` (2 preceding siblings ...)
2014-11-03 18:12 ` [PATCH v3 3/4] regulator: gpio: " Markus Pargmann
@ 2014-11-03 18:12 ` Markus Pargmann
2014-11-07 11:30 ` [PATCH v3 0/4] regulator: Fix core behaviour for gpio 0, remaining patches Mark Brown
4 siblings, 0 replies; 6+ messages in thread
From: Markus Pargmann @ 2014-11-03 18:12 UTC (permalink / raw)
To: linux-arm-kernel
The config is used for multiple regulators within a for loop. The config
field is not cleared before it is used for the next item. To avoid any
issues this patch adds a proper initialization for the config->ena_gpio
field in case no gpio is available.
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
drivers/regulator/tps65090-regulator.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/regulator/tps65090-regulator.c b/drivers/regulator/tps65090-regulator.c
index 2e92aa8718cc..f1df4423d361 100644
--- a/drivers/regulator/tps65090-regulator.c
+++ b/drivers/regulator/tps65090-regulator.c
@@ -314,6 +314,9 @@ static void tps65090_configure_regulator_config(
config->ena_gpio = tps_pdata->gpio;
config->ena_gpio_initialized = true;
config->ena_gpio_flags = gpio_flag;
+ } else {
+ config->ena_gpio = -EINVAL;
+ config->ena_gpio_initialized = false;
}
}
--
2.1.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v3 0/4] regulator: Fix core behaviour for gpio 0, remaining patches
2014-11-03 18:12 [PATCH v3 0/4] regulator: Fix core behaviour for gpio 0, remaining patches Markus Pargmann
` (3 preceding siblings ...)
2014-11-03 18:12 ` [PATCH v3 4/4] regulator: tps65090: Fix gpio initialization Markus Pargmann
@ 2014-11-07 11:30 ` Mark Brown
4 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2014-11-07 11:30 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Nov 03, 2014 at 07:12:03PM +0100, Markus Pargmann wrote:
> Hi,
>
> here are the remaining patches of the series. Version 3 contains some fixes for
> the first three patches. I added another patch which fixes a problem I noticed
> in the tps65090 driver.
Applied all, thanks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141107/6e45c5a0/attachment.sig>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-11-07 11:30 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-03 18:12 [PATCH v3 0/4] regulator: Fix core behaviour for gpio 0, remaining patches Markus Pargmann
2014-11-03 18:12 ` [PATCH v3 1/4] regulator: Set ena_gpio_initialized in regulator drivers Markus Pargmann
2014-11-03 18:12 ` [PATCH v3 2/4] regulator: fixed: Use gpio_is_valid Markus Pargmann
2014-11-03 18:12 ` [PATCH v3 3/4] regulator: gpio: " Markus Pargmann
2014-11-03 18:12 ` [PATCH v3 4/4] regulator: tps65090: Fix gpio initialization Markus Pargmann
2014-11-07 11:30 ` [PATCH v3 0/4] regulator: Fix core behaviour for gpio 0, remaining patches Mark Brown
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).