aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/wm8994-regulator.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator/wm8994-regulator.c')
-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 594f88eb60c3..35b2958d5106 100644
--- a/drivers/regulator/wm8994-regulator.c
+++ b/drivers/regulator/wm8994-regulator.c
@@ -130,10 +130,19 @@ static struct regulator_ops wm8994_ldo1_ops = {
130static int wm8994_ldo2_list_voltage(struct regulator_dev *rdev, 130static int wm8994_ldo2_list_voltage(struct regulator_dev *rdev,
131 unsigned int selector) 131 unsigned int selector)
132{ 132{
133 struct wm8994_ldo *ldo = rdev_get_drvdata(rdev);
134
133 if (selector > WM8994_LDO2_MAX_SELECTOR) 135 if (selector > WM8994_LDO2_MAX_SELECTOR)
134 return -EINVAL; 136 return -EINVAL;
135 137
136 return (selector * 100000) + 900000; 138 switch (ldo->wm8994->type) {
139 case WM8994:
140 return (selector * 100000) + 900000;
141 case WM8958:
142 return (selector * 100000) + 1000000;
143 default:
144 return -EINVAL;
145 }
137} 146}
138 147
139static int wm8994_ldo2_get_voltage_sel(struct regulator_dev *rdev) 148static int wm8994_ldo2_get_voltage_sel(struct regulator_dev *rdev)
@@ -154,7 +163,17 @@ static int wm8994_ldo2_set_voltage(struct regulator_dev *rdev,
154 struct wm8994_ldo *ldo = rdev_get_drvdata(rdev); 163 struct wm8994_ldo *ldo = rdev_get_drvdata(rdev);
155 int selector, v; 164 int selector, v;
156 165
157 selector = (min_uV - 900000) / 100000; 166 switch (ldo->wm8994->type) {
167 case WM8994:
168 selector = (min_uV - 900000) / 100000;
169 break;
170 case WM8958:
171 selector = (min_uV - 1000000) / 100000;
172 break;
173 default:
174 return -EINVAL;
175 }
176
158 v = wm8994_ldo2_list_voltage(rdev, selector); 177 v = wm8994_ldo2_list_voltage(rdev, selector);
159 if (v < 0 || v > max_uV) 178 if (v < 0 || v > max_uV)
160 return -EINVAL; 179 return -EINVAL;