]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Merge remote-tracking branches 'regulator/topic/anatop', 'regulator/topic/disable...
authorMark Brown <broonie@kernel.org>
Fri, 5 Dec 2014 11:14:35 +0000 (11:14 +0000)
committerMark Brown <broonie@kernel.org>
Fri, 5 Dec 2014 11:14:35 +0000 (11:14 +0000)
1  2  3  4  5 
drivers/regulator/core.c
include/linux/regulator/consumer.h

diff --combined drivers/regulator/core.c
index 47a455cfe04fb344409a1f48ac52a7c9450edad3,cd87c0c37034de32ad2f2c7ae2085d4761041761,53de911a09542e6cc58038db5e64a3112842e628,cd87c0c37034de32ad2f2c7ae2085d4761041761,55a87a2722d87174435c8f2d55e9b1e1a1b63391..e225711bb8bc0009114d6ec0d95ab8d2bb2d68f3
@@@@@@ -828,7 -828,7 -828,7 -828,7 -828,7 +828,7 @@@@@@ static void print_constraints(struct re
        if (!count)
                sprintf(buf, "no parameters");
     
 ----   rdev_info(rdev, "%s\n", buf);
 ++++   rdev_dbg(rdev, "%s\n", buf);
     
        if ((constraints->min_uV != constraints->max_uV) &&
            !(constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE))
@@@@@@ -1713,8 -1713,6 -1713,6 -1713,6 -1713,6 +1713,8 @@@@@@ static void regulator_ena_gpio_free(str
                                gpiod_put(pin->gpiod);
                                list_del(&pin->list);
                                kfree(pin);
 ++++                           rdev->ena_pin = NULL;
 ++++                           return;
                        } else {
                                pin->request_count--;
                        }
@@@@@@ -1978,9 -1976,9 -1976,18 -1976,9 -1976,9 +1978,18 @@@@@@ static int _regulator_disable(struct re
     
                /* we are last user */
                if (_regulator_can_change_status(rdev)) {
++ ++                   ret = _notifier_call_chain(rdev,
++ ++                                              REGULATOR_EVENT_PRE_DISABLE,
++ ++                                              NULL);
++ ++                   if (ret & NOTIFY_STOP_MASK)
++ ++                           return -EINVAL;
++ ++
                        ret = _regulator_do_disable(rdev);
                        if (ret < 0) {
                                rdev_err(rdev, "failed to disable\n");
++ ++                           _notifier_call_chain(rdev,
++ ++                                           REGULATOR_EVENT_ABORT_DISABLE,
++ ++                                           NULL);
                                return ret;
                        }
                        _notifier_call_chain(rdev, REGULATOR_EVENT_DISABLE,
@@@@@@ -2037,9 -2035,9 -2044,16 -2035,9 -2035,9 +2046,16 @@@@@@ static int _regulator_force_disable(str
     {
        int ret = 0;
     
++ ++   ret = _notifier_call_chain(rdev, REGULATOR_EVENT_FORCE_DISABLE |
++ ++                   REGULATOR_EVENT_PRE_DISABLE, NULL);
++ ++   if (ret & NOTIFY_STOP_MASK)
++ ++           return -EINVAL;
++ ++
        ret = _regulator_do_disable(rdev);
        if (ret < 0) {
                rdev_err(rdev, "failed to force disable\n");
++ ++           _notifier_call_chain(rdev, REGULATOR_EVENT_FORCE_DISABLE |
++ ++                           REGULATOR_EVENT_ABORT_DISABLE, NULL);
                return ret;
        }
     
@@@@@@ -3652,7 -3650,7 -3666,7 -3650,7 -3650,8 +3668,8 @@@@@@ regulator_register(const struct regulat
     
        dev_set_drvdata(&rdev->dev, rdev);
     
----    if (config->ena_gpio && gpio_is_valid(config->ena_gpio)) {
++++    if ((config->ena_gpio || config->ena_gpio_initialized) &&
++++        gpio_is_valid(config->ena_gpio)) {
                ret = regulator_ena_gpio_request(rdev, config);
                if (ret != 0) {
                        rdev_err(rdev, "Failed to request enable GPIO%d: %d\n",
index f540b1496e2f798f63c4cc1db0803f12f3e6e732,d347c805f923f8539b6430fa30119527edb7f244,9efddd2a63ee08f457768250a1a6621327df5e29,d347c805f923f8539b6430fa30119527edb7f244,d347c805f923f8539b6430fa30119527edb7f244..4cfaaf222304be704e5bce0eec8d5e8c6328d7f8
     #ifndef __LINUX_REGULATOR_CONSUMER_H_
     #define __LINUX_REGULATOR_CONSUMER_H_
     
 ++++#include <linux/err.h>
 ++++
     struct device;
     struct notifier_block;
     struct regmap;
      *                      Data passed is "struct pre_voltage_change_data"
      * ABORT_VOLTAGE_CHANGE Regulator voltage change failed for some reason.
      *                      Data passed is old voltage cast to (void *).
++ ++ * PRE_DISABLE    Regulator is about to be disabled
++ ++ * ABORT_DISABLE  Regulator disable failed for some reason
      *
      * NOTE: These events can be OR'ed together when passed into handler.
      */
     #define REGULATOR_EVENT_DISABLE            0x80
     #define REGULATOR_EVENT_PRE_VOLTAGE_CHANGE 0x100
     #define REGULATOR_EVENT_ABORT_VOLTAGE_CHANGE       0x200
++ ++#define REGULATOR_EVENT_PRE_DISABLE                0x400
++ ++#define REGULATOR_EVENT_ABORT_DISABLE              0x800
     
     /**
      * struct pre_voltage_change_data - Data sent with PRE_VOLTAGE_CHANGE event