aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power/ab8500_bmdata.c
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2012-11-29 10:08:41 -0500
committerLee Jones <lee.jones@linaro.org>2012-12-11 03:43:54 -0500
commit23a04f9f40f2b32ee593b768483105b1c776814d (patch)
tree7c069255c0d34f30f2e3132dd5ce4a614de5ca29 /drivers/power/ab8500_bmdata.c
parentb0284de05e07d56ff7de154d0c9263788755f5eb (diff)
ab8500_bm: Always send platform specific battery information via pdata
Currently the AB8500 battery management subsystem receives platform specific information via two different means depending on how the platform is booted. If DT is not enabled, a reference to a *_bm_data data structure containing each platform specific attribute is passed though platform_data. However, if DT is enabled, then platform_data is empty and the reference is gained though a DT specific probe function. There are two issues here 1) the same reference is being collected each time and 2) the DT way doesn't allow any provisions to select different platform specific attributes, which kind of defeats the object. Cc: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/power/ab8500_bmdata.c')
-rw-r--r--drivers/power/ab8500_bmdata.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/drivers/power/ab8500_bmdata.c b/drivers/power/ab8500_bmdata.c
index c2fb2c554019..6b772e5f515f 100644
--- a/drivers/power/ab8500_bmdata.c
+++ b/drivers/power/ab8500_bmdata.c
@@ -454,16 +454,13 @@ struct abx500_bm_data ab8500_bm_data = {
454 454
455int __devinit ab8500_bm_of_probe(struct device *dev, 455int __devinit ab8500_bm_of_probe(struct device *dev,
456 struct device_node *np, 456 struct device_node *np,
457 struct abx500_bm_data **battery) 457 struct abx500_bm_data *bm)
458{ 458{
459 struct batres_vs_temp *tmp_batres_tbl; 459 struct batres_vs_temp *tmp_batres_tbl;
460 struct device_node *np_bat_supply; 460 struct device_node *np_bat_supply;
461 struct abx500_bm_data *bat;
462 const char *btech; 461 const char *btech;
463 int i; 462 int i;
464 463
465 *battery = &ab8500_bm_data;
466
467 /* get phandle to 'battery-info' node */ 464 /* get phandle to 'battery-info' node */
468 np_bat_supply = of_parse_phandle(np, "battery", 0); 465 np_bat_supply = of_parse_phandle(np, "battery", 0);
469 if (!np_bat_supply) { 466 if (!np_bat_supply) {
@@ -477,16 +474,14 @@ int __devinit ab8500_bm_of_probe(struct device *dev,
477 return -EINVAL; 474 return -EINVAL;
478 } 475 }
479 476
480 bat = *battery;
481
482 if (strncmp(btech, "LION", 4) == 0) { 477 if (strncmp(btech, "LION", 4) == 0) {
483 bat->no_maintenance = true; 478 bm->no_maintenance = true;
484 bat->chg_unknown_bat = true; 479 bm->chg_unknown_bat = true;
485 bat->bat_type[BATTERY_UNKNOWN].charge_full_design = 2600; 480 bm->bat_type[BATTERY_UNKNOWN].charge_full_design = 2600;
486 bat->bat_type[BATTERY_UNKNOWN].termination_vol = 4150; 481 bm->bat_type[BATTERY_UNKNOWN].termination_vol = 4150;
487 bat->bat_type[BATTERY_UNKNOWN].recharge_vol = 4130; 482 bm->bat_type[BATTERY_UNKNOWN].recharge_vol = 4130;
488 bat->bat_type[BATTERY_UNKNOWN].normal_cur_lvl = 520; 483 bm->bat_type[BATTERY_UNKNOWN].normal_cur_lvl = 520;
489 bat->bat_type[BATTERY_UNKNOWN].normal_vol_lvl = 4200; 484 bm->bat_type[BATTERY_UNKNOWN].normal_vol_lvl = 4200;
490 } 485 }
491 486
492 if (of_property_read_bool(np_bat_supply, "thermistor-on-batctrl")) { 487 if (of_property_read_bool(np_bat_supply, "thermistor-on-batctrl")) {
@@ -495,15 +490,15 @@ int __devinit ab8500_bm_of_probe(struct device *dev,
495 else 490 else
496 tmp_batres_tbl = temp_to_batres_tbl_thermistor; 491 tmp_batres_tbl = temp_to_batres_tbl_thermistor;
497 } else { 492 } else {
498 bat->n_btypes = 4; 493 bm->n_btypes = 4;
499 bat->bat_type = bat_type_ext_thermistor; 494 bm->bat_type = bat_type_ext_thermistor;
500 bat->adc_therm = ABx500_ADC_THERM_BATTEMP; 495 bm->adc_therm = ABx500_ADC_THERM_BATTEMP;
501 tmp_batres_tbl = temp_to_batres_tbl_ext_thermistor; 496 tmp_batres_tbl = temp_to_batres_tbl_ext_thermistor;
502 } 497 }
503 498
504 /* select the battery resolution table */ 499 /* select the battery resolution table */
505 for (i = 0; i < bat->n_btypes; ++i) 500 for (i = 0; i < bm->n_btypes; ++i)
506 bat->bat_type[i]->batres_tbl = tmp_batres_tbl; 501 bm->bat_type[i].batres_tbl = tmp_batres_tbl;
507 502
508 of_node_put(np_bat_supply); 503 of_node_put(np_bat_supply);
509 504