aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/regulator
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2010-12-12 09:36:17 -0500
committerLiam Girdwood <lrg@slimlogic.co.uk>2011-01-12 09:33:04 -0500
commite8eef82b2c652d031bee9dff9762325672f5a1e0 (patch)
treeb4c69b01c190e5e5a285a46dd4b26e4c801ddaa2 /include/linux/regulator
parent757902513019e6ee469791ff76f954b19ca8d036 (diff)
regulator: Provide a selector based set_voltage_sel() operation
Many regulator drivers implement voltage setting by looping through a table of possible values, normally because the set of available voltages can't be mapped onto selectors with simple calcuation. Factor out these loops by providing a variant of set_voltage() which takes a selector rather than a voltage range as an argument and implementing a loop through the available selectors in the core. This is not going to be suitable for use with all devices as when the regulator voltage can be mapped onto selector values with a simple calculation the linear scan through the available values will be more expensive than just doing the calculation, especially for regulators that provide fine grained voltage control. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'include/linux/regulator')
-rw-r--r--include/linux/regulator/driver.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index bf3e653591b9..975ae06cb634 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -42,6 +42,8 @@ enum regulator_status {
42 * 42 *
43 * @set_voltage: Set the voltage for the regulator within the range specified. 43 * @set_voltage: Set the voltage for the regulator within the range specified.
44 * The driver should select the voltage closest to min_uV. 44 * The driver should select the voltage closest to min_uV.
45 * @set_voltage_sel: Set the voltage for the regulator using the specified
46 * selector.
45 * @get_voltage: Return the currently configured voltage for the regulator. 47 * @get_voltage: Return the currently configured voltage for the regulator.
46 * @get_voltage_sel: Return the currently configured voltage selector for the 48 * @get_voltage_sel: Return the currently configured voltage selector for the
47 * regulator. 49 * regulator.
@@ -83,6 +85,7 @@ struct regulator_ops {
83 /* get/set regulator voltage */ 85 /* get/set regulator voltage */
84 int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV, 86 int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV,
85 unsigned *selector); 87 unsigned *selector);
88 int (*set_voltage_sel) (struct regulator_dev *, unsigned selector);
86 int (*get_voltage) (struct regulator_dev *); 89 int (*get_voltage) (struct regulator_dev *);
87 int (*get_voltage_sel) (struct regulator_dev *); 90 int (*get_voltage_sel) (struct regulator_dev *);
88 91