aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKalle Komierowski <karl.komierowski@stericsson.com>2011-10-13 09:41:17 +0200
committerRobert Marklund <robert.marklund@stericsson.com>2011-10-27 16:08:58 +0200
commit65c4df6b50feb05968308d917095cbe6526628d9 (patch)
treece20d082595cb3295dc48cb3868afb69ae593875
parent0645d7f68bab73a173915e779c075ebc79e6b772 (diff)
Power: ab8500_bm: Update battery capacity before notify
Now the battery capacity calculations and the power_supply framework is updated with the new status when battery has been fully charged before clients polling the capacity sysfs node are being notified. ST-Ericsson ID: 358829 ST-Ericsson Linux next: Not tested ST-Ericsson FOSS-OUT ID: Trivial Change-Id: Icd827863bc694e44495487f8536e95ab5fe0714f Signed-off-by: Kalle Komierowski <karl.komierowski@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/33880 Reviewed-by: QABUILD Reviewed-by: Johan PALSSON <johan.palsson@stericsson.com>
-rw-r--r--drivers/power/ab8500_fg.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c
index ce7d9606667..e192893764a 100644
--- a/drivers/power/ab8500_fg.c
+++ b/drivers/power/ab8500_fg.c
@@ -1158,9 +1158,14 @@ static void ab8500_fg_check_capacity_limits(struct ab8500_fg *di, bool init)
}
}
- if (changed)
+ if (changed) {
power_supply_changed(&di->fg_psy);
-
+ if (di->flags.fully_charged) {
+ dev_dbg(di->dev, "Full, notifying..: %d\n",
+ di->flags.fully_charged);
+ sysfs_notify(&di->fg_kobject, NULL, "charge_full");
+ }
+ }
}
static void ab8500_fg_charge_state_to(struct ab8500_fg *di,
@@ -1794,8 +1799,6 @@ static int ab8500_fg_get_ext_psy_data(struct device *dev, void *data)
di->flags.fully_charged = true;
/* Save current capacity as maximum */
di->bat_cap.max_mah = di->bat_cap.mah;
- sysfs_notify(&di->fg_kobject,
- NULL, "charge_full");
queue_work(di->fg_wq, &di->fg_work);
break;
case POWER_SUPPLY_STATUS_CHARGING: