diff options
author | Lee Jones <lee.jones@linaro.org> | 2012-11-29 15:08:41 +0000 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2012-12-11 08:43:54 +0000 |
commit | 23a04f9f40f2b32ee593b768483105b1c776814d (patch) | |
tree | 7c069255c0d34f30f2e3132dd5ce4a614de5ca29 /drivers/power | |
parent | b0284de05e07d56ff7de154d0c9263788755f5eb (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')
-rw-r--r-- | drivers/power/ab8500_bmdata.c | 33 | ||||
-rw-r--r-- | drivers/power/ab8500_btemp.c | 2 | ||||
-rw-r--r-- | drivers/power/ab8500_charger.c | 2 | ||||
-rw-r--r-- | drivers/power/ab8500_fg.c | 2 | ||||
-rw-r--r-- | drivers/power/abx500_chargalg.c | 2 |
5 files changed, 18 insertions, 23 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 = { int __devinit ab8500_bm_of_probe(struct device *dev, struct device_node *np, - struct abx500_bm_data **battery) + struct abx500_bm_data *bm) { struct batres_vs_temp *tmp_batres_tbl; struct device_node *np_bat_supply; - struct abx500_bm_data *bat; const char *btech; int i; - *battery = &ab8500_bm_data; - /* get phandle to 'battery-info' node */ np_bat_supply = of_parse_phandle(np, "battery", 0); if (!np_bat_supply) { @@ -477,16 +474,14 @@ int __devinit ab8500_bm_of_probe(struct device *dev, return -EINVAL; } - bat = *battery; - if (strncmp(btech, "LION", 4) == 0) { - bat->no_maintenance = true; - bat->chg_unknown_bat = true; - bat->bat_type[BATTERY_UNKNOWN].charge_full_design = 2600; - bat->bat_type[BATTERY_UNKNOWN].termination_vol = 4150; - bat->bat_type[BATTERY_UNKNOWN].recharge_vol = 4130; - bat->bat_type[BATTERY_UNKNOWN].normal_cur_lvl = 520; - bat->bat_type[BATTERY_UNKNOWN].normal_vol_lvl = 4200; + bm->no_maintenance = true; + bm->chg_unknown_bat = true; + bm->bat_type[BATTERY_UNKNOWN].charge_full_design = 2600; + bm->bat_type[BATTERY_UNKNOWN].termination_vol = 4150; + bm->bat_type[BATTERY_UNKNOWN].recharge_vol = 4130; + bm->bat_type[BATTERY_UNKNOWN].normal_cur_lvl = 520; + bm->bat_type[BATTERY_UNKNOWN].normal_vol_lvl = 4200; } if (of_property_read_bool(np_bat_supply, "thermistor-on-batctrl")) { @@ -495,15 +490,15 @@ int __devinit ab8500_bm_of_probe(struct device *dev, else tmp_batres_tbl = temp_to_batres_tbl_thermistor; } else { - bat->n_btypes = 4; - bat->bat_type = bat_type_ext_thermistor; - bat->adc_therm = ABx500_ADC_THERM_BATTEMP; - tmp_batres_tbl = temp_to_batres_tbl_ext_thermistor; + bm->n_btypes = 4; + bm->bat_type = bat_type_ext_thermistor; + bm->adc_therm = ABx500_ADC_THERM_BATTEMP; + tmp_batres_tbl = temp_to_batres_tbl_ext_thermistor; } /* select the battery resolution table */ - for (i = 0; i < bat->n_btypes; ++i) - bat->bat_type[i]->batres_tbl = tmp_batres_tbl; + for (i = 0; i < bm->n_btypes; ++i) + bm->bat_type[i].batres_tbl = tmp_batres_tbl; of_node_put(np_bat_supply); diff --git a/drivers/power/ab8500_btemp.c b/drivers/power/ab8500_btemp.c index 33ed0fccbd0e..c0f7dcceae45 100644 --- a/drivers/power/ab8500_btemp.c +++ b/drivers/power/ab8500_btemp.c @@ -988,7 +988,7 @@ static int __devinit ab8500_btemp_probe(struct platform_device *pdev) di->bm = pdev->mfd_cell->platform_data; if (!di->bm) { if (np) { - ret = ab8500_bm_of_probe(&pdev->dev, np, &di->bm); + ret = ab8500_bm_of_probe(&pdev->dev, np, di->bm); if (ret) { dev_err(&pdev->dev, "failed to get battery information\n"); diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c index 21dc8422778d..c1077df26783 100644 --- a/drivers/power/ab8500_charger.c +++ b/drivers/power/ab8500_charger.c @@ -2647,7 +2647,7 @@ static int __devinit ab8500_charger_probe(struct platform_device *pdev) di->bm = pdev->mfd_cell->platform_data; if (!di->bm) { if (np) { - ret = ab8500_bm_of_probe(&pdev->dev, np, &di->bm); + ret = ab8500_bm_of_probe(&pdev->dev, np, di->bm); if (ret) { dev_err(&pdev->dev, "failed to get battery information\n"); diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c index 4cf231375de3..8bb9df92627d 100644 --- a/drivers/power/ab8500_fg.c +++ b/drivers/power/ab8500_fg.c @@ -2460,7 +2460,7 @@ static int __devinit ab8500_fg_probe(struct platform_device *pdev) di->bm = pdev->mfd_cell->platform_data; if (!di->bm) { if (np) { - ret = ab8500_bm_of_probe(&pdev->dev, np, &di->bm); + ret = ab8500_bm_of_probe(&pdev->dev, np, di->bm); if (ret) { dev_err(&pdev->dev, "failed to get battery information\n"); diff --git a/drivers/power/abx500_chargalg.c b/drivers/power/abx500_chargalg.c index ea2e2eb652ef..22a511c2a719 100644 --- a/drivers/power/abx500_chargalg.c +++ b/drivers/power/abx500_chargalg.c @@ -1817,7 +1817,7 @@ static int __devinit abx500_chargalg_probe(struct platform_device *pdev) di->bm = pdev->mfd_cell->platform_data; if (!di->bm) { if (np) { - ret = ab8500_bm_of_probe(&pdev->dev, np, &di->bm); + ret = ab8500_bm_of_probe(&pdev->dev, np, di->bm); if (ret) { dev_err(&pdev->dev, "failed to get battery information\n"); |