From patchwork Thu Sep 27 20:08:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11790 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 87E1E24140 for ; Thu, 27 Sep 2012 20:09:43 +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 384C5A18B53 for ; Thu, 27 Sep 2012 20:09:43 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so5234855iej.11 for ; Thu, 27 Sep 2012 13:09:43 -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=7qUe63SegP+GQJny7AFrDBPtbRY2BxVEMXyveCev/as=; b=XoQXxb8Rd7rdUDYQjWEteKV4YvXo147Q7awyYTwuM+zqRSv59RluQerkJatJhXy/Lr Vvw0PGIBWP1NLtr7JDrgHCcNd48u7zj1fhLpJ3n4REZ1MlBkOd38L6UL+6BWSAEes5qH YO8yhM1NdwPb7HzQsOgPCKuzZI7e2ADEHWQtKW8nNnJbLOaczqMF1mei/rrl5PfIj5y4 lKkShjGmJUwd2hq34Kf6rRKa1KWepaBRgxTzORh4R9+C8Sho1sIjpkPO59s8GWq/AXlP pxd72gsEpfgId4rwWT2Ap7btzHTU2qbk5XfRudO68kiBzZbV/ilM8SAzgYb3Q6hei7Pq 8mvg== Received: by 10.50.0.193 with SMTP id 1mr4747036igg.0.1348776583005; Thu, 27 Sep 2012 13:09:43 -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 ex8csp436297igc; Thu, 27 Sep 2012 13:09:42 -0700 (PDT) Received: by 10.68.225.68 with SMTP id ri4mr14264879pbc.115.1348776582445; Thu, 27 Sep 2012 13:09:42 -0700 (PDT) Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by mx.google.com with ESMTPS id vn9si8390651pbc.17.2012.09.27.13.09.42 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Sep 2012 13:09:42 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.50 is neither permitted nor denied by best guess record for domain of mathieu.poirier@linaro.org) client-ip=209.85.220.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.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-pa0-f50.google.com with SMTP id hz11so1847989pad.37 for ; Thu, 27 Sep 2012 13:09:42 -0700 (PDT) Received: by 10.68.232.70 with SMTP id tm6mr14422054pbc.104.1348776582232; Thu, 27 Sep 2012 13:09:42 -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.09.41 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Sep 2012 13:09:41 -0700 (PDT) From: mathieu.poirier@linaro.org To: patches@linaro.org Subject: [PATCH 17/57] power: ab8500_bm: Added support for BATT_OVV Date: Thu, 27 Sep 2012 14:08:34 -0600 Message-Id: <1348776554-10019-18-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: ALoCoQlqzOWU3tAbORWFlLKhZbJlBSmtYD4S8OVWC59huKGKVKSOZTf6ZUHw+DU0qHgfhfP/4j7X From: Hakan Berg Add support for the battery over-voltage situation Signed-off-by: Hakan Berg Signed-off-by: Mathieu Poirier Reviewed-by: Karl KOMIEROWSKI --- drivers/power/ab8500_fg.c | 32 ++++++++++++++++---------------- 1 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c index c4d9307..8507254 100644 --- a/drivers/power/ab8500_fg.c +++ b/drivers/power/ab8500_fg.c @@ -1842,24 +1842,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); } } @@ -2039,8 +2041,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);