diff options
author | Haojian Zhuang <haojian.zhuang@marvell.com> | 2009-12-10 06:06:17 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2010-03-07 16:17:06 -0500 |
commit | 34a4b2391e9fbd12de9817de4ae409528bd7d7b6 (patch) | |
tree | fc82cd2d7985a84eec048b1895ed5f354d55759e | |
parent | 866a98ae6e1a9768cd25fe1185481569c7e4b4a9 (diff) |
regulator: Unsupport 88pm8607 A0 and A1
Remove the support 88PM8607 A0/A1 stepping. There's some register
definition changes in B0 stepping. It can make software more efficient.
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r-- | drivers/regulator/88pm8607.c | 290 |
1 files changed, 77 insertions, 213 deletions
diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c index 97897a6bf4f3..5fb83e2ced25 100644 --- a/drivers/regulator/88pm8607.c +++ b/drivers/regulator/88pm8607.c | |||
@@ -48,7 +48,6 @@ static inline int check_range(struct pm8607_regulator_info *info, | |||
48 | static int pm8607_list_voltage(struct regulator_dev *rdev, unsigned index) | 48 | static int pm8607_list_voltage(struct regulator_dev *rdev, unsigned index) |
49 | { | 49 | { |
50 | struct pm8607_regulator_info *info = rdev_get_drvdata(rdev); | 50 | struct pm8607_regulator_info *info = rdev_get_drvdata(rdev); |
51 | uint8_t chip_id = info->chip->chip_version; | ||
52 | int ret = -EINVAL; | 51 | int ret = -EINVAL; |
53 | 52 | ||
54 | switch (info->desc.id) { | 53 | switch (info->desc.id) { |
@@ -90,79 +89,29 @@ static int pm8607_list_voltage(struct regulator_dev *rdev, unsigned index) | |||
90 | case PM8607_ID_LDO2: | 89 | case PM8607_ID_LDO2: |
91 | case PM8607_ID_LDO3: | 90 | case PM8607_ID_LDO3: |
92 | case PM8607_ID_LDO9: | 91 | case PM8607_ID_LDO9: |
93 | switch (chip_id) { | 92 | ret = (index < 3) ? (index * 50000 + 1800000) : |
94 | case PM8607_CHIP_A0: | 93 | ((index < 7) ? (index * 50000 + 2550000) : |
95 | case PM8607_CHIP_A1: | 94 | 3300000); |
96 | ret = (index < 3) ? (index * 50000 + 1800000) : | ||
97 | ((index < 8) ? (index * 50000 + 2550000) : | ||
98 | -EINVAL); | ||
99 | break; | ||
100 | case PM8607_CHIP_B0: | ||
101 | ret = (index < 3) ? (index * 50000 + 1800000) : | ||
102 | ((index < 7) ? (index * 50000 + 2550000) : | ||
103 | 3300000); | ||
104 | break; | ||
105 | } | ||
106 | break; | 95 | break; |
107 | case PM8607_ID_LDO4: | 96 | case PM8607_ID_LDO4: |
108 | switch (chip_id) { | 97 | ret = (index < 3) ? (index * 50000 + 1800000) : |
109 | case PM8607_CHIP_A0: | 98 | ((index < 6) ? (index * 50000 + 2550000) : |
110 | case PM8607_CHIP_A1: | 99 | ((index == 6) ? 2900000 : 3300000)); |
111 | ret = (index < 3) ? (index * 50000 + 1800000) : | ||
112 | ((index < 8) ? (index * 50000 + 2550000) : | ||
113 | -EINVAL); | ||
114 | break; | ||
115 | case PM8607_CHIP_B0: | ||
116 | ret = (index < 3) ? (index * 50000 + 1800000) : | ||
117 | ((index < 6) ? (index * 50000 + 2550000) : | ||
118 | ((index == 6) ? 2900000 : 3300000)); | ||
119 | break; | ||
120 | } | ||
121 | break; | 100 | break; |
122 | case PM8607_ID_LDO6: | 101 | case PM8607_ID_LDO6: |
123 | switch (chip_id) { | 102 | ret = (index < 2) ? (index * 50000 + 1800000) : |
124 | case PM8607_CHIP_A0: | 103 | ((index < 7) ? (index * 50000 + 2500000) : |
125 | case PM8607_CHIP_A1: | 104 | 3300000); |
126 | ret = (index < 3) ? (index * 50000 + 1800000) : | ||
127 | ((index < 8) ? (index * 50000 + 2450000) : | ||
128 | -EINVAL); | ||
129 | break; | ||
130 | case PM8607_CHIP_B0: | ||
131 | ret = (index < 2) ? (index * 50000 + 1800000) : | ||
132 | ((index < 7) ? (index * 50000 + 2500000) : | ||
133 | 3300000); | ||
134 | break; | ||
135 | } | ||
136 | break; | 105 | break; |
137 | case PM8607_ID_LDO10: | 106 | case PM8607_ID_LDO10: |
138 | switch (chip_id) { | 107 | ret = (index < 3) ? (index * 50000 + 1800000) : |
139 | case PM8607_CHIP_A0: | 108 | ((index < 7) ? (index * 50000 + 2550000) : |
140 | case PM8607_CHIP_A1: | 109 | ((index == 7) ? 3300000 : 1200000)); |
141 | ret = (index < 3) ? (index * 50000 + 1800000) : | ||
142 | ((index < 8) ? (index * 50000 + 2550000) : | ||
143 | 1200000); | ||
144 | break; | ||
145 | case PM8607_CHIP_B0: | ||
146 | ret = (index < 3) ? (index * 50000 + 1800000) : | ||
147 | ((index < 7) ? (index * 50000 + 2550000) : | ||
148 | ((index == 7) ? 3300000 : 1200000)); | ||
149 | break; | ||
150 | } | ||
151 | break; | 110 | break; |
152 | case PM8607_ID_LDO14: | 111 | case PM8607_ID_LDO14: |
153 | switch (chip_id) { | 112 | ret = (index < 2) ? (index * 50000 + 1800000) : |
154 | case PM8607_CHIP_A0: | 113 | ((index < 7) ? (index * 50000 + 2600000) : |
155 | case PM8607_CHIP_A1: | 114 | 3300000); |
156 | ret = (index < 3) ? (index * 50000 + 1800000) : | ||
157 | ((index < 8) ? (index * 50000 + 2550000) : | ||
158 | -EINVAL); | ||
159 | break; | ||
160 | case PM8607_CHIP_B0: | ||
161 | ret = (index < 2) ? (index * 50000 + 1800000) : | ||
162 | ((index < 7) ? (index * 50000 + 2600000) : | ||
163 | 3300000); | ||
164 | break; | ||
165 | } | ||
166 | break; | 115 | break; |
167 | } | 116 | } |
168 | return ret; | 117 | return ret; |
@@ -171,7 +120,6 @@ static int pm8607_list_voltage(struct regulator_dev *rdev, unsigned index) | |||
171 | static int choose_voltage(struct regulator_dev *rdev, int min_uV, int max_uV) | 120 | static int choose_voltage(struct regulator_dev *rdev, int min_uV, int max_uV) |
172 | { | 121 | { |
173 | struct pm8607_regulator_info *info = rdev_get_drvdata(rdev); | 122 | struct pm8607_regulator_info *info = rdev_get_drvdata(rdev); |
174 | uint8_t chip_id = info->chip->chip_version; | ||
175 | int val = -ENOENT; | 123 | int val = -ENOENT; |
176 | int ret; | 124 | int ret; |
177 | 125 | ||
@@ -256,161 +204,77 @@ static int choose_voltage(struct regulator_dev *rdev, int min_uV, int max_uV) | |||
256 | case PM8607_ID_LDO2: | 204 | case PM8607_ID_LDO2: |
257 | case PM8607_ID_LDO3: | 205 | case PM8607_ID_LDO3: |
258 | case PM8607_ID_LDO9: | 206 | case PM8607_ID_LDO9: |
259 | switch (chip_id) { | 207 | if (min_uV < 2700000) { /* 1800mV ~ 1900mV / 50mV */ |
260 | case PM8607_CHIP_A0: | 208 | if (min_uV <= 1800000) |
261 | case PM8607_CHIP_A1: | 209 | val = 0; |
262 | if (min_uV < 2700000) /* 1800mV ~ 1900mV / 50mV */ | 210 | else if (min_uV <= 1900000) |
263 | if (min_uV <= 1800000) | 211 | val = (min_uV - 1750001) / 50000; |
264 | val = 0; | 212 | else |
265 | else if (min_uV <= 1900000) | 213 | val = 3; /* 2700mV */ |
266 | val = (min_uV - 1750001) / 50000; | 214 | } else { /* 2700mV ~ 2850mV / 50mV */ |
267 | else | 215 | if (min_uV <= 2850000) { |
268 | val = 3; /* 2700mV */ | 216 | val = (min_uV - 2650001) / 50000; |
269 | else { /* 2700mV ~ 2900mV / 50mV */ | 217 | val += 3; |
270 | if (min_uV <= 2900000) { | 218 | } else if (min_uV <= 3300000) |
271 | val = (min_uV - 2650001) / 50000; | 219 | val = 7; |
272 | val += 3; | 220 | else |
273 | } else | 221 | val = -EINVAL; |
274 | val = -EINVAL; | ||
275 | } | ||
276 | break; | ||
277 | case PM8607_CHIP_B0: | ||
278 | if (min_uV < 2700000) { /* 1800mV ~ 1900mV / 50mV */ | ||
279 | if (min_uV <= 1800000) | ||
280 | val = 0; | ||
281 | else if (min_uV <= 1900000) | ||
282 | val = (min_uV - 1750001) / 50000; | ||
283 | else | ||
284 | val = 3; /* 2700mV */ | ||
285 | } else { /* 2700mV ~ 2850mV / 50mV */ | ||
286 | if (min_uV <= 2850000) { | ||
287 | val = (min_uV - 2650001) / 50000; | ||
288 | val += 3; | ||
289 | } else if (min_uV <= 3300000) | ||
290 | val = 7; | ||
291 | else | ||
292 | val = -EINVAL; | ||
293 | } | ||
294 | break; | ||
295 | } | 222 | } |
296 | break; | 223 | break; |
297 | case PM8607_ID_LDO4: | 224 | case PM8607_ID_LDO4: |
298 | switch (chip_id) { | 225 | if (min_uV < 2700000) { /* 1800mV ~ 1900mV / 50mV */ |
299 | case PM8607_CHIP_A0: | 226 | if (min_uV <= 1800000) |
300 | case PM8607_CHIP_A1: | 227 | val = 0; |
301 | if (min_uV < 2700000) /* 1800mV ~ 1900mV / 50mV */ | 228 | else if (min_uV <= 1900000) |
302 | if (min_uV <= 1800000) | 229 | val = (min_uV - 1750001) / 50000; |
303 | val = 0; | 230 | else |
304 | else if (min_uV <= 1900000) | 231 | val = 3; /* 2700mV */ |
305 | val = (min_uV - 1750001) / 50000; | 232 | } else { /* 2700mV ~ 2800mV / 50mV */ |
306 | else | 233 | if (min_uV <= 2850000) { |
307 | val = 3; /* 2700mV */ | 234 | val = (min_uV - 2650001) / 50000; |
308 | else { /* 2700mV ~ 2900mV / 50mV */ | 235 | val += 3; |
309 | if (min_uV <= 2900000) { | 236 | } else if (min_uV <= 2900000) |
310 | val = (min_uV - 2650001) / 50000; | 237 | val = 6; |
311 | val += 3; | 238 | else if (min_uV <= 3300000) |
312 | } else | 239 | val = 7; |
313 | val = -EINVAL; | 240 | else |
314 | } | 241 | val = -EINVAL; |
315 | break; | ||
316 | case PM8607_CHIP_B0: | ||
317 | if (min_uV < 2700000) { /* 1800mV ~ 1900mV / 50mV */ | ||
318 | if (min_uV <= 1800000) | ||
319 | val = 0; | ||
320 | else if (min_uV <= 1900000) | ||
321 | val = (min_uV - 1750001) / 50000; | ||
322 | else | ||
323 | val = 3; /* 2700mV */ | ||
324 | } else { /* 2700mV ~ 2800mV / 50mV */ | ||
325 | if (min_uV <= 2850000) { | ||
326 | val = (min_uV - 2650001) / 50000; | ||
327 | val += 3; | ||
328 | } else if (min_uV <= 2900000) | ||
329 | val = 6; | ||
330 | else if (min_uV <= 3300000) | ||
331 | val = 7; | ||
332 | else | ||
333 | val = -EINVAL; | ||
334 | } | ||
335 | break; | ||
336 | } | 242 | } |
337 | break; | 243 | break; |
338 | case PM8607_ID_LDO6: | 244 | case PM8607_ID_LDO6: |
339 | switch (chip_id) { | 245 | if (min_uV < 2600000) { /* 1800mV ~ 1850mV / 50mV */ |
340 | case PM8607_CHIP_A0: | 246 | if (min_uV <= 1800000) |
341 | case PM8607_CHIP_A1: | 247 | val = 0; |
342 | if (min_uV < 2600000) { /* 1800mV ~ 1900mV / 50mV */ | 248 | else if (min_uV <= 1850000) |
343 | if (min_uV <= 1800000) | 249 | val = (min_uV - 1750001) / 50000; |
344 | val = 0; | 250 | else |
345 | else if (min_uV <= 1900000) | 251 | val = 2; /* 2600mV */ |
346 | val = (min_uV - 1750001) / 50000; | 252 | } else { /* 2600mV ~ 2800mV / 50mV */ |
347 | else | 253 | if (min_uV <= 2800000) { |
348 | val = 3; /* 2600mV */ | 254 | val = (min_uV - 2550001) / 50000; |
349 | } else { /* 2600mV ~ 2800mV / 50mV */ | 255 | val += 2; |
350 | if (min_uV <= 2800000) { | 256 | } else if (min_uV <= 3300000) |
351 | val = (min_uV - 2550001) / 50000; | 257 | val = 7; |
352 | val += 3; | 258 | else |
353 | } else | 259 | val = -EINVAL; |
354 | val = -EINVAL; | ||
355 | } | ||
356 | break; | ||
357 | case PM8607_CHIP_B0: | ||
358 | if (min_uV < 2600000) { /* 1800mV ~ 1850mV / 50mV */ | ||
359 | if (min_uV <= 1800000) | ||
360 | val = 0; | ||
361 | else if (min_uV <= 1850000) | ||
362 | val = (min_uV - 1750001) / 50000; | ||
363 | else | ||
364 | val = 2; /* 2600mV */ | ||
365 | } else { /* 2600mV ~ 2800mV / 50mV */ | ||
366 | if (min_uV <= 2800000) { | ||
367 | val = (min_uV - 2550001) / 50000; | ||
368 | val += 2; | ||
369 | } else if (min_uV <= 3300000) | ||
370 | val = 7; | ||
371 | else | ||
372 | val = -EINVAL; | ||
373 | } | ||
374 | break; | ||
375 | } | 260 | } |
376 | break; | 261 | break; |
377 | case PM8607_ID_LDO14: | 262 | case PM8607_ID_LDO14: |
378 | switch (chip_id) { | 263 | if (min_uV < 2700000) { /* 1800mV ~ 1850mV / 50mV */ |
379 | case PM8607_CHIP_A0: | 264 | if (min_uV <= 1800000) |
380 | case PM8607_CHIP_A1: | 265 | val = 0; |
381 | if (min_uV < 2700000) { /* 1800mV ~ 1900mV / 50mV */ | 266 | else if (min_uV <= 1850000) |
382 | if (min_uV <= 1800000) | 267 | val = (min_uV - 1750001) / 50000; |
383 | val = 0; | 268 | else |
384 | else if (min_uV <= 1900000) | 269 | val = 2; /* 2700mV */ |
385 | val = (min_uV - 1750001) / 50000; | 270 | } else { /* 2700mV ~ 2900mV / 50mV */ |
386 | else | 271 | if (min_uV <= 2900000) { |
387 | val = 3; /* 2700mV */ | 272 | val = (min_uV - 2650001) / 50000; |
388 | } else { /* 2700mV ~ 2900mV / 50mV */ | 273 | val += 2; |
389 | if (min_uV <= 2900000) { | 274 | } else if (min_uV <= 3300000) |
390 | val = (min_uV - 2650001) / 50000; | 275 | val = 7; |
391 | val += 3; | 276 | else |
392 | } else | 277 | val = -EINVAL; |
393 | val = -EINVAL; | ||
394 | } | ||
395 | break; | ||
396 | case PM8607_CHIP_B0: | ||
397 | if (min_uV < 2700000) { /* 1800mV ~ 1850mV / 50mV */ | ||
398 | if (min_uV <= 1800000) | ||
399 | val = 0; | ||
400 | else if (min_uV <= 1850000) | ||
401 | val = (min_uV - 1750001) / 50000; | ||
402 | else | ||
403 | val = 2; /* 2700mV */ | ||
404 | } else { /* 2700mV ~ 2900mV / 50mV */ | ||
405 | if (min_uV <= 2900000) { | ||
406 | val = (min_uV - 2650001) / 50000; | ||
407 | val += 2; | ||
408 | } else if (min_uV <= 3300000) | ||
409 | val = 7; | ||
410 | else | ||
411 | val = -EINVAL; | ||
412 | } | ||
413 | break; | ||
414 | } | 278 | } |
415 | break; | 279 | break; |
416 | } | 280 | } |