diff options
| author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-05-09 16:16:06 -0400 |
|---|---|---|
| committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-05-12 06:11:23 -0400 |
| commit | e843fc4616485bbd8b5a115f5bd4f73808656373 (patch) | |
| tree | f0e56438d078de5cd1adc8f839580fd14b60846c /include/linux/regulator | |
| parent | 5949a7e9ab2db04edaeee7c368eb4c99131f4629 (diff) | |
regulator: core: Allow regulators to provide a voltage to selector mapping
In order to allow more drivers to factor things out into data allow
drivers to provide a mapping function to convert voltages into selectors.
This allows any driver to use set_voltage_sel(). The existing mapping
based on iterating over list_voltage() is provided as an operation which
can be assigned to the new map_voltage() function though for ease of
transition it is treated as the default.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Diffstat (limited to 'include/linux/regulator')
| -rw-r--r-- | include/linux/regulator/driver.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index 8160bc87be2..13aa852b24a 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h | |||
| @@ -46,6 +46,7 @@ enum regulator_status { | |||
| 46 | * The driver should select the voltage closest to min_uV. | 46 | * The driver should select the voltage closest to min_uV. |
| 47 | * @set_voltage_sel: Set the voltage for the regulator using the specified | 47 | * @set_voltage_sel: Set the voltage for the regulator using the specified |
| 48 | * selector. | 48 | * selector. |
| 49 | * @map_voltage: Convert a voltage into a selector | ||
| 49 | * @get_voltage: Return the currently configured voltage for the regulator. | 50 | * @get_voltage: Return the currently configured voltage for the regulator. |
| 50 | * @get_voltage_sel: Return the currently configured voltage selector for the | 51 | * @get_voltage_sel: Return the currently configured voltage selector for the |
| 51 | * regulator. | 52 | * regulator. |
| @@ -91,6 +92,7 @@ struct regulator_ops { | |||
| 91 | /* get/set regulator voltage */ | 92 | /* get/set regulator voltage */ |
| 92 | int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV, | 93 | int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV, |
| 93 | unsigned *selector); | 94 | unsigned *selector); |
| 95 | int (*map_voltage)(struct regulator_dev *, int min_uV, int max_uV); | ||
| 94 | int (*set_voltage_sel) (struct regulator_dev *, unsigned selector); | 96 | int (*set_voltage_sel) (struct regulator_dev *, unsigned selector); |
| 95 | int (*get_voltage) (struct regulator_dev *); | 97 | int (*get_voltage) (struct regulator_dev *); |
| 96 | int (*get_voltage_sel) (struct regulator_dev *); | 98 | int (*get_voltage_sel) (struct regulator_dev *); |
| @@ -260,6 +262,8 @@ int rdev_get_id(struct regulator_dev *rdev); | |||
| 260 | 262 | ||
| 261 | int regulator_mode_to_status(unsigned int); | 263 | int regulator_mode_to_status(unsigned int); |
| 262 | 264 | ||
| 265 | int regulator_map_voltage_iterate(struct regulator_dev *rdev, | ||
| 266 | int min_uV, int max_uV); | ||
| 263 | int regulator_get_voltage_sel_regmap(struct regulator_dev *rdev); | 267 | int regulator_get_voltage_sel_regmap(struct regulator_dev *rdev); |
| 264 | int regulator_set_voltage_sel_regmap(struct regulator_dev *rdev, unsigned sel); | 268 | int regulator_set_voltage_sel_regmap(struct regulator_dev *rdev, unsigned sel); |
| 265 | int regulator_is_enabled_regmap(struct regulator_dev *rdev); | 269 | int regulator_is_enabled_regmap(struct regulator_dev *rdev); |
