summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/pwm-regulator.c
diff options
context:
space:
mode:
authorLinus Torvalds2015-11-05 22:06:22 +0100
committerLinus Torvalds2015-11-05 22:06:22 +0100
commit52787e91bf5375e68e90f381bd157bd92e1f4a77 (patch)
tree102103aca706e14ed1df0fab36cdd827a4d86b75 /drivers/regulator/pwm-regulator.c
parentMerge tag 'clk-for-linus-20151104' of git://git.kernel.org/pub/scm/linux/kern... (diff)
parentMerge remote-tracking branches 'regulator/topic/supply', 'regulator/topic/tps... (diff)
downloadkernel-qcow2-linux-52787e91bf5375e68e90f381bd157bd92e1f4a77.tar.gz
kernel-qcow2-linux-52787e91bf5375e68e90f381bd157bd92e1f4a77.tar.xz
kernel-qcow2-linux-52787e91bf5375e68e90f381bd157bd92e1f4a77.zip
Merge tag 'regulator-v4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator updates from Mark Brown: "This is quite a quiet release in terms of volume of patches but it includes a couple of really nice core changes - the work Sascha has done in particular is something I've wanted to get done for a long time but just never got round to myself. Highlights include: - Support from Sascha Hauer for setting the voltage of parent supplies based on requests from their children. This is used both to allow set_voltage() to work through a dumb switch and to improve the efficiency of systems where DCDCs are used to supply LDOs by minimising the voltage drop over the LDOs. - Removal of regulator_list by Tomeu Vizoso, meaning we're not duplicating the device list maintained by the driver core. - Support for Wolfson/Cirrus WM8998 and WM1818" * tag 'regulator-v4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (29 commits) regulator: Use regulator_lock_supply() for get_voltage() too regulator: arizona: Add regulator specific device tree binding document regulator: stw481x: compile on COMPILE_TEST regulator: qcom-smd: Correct set_load() unit regulator: core: Propagate voltage changes to supply regulators regulator: core: Factor out regulator_map_voltage regulator: i.MX anatop: Allow supply regulator regulator: introduce min_dropout_uV regulator: core: create unlocked version of regulator_set_voltage regulator: arizona-ldo1: Fix handling of GPIO 0 regulator: da9053: Update regulator for DA9053 BC silicon support regulator: max77802: Separate sections for nodes and properties regulator: max77802: Add input supply properties to DT binding doc regulator: axp20x: set supply names for AXP22X DC1SW/DC5LDO internally regulator: axp20x: Drop AXP221 DC1SW and DC5LDO regulator supplies from bindings mfd: tps6105x: Use i2c regmap to access registers regulator: act8865: add DT binding for property "active-semi,vsel-high" regulator: act8865: support output voltage by VSET2[] bits regulator: arizona: add support for WM8998 and WM1814 regulator: core: create unlocked version of regulator_list_voltage ...
Diffstat (limited to 'drivers/regulator/pwm-regulator.c')
-rw-r--r--drivers/regulator/pwm-regulator.c35
1 files changed, 29 insertions, 6 deletions
diff --git a/drivers/regulator/pwm-regulator.c b/drivers/regulator/pwm-regulator.c
index fc3166dfcbfa..3aca067b9901 100644
--- a/drivers/regulator/pwm-regulator.c
+++ b/drivers/regulator/pwm-regulator.c
@@ -69,12 +69,6 @@ static int pwm_regulator_set_voltage_sel(struct regulator_dev *rdev,
drvdata->state = selector;
- ret = pwm_enable(drvdata->pwm);
- if (ret) {
- dev_err(&rdev->dev, "Failed to enable PWM\n");
- return ret;
- }
-
return 0;
}
@@ -89,6 +83,29 @@ static int pwm_regulator_list_voltage(struct regulator_dev *rdev,
return drvdata->duty_cycle_table[selector].uV;
}
+static int pwm_regulator_enable(struct regulator_dev *dev)
+{
+ struct pwm_regulator_data *drvdata = rdev_get_drvdata(dev);
+
+ return pwm_enable(drvdata->pwm);
+}
+
+static int pwm_regulator_disable(struct regulator_dev *dev)
+{
+ struct pwm_regulator_data *drvdata = rdev_get_drvdata(dev);
+
+ pwm_disable(drvdata->pwm);
+
+ return 0;
+}
+
+static int pwm_regulator_is_enabled(struct regulator_dev *dev)
+{
+ struct pwm_regulator_data *drvdata = rdev_get_drvdata(dev);
+
+ return pwm_is_enabled(drvdata->pwm);
+}
+
/**
* Continuous voltage call-backs
*/
@@ -144,11 +161,17 @@ static struct regulator_ops pwm_regulator_voltage_table_ops = {
.get_voltage_sel = pwm_regulator_get_voltage_sel,
.list_voltage = pwm_regulator_list_voltage,
.map_voltage = regulator_map_voltage_iterate,
+ .enable = pwm_regulator_enable,
+ .disable = pwm_regulator_disable,
+ .is_enabled = pwm_regulator_is_enabled,
};
static struct regulator_ops pwm_regulator_voltage_continuous_ops = {
.get_voltage = pwm_regulator_get_voltage,
.set_voltage = pwm_regulator_set_voltage,
+ .enable = pwm_regulator_enable,
+ .disable = pwm_regulator_disable,
+ .is_enabled = pwm_regulator_is_enabled,
};
static struct regulator_desc pwm_regulator_desc = {