summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRong Dian <b38775@freescale.com>2012-07-04 12:51:17 +0800
committerLin Fuzhen <fuzhen.lin@freescale.com>2012-07-10 11:33:09 +0800
commit322208e066c37c65f60a74844e5851a2db86696a (patch)
tree5e84a36747d726b5a83b213afd1d7b9a802b96e0
parent88d009f005790e5f46c96788409f403cff0a74c9 (diff)
ENGR00215718: battery: fix issure that coulomb data increases in discharger
Hardware cannot support battery internal resistance and coulomb calculation, estimate data only by battery voltage.The true battery voltage will change to a bit lower about 50mV~500mV than normal voltage with playing game or video or other consumption actions, then change back to normal voltage with finishing playing game or video or other consumption actions in the discharger stage. Signed-off-by: Rong Dian <b38775@freescale.com>
-rwxr-xr-xdrivers/power/sabresd_battery.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/power/sabresd_battery.c b/drivers/power/sabresd_battery.c
index df9f62cdeb5d..460da4a43b72 100755
--- a/drivers/power/sabresd_battery.c
+++ b/drivers/power/sabresd_battery.c
@@ -249,8 +249,26 @@ u32 calibration_voltage(struct max8903_data *data)
static void max8903_battery_update_status(struct max8903_data *data)
{
static int counter;
+ int temp;
+ static int temp_last;
mutex_lock(&data->work_lock);
- data->voltage_uV = calibration_voltage(data);
+ temp = calibration_voltage(data);
+ if (temp_last == 0) {
+ data->voltage_uV = temp;
+ temp_last = temp;
+ }
+ if (data->charger_online == 0 && temp_last != 0) {
+ if (temp < temp_last) {
+ temp_last = temp;
+ data->voltage_uV = temp;
+ } else {
+ data->voltage_uV = temp_last;
+ }
+ }
+ if (data->charger_online == 1) {
+ data->voltage_uV = temp;
+ temp_last = temp;
+ }
data->percent = calibrate_battery_capability_percent(data);
if (data->percent != data->old_percent) {
data->old_percent = data->percent;