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))
gpiod_put(pin->gpiod);
list_del(&pin->list);
kfree(pin);
++++ rdev->ena_pin = NULL;
++++ return;
} else {
pin->request_count--;
}
/* 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,
{
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;
}
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",
#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