diff options
| author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-05-09 16:38:33 -0400 |
|---|---|---|
| committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-05-12 06:11:32 -0400 |
| commit | bca7bbfff37808d56355bbcf0ceec34f0cc6c85d (patch) | |
| tree | 2ad595ab595a404b8082b01696fc152de95a10b2 /include/linux/regulator | |
| parent | e843fc4616485bbd8b5a115f5bd4f73808656373 (diff) | |
regulator: core: Allow drivers to set simple linear voltage maps as data
A lot of regulator hardware maps selectors on to voltages with a simple
linear mapping function
selector = base + (selector * step size)
Provide off the shelf list_voltage() and map_voltage() operations which
use new min_uV and uV_step members in the regulator_desc to implement
this function.
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 | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index 13aa852b24ad..b0432cc2b169 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h | |||
| @@ -161,12 +161,16 @@ enum regulator_type { | |||
| 161 | * @name: Identifying name for the regulator. | 161 | * @name: Identifying name for the regulator. |
| 162 | * @supply_name: Identifying the regulator supply | 162 | * @supply_name: Identifying the regulator supply |
| 163 | * @id: Numerical identifier for the regulator. | 163 | * @id: Numerical identifier for the regulator. |
| 164 | * @n_voltages: Number of selectors available for ops.list_voltage(). | ||
| 165 | * @ops: Regulator operations table. | 164 | * @ops: Regulator operations table. |
| 166 | * @irq: Interrupt number for the regulator. | 165 | * @irq: Interrupt number for the regulator. |
| 167 | * @type: Indicates if the regulator is a voltage or current regulator. | 166 | * @type: Indicates if the regulator is a voltage or current regulator. |
| 168 | * @owner: Module providing the regulator, used for refcounting. | 167 | * @owner: Module providing the regulator, used for refcounting. |
| 169 | 168 | * | |
| 169 | * @n_voltages: Number of selectors available for ops.list_voltage(). | ||
| 170 | * | ||
| 171 | * @min_uV: Voltage given by the lowest selector (if linear mapping) | ||
| 172 | * @uV_step: Voltage increase with each selector (if linear mapping) | ||
| 173 | * | ||
| 170 | * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_ | 174 | * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_ |
| 171 | * @vsel_mask: Mask for register bitfield used for selector | 175 | * @vsel_mask: Mask for register bitfield used for selector |
| 172 | * @enable_reg: Register for control when using regmap enable/disable ops | 176 | * @enable_reg: Register for control when using regmap enable/disable ops |
| @@ -182,6 +186,9 @@ struct regulator_desc { | |||
| 182 | enum regulator_type type; | 186 | enum regulator_type type; |
| 183 | struct module *owner; | 187 | struct module *owner; |
| 184 | 188 | ||
| 189 | unsigned int min_uV; | ||
| 190 | unsigned int uV_step; | ||
| 191 | |||
| 185 | unsigned int vsel_reg; | 192 | unsigned int vsel_reg; |
| 186 | unsigned int vsel_mask; | 193 | unsigned int vsel_mask; |
| 187 | unsigned int enable_reg; | 194 | unsigned int enable_reg; |
| @@ -262,6 +269,10 @@ int rdev_get_id(struct regulator_dev *rdev); | |||
| 262 | 269 | ||
| 263 | int regulator_mode_to_status(unsigned int); | 270 | int regulator_mode_to_status(unsigned int); |
| 264 | 271 | ||
| 272 | int regulator_list_voltage_linear(struct regulator_dev *rdev, | ||
| 273 | unsigned int selector); | ||
| 274 | int regulator_map_voltage_linear(struct regulator_dev *rdev, | ||
| 275 | int min_uV, int max_uV); | ||
| 265 | int regulator_map_voltage_iterate(struct regulator_dev *rdev, | 276 | int regulator_map_voltage_iterate(struct regulator_dev *rdev, |
| 266 | int min_uV, int max_uV); | 277 | int min_uV, int max_uV); |
| 267 | int regulator_get_voltage_sel_regmap(struct regulator_dev *rdev); | 278 | int regulator_get_voltage_sel_regmap(struct regulator_dev *rdev); |
