diff options
author | 2021-11-20 16:53:18 +0100 | |
---|---|---|
committer | 2021-11-22 17:16:25 +0100 | |
commit | 2a5f41830aadc2d7f4145eae49381133da5df2a3 (patch) | |
tree | 292edd94a9347125058f1d634c92434780dc84a6 /drivers/power/supply/ab8500_chargalg.c | |
parent | power: supply: ab8500: Standardize technology (diff) | |
download | linux-dev-2a5f41830aadc2d7f4145eae49381133da5df2a3.tar.xz linux-dev-2a5f41830aadc2d7f4145eae49381133da5df2a3.zip |
power: supply: ab8500: Standardize voltages
The nominal voltage in this charge driver corresponds to
both the voltage_min_design_uv and voltage_max_design_uv
of struct power_supply_battery_info so assign both if this
is undefined.
The overcharge max voltage (when the charger should cut off)
is migrated at the same time so we move both voltages to
struct power_supply_battery_info.
Adjust the code to deal directly with the microvolt values
instead of converting them to millivolts.
Add *_uv suffixes 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>
Diffstat (limited to 'drivers/power/supply/ab8500_chargalg.c')
-rw-r--r-- | drivers/power/supply/ab8500_chargalg.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/power/supply/ab8500_chargalg.c b/drivers/power/supply/ab8500_chargalg.c index a5ccfb0aa9f4..dd9cad63e37e 100644 --- a/drivers/power/supply/ab8500_chargalg.c +++ b/drivers/power/supply/ab8500_chargalg.c @@ -86,7 +86,7 @@ struct ab8500_chargalg_current_step_status { struct ab8500_chargalg_battery_data { int temp; - int volt; + int volt_uv; int avg_curr; int inst_curr; int percent; @@ -792,8 +792,8 @@ static void ab8500_chargalg_end_of_charge(struct ab8500_chargalg *di) { if (di->charge_status == POWER_SUPPLY_STATUS_CHARGING && di->charge_state == STATE_NORMAL && - !di->maintenance_chg && (di->batt_data.volt >= - di->bm->bat_type->termination_vol || + !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 && @@ -1160,7 +1160,7 @@ static int ab8500_chargalg_get_ext_psy_data(struct device *dev, void *data) case POWER_SUPPLY_PROP_VOLTAGE_NOW: switch (ext->desc->type) { case POWER_SUPPLY_TYPE_BATTERY: - di->batt_data.volt = ret.intval / 1000; + di->batt_data.volt_uv = ret.intval; break; case POWER_SUPPLY_TYPE_MAINS: di->chg_info.ac_volt = ret.intval / 1000; @@ -1397,7 +1397,7 @@ static void ab8500_chargalg_algorithm(struct ab8500_chargalg *di) "State %s Active_chg %d Chg_status %d AC %d USB %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", - di->batt_data.volt, + di->batt_data.volt_uv, di->batt_data.avg_curr, di->batt_data.inst_curr, di->batt_data.temp, |