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: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This commit is contained in:
parent
50425ccf24
commit
9c20899da4
@ -374,7 +374,6 @@ struct ab8500_maxim_parameters {
|
||||
* struct ab8500_battery_type - different batteries supported
|
||||
* @resis_high: battery upper 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
|
||||
* full charging cycle in the case where maintenan-
|
||||
* -ce charging has been disabled
|
||||
@ -398,7 +397,6 @@ struct ab8500_maxim_parameters {
|
||||
struct ab8500_battery_type {
|
||||
int resis_high;
|
||||
int resis_low;
|
||||
int termination_curr;
|
||||
int recharge_cap;
|
||||
int normal_cur_lvl;
|
||||
int normal_vol_lvl;
|
||||
|
@ -83,7 +83,6 @@ static const struct batres_vs_temp temp_to_batres_tbl_thermistor[] = {
|
||||
static struct ab8500_battery_type bat_type_thermistor_unknown = {
|
||||
.resis_high = 0,
|
||||
.resis_low = 0,
|
||||
.termination_curr = 200,
|
||||
.recharge_cap = 95,
|
||||
.normal_cur_lvl = 400,
|
||||
.normal_vol_lvl = 4100,
|
||||
@ -203,6 +202,10 @@ int ab8500_bm_of_probe(struct power_supply *psy,
|
||||
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)
|
||||
bi->factory_internal_resistance_uohm = 300000;
|
||||
|
||||
|
@ -87,7 +87,7 @@ struct ab8500_chargalg_current_step_status {
|
||||
struct ab8500_chargalg_battery_data {
|
||||
int temp;
|
||||
int volt_uv;
|
||||
int avg_curr;
|
||||
int avg_curr_ua;
|
||||
int inst_curr;
|
||||
int percent;
|
||||
};
|
||||
@ -795,9 +795,9 @@ static void ab8500_chargalg_end_of_charge(struct ab8500_chargalg *di)
|
||||
!di->maintenance_chg && (di->batt_data.volt_uv >=
|
||||
di->bm->bi.overvoltage_limit_uv ||
|
||||
di->events.usb_cv_active || di->events.ac_cv_active) &&
|
||||
di->batt_data.avg_curr <
|
||||
di->bm->bat_type->termination_curr &&
|
||||
di->batt_data.avg_curr > 0) {
|
||||
di->batt_data.avg_curr_ua <
|
||||
di->bm->bi.charge_term_current_ua &&
|
||||
di->batt_data.avg_curr_ua > 0) {
|
||||
if (++di->eoc_cnt >= EOC_COND_CNT) {
|
||||
di->eoc_cnt = 0;
|
||||
di->charge_status = POWER_SUPPLY_STATUS_FULL;
|
||||
@ -1237,7 +1237,7 @@ static int ab8500_chargalg_get_ext_psy_data(struct device *dev, void *data)
|
||||
case POWER_SUPPLY_PROP_CURRENT_AVG:
|
||||
switch (ext->desc->type) {
|
||||
case POWER_SUPPLY_TYPE_BATTERY:
|
||||
di->batt_data.avg_curr = ret.intval / 1000;
|
||||
di->batt_data.avg_curr_ua = ret.intval;
|
||||
break;
|
||||
case POWER_SUPPLY_TYPE_USB:
|
||||
if (ret.intval)
|
||||
@ -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 "
|
||||
"USB_I %d AC_Vset %d AC_Iset %d USB_Vset %d USB_Iset %d\n",
|
||||
di->batt_data.volt_uv,
|
||||
di->batt_data.avg_curr,
|
||||
di->batt_data.avg_curr_ua,
|
||||
di->batt_data.inst_curr,
|
||||
di->batt_data.temp,
|
||||
di->batt_data.percent,
|
||||
|
Loading…
Reference in New Issue
Block a user