diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-21 13:34:56 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-21 13:34:56 -0400 |
commit | d15d76448bb58c7832e954b6a8f1e301720b7866 (patch) | |
tree | 7891c9e0779f5df33840be9cdba1f0331459e97c /drivers/regulator/isl6271a-regulator.c | |
parent | 0c2fe82a9b106f1c03719783134360586d718a69 (diff) | |
parent | 4992fa1fd425f1934f503ffa96b68e235b89db9a (diff) |
Merge tag 'regulator-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator updates for 3.4 from Mark Brown:
"This has been a fairly quiet release from a regulator point of view,
the only real framework features added were devm support and a
convenience helper for setting up fixed voltage regulators.
We also added a couple of drivers (but will drop the BQ240022 driver
via the arm-soc tree as it's been replaced by the more generic
gpio-regulator driver) and Axel Lin continued his relentless and
generally awesome stream of fixes and cleanups."
* tag 'regulator-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (93 commits)
regulator: Fix up a confusing dev_warn when DT lookup fails
regulator: Convert tps6507x to set_voltage_sel
regulator: Refactor tps6507x to use one tps6507x_pmic_ops for all LDOs and DCDCs
regulator: Make s5m8767_get_voltage_register always return correct register
regulator: s5m8767: Check pdata->buck[2|3|4]_gpiodvs earlier
regulator: tps65910: Provide settling time for DCDC voltage change
regulator: Add Anatop regulator driver
regulator: Simplify implementation of tps65912_get_voltage_dcdc
regulator: Use tps65912_set_voltage_sel for both DCDCx and LDOx
regulator: tps65910: Provide settling time for enabling rails
regulator: max8925: Use DIV_ROUND_UP macro
regulator: tps65912: Use simple equations to get register address
regulator: Fix the logic of tps65910_get_mode
regulator: Merge tps65217_pmic_ldo234_ops and tps65217_pmic_dcdc_ops to tps65217_pmic_ops
regulator: Use DIV_ROUND_CLOSEST in wm8350_isink_get_current
regulator: Use array to store dcdc_range settings for tps65912
regulator: Rename s5m8767_convert_voltage to s5m8767_convert_voltage_to_sel
regulator: tps6524x: Remove unneeded comment for N_REGULATORS
regulator: Rename set_voltage_sel callback function name to *_sel
regulator: Fix s5m8767_set_voltage_time_sel calculation value
...
Diffstat (limited to 'drivers/regulator/isl6271a-regulator.c')
-rw-r--r-- | drivers/regulator/isl6271a-regulator.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/drivers/regulator/isl6271a-regulator.c b/drivers/regulator/isl6271a-regulator.c index c1a456c4257c..775f5fd208c3 100644 --- a/drivers/regulator/isl6271a-regulator.c +++ b/drivers/regulator/isl6271a-regulator.c | |||
@@ -63,23 +63,15 @@ static int isl6271a_set_voltage(struct regulator_dev *dev, | |||
63 | unsigned *selector) | 63 | unsigned *selector) |
64 | { | 64 | { |
65 | struct isl_pmic *pmic = rdev_get_drvdata(dev); | 65 | struct isl_pmic *pmic = rdev_get_drvdata(dev); |
66 | int vsel, err, data; | 66 | int err, data; |
67 | 67 | ||
68 | if (minuV < ISL6271A_VOLTAGE_MIN || minuV > ISL6271A_VOLTAGE_MAX) | 68 | if (minuV < ISL6271A_VOLTAGE_MIN || minuV > ISL6271A_VOLTAGE_MAX) |
69 | return -EINVAL; | 69 | return -EINVAL; |
70 | if (maxuV < ISL6271A_VOLTAGE_MIN || maxuV > ISL6271A_VOLTAGE_MAX) | 70 | if (maxuV < ISL6271A_VOLTAGE_MIN || maxuV > ISL6271A_VOLTAGE_MAX) |
71 | return -EINVAL; | 71 | return -EINVAL; |
72 | 72 | ||
73 | /* Align to 50000 mV */ | 73 | data = DIV_ROUND_UP(minuV - ISL6271A_VOLTAGE_MIN, |
74 | vsel = minuV - (minuV % ISL6271A_VOLTAGE_STEP); | 74 | ISL6271A_VOLTAGE_STEP); |
75 | |||
76 | /* If the result fell out of [minuV,maxuV] range, put it back */ | ||
77 | if (vsel < minuV) | ||
78 | vsel += ISL6271A_VOLTAGE_STEP; | ||
79 | |||
80 | /* Convert the microvolts to data for the chip */ | ||
81 | data = (vsel - ISL6271A_VOLTAGE_MIN) / ISL6271A_VOLTAGE_STEP; | ||
82 | |||
83 | *selector = data; | 75 | *selector = data; |
84 | 76 | ||
85 | mutex_lock(&pmic->mtx); | 77 | mutex_lock(&pmic->mtx); |