summaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorRong Dian <b38775@freescale.com>2012-07-04 12:51:17 +0800
committerTerry Lv <r65388@freescale.com>2012-07-25 13:10:27 +0800
commit6cf00108de4e6c354e82bc30ae7452684d2ba8ee (patch)
tree3884bd0f4eb8d746c12b664a5d53525b61b5b97b /drivers/power
parenta23fda1bd3fa217651eca032e3ca3ca9dad0178f (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>
Diffstat (limited to 'drivers/power')
-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;