From patchwork Thu Dec 13 15:21:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 13549 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 4E76E23E2A for ; Thu, 13 Dec 2012 15:22:17 +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 02314A185E5 for ; Thu, 13 Dec 2012 15:22:16 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so4139592ieb.11 for ; Thu, 13 Dec 2012 07:22:16 -0800 (PST) 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:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=EzkQq8485W4wvrfgvEXMZb2sHfFytrfxZcOtj8XR2q4=; b=iC0ShWKya/2GiPisG+3+eulagZxoxItgi8klHGkVSbECVLgtwKFIn6eADvRrMRj8YG DK7333tJ2eUGFsuDnr7UUAELn2f9xjHhoupeuMjQOnmgfU15GkhyebXCyojWb64RvE0M KkK9+C+dLJiSc2loQriJeIEo1lkr3PNSZgeqmC4N7EUVpQ/dRLAjHjB9z287ivZpDrvO 4oxUNLMI7j5b6EjdN4nEoq4tP2dku4v31RGtcOo1liDqy3My3c8eHSp/1J/bLvZUC3fT FNU2HAM/OXFz1BTO7ElqoXGN6SVy5TyEbnDnnAo18BoPstZ8VS6lz2Mx4GBXhFzzWmn7 bC1A== Received: by 10.50.42.168 with SMTP id p8mr1894944igl.57.1355412136446; Thu, 13 Dec 2012 07:22:16 -0800 (PST) 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.67.148 with SMTP id n20csp16267igt; Thu, 13 Dec 2012 07:22:16 -0800 (PST) Received: by 10.194.236.166 with SMTP id uv6mr9038263wjc.34.1355412135550; Thu, 13 Dec 2012 07:22:15 -0800 (PST) Received: from mail-wg0-f48.google.com (mail-wg0-f48.google.com [74.125.82.48]) by mx.google.com with ESMTPS id t6si12607573wjw.35.2012.12.13.07.22.15 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 13 Dec 2012 07:22:15 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.48 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.48; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.48 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by mail-wg0-f48.google.com with SMTP id dt10so860180wgb.15 for ; Thu, 13 Dec 2012 07:22:15 -0800 (PST) Received: by 10.180.78.161 with SMTP id c1mr4048113wix.4.1355412135096; Thu, 13 Dec 2012 07:22:15 -0800 (PST) Received: from localhost.localdomain (cpc1-aztw13-0-0-cust473.18-1.cable.virginmedia.com. [77.102.241.218]) by mx.google.com with ESMTPS id i6sm8200894wix.5.2012.12.13.07.22.13 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 13 Dec 2012 07:22:14 -0800 (PST) From: Lee Jones To: linux-kernel@vger.kernel.org Cc: cbou@mail.ru, Hakan Berg , Lee Jones Subject: [PATCH 13/18] power: ab8500_fg: Added support for BATT_OVV Date: Thu, 13 Dec 2012 15:21:36 +0000 Message-Id: <1355412102-14265-14-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1355412102-14265-1-git-send-email-lee.jones@linaro.org> References: <1355412102-14265-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQlH0NjEWd/dkkNjNVKUU3M+3m6RO/qA4/xpzdEWmIRh39t2Q4M05YPA8p6j/3H731vVBnII From: Hakan Berg Add support for the battery over-voltage situation Signed-off-by: Lee Jones Signed-off-by: Hakan Berg Reviewed-by: Karl KOMIEROWSKI --- drivers/power/ab8500_fg.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c index 5aa981e..f931bf8 100644 --- a/drivers/power/ab8500_fg.c +++ b/drivers/power/ab8500_fg.c @@ -1840,24 +1840,26 @@ static void ab8500_fg_check_hw_failure_work(struct work_struct *work) * If we have had a battery over-voltage situation, * check ovv-bit to see if it should be reset. */ - if (di->flags.bat_ovv) { - ret = abx500_get_register_interruptible(di->dev, - AB8500_CHARGER, AB8500_CH_STAT_REG, - ®_value); - if (ret < 0) { - dev_err(di->dev, "%s ab8500 read failed\n", __func__); - return; - } - if ((reg_value & BATT_OVV) != BATT_OVV) { - dev_dbg(di->dev, "Battery recovered from OVV\n"); - di->flags.bat_ovv = false; + ret = abx500_get_register_interruptible(di->dev, + AB8500_CHARGER, AB8500_CH_STAT_REG, + ®_value); + if (ret < 0) { + dev_err(di->dev, "%s ab8500 read failed\n", __func__); + return; + } + if ((reg_value & BATT_OVV) == BATT_OVV) { + if (!di->flags.bat_ovv) { + dev_dbg(di->dev, "Battery OVV\n"); + di->flags.bat_ovv = true; power_supply_changed(&di->fg_psy); - return; } - /* Not yet recovered from ovv, reschedule this test */ queue_delayed_work(di->fg_wq, &di->fg_check_hw_failure_work, - round_jiffies(HZ)); + HZ); + } else { + dev_dbg(di->dev, "Battery recovered from OVV\n"); + di->flags.bat_ovv = false; + power_supply_changed(&di->fg_psy); } } @@ -2037,8 +2039,6 @@ static irqreturn_t ab8500_fg_batt_ovv_handler(int irq, void *_di) struct ab8500_fg *di = _di; dev_dbg(di->dev, "Battery OVV\n"); - di->flags.bat_ovv = true; - power_supply_changed(&di->fg_psy); /* Schedule a new HW failure check */ queue_delayed_work(di->fg_wq, &di->fg_check_hw_failure_work, 0);