From patchwork Fri Jan 11 13:13:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 13986 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 9339723E27 for ; Fri, 11 Jan 2013 13:13:46 +0000 (UTC) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by fiordland.canonical.com (Postfix) with ESMTP id 49E5FA1849E for ; Fri, 11 Jan 2013 13:13:46 +0000 (UTC) Received: by mail-vc0-f170.google.com with SMTP id fl11so1412257vcb.15 for ; Fri, 11 Jan 2013 05:13:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=wPmID5E5T7aeTCFlcB4FXVBEwcrLfxT5tGHJQ4cLTqw=; b=ilvs8wovB6WmfyS+AtlaeNBWMtnZR73XHoI4T3+Q8Tj4xkkmbhThyUAgx6XPxl8ggN k6VN9IsnP0yaC2RmlcxZF3zqqasqXtWOV2jaZGLBW8C4cMVcI9uizCAJVQub5OuTRMlG LQFq/8uE188KiCRRScnK1w269pOxVe3/V6k2uNUFrOpYH/NjSXFxwOEObhQoOLKbIMui LmKsRc7b5Dg+9jkbHPkwrOYWqazdaIIPPwX8CWSZCwQZnLp2cGWOPnowpXyIQDA9iplC mJzaozu/6vAEr6ILvGbzfRwVLojydm2GESgotSiC037nZhZgDs/tIzbtIWTCso9ucxI0 UWiw== X-Received: by 10.220.238.139 with SMTP id ks11mr92007144vcb.49.1357910025751; Fri, 11 Jan 2013 05:13:45 -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.58.145.101 with SMTP id st5csp111248veb; Fri, 11 Jan 2013 05:13:45 -0800 (PST) X-Received: by 10.194.7.104 with SMTP id i8mr120659660wja.27.1357910024748; Fri, 11 Jan 2013 05:13:44 -0800 (PST) Received: from mail-wg0-f43.google.com (mail-wg0-f43.google.com [74.125.82.43]) by mx.google.com with ESMTPS id bh9si16353980wib.43.2013.01.11.05.13.44 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 11 Jan 2013 05:13:44 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.43 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.43; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.43 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-f43.google.com with SMTP id e12so821383wge.10 for ; Fri, 11 Jan 2013 05:13:44 -0800 (PST) X-Received: by 10.194.77.13 with SMTP id o13mr120987872wjw.58.1357910024366; Fri, 11 Jan 2013 05:13:44 -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 p2sm7204515wic.7.2013.01.11.05.13.42 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 11 Jan 2013 05:13:43 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: arnd@arndb.de, linus.walleij@stericsson.com, cbouatmailru@gmail.com, Hakan Berg , Lee Jones Subject: [PATCH 13/18] power: ab8500_fg: Added support for BATT_OVV Date: Fri, 11 Jan 2013 13:13:01 +0000 Message-Id: <1357909986-9262-14-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1357909986-9262-1-git-send-email-lee.jones@linaro.org> References: <1357909986-9262-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQlJKTU9mqFdhvnCypURo0uuglAt9G2OwV993DTn0/2+0bvq9SND9FKfuMlqhF1xBIPTG6xt 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 | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c index 5e8291b..845e64f 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)); + } 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);