aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2010-12-13 10:07:40 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-12-13 12:36:10 -0500
commit5a7743edac3d720a52e721229938d21d40f045ce (patch)
treea2dd171afec5da22b9abf77544cb8c1755bc122d /drivers/regulator
parent7d8316df44053687625eef792d53b3ac62e82248 (diff)
regulator: Update LDO2 for WM8958
LDO2 has a slightly different range of supported voltages on WM8958 so update the selector<->voltage mappings to match. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/wm8994-regulator.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/drivers/regulator/wm8994-regulator.c b/drivers/regulator/wm8994-regulator.c
index 03713bc66e4a..21fefef02a43 100644
--- a/drivers/regulator/wm8994-regulator.c
+++ b/drivers/regulator/wm8994-regulator.c
@@ -131,10 +131,19 @@ static struct regulator_ops wm8994_ldo1_ops = {
131static int wm8994_ldo2_list_voltage(struct regulator_dev *rdev, 131static int wm8994_ldo2_list_voltage(struct regulator_dev *rdev,
132 unsigned int selector) 132 unsigned int selector)
133{ 133{
134 struct wm8994_ldo *ldo = rdev_get_drvdata(rdev);
135
134 if (selector > WM8994_LDO2_MAX_SELECTOR) 136 if (selector > WM8994_LDO2_MAX_SELECTOR)
135 return -EINVAL; 137 return -EINVAL;
136 138
137 return (selector * 100000) + 900000; 139 switch (ldo->wm8994->type) {
140 case WM8994:
141 return (selector * 100000) + 900000;
142 case WM8958:
143 return (selector * 100000) + 1000000;
144 default:
145 return -EINVAL;
146 }
138} 147}
139 148
140static int wm8994_ldo2_get_voltage(struct regulator_dev *rdev) 149static int wm8994_ldo2_get_voltage(struct regulator_dev *rdev)
@@ -157,7 +166,17 @@ static int wm8994_ldo2_set_voltage(struct regulator_dev *rdev,
157 struct wm8994_ldo *ldo = rdev_get_drvdata(rdev); 166 struct wm8994_ldo *ldo = rdev_get_drvdata(rdev);
158 int selector, v; 167 int selector, v;
159 168
160 selector = (min_uV - 900000) / 100000; 169 switch (ldo->wm8994->type) {
170 case WM8994:
171 selector = (min_uV - 900000) / 100000;
172 break;
173 case WM8958:
174 selector = (min_uV - 1000000) / 100000;
175 break;
176 default:
177 return -EINVAL;
178 }
179
161 v = wm8994_ldo2_list_voltage(rdev, selector); 180 v = wm8994_ldo2_list_voltage(rdev, selector);
162 if (v < 0 || v > max_uV) 181 if (v < 0 || v > max_uV)
163 return -EINVAL; 182 return -EINVAL;