aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBengt Jonsson <bengt.g.jonsson@stericsson.com>2010-12-10 05:08:47 -0500
committerLiam Girdwood <lrg@slimlogic.co.uk>2011-01-12 09:33:03 -0500
commit6909b4522e0fc459d344fd42db444ca8b3106b8c (patch)
treefa31d1c3ae136a667a4e3d9d77ace57f5279e1c3
parent09aefa12ac3c023e2db2315b0e229be98ef6bf23 (diff)
regulators: Removed macros for initialization of ab8500 regulators
This patch removes the macros for initializing the regulators. The purpose is to remove one layer of abstraction and make the code easier to read. Signed-off-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com> Acked-by: Linus Walleij <linus.walleij@stericsson.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
-rw-r--r--drivers/regulator/ab8500.c241
1 files changed, 179 insertions, 62 deletions
diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
index 7d372b87b5dd..d9a052c53aec 100644
--- a/drivers/regulator/ab8500.c
+++ b/drivers/regulator/ab8500.c
@@ -311,7 +311,7 @@ static int ab8500_fixed_get_voltage(struct regulator_dev *rdev)
311 return info->fixed_uV; 311 return info->fixed_uV;
312} 312}
313 313
314static struct regulator_ops ab8500_ldo_fixed_ops = { 314static struct regulator_ops ab8500_regulator_fixed_ops = {
315 .enable = ab8500_regulator_enable, 315 .enable = ab8500_regulator_enable,
316 .disable = ab8500_regulator_disable, 316 .disable = ab8500_regulator_disable,
317 .is_enabled = ab8500_regulator_is_enabled, 317 .is_enabled = ab8500_regulator_is_enabled,
@@ -319,79 +319,196 @@ static struct regulator_ops ab8500_ldo_fixed_ops = {
319 .list_voltage = ab8500_list_voltage, 319 .list_voltage = ab8500_list_voltage,
320}; 320};
321 321
322#define AB8500_LDO(_id, _min_mV, _max_mV, \ 322static struct ab8500_regulator_info
323 _u_bank, _u_reg, _u_mask, _u_val_enable, \ 323 ab8500_regulator_info[AB8500_NUM_REGULATORS] = {
324 _v_bank, _v_reg, _v_mask, _v_table, _v_table_len) \
325[AB8500_LDO_##_id] = { \
326 .desc = { \
327 .name = "LDO-" #_id, \
328 .ops = &ab8500_regulator_ops, \
329 .type = REGULATOR_VOLTAGE, \
330 .id = AB8500_LDO_##_id, \
331 .owner = THIS_MODULE, \
332 }, \
333 .min_uV = (_min_mV) * 1000, \
334 .max_uV = (_max_mV) * 1000, \
335 .update_bank = _u_bank, \
336 .update_reg = _u_reg, \
337 .update_mask = _u_mask, \
338 .update_val_enable = _u_val_enable, \
339 .voltage_bank = _v_bank, \
340 .voltage_reg = _v_reg, \
341 .voltage_mask = _v_mask, \
342 .voltages = _v_table, \
343 .voltages_len = _v_table_len, \
344 .fixed_uV = 0, \
345}
346
347#define AB8500_FIXED_LDO(_id, _fixed_mV, \
348 _u_bank, _u_reg, _u_mask, _u_val_enable) \
349[AB8500_LDO_##_id] = { \
350 .desc = { \
351 .name = "LDO-" #_id, \
352 .ops = &ab8500_ldo_fixed_ops, \
353 .type = REGULATOR_VOLTAGE, \
354 .id = AB8500_LDO_##_id, \
355 .owner = THIS_MODULE, \
356 }, \
357 .fixed_uV = (_fixed_mV) * 1000, \
358 .update_bank = _u_bank, \
359 .update_reg = _u_reg, \
360 .update_mask = _u_mask, \
361 .update_val_enable = _u_val_enable, \
362}
363
364static struct ab8500_regulator_info ab8500_regulator_info[] = {
365 /* 324 /*
366 * Variable Voltage Regulators 325 * Variable Voltage Regulators
367 * name, min mV, max mV, 326 * name, min mV, max mV,
368 * update bank, reg, mask, enable val 327 * update bank, reg, mask, enable val
369 * volt bank, reg, mask, table, table length 328 * volt bank, reg, mask, table, table length
370 */ 329 */
371 AB8500_LDO(AUX1, 1100, 3300, 330 [AB8500_LDO_AUX1] = {
372 0x04, 0x09, 0x03, 0x01, 0x04, 0x1f, 0x0f, 331 .desc = {
373 ldo_vauxn_voltages, ARRAY_SIZE(ldo_vauxn_voltages)), 332 .name = "LDO-AUX1",
374 AB8500_LDO(AUX2, 1100, 3300, 333 .ops = &ab8500_regulator_ops,
375 0x04, 0x09, 0x0c, 0x04, 0x04, 0x20, 0x0f, 334 .type = REGULATOR_VOLTAGE,
376 ldo_vauxn_voltages, ARRAY_SIZE(ldo_vauxn_voltages)), 335 .id = AB8500_LDO_AUX1,
377 AB8500_LDO(AUX3, 1100, 3300, 336 .owner = THIS_MODULE,
378 0x04, 0x0a, 0x03, 0x01, 0x04, 0x21, 0x07, 337 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
379 ldo_vaux3_voltages, ARRAY_SIZE(ldo_vaux3_voltages)), 338 },
380 AB8500_LDO(INTCORE, 1100, 3300, 339 .min_uV = 1100000,
381 0x03, 0x80, 0x44, 0x04, 0x03, 0x80, 0x38, 340 .max_uV = 3300000,
382 ldo_vintcore_voltages, ARRAY_SIZE(ldo_vintcore_voltages)), 341 .update_bank = 0x04,
342 .update_reg = 0x09,
343 .update_mask = 0x03,
344 .update_val_enable = 0x01,
345 .voltage_bank = 0x04,
346 .voltage_reg = 0x1f,
347 .voltage_mask = 0x0f,
348 .voltages = ldo_vauxn_voltages,
349 .voltages_len = ARRAY_SIZE(ldo_vauxn_voltages),
350 },
351 [AB8500_LDO_AUX2] = {
352 .desc = {
353 .name = "LDO-AUX2",
354 .ops = &ab8500_regulator_ops,
355 .type = REGULATOR_VOLTAGE,
356 .id = AB8500_LDO_AUX2,
357 .owner = THIS_MODULE,
358 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
359 },
360 .min_uV = 1100000,
361 .max_uV = 3300000,
362 .update_bank = 0x04,
363 .update_reg = 0x09,
364 .update_mask = 0x0c,
365 .update_val_enable = 0x04,
366 .voltage_bank = 0x04,
367 .voltage_reg = 0x20,
368 .voltage_mask = 0x0f,
369 .voltages = ldo_vauxn_voltages,
370 .voltages_len = ARRAY_SIZE(ldo_vauxn_voltages),
371 },
372 [AB8500_LDO_AUX3] = {
373 .desc = {
374 .name = "LDO-AUX3",
375 .ops = &ab8500_regulator_ops,
376 .type = REGULATOR_VOLTAGE,
377 .id = AB8500_LDO_AUX3,
378 .owner = THIS_MODULE,
379 .n_voltages = ARRAY_SIZE(ldo_vaux3_voltages),
380 },
381 .min_uV = 1100000,
382 .max_uV = 3300000,
383 .update_bank = 0x04,
384 .update_reg = 0x0a,
385 .update_mask = 0x03,
386 .update_val_enable = 0x01,
387 .voltage_bank = 0x04,
388 .voltage_reg = 0x21,
389 .voltage_mask = 0x07,
390 .voltages = ldo_vaux3_voltages,
391 .voltages_len = ARRAY_SIZE(ldo_vaux3_voltages),
392 },
393 [AB8500_LDO_INTCORE] = {
394 .desc = {
395 .name = "LDO-INTCORE",
396 .ops = &ab8500_regulator_ops,
397 .type = REGULATOR_VOLTAGE,
398 .id = AB8500_LDO_INTCORE,
399 .owner = THIS_MODULE,
400 .n_voltages = ARRAY_SIZE(ldo_vintcore_voltages),
401 },
402 .min_uV = 1100000,
403 .max_uV = 3300000,
404 .update_bank = 0x03,
405 .update_reg = 0x80,
406 .update_mask = 0x44,
407 .update_val_enable = 0x04,
408 .voltage_bank = 0x03,
409 .voltage_reg = 0x80,
410 .voltage_mask = 0x38,
411 .voltages = ldo_vintcore_voltages,
412 .voltages_len = ARRAY_SIZE(ldo_vintcore_voltages),
413 },
383 414
384 /* 415 /*
385 * Fixed Voltage Regulators 416 * Fixed Voltage Regulators
386 * name, fixed mV, 417 * name, fixed mV,
387 * update bank, reg, mask, enable val 418 * update bank, reg, mask, enable val
388 */ 419 */
389 AB8500_FIXED_LDO(TVOUT, 2000, 0x03, 0x80, 0x82, 0x02), 420 [AB8500_LDO_TVOUT] = {
390 AB8500_FIXED_LDO(AUDIO, 2000, 0x03, 0x83, 0x02, 0x02), 421 .desc = {
391 AB8500_FIXED_LDO(ANAMIC1, 2050, 0x03, 0x83, 0x08, 0x08), 422 .name = "LDO-TVOUT",
392 AB8500_FIXED_LDO(ANAMIC2, 2050, 0x03, 0x83, 0x10, 0x10), 423 .ops = &ab8500_regulator_fixed_ops,
393 AB8500_FIXED_LDO(DMIC, 1800, 0x03, 0x83, 0x04, 0x04), 424 .type = REGULATOR_VOLTAGE,
394 AB8500_FIXED_LDO(ANA, 1200, 0x04, 0x06, 0x0c, 0x04), 425 .id = AB8500_LDO_TVOUT,
426 .owner = THIS_MODULE,
427 .n_voltages = 1,
428 },
429 .fixed_uV = 2000000,
430 .update_bank = 0x03,
431 .update_reg = 0x80,
432 .update_mask = 0x82,
433 .update_val_enable = 0x02,
434 },
435 [AB8500_LDO_AUDIO] = {
436 .desc = {
437 .name = "LDO-AUDIO",
438 .ops = &ab8500_regulator_fixed_ops,
439 .type = REGULATOR_VOLTAGE,
440 .id = AB8500_LDO_AUDIO,
441 .owner = THIS_MODULE,
442 .n_voltages = 1,
443 },
444 .fixed_uV = 2000000,
445 .update_bank = 0x03,
446 .update_reg = 0x83,
447 .update_mask = 0x02,
448 .update_val_enable = 0x02,
449 },
450 [AB8500_LDO_ANAMIC1] = {
451 .desc = {
452 .name = "LDO-ANAMIC1",
453 .ops = &ab8500_regulator_fixed_ops,
454 .type = REGULATOR_VOLTAGE,
455 .id = AB8500_LDO_ANAMIC1,
456 .owner = THIS_MODULE,
457 .n_voltages = 1,
458 },
459 .fixed_uV = 2050000,
460 .update_bank = 0x03,
461 .update_reg = 0x83,
462 .update_mask = 0x08,
463 .update_val_enable = 0x08,
464 },
465 [AB8500_LDO_ANAMIC2] = {
466 .desc = {
467 .name = "LDO-ANAMIC2",
468 .ops = &ab8500_regulator_fixed_ops,
469 .type = REGULATOR_VOLTAGE,
470 .id = AB8500_LDO_ANAMIC2,
471 .owner = THIS_MODULE,
472 .n_voltages = 1,
473 },
474 .fixed_uV = 2050000,
475 .update_bank = 0x03,
476 .update_reg = 0x83,
477 .update_mask = 0x10,
478 .update_val_enable = 0x10,
479 },
480 [AB8500_LDO_DMIC] = {
481 .desc = {
482 .name = "LDO-DMIC",
483 .ops = &ab8500_regulator_fixed_ops,
484 .type = REGULATOR_VOLTAGE,
485 .id = AB8500_LDO_DMIC,
486 .owner = THIS_MODULE,
487 .n_voltages = 1,
488 },
489 .fixed_uV = 1800000,
490 .update_bank = 0x03,
491 .update_reg = 0x83,
492 .update_mask = 0x04,
493 .update_val_enable = 0x04,
494 },
495 [AB8500_LDO_ANA] = {
496 .desc = {
497 .name = "LDO-ANA",
498 .ops = &ab8500_regulator_fixed_ops,
499 .type = REGULATOR_VOLTAGE,
500 .id = AB8500_LDO_ANA,
501 .owner = THIS_MODULE,
502 .n_voltages = 1,
503 },
504 .fixed_uV = 1200000,
505 .update_bank = 0x04,
506 .update_reg = 0x06,
507 .update_mask = 0x0c,
508 .update_val_enable = 0x04,
509 },
510
511
395}; 512};
396 513
397static __devinit int ab8500_regulator_probe(struct platform_device *pdev) 514static __devinit int ab8500_regulator_probe(struct platform_device *pdev)