From patchwork Thu Sep 27 20:08:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11808 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 B70D524140 for ; Thu, 27 Sep 2012 20:10:06 +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 663A0A18968 for ; Thu, 27 Sep 2012 20:10:06 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so5234855iej.11 for ; Thu, 27 Sep 2012 13:10:06 -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=Wrb2ZEpbZYoZgOnGjt5tn1iYYOqjfEXwxKzvEy5tHkY=; b=i1mmdxUmuTCt09WZMAv7BfX15G4AHY4D+enJGBALhOsk84t7FcRBbTYTSvH6ZUM8F9 JhjmPIYZuFSKToKJt+m8oSjBjOZRZpkpefcv8TQfvtM2qR2cD+A3LTWvMZ/KONxC7kIo zkBnAdaVa0SejP8Lu0pacZb9h8YEb+gwqY/pEk0cpYXe6ZUS98VNqk1d3b1e/o04SQJ6 U9NuDfrMgeGA85pamOmSlNj0hWCV2TM3X2WG1CHqEIjKG9XOkU+vrPhFhmnPUqVo+mUq W26UNhkjyBWIURa7GMIWZ9GjIZ6HvnkTkuIeGs3DO9GHdcqQQnDugmorYtmh5iCxY3Qc vZPQ== Received: by 10.50.217.227 with SMTP id pb3mr15358950igc.28.1348776606010; Thu, 27 Sep 2012 13:10:06 -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 ex8csp436348igc; Thu, 27 Sep 2012 13:10:05 -0700 (PDT) Received: by 10.68.116.232 with SMTP id jz8mr14561320pbb.77.1348776605388; Thu, 27 Sep 2012 13:10:05 -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.05 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Sep 2012 13:10:05 -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:05 -0700 (PDT) Received: by 10.68.217.67 with SMTP id ow3mr14522797pbc.26.1348776605173; Thu, 27 Sep 2012 13:10:05 -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.03 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Sep 2012 13:10:04 -0700 (PDT) From: mathieu.poirier@linaro.org To: patches@linaro.org Subject: [PATCH 35/57] power: ab8500_fg: Report unscaled capacity Date: Thu, 27 Sep 2012 14:08:52 -0600 Message-Id: <1348776554-10019-36-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: ALoCoQmS690jbjwp3+P/k3dS2QRvf1Pg7Ezxlm+zgmbkV77YHGxTgrBgKbtHB+UZfn0+4JKyAc/0 From: Martin Bergstrom Unscaled capacity should be reported for POWER_SUPPLY_PROP_CAPACITY. Signed-off-by: Martin Bergstrom Signed-off-by: Mathieu Poirier Reviewed-by: Marcus COOPER Reviewed-by: Jonas ABERG --- drivers/power/ab8500_fg.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c index fde189a..c5732e7 100644 --- a/drivers/power/ab8500_fg.c +++ b/drivers/power/ab8500_fg.c @@ -2159,9 +2159,7 @@ static int ab8500_fg_get_property(struct power_supply *psy, val->intval = di->bat_cap.prev_mah; break; case POWER_SUPPLY_PROP_CAPACITY: - if (di->bat->capacity_scaling) - val->intval = di->bat_cap.cap_scale.scaled_cap; - else if (di->flags.batt_unknown && !di->bat->chg_unknown_bat && + if (di->flags.batt_unknown && !di->bat->chg_unknown_bat && di->flags.batt_id_received) val->intval = 100; else @@ -2625,7 +2623,7 @@ static ssize_t ab8500_show_capacity(struct device *dev, if (di->bat->capacity_scaling) capacity = di->bat_cap.cap_scale.scaled_cap; else - capacity = DIV_ROUND_CLOSEST(di->bat_cap.permille, 10); + capacity = di->bat_cap.prev_percent; return scnprintf(buf, PAGE_SIZE, "%d\n", capacity); }