diff options
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/s2mpa01.c | 134 |
1 files changed, 36 insertions, 98 deletions
diff --git a/drivers/regulator/s2mpa01.c b/drivers/regulator/s2mpa01.c index 962c5f192f7c..4acefa6b462e 100644 --- a/drivers/regulator/s2mpa01.c +++ b/drivers/regulator/s2mpa01.c | |||
@@ -235,28 +235,14 @@ static struct regulator_ops s2mpa01_buck_ops = { | |||
235 | .set_ramp_delay = s2mpa01_set_ramp_delay, | 235 | .set_ramp_delay = s2mpa01_set_ramp_delay, |
236 | }; | 236 | }; |
237 | 237 | ||
238 | #define regulator_desc_ldo1(num) { \ | 238 | #define regulator_desc_ldo(num, step) { \ |
239 | .name = "LDO"#num, \ | 239 | .name = "LDO"#num, \ |
240 | .id = S2MPA01_LDO##num, \ | 240 | .id = S2MPA01_LDO##num, \ |
241 | .ops = &s2mpa01_ldo_ops, \ | 241 | .ops = &s2mpa01_ldo_ops, \ |
242 | .type = REGULATOR_VOLTAGE, \ | 242 | .type = REGULATOR_VOLTAGE, \ |
243 | .owner = THIS_MODULE, \ | 243 | .owner = THIS_MODULE, \ |
244 | .min_uV = MIN_800_MV, \ | 244 | .min_uV = MIN_800_MV, \ |
245 | .uV_step = STEP_50_MV, \ | 245 | .uV_step = step, \ |
246 | .n_voltages = S2MPA01_LDO_N_VOLTAGES, \ | ||
247 | .vsel_reg = S2MPA01_REG_L1CTRL + num - 1, \ | ||
248 | .vsel_mask = S2MPA01_LDO_VSEL_MASK, \ | ||
249 | .enable_reg = S2MPA01_REG_L1CTRL + num - 1, \ | ||
250 | .enable_mask = S2MPA01_ENABLE_MASK \ | ||
251 | } | ||
252 | #define regulator_desc_ldo2(num) { \ | ||
253 | .name = "LDO"#num, \ | ||
254 | .id = S2MPA01_LDO##num, \ | ||
255 | .ops = &s2mpa01_ldo_ops, \ | ||
256 | .type = REGULATOR_VOLTAGE, \ | ||
257 | .owner = THIS_MODULE, \ | ||
258 | .min_uV = MIN_800_MV, \ | ||
259 | .uV_step = STEP_25_MV, \ | ||
260 | .n_voltages = S2MPA01_LDO_N_VOLTAGES, \ | 246 | .n_voltages = S2MPA01_LDO_N_VOLTAGES, \ |
261 | .vsel_reg = S2MPA01_REG_L1CTRL + num - 1, \ | 247 | .vsel_reg = S2MPA01_REG_L1CTRL + num - 1, \ |
262 | .vsel_mask = S2MPA01_LDO_VSEL_MASK, \ | 248 | .vsel_mask = S2MPA01_LDO_VSEL_MASK, \ |
@@ -296,14 +282,14 @@ static struct regulator_ops s2mpa01_buck_ops = { | |||
296 | .enable_mask = S2MPA01_ENABLE_MASK \ | 282 | .enable_mask = S2MPA01_ENABLE_MASK \ |
297 | } | 283 | } |
298 | 284 | ||
299 | #define regulator_desc_buck6_7(num) { \ | 285 | #define regulator_desc_buck6_10(num, min, step) { \ |
300 | .name = "BUCK"#num, \ | 286 | .name = "BUCK"#num, \ |
301 | .id = S2MPA01_BUCK##num, \ | 287 | .id = S2MPA01_BUCK##num, \ |
302 | .ops = &s2mpa01_buck_ops, \ | 288 | .ops = &s2mpa01_buck_ops, \ |
303 | .type = REGULATOR_VOLTAGE, \ | 289 | .type = REGULATOR_VOLTAGE, \ |
304 | .owner = THIS_MODULE, \ | 290 | .owner = THIS_MODULE, \ |
305 | .min_uV = MIN_600_MV, \ | 291 | .min_uV = min, \ |
306 | .uV_step = STEP_6_25_MV, \ | 292 | .uV_step = step, \ |
307 | .n_voltages = S2MPA01_BUCK_N_VOLTAGES, \ | 293 | .n_voltages = S2MPA01_BUCK_N_VOLTAGES, \ |
308 | .ramp_delay = S2MPA01_RAMP_DELAY, \ | 294 | .ramp_delay = S2MPA01_RAMP_DELAY, \ |
309 | .vsel_reg = S2MPA01_REG_B6CTRL2 + (num - 6) * 2, \ | 295 | .vsel_reg = S2MPA01_REG_B6CTRL2 + (num - 6) * 2, \ |
@@ -312,91 +298,43 @@ static struct regulator_ops s2mpa01_buck_ops = { | |||
312 | .enable_mask = S2MPA01_ENABLE_MASK \ | 298 | .enable_mask = S2MPA01_ENABLE_MASK \ |
313 | } | 299 | } |
314 | 300 | ||
315 | #define regulator_desc_buck8 { \ | ||
316 | .name = "BUCK8", \ | ||
317 | .id = S2MPA01_BUCK8, \ | ||
318 | .ops = &s2mpa01_buck_ops, \ | ||
319 | .type = REGULATOR_VOLTAGE, \ | ||
320 | .owner = THIS_MODULE, \ | ||
321 | .min_uV = MIN_800_MV, \ | ||
322 | .uV_step = STEP_12_5_MV, \ | ||
323 | .n_voltages = S2MPA01_BUCK_N_VOLTAGES, \ | ||
324 | .ramp_delay = S2MPA01_RAMP_DELAY, \ | ||
325 | .vsel_reg = S2MPA01_REG_B8CTRL2, \ | ||
326 | .vsel_mask = S2MPA01_BUCK_VSEL_MASK, \ | ||
327 | .enable_reg = S2MPA01_REG_B8CTRL1, \ | ||
328 | .enable_mask = S2MPA01_ENABLE_MASK \ | ||
329 | } | ||
330 | |||
331 | #define regulator_desc_buck9 { \ | ||
332 | .name = "BUCK9", \ | ||
333 | .id = S2MPA01_BUCK9, \ | ||
334 | .ops = &s2mpa01_buck_ops, \ | ||
335 | .type = REGULATOR_VOLTAGE, \ | ||
336 | .owner = THIS_MODULE, \ | ||
337 | .min_uV = MIN_1500_MV, \ | ||
338 | .uV_step = STEP_12_5_MV, \ | ||
339 | .n_voltages = S2MPA01_BUCK_N_VOLTAGES, \ | ||
340 | .ramp_delay = S2MPA01_RAMP_DELAY, \ | ||
341 | .vsel_reg = S2MPA01_REG_B9CTRL2, \ | ||
342 | .vsel_mask = S2MPA01_BUCK_VSEL_MASK, \ | ||
343 | .enable_reg = S2MPA01_REG_B9CTRL1, \ | ||
344 | .enable_mask = S2MPA01_ENABLE_MASK \ | ||
345 | } | ||
346 | |||
347 | #define regulator_desc_buck10 { \ | ||
348 | .name = "BUCK10", \ | ||
349 | .id = S2MPA01_BUCK10, \ | ||
350 | .ops = &s2mpa01_buck_ops, \ | ||
351 | .type = REGULATOR_VOLTAGE, \ | ||
352 | .owner = THIS_MODULE, \ | ||
353 | .min_uV = MIN_1000_MV, \ | ||
354 | .uV_step = STEP_12_5_MV, \ | ||
355 | .n_voltages = S2MPA01_BUCK_N_VOLTAGES, \ | ||
356 | .ramp_delay = S2MPA01_RAMP_DELAY, \ | ||
357 | .vsel_reg = S2MPA01_REG_B10CTRL2, \ | ||
358 | .vsel_mask = S2MPA01_BUCK_VSEL_MASK, \ | ||
359 | .enable_reg = S2MPA01_REG_B10CTRL1, \ | ||
360 | .enable_mask = S2MPA01_ENABLE_MASK \ | ||
361 | } | ||
362 | |||
363 | static struct regulator_desc regulators[] = { | 301 | static struct regulator_desc regulators[] = { |
364 | regulator_desc_ldo2(1), | 302 | regulator_desc_ldo(1, STEP_25_MV), |
365 | regulator_desc_ldo1(2), | 303 | regulator_desc_ldo(2, STEP_50_MV), |
366 | regulator_desc_ldo1(3), | 304 | regulator_desc_ldo(3, STEP_50_MV), |
367 | regulator_desc_ldo1(4), | 305 | regulator_desc_ldo(4, STEP_50_MV), |
368 | regulator_desc_ldo1(5), | 306 | regulator_desc_ldo(5, STEP_50_MV), |
369 | regulator_desc_ldo2(6), | 307 | regulator_desc_ldo(6, STEP_25_MV), |
370 | regulator_desc_ldo1(7), | 308 | regulator_desc_ldo(7, STEP_50_MV), |
371 | regulator_desc_ldo1(8), | 309 | regulator_desc_ldo(8, STEP_50_MV), |
372 | regulator_desc_ldo1(9), | 310 | regulator_desc_ldo(9, STEP_50_MV), |
373 | regulator_desc_ldo1(10), | 311 | regulator_desc_ldo(10, STEP_50_MV), |
374 | regulator_desc_ldo2(11), | 312 | regulator_desc_ldo(11, STEP_25_MV), |
375 | regulator_desc_ldo1(12), | 313 | regulator_desc_ldo(12, STEP_50_MV), |
376 | regulator_desc_ldo1(13), | 314 | regulator_desc_ldo(13, STEP_50_MV), |
377 | regulator_desc_ldo1(14), | 315 | regulator_desc_ldo(14, STEP_50_MV), |
378 | regulator_desc_ldo1(15), | 316 | regulator_desc_ldo(15, STEP_50_MV), |
379 | regulator_desc_ldo1(16), | 317 | regulator_desc_ldo(16, STEP_50_MV), |
380 | regulator_desc_ldo1(17), | 318 | regulator_desc_ldo(17, STEP_50_MV), |
381 | regulator_desc_ldo1(18), | 319 | regulator_desc_ldo(18, STEP_50_MV), |
382 | regulator_desc_ldo1(19), | 320 | regulator_desc_ldo(19, STEP_50_MV), |
383 | regulator_desc_ldo1(20), | 321 | regulator_desc_ldo(20, STEP_50_MV), |
384 | regulator_desc_ldo1(21), | 322 | regulator_desc_ldo(21, STEP_50_MV), |
385 | regulator_desc_ldo2(22), | 323 | regulator_desc_ldo(22, STEP_25_MV), |
386 | regulator_desc_ldo2(23), | 324 | regulator_desc_ldo(23, STEP_25_MV), |
387 | regulator_desc_ldo1(24), | 325 | regulator_desc_ldo(24, STEP_50_MV), |
388 | regulator_desc_ldo1(25), | 326 | regulator_desc_ldo(25, STEP_50_MV), |
389 | regulator_desc_ldo1(26), | 327 | regulator_desc_ldo(26, STEP_50_MV), |
390 | regulator_desc_buck1_4(1), | 328 | regulator_desc_buck1_4(1), |
391 | regulator_desc_buck1_4(2), | 329 | regulator_desc_buck1_4(2), |
392 | regulator_desc_buck1_4(3), | 330 | regulator_desc_buck1_4(3), |
393 | regulator_desc_buck1_4(4), | 331 | regulator_desc_buck1_4(4), |
394 | regulator_desc_buck5, | 332 | regulator_desc_buck5, |
395 | regulator_desc_buck6_7(6), | 333 | regulator_desc_buck6_10(6, MIN_600_MV, STEP_6_25_MV), |
396 | regulator_desc_buck6_7(7), | 334 | regulator_desc_buck6_10(7, MIN_600_MV, STEP_6_25_MV), |
397 | regulator_desc_buck8, | 335 | regulator_desc_buck6_10(8, MIN_800_MV, STEP_12_5_MV), |
398 | regulator_desc_buck9, | 336 | regulator_desc_buck6_10(9, MIN_1500_MV, STEP_12_5_MV), |
399 | regulator_desc_buck10, | 337 | regulator_desc_buck6_10(10, MIN_1000_MV, STEP_12_5_MV), |
400 | }; | 338 | }; |
401 | 339 | ||
402 | static int s2mpa01_pmic_probe(struct platform_device *pdev) | 340 | static int s2mpa01_pmic_probe(struct platform_device *pdev) |