From 2c4c40ac0052eaf9b14009635ab475362e88c6e0 Mon Sep 17 00:00:00 2001 From: Rupesh Kumar Date: Wed, 22 Aug 2012 15:14:22 +0530 Subject: [PATCH] ab8500-btemp: Defer btemp filtering while initialising Due to btemp filtering enabled during init, temp values reported to charge algorithm driver started from 0. As a result,charge algorithm was going into wrong state and charging was stopped. Signed-off-by: Rupesh Kumar Signed-off-by: Lee Jones Reviewed-by: Marcus COOPER Reviewed-by: Martin SJOBLOM Reviewed-by: Philippe LANGLAIS --- drivers/power/ab8500_btemp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/power/ab8500_btemp.c b/drivers/power/ab8500_btemp.c index fa60e3a..91ad3ed 100644 --- a/drivers/power/ab8500_btemp.c +++ b/drivers/power/ab8500_btemp.c @@ -609,7 +609,6 @@ static void ab8500_btemp_periodic_work(struct work_struct *work) struct ab8500_btemp, btemp_periodic_work.work); if (!di->initialized) { - di->initialized = true; /* Identify the battery */ if (ab8500_btemp_id(di) < 0) dev_warn(di->dev, "failed to identify the battery\n"); @@ -622,8 +621,9 @@ static void ab8500_btemp_periodic_work(struct work_struct *work) * same temperature. Else only allow 1 degree change from previous * reported value in the direction of the new measurement. */ - if (bat_temp == di->prev_bat_temp || !di->initialized) { - if (di->bat_temp != di->prev_bat_temp || !di->initialized) { + if ((bat_temp == di->prev_bat_temp) || !di->initialized) { + if ((di->bat_temp != di->prev_bat_temp) || !di->initialized) { + di->initialized = true; di->bat_temp = bat_temp; power_supply_changed(&di->btemp_psy); } -- 2.7.4