Commit 9c20899d authored by Linus Walleij's avatar Linus Walleij Committed by Sebastian Reichel

power: supply: ab8500: Standardize termination current

The AB8500 custom termination current can be replaced by the
corresponding struct power_supply_battery_info field.

Remove the struct member and amend the code to use the
standard property.

Add *_ua suffix for clarity and to make sure we have
changed all code sites using this member.
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
parent 50425ccf
...@@ -374,7 +374,6 @@ struct ab8500_maxim_parameters { ...@@ -374,7 +374,6 @@ struct ab8500_maxim_parameters {
* struct ab8500_battery_type - different batteries supported * struct ab8500_battery_type - different batteries supported
* @resis_high: battery upper resistance limit * @resis_high: battery upper resistance limit
* @resis_low: battery lower resistance limit * @resis_low: battery lower resistance limit
* @termination_curr battery charging termination current in mA
* @recharge_cap battery capacity limit that will trigger a new * @recharge_cap battery capacity limit that will trigger a new
* full charging cycle in the case where maintenan- * full charging cycle in the case where maintenan-
* -ce charging has been disabled * -ce charging has been disabled
...@@ -398,7 +397,6 @@ struct ab8500_maxim_parameters { ...@@ -398,7 +397,6 @@ struct ab8500_maxim_parameters {
struct ab8500_battery_type { struct ab8500_battery_type {
int resis_high; int resis_high;
int resis_low; int resis_low;
int termination_curr;
int recharge_cap; int recharge_cap;
int normal_cur_lvl; int normal_cur_lvl;
int normal_vol_lvl; int normal_vol_lvl;
......
...@@ -83,7 +83,6 @@ static const struct batres_vs_temp temp_to_batres_tbl_thermistor[] = { ...@@ -83,7 +83,6 @@ static const struct batres_vs_temp temp_to_batres_tbl_thermistor[] = {
static struct ab8500_battery_type bat_type_thermistor_unknown = { static struct ab8500_battery_type bat_type_thermistor_unknown = {
.resis_high = 0, .resis_high = 0,
.resis_low = 0, .resis_low = 0,
.termination_curr = 200,
.recharge_cap = 95, .recharge_cap = 95,
.normal_cur_lvl = 400, .normal_cur_lvl = 400,
.normal_vol_lvl = 4100, .normal_vol_lvl = 4100,
...@@ -203,6 +202,10 @@ int ab8500_bm_of_probe(struct power_supply *psy, ...@@ -203,6 +202,10 @@ int ab8500_bm_of_probe(struct power_supply *psy,
bi->overvoltage_limit_uv = 4050000; bi->overvoltage_limit_uv = 4050000;
} }
if (bi->charge_term_current_ua)
/* Charging stops when we drop below this current */
bi->charge_term_current_ua = 200000;
if (bi->factory_internal_resistance_uohm < 0) if (bi->factory_internal_resistance_uohm < 0)
bi->factory_internal_resistance_uohm = 300000; bi->factory_internal_resistance_uohm = 300000;
......
...@@ -87,7 +87,7 @@ struct ab8500_chargalg_current_step_status { ...@@ -87,7 +87,7 @@ struct ab8500_chargalg_current_step_status {
struct ab8500_chargalg_battery_data { struct ab8500_chargalg_battery_data {
int temp; int temp;
int volt_uv; int volt_uv;
int avg_curr; int avg_curr_ua;
int inst_curr; int inst_curr;
int percent; int percent;
}; };
...@@ -795,9 +795,9 @@ static void ab8500_chargalg_end_of_charge(struct ab8500_chargalg *di) ...@@ -795,9 +795,9 @@ static void ab8500_chargalg_end_of_charge(struct ab8500_chargalg *di)
!di->maintenance_chg && (di->batt_data.volt_uv >= !di->maintenance_chg && (di->batt_data.volt_uv >=
di->bm->bi.overvoltage_limit_uv || di->bm->bi.overvoltage_limit_uv ||
di->events.usb_cv_active || di->events.ac_cv_active) && di->events.usb_cv_active || di->events.ac_cv_active) &&
di->batt_data.avg_curr < di->batt_data.avg_curr_ua <
di->bm->bat_type->termination_curr && di->bm->bi.charge_term_current_ua &&
di->batt_data.avg_curr > 0) { di->batt_data.avg_curr_ua > 0) {
if (++di->eoc_cnt >= EOC_COND_CNT) { if (++di->eoc_cnt >= EOC_COND_CNT) {
di->eoc_cnt = 0; di->eoc_cnt = 0;
di->charge_status = POWER_SUPPLY_STATUS_FULL; di->charge_status = POWER_SUPPLY_STATUS_FULL;
...@@ -1237,7 +1237,7 @@ static int ab8500_chargalg_get_ext_psy_data(struct device *dev, void *data) ...@@ -1237,7 +1237,7 @@ static int ab8500_chargalg_get_ext_psy_data(struct device *dev, void *data)
case POWER_SUPPLY_PROP_CURRENT_AVG: case POWER_SUPPLY_PROP_CURRENT_AVG:
switch (ext->desc->type) { switch (ext->desc->type) {
case POWER_SUPPLY_TYPE_BATTERY: case POWER_SUPPLY_TYPE_BATTERY:
di->batt_data.avg_curr = ret.intval / 1000; di->batt_data.avg_curr_ua = ret.intval;
break; break;
case POWER_SUPPLY_TYPE_USB: case POWER_SUPPLY_TYPE_USB:
if (ret.intval) if (ret.intval)
...@@ -1398,7 +1398,7 @@ static void ab8500_chargalg_algorithm(struct ab8500_chargalg *di) ...@@ -1398,7 +1398,7 @@ static void ab8500_chargalg_algorithm(struct ab8500_chargalg *di)
"AC_online %d USB_online %d AC_CV %d USB_CV %d AC_I %d " "AC_online %d USB_online %d AC_CV %d USB_CV %d AC_I %d "
"USB_I %d AC_Vset %d AC_Iset %d USB_Vset %d USB_Iset %d\n", "USB_I %d AC_Vset %d AC_Iset %d USB_Vset %d USB_Iset %d\n",
di->batt_data.volt_uv, di->batt_data.volt_uv,
di->batt_data.avg_curr, di->batt_data.avg_curr_ua,
di->batt_data.inst_curr, di->batt_data.inst_curr,
di->batt_data.temp, di->batt_data.temp,
di->batt_data.percent, di->batt_data.percent,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment