diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2011-03-17 08:25:02 -0400 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2011-03-26 10:15:06 -0400 |
commit | 42ab616afe8844261828395cc2e4708c867412c2 (patch) | |
tree | 99f1054c1c4bb3deff87b3650a0d615043f3f47b /drivers/regulator | |
parent | 88cd222b259d62148ab8c82398498b1a01314476 (diff) |
regulator: add ab8500 enable and raise time delays
This uses the new infrastructure to provide proper delays when
enabling or setting the voltage of one specific regulator.
Cc: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/ab8500.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index d157146c8655..02f3c2333c83 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c | |||
@@ -38,6 +38,7 @@ | |||
38 | * @voltage_mask: mask to control regulator voltage | 38 | * @voltage_mask: mask to control regulator voltage |
39 | * @voltages: supported voltage table | 39 | * @voltages: supported voltage table |
40 | * @voltages_len: number of supported voltages for the regulator | 40 | * @voltages_len: number of supported voltages for the regulator |
41 | * @delay: startup/set voltage delay in us | ||
41 | */ | 42 | */ |
42 | struct ab8500_regulator_info { | 43 | struct ab8500_regulator_info { |
43 | struct device *dev; | 44 | struct device *dev; |
@@ -55,6 +56,7 @@ struct ab8500_regulator_info { | |||
55 | u8 voltage_mask; | 56 | u8 voltage_mask; |
56 | int const *voltages; | 57 | int const *voltages; |
57 | int voltages_len; | 58 | int voltages_len; |
59 | unsigned int delay; | ||
58 | }; | 60 | }; |
59 | 61 | ||
60 | /* voltage tables for the vauxn/vintcore supplies */ | 62 | /* voltage tables for the vauxn/vintcore supplies */ |
@@ -290,6 +292,29 @@ static int ab8500_regulator_set_voltage(struct regulator_dev *rdev, | |||
290 | return ret; | 292 | return ret; |
291 | } | 293 | } |
292 | 294 | ||
295 | static int ab8500_regulator_enable_time(struct regulator_dev *rdev) | ||
296 | { | ||
297 | struct ab8500_regulator_info *info = rdev_get_drvdata(rdev); | ||
298 | |||
299 | return info->delay; | ||
300 | } | ||
301 | |||
302 | static int ab8500_regulator_set_voltage_time_sel(struct regulator_dev *rdev, | ||
303 | unsigned int old_sel, | ||
304 | unsigned int new_sel) | ||
305 | { | ||
306 | struct ab8500_regulator_info *info = rdev_get_drvdata(rdev); | ||
307 | int ret; | ||
308 | |||
309 | /* If the regulator isn't on, it won't take time here */ | ||
310 | ret = ab8500_regulator_is_enabled(rdev); | ||
311 | if (ret < 0) | ||
312 | return ret; | ||
313 | if (!ret) | ||
314 | return 0; | ||
315 | return info->delay; | ||
316 | } | ||
317 | |||
293 | static struct regulator_ops ab8500_regulator_ops = { | 318 | static struct regulator_ops ab8500_regulator_ops = { |
294 | .enable = ab8500_regulator_enable, | 319 | .enable = ab8500_regulator_enable, |
295 | .disable = ab8500_regulator_disable, | 320 | .disable = ab8500_regulator_disable, |
@@ -297,6 +322,8 @@ static struct regulator_ops ab8500_regulator_ops = { | |||
297 | .get_voltage = ab8500_regulator_get_voltage, | 322 | .get_voltage = ab8500_regulator_get_voltage, |
298 | .set_voltage = ab8500_regulator_set_voltage, | 323 | .set_voltage = ab8500_regulator_set_voltage, |
299 | .list_voltage = ab8500_list_voltage, | 324 | .list_voltage = ab8500_list_voltage, |
325 | .enable_time = ab8500_regulator_enable_time, | ||
326 | .set_voltage_time_sel = ab8500_regulator_set_voltage_time_sel, | ||
300 | }; | 327 | }; |
301 | 328 | ||
302 | static int ab8500_fixed_get_voltage(struct regulator_dev *rdev) | 329 | static int ab8500_fixed_get_voltage(struct regulator_dev *rdev) |
@@ -317,6 +344,8 @@ static struct regulator_ops ab8500_regulator_fixed_ops = { | |||
317 | .is_enabled = ab8500_regulator_is_enabled, | 344 | .is_enabled = ab8500_regulator_is_enabled, |
318 | .get_voltage = ab8500_fixed_get_voltage, | 345 | .get_voltage = ab8500_fixed_get_voltage, |
319 | .list_voltage = ab8500_list_voltage, | 346 | .list_voltage = ab8500_list_voltage, |
347 | .enable_time = ab8500_regulator_enable_time, | ||
348 | .set_voltage_time_sel = ab8500_regulator_set_voltage_time_sel, | ||
320 | }; | 349 | }; |
321 | 350 | ||
322 | static struct ab8500_regulator_info | 351 | static struct ab8500_regulator_info |
@@ -426,6 +455,7 @@ static struct ab8500_regulator_info | |||
426 | .owner = THIS_MODULE, | 455 | .owner = THIS_MODULE, |
427 | .n_voltages = 1, | 456 | .n_voltages = 1, |
428 | }, | 457 | }, |
458 | .delay = 10000, | ||
429 | .fixed_uV = 2000000, | 459 | .fixed_uV = 2000000, |
430 | .update_bank = 0x03, | 460 | .update_bank = 0x03, |
431 | .update_reg = 0x80, | 461 | .update_reg = 0x80, |