aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power/ab8500_bmdata.c
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2012-08-29 08:36:51 -0400
committerLee Jones <lee.jones@linaro.org>2013-03-06 23:35:48 -0500
commit861a30da53e2c5b9823b5390c1757baaf8f6e356 (patch)
treef703602dfcfabac6f1855633aec306cf271ec7d5 /drivers/power/ab8500_bmdata.c
parent2c4c40ac0052eaf9b14009635ab475362e88c6e0 (diff)
ab8500-bm: Add support for the new ab8540 platform
Provide AB8540 platform specific information required to run the Battery Management subsystem on AB8540 based devices. For this to happen we see the introduction of separate platform specific data structures and a means in which to process them. Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/power/ab8500_bmdata.c')
-rw-r--r--drivers/power/ab8500_bmdata.c91
1 files changed, 88 insertions, 3 deletions
diff --git a/drivers/power/ab8500_bmdata.c b/drivers/power/ab8500_bmdata.c
index e8759763fbe0..85742a6d29ff 100644
--- a/drivers/power/ab8500_bmdata.c
+++ b/drivers/power/ab8500_bmdata.c
@@ -414,13 +414,20 @@ static const struct abx500_fg_parameters fg = {
414 .pcut_debounce_time = 2, 414 .pcut_debounce_time = 2,
415}; 415};
416 416
417static const struct abx500_maxim_parameters maxi_params = { 417static const struct abx500_maxim_parameters ab8500_maxi_params = {
418 .ena_maxi = true, 418 .ena_maxi = true,
419 .chg_curr = 910, 419 .chg_curr = 910,
420 .wait_cycles = 10, 420 .wait_cycles = 10,
421 .charger_curr_step = 100, 421 .charger_curr_step = 100,
422}; 422};
423 423
424static const struct abx500_maxim_parameters abx540_maxi_params = {
425 .ena_maxi = true,
426 .chg_curr = 3000,
427 .wait_cycles = 10,
428 .charger_curr_step = 200,
429};
430
424static const struct abx500_bm_charger_parameters chg = { 431static const struct abx500_bm_charger_parameters chg = {
425 .usb_volt_max = 5500, 432 .usb_volt_max = 5500,
426 .usb_curr_max = 1500, 433 .usb_curr_max = 1500,
@@ -428,6 +435,46 @@ static const struct abx500_bm_charger_parameters chg = {
428 .ac_curr_max = 1500, 435 .ac_curr_max = 1500,
429}; 436};
430 437
438/*
439 * This array maps the raw hex value to charger output current used by the
440 * AB8500 values
441 */
442static int ab8500_charge_output_curr_map[] = {
443 100, 200, 300, 400, 500, 600, 700, 800,
444 900, 1000, 1100, 1200, 1300, 1400, 1500, 1500,
445};
446
447static int ab8540_charge_output_curr_map[] = {
448 0, 0, 0, 75, 100, 125, 150, 175,
449 200, 225, 250, 275, 300, 325, 350, 375,
450 400, 425, 450, 475, 500, 525, 550, 575,
451 600, 625, 650, 675, 700, 725, 750, 775,
452 800, 825, 850, 875, 900, 925, 950, 975,
453 1000, 1025, 1050, 1075, 1100, 1125, 1150, 1175,
454 1200, 1225, 1250, 1275, 1300, 1325, 1350, 1375,
455 1400, 1425, 1450, 1500, 1600, 1700, 1900, 2000,
456};
457
458/*
459 * This array maps the raw hex value to charger input current used by the
460 * AB8500 values
461 */
462static int ab8500_charge_input_curr_map[] = {
463 50, 98, 193, 290, 380, 450, 500, 600,
464 700, 800, 900, 1000, 1100, 1300, 1400, 1500,
465};
466
467static int ab8540_charge_input_curr_map[] = {
468 25, 50, 75, 100, 125, 150, 175, 200,
469 225, 250, 275, 300, 325, 350, 375, 400,
470 425, 450, 475, 500, 525, 550, 575, 600,
471 625, 650, 675, 700, 725, 750, 775, 800,
472 825, 850, 875, 900, 925, 950, 975, 1000,
473 1025, 1050, 1075, 1100, 1125, 1150, 1175, 1200,
474 1225, 1250, 1275, 1300, 1325, 1350, 1375, 1400,
475 1425, 1450, 1475, 1500, 1500, 1500, 1500, 1500,
476};
477
431struct abx500_bm_data ab8500_bm_data = { 478struct abx500_bm_data ab8500_bm_data = {
432 .temp_under = 3, 479 .temp_under = 3,
433 .temp_low = 8, 480 .temp_low = 8,
@@ -447,15 +494,53 @@ struct abx500_bm_data ab8500_bm_data = {
447 .fg_res = 100, 494 .fg_res = 100,
448 .cap_levels = &cap_levels, 495 .cap_levels = &cap_levels,
449 .bat_type = bat_type_thermistor, 496 .bat_type = bat_type_thermistor,
450 .n_btypes = 3, 497 .n_btypes = ARRAY_SIZE(bat_type_thermistor),
451 .batt_id = 0, 498 .batt_id = 0,
452 .interval_charging = 5, 499 .interval_charging = 5,
453 .interval_not_charging = 120, 500 .interval_not_charging = 120,
454 .temp_hysteresis = 3, 501 .temp_hysteresis = 3,
455 .gnd_lift_resistance = 34, 502 .gnd_lift_resistance = 34,
456 .maxi = &maxi_params, 503 .chg_output_curr = ab8500_charge_output_curr_map,
504 .n_chg_out_curr = ARRAY_SIZE(ab8500_charge_output_curr_map),
505 .maxi = &ab8500_maxi_params,
457 .chg_params = &chg, 506 .chg_params = &chg,
458 .fg_params = &fg, 507 .fg_params = &fg,
508 .chg_input_curr = ab8500_charge_input_curr_map,
509 .n_chg_in_curr = ARRAY_SIZE(ab8500_charge_input_curr_map),
510};
511
512struct abx500_bm_data ab8540_bm_data = {
513 .temp_under = 3,
514 .temp_low = 8,
515 .temp_high = 43,
516 .temp_over = 48,
517 .main_safety_tmr_h = 4,
518 .temp_interval_chg = 20,
519 .temp_interval_nochg = 120,
520 .usb_safety_tmr_h = 4,
521 .bkup_bat_v = BUP_VCH_SEL_2P6V,
522 .bkup_bat_i = BUP_ICH_SEL_150UA,
523 .no_maintenance = false,
524 .capacity_scaling = false,
525 .adc_therm = ABx500_ADC_THERM_BATCTRL,
526 .chg_unknown_bat = false,
527 .enable_overshoot = false,
528 .fg_res = 100,
529 .cap_levels = &cap_levels,
530 .bat_type = bat_type_thermistor,
531 .n_btypes = ARRAY_SIZE(bat_type_thermistor),
532 .batt_id = 0,
533 .interval_charging = 5,
534 .interval_not_charging = 120,
535 .temp_hysteresis = 3,
536 .gnd_lift_resistance = 0,
537 .maxi = &abx540_maxi_params,
538 .chg_params = &chg,
539 .fg_params = &fg,
540 .chg_output_curr = ab8540_charge_output_curr_map,
541 .n_chg_out_curr = ARRAY_SIZE(ab8540_charge_output_curr_map),
542 .chg_input_curr = ab8540_charge_input_curr_map,
543 .n_chg_in_curr = ARRAY_SIZE(ab8540_charge_input_curr_map),
459}; 544};
460 545
461int ab8500_bm_of_probe(struct device *dev, 546int ab8500_bm_of_probe(struct device *dev,