From patchwork Fri Nov 30 11:57:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 13302 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 A61042425D for ; Fri, 30 Nov 2012 11:57:54 +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 5E8D3A1915F for ; Fri, 30 Nov 2012 11:57:54 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so449761ieb.11 for ; Fri, 30 Nov 2012 03:57:53 -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=fuvkXRnOzarVYUeGCsH5lNexewXxbObhBx3LDpJ0eXA=; b=BR7a3wy8tOX3Y+C0Az4QhKpdREQeJO+GVx4T9otVM+INlo915kJqnIqidTSwtrH5Ya 0x01McdnN7YyUWxFVWLI86Utk/y39Gq7Bak1st/BqQAf/0KvNwulAeUa5dHZrOZoleus obFJrsiQuZ7PcDXizlSH2Uwb9Ead2xn4q72QEf99lNubpNGzURGww/a5NMJvQ1Y1ZF2D 2870nyoZndpvjtwuo0Ewngd12DXV5cUGrswgsKucfpMynEQeQdOc9uIPHO7pmVUaPaab HhTJ3uXYubo7BokFFi5SlMN8rvSkATjx5W7SGnltRPi6M8bkuhUJRbfhJ/pqSJ0UkN2m 5nQg== Received: by 10.50.213.69 with SMTP id nq5mr28318777igc.70.1354276673816; Fri, 30 Nov 2012 03:57:53 -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 n20csp1011249igt; Fri, 30 Nov 2012 03:57:53 -0800 (PST) Received: by 10.180.80.201 with SMTP id t9mr1682511wix.0.1354276672776; Fri, 30 Nov 2012 03:57:52 -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 hm16si11036531wib.1.2012.11.30.03.57.52 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 30 Nov 2012 03:57:52 -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 dt10so155928wgb.27 for ; Fri, 30 Nov 2012 03:57:52 -0800 (PST) Received: by 10.216.209.70 with SMTP id r48mr408458weo.196.1354276672202; Fri, 30 Nov 2012 03:57:52 -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 i6sm14966896wix.5.2012.11.30.03.57.50 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 30 Nov 2012 03:57:51 -0800 (PST) From: Lee Jones To: linux-kernel@vger.kernel.org Cc: linus.walleij@stericsson.com, arnd@arndb.de, cbou@mail.ru, dwmw2@infradead.org, rajanikanth.hv@linaro.org, Kalle Komierowski , Marcus Cooper , Lee Jones Subject: [PATCH 02/12] ab8500_fg: Don't clear the CCMuxOffset bit Date: Fri, 30 Nov 2012 11:57:24 +0000 Message-Id: <1354276654-590-3-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1354276654-590-1-git-send-email-lee.jones@linaro.org> References: <1354276654-590-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQkAWVKaXNEbMnG6f3eW1L9NAbt8ORb3NMhKRKU8ACZzPZtuyHJl3GPNJl6VTlVVZCT/mRtn From: Kalle Komierowski The CCMuxOffset bit is not kept set. This will force the columb counter of the AB8500 to use the measure offset calibration. This should increase the accuracy of the fuel gauge. Signed-off-by: Kalle Komierowski Signed-off-by: Marcus Cooper Signed-off-by: Lee Jones Reviewed-by: Jonas ABERG --- drivers/power/ab8500_fg.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c index ed62ef7..5a9f58d 100644 --- a/drivers/power/ab8500_fg.c +++ b/drivers/power/ab8500_fg.c @@ -484,8 +484,9 @@ static int ab8500_fg_coulomb_counter(struct ab8500_fg *di, bool enable) di->flags.fg_enabled = true; } else { /* Clear any pending read requests */ - ret = abx500_set_register_interruptible(di->dev, - AB8500_GAS_GAUGE, AB8500_GASG_CC_CTRL_REG, 0); + ret = abx500_mask_and_set_register_interruptible(di->dev, + AB8500_GAS_GAUGE, AB8500_GASG_CC_CTRL_REG, + (RESET_ACCU | READ_REQ), 0); if (ret) goto cc_err; @@ -1403,8 +1404,7 @@ static void ab8500_fg_algorithm_discharging(struct ab8500_fg *di) sleep_time = di->bat->fg_params->init_timer; /* Discard the first [x] seconds */ - if (di->init_cnt > - di->bat->fg_params->init_discard_time) { + if (di->init_cnt > di->bat->fg_params->init_discard_time) { ab8500_fg_calc_cap_discharge_voltage(di, true); ab8500_fg_check_capacity_limits(di, true);