From patchwork Thu Sep 27 20:09:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11817 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 2731424140 for ; Thu, 27 Sep 2012 20:10:23 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id B90E7A18351 for ; Thu, 27 Sep 2012 20:10:22 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so5234801iej.11 for ; Thu, 27 Sep 2012 13:10:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=s5xJgzMqMkMQPLV9Ux8vwzPFeBI7m9NlH2aBFeexbA4=; b=MZAHxwjjx60/L9247Zk64ozaZI0Kvcv6+HVYMnfmg/7Lhq4sZXZYJlwtyLbo2Ah412 t8KLfiMnAKjeYdWiRumsBb0BRkJA/nn0Avh0wPkPHjrFFsZG6KMKL0TD5Zq7tNXwFDfx IC1fDEXtkjZoqctz5Lt0wpBUMkaOAJDBxf22WFuhHWsyFAUmct1ovkbjIQiSLtNwV6yO daaq+sZglcSOzc06KGqHPpta/6FmAixlg9DUDjy7Pv7jXOlGjGJfdjmU3efdWnu+0Vb1 KES0YQd3qHphW+chrSntQx93pfYCFLIPGtkNr5RuZiLc8cfATLw7692IFvrLHlV6sqJ5 e+aw== Received: by 10.42.110.130 with SMTP id q2mr3863932icp.53.1348776622538; Thu, 27 Sep 2012 13:10:22 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp436383igc; Thu, 27 Sep 2012 13:10:22 -0700 (PDT) Received: by 10.66.85.133 with SMTP id h5mr12163247paz.10.1348776621781; Thu, 27 Sep 2012 13:10:21 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id pi9si5467641pbb.12.2012.09.27.13.10.21 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Sep 2012 13:10:21 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of mathieu.poirier@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of mathieu.poirier@linaro.org) smtp.mail=mathieu.poirier@linaro.org Received: by mail-pb0-f50.google.com with SMTP id md4so1686045pbc.37 for ; Thu, 27 Sep 2012 13:10:21 -0700 (PDT) Received: by 10.66.83.8 with SMTP id m8mr12162399pay.48.1348776621542; Thu, 27 Sep 2012 13:10:21 -0700 (PDT) Received: from localhost.localdomain (S0106002369de4dac.cg.shawcable.net. [70.73.24.112]) by mx.google.com with ESMTPS id sa2sm1587890pbc.4.2012.09.27.13.10.20 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Sep 2012 13:10:20 -0700 (PDT) From: mathieu.poirier@linaro.org To: patches@linaro.org Subject: [PATCH 45/57] power: ab8500: defer btemp filtering while init Date: Thu, 27 Sep 2012 14:09:02 -0600 Message-Id: <1348776554-10019-46-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1348776554-10019-1-git-send-email-mathieu.poirier@linaro.org> References: <1348776554-10019-1-git-send-email-mathieu.poirier@linaro.org> X-Gm-Message-State: ALoCoQkTUUCnRO8LV4CEAnyhl3p9vB4NniwmkhXAx27Qhy6fqdAIKkLmAICvZ27LKJvuYGdhyb9b From: Rupesh Kumar 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. This patch defers btemp filtering till init is done. Signed-off-by: Rupesh Kumar Signed-off-by: Mathieu Poirier Reviewed-by: Marcus COOPER Reviewed-by: Martin SJOBLOM Reviewed-by: Philippe LANGLAIS --- drivers/power/ab8500_btemp.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/power/ab8500_btemp.c b/drivers/power/ab8500_btemp.c index b24835f..1f33122 100644 --- a/drivers/power/ab8500_btemp.c +++ b/drivers/power/ab8500_btemp.c @@ -613,7 +613,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"); @@ -626,8 +625,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); }