diff options
| author | Mark Brown <broonie@linaro.org> | 2013-07-02 17:52:41 -0400 |
|---|---|---|
| committer | Mark Brown <broonie@linaro.org> | 2013-07-15 06:20:32 -0400 |
| commit | 94d33c02c7186b69849c292e1216a08ad1c0d99d (patch) | |
| tree | 7427db70b59494e1d8e3f295123ab1fd2d53f663 /include/linux/regulator | |
| parent | ad81f0545ef01ea651886dddac4bef6cec930092 (diff) | |
regulator: core: Add helpers for multiple linear ranges
Many regulators have several linear ranges of selector with different
step sizes, for example offering better resolution at lower voltages.
Provide regulator_{map,list}_voltage_linear_range() allowing these
regulators to use generic code. To do so a table of regulator_linear_range
structs needs to be pointed to from the descriptor.
This was inspired by similar code included in a driver submission from
Chao Xie and Yi Zhang at Marvell.
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'include/linux/regulator')
| -rw-r--r-- | include/linux/regulator/driver.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index 6700cc94bdd1..67e13aa5a478 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h | |||
| @@ -40,6 +40,24 @@ enum regulator_status { | |||
| 40 | }; | 40 | }; |
| 41 | 41 | ||
| 42 | /** | 42 | /** |
| 43 | * Specify a range of voltages for regulator_map_linar_range() and | ||
| 44 | * regulator_list_linear_range(). | ||
| 45 | * | ||
| 46 | * @min_uV: Lowest voltage in range | ||
| 47 | * @max_uV: Highest voltage in range | ||
| 48 | * @min_sel: Lowest selector for range | ||
| 49 | * @max_sel: Highest selector for range | ||
| 50 | * @uV_step: Step size | ||
| 51 | */ | ||
| 52 | struct regulator_linear_range { | ||
| 53 | unsigned int min_uV; | ||
| 54 | unsigned int max_uV; | ||
| 55 | unsigned int min_sel; | ||
| 56 | unsigned int max_sel; | ||
| 57 | unsigned int uV_step; | ||
| 58 | }; | ||
| 59 | |||
| 60 | /** | ||
| 43 | * struct regulator_ops - regulator operations. | 61 | * struct regulator_ops - regulator operations. |
| 44 | * | 62 | * |
| 45 | * @enable: Configure the regulator as enabled. | 63 | * @enable: Configure the regulator as enabled. |
| @@ -223,6 +241,9 @@ struct regulator_desc { | |||
| 223 | unsigned int linear_min_sel; | 241 | unsigned int linear_min_sel; |
| 224 | unsigned int ramp_delay; | 242 | unsigned int ramp_delay; |
| 225 | 243 | ||
| 244 | const struct regulator_linear_range *linear_ranges; | ||
| 245 | int n_linear_ranges; | ||
| 246 | |||
| 226 | const unsigned int *volt_table; | 247 | const unsigned int *volt_table; |
| 227 | 248 | ||
| 228 | unsigned int vsel_reg; | 249 | unsigned int vsel_reg; |
| @@ -326,10 +347,14 @@ int regulator_mode_to_status(unsigned int); | |||
| 326 | 347 | ||
| 327 | int regulator_list_voltage_linear(struct regulator_dev *rdev, | 348 | int regulator_list_voltage_linear(struct regulator_dev *rdev, |
| 328 | unsigned int selector); | 349 | unsigned int selector); |
| 350 | int regulator_list_voltage_linear_range(struct regulator_dev *rdev, | ||
| 351 | unsigned int selector); | ||
| 329 | int regulator_list_voltage_table(struct regulator_dev *rdev, | 352 | int regulator_list_voltage_table(struct regulator_dev *rdev, |
| 330 | unsigned int selector); | 353 | unsigned int selector); |
| 331 | int regulator_map_voltage_linear(struct regulator_dev *rdev, | 354 | int regulator_map_voltage_linear(struct regulator_dev *rdev, |
| 332 | int min_uV, int max_uV); | 355 | int min_uV, int max_uV); |
| 356 | int regulator_map_voltage_linear_range(struct regulator_dev *rdev, | ||
| 357 | int min_uV, int max_uV); | ||
| 333 | int regulator_map_voltage_iterate(struct regulator_dev *rdev, | 358 | int regulator_map_voltage_iterate(struct regulator_dev *rdev, |
| 334 | int min_uV, int max_uV); | 359 | int min_uV, int max_uV); |
| 335 | int regulator_map_voltage_ascend(struct regulator_dev *rdev, | 360 | int regulator_map_voltage_ascend(struct regulator_dev *rdev, |
