diff options
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/core.c | 12 | ||||
-rw-r--r-- | drivers/regulator/cpcap-regulator.c | 8 | ||||
-rw-r--r-- | drivers/regulator/of_regulator.c | 2 |
3 files changed, 16 insertions, 6 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index e567fa54980b..9f4d484eb25d 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -2396,6 +2396,14 @@ static void regulator_disable_work(struct work_struct *work) count = rdev->deferred_disables; rdev->deferred_disables = 0; + /* + * Workqueue functions queue the new work instance while the previous + * work instance is being processed. Cancel the queued work instance + * as the work instance under processing does the job of the queued + * work instance. + */ + cancel_delayed_work(&rdev->disable_work); + for (i = 0; i < count; i++) { ret = _regulator_disable(rdev); if (ret != 0) @@ -2439,10 +2447,10 @@ int regulator_disable_deferred(struct regulator *regulator, int ms) mutex_lock(&rdev->mutex); rdev->deferred_disables++; + mod_delayed_work(system_power_efficient_wq, &rdev->disable_work, + msecs_to_jiffies(ms)); mutex_unlock(&rdev->mutex); - queue_delayed_work(system_power_efficient_wq, &rdev->disable_work, - msecs_to_jiffies(ms)); return 0; } EXPORT_SYMBOL_GPL(regulator_disable_deferred); diff --git a/drivers/regulator/cpcap-regulator.c b/drivers/regulator/cpcap-regulator.c index cc98aceed1c1..ce1cab320f6f 100644 --- a/drivers/regulator/cpcap-regulator.c +++ b/drivers/regulator/cpcap-regulator.c @@ -77,6 +77,8 @@ #define CPCAP_BIT_VAUDIO_MODE0 BIT(1) #define CPCAP_BIT_V_AUDIO_EN BIT(0) +#define CPCAP_BIT_AUDIO_NORMAL_MODE 0x00 + /* * Off mode configuration bit. Used currently only by SW5 on omap4. There's * the following comment in Motorola Linux kernel tree for it: @@ -217,7 +219,7 @@ static unsigned int cpcap_regulator_get_mode(struct regulator_dev *rdev) regmap_read(rdev->regmap, rdev->desc->enable_reg, &value); - if (!(value & CPCAP_BIT_AUDIO_LOW_PWR)) + if (value & CPCAP_BIT_AUDIO_LOW_PWR) return REGULATOR_MODE_STANDBY; return REGULATOR_MODE_NORMAL; @@ -230,10 +232,10 @@ static int cpcap_regulator_set_mode(struct regulator_dev *rdev, switch (mode) { case REGULATOR_MODE_NORMAL: - value = CPCAP_BIT_AUDIO_LOW_PWR; + value = CPCAP_BIT_AUDIO_NORMAL_MODE; break; case REGULATOR_MODE_STANDBY: - value = 0; + value = CPCAP_BIT_AUDIO_LOW_PWR; break; default: return -EINVAL; diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c index 96bf75458da5..9dd44dd4cdf6 100644 --- a/drivers/regulator/of_regulator.c +++ b/drivers/regulator/of_regulator.c @@ -333,7 +333,7 @@ struct regulator_init_data *regulator_of_get_init_data(struct device *dev, search = of_get_child_by_name(dev->of_node, desc->regulators_node); else - search = dev->of_node; + search = of_node_get(dev->of_node); if (!search) { dev_dbg(dev, "Failed to find regulator container node '%s'\n", |