Commit 8ca8f326 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'regulator/fix/gpio-enable' and...

Merge remote-tracking branches 'regulator/fix/gpio-enable' and 'regulator/fix/tps65910' into regulator-linus
...@@ -1839,10 +1839,12 @@ static int _regulator_do_enable(struct regulator_dev *rdev) ...@@ -1839,10 +1839,12 @@ static int _regulator_do_enable(struct regulator_dev *rdev)
} }
if (rdev->ena_pin) { if (rdev->ena_pin) {
ret = regulator_ena_gpio_ctrl(rdev, true); if (!rdev->ena_gpio_state) {
if (ret < 0) ret = regulator_ena_gpio_ctrl(rdev, true);
return ret; if (ret < 0)
rdev->ena_gpio_state = 1; return ret;
rdev->ena_gpio_state = 1;
}
} else if (rdev->desc->ops->enable) { } else if (rdev->desc->ops->enable) {
ret = rdev->desc->ops->enable(rdev); ret = rdev->desc->ops->enable(rdev);
if (ret < 0) if (ret < 0)
...@@ -1939,10 +1941,12 @@ static int _regulator_do_disable(struct regulator_dev *rdev) ...@@ -1939,10 +1941,12 @@ static int _regulator_do_disable(struct regulator_dev *rdev)
trace_regulator_disable(rdev_get_name(rdev)); trace_regulator_disable(rdev_get_name(rdev));
if (rdev->ena_pin) { if (rdev->ena_pin) {
ret = regulator_ena_gpio_ctrl(rdev, false); if (rdev->ena_gpio_state) {
if (ret < 0) ret = regulator_ena_gpio_ctrl(rdev, false);
return ret; if (ret < 0)
rdev->ena_gpio_state = 0; return ret;
rdev->ena_gpio_state = 0;
}
} else if (rdev->desc->ops->disable) { } else if (rdev->desc->ops->disable) {
ret = rdev->desc->ops->disable(rdev); ret = rdev->desc->ops->disable(rdev);
...@@ -3626,12 +3630,6 @@ regulator_register(const struct regulator_desc *regulator_desc, ...@@ -3626,12 +3630,6 @@ regulator_register(const struct regulator_desc *regulator_desc,
config->ena_gpio, ret); config->ena_gpio, ret);
goto wash; goto wash;
} }
if (config->ena_gpio_flags & GPIOF_OUT_INIT_HIGH)
rdev->ena_gpio_state = 1;
if (config->ena_gpio_invert)
rdev->ena_gpio_state = !rdev->ena_gpio_state;
} }
/* set regulator constraints */ /* set regulator constraints */
...@@ -3800,9 +3798,11 @@ int regulator_suspend_finish(void) ...@@ -3800,9 +3798,11 @@ int regulator_suspend_finish(void)
list_for_each_entry(rdev, &regulator_list, list) { list_for_each_entry(rdev, &regulator_list, list) {
mutex_lock(&rdev->mutex); mutex_lock(&rdev->mutex);
if (rdev->use_count > 0 || rdev->constraints->always_on) { if (rdev->use_count > 0 || rdev->constraints->always_on) {
error = _regulator_do_enable(rdev); if (!_regulator_is_enabled(rdev)) {
if (error) error = _regulator_do_enable(rdev);
ret = error; if (error)
ret = error;
}
} else { } else {
if (!have_full_constraints()) if (!have_full_constraints())
goto unlock; goto unlock;
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/of.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/regulator/driver.h> #include <linux/regulator/driver.h>
#include <linux/regulator/machine.h> #include <linux/regulator/machine.h>
......
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