@@ -186,13 +186,11 @@ int ab8500_bm_of_probe(struct power_supply *psy,
* fall back to safe defaults.
*/
if ((bi->voltage_min_design_uv < 0) ||
- (bi->voltage_max_design_uv < 0) ||
- (bi->overvoltage_limit_uv < 0)) {
+ (bi->voltage_max_design_uv < 0)) {
/* Nominal voltage is 3.7V for unknown batteries */
bi->voltage_min_design_uv = 3700000;
- bi->voltage_max_design_uv = 3700000;
- /* Termination voltage (overcharge limit) 4.05V */
- bi->overvoltage_limit_uv = 4050000;
+ /* Termination voltage 4.05V */
+ bi->voltage_max_design_uv = 4050000;
}
if (bi->constant_charge_current_max_ua < 0)
@@ -802,7 +802,7 @@ 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_uv >=
- di->bm->bi->overvoltage_limit_uv ||
+ di->bm->bi->voltage_max_design_uv ||
di->events.usb_cv_active || di->events.ac_cv_active) &&
di->batt_data.avg_curr_ua <
di->bm->bi->charge_term_current_ua &&
@@ -2263,7 +2263,13 @@ static int ab8500_fg_init_hw_registers(struct ab8500_fg *di)
{
int ret;
- /* Set VBAT OVV threshold */
+ /*
+ * Set VBAT OVV (overvoltage) threshold to 4.75V (typ) this is what
+ * the hardware supports, nothing else can be configured in hardware.
+ * See this as an "outer limit" where the charger will certainly
+ * shut down. Other (lower) overvoltage levels need to be implemented
+ * in software.
+ */
ret = abx500_mask_and_set_register_interruptible(di->dev,
AB8500_CHARGER,
AB8500_BATT_OVV,
We should terminate charging when we reach the voltage_max_design_uv not overvoltage_limit_uv, this is an abuse of that struct member. The overvoltage limit is actually not configurable on the AB8500, it is fixed to 4.75 V so drop a comment about that in the code. Fixes: 2a5f41830aad ("power: supply: ab8500: Standardize voltages") Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- ChangeLog v1->v2: - Resending with other patches, no changes. --- drivers/power/supply/ab8500_bmdata.c | 8 +++----- drivers/power/supply/ab8500_chargalg.c | 2 +- drivers/power/supply/ab8500_fg.c | 8 +++++++- 3 files changed, 11 insertions(+), 7 deletions(-)