From patchwork Fri Jan 11 13:12:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 13981 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 F004423E27 for ; Fri, 11 Jan 2013 13:13:37 +0000 (UTC) Received: from mail-vb0-f45.google.com (mail-vb0-f45.google.com [209.85.212.45]) by fiordland.canonical.com (Postfix) with ESMTP id AA913A1849E for ; Fri, 11 Jan 2013 13:13:37 +0000 (UTC) Received: by mail-vb0-f45.google.com with SMTP id p1so1398643vbi.18 for ; Fri, 11 Jan 2013 05:13:37 -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=gpNNDl0BhcMbJZz/TUB4Ftl/TwKXBT+iqDAkbFKzy2Y=; b=cAc4utZPM239IwcW458fdxVLFcOIL4Z/Jx3IM737c1mQXjU11JdHP4EDwBJjGhlzi0 hRyDpMOkiCxyaRrwywtApdznbExuycGY6/ZEy4P5UoQUSa7jIdFGPm7vT80qre3Nzwrb NmRb3f1dlj9XCLPKwT4PWXiaIQZpCs4z6IL2Sx1Fv1Yv0M+H7C8Rd3fS8OKpnwMqbN/o G+ZI1gKmv7/NjTvoflxb+sqW9Y4/9C/VHVOgMaGxz3hl38Vv7CSZ+0DpNtLMI6KVCkNy iaZCe7NsdJ4VsHbn1844uTuFFF6dEUzAsIVhLreaIpGZvET0F/r5nASBjTZkaQIy8kEg SLaA== X-Received: by 10.52.18.147 with SMTP id w19mr82436443vdd.94.1357910017201; Fri, 11 Jan 2013 05:13:37 -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 st5csp111236veb; Fri, 11 Jan 2013 05:13:36 -0800 (PST) X-Received: by 10.180.72.232 with SMTP id g8mr15452221wiv.0.1357910016212; Fri, 11 Jan 2013 05:13:36 -0800 (PST) Received: from mail-we0-f170.google.com (mail-we0-f170.google.com [74.125.82.170]) by mx.google.com with ESMTPS id bk8si8679859wjb.30.2013.01.11.05.13.35 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 11 Jan 2013 05:13:36 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.170 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.170; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.170 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-we0-f170.google.com with SMTP id r1so829951wey.15 for ; Fri, 11 Jan 2013 05:13:35 -0800 (PST) X-Received: by 10.180.101.99 with SMTP id ff3mr15502267wib.21.1357910015816; Fri, 11 Jan 2013 05:13:35 -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.34 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 11 Jan 2013 05:13:35 -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, Lee Jones Subject: [PATCH 08/18] power: ab8500_btemp: Allign battery temperature resolution with the framework Date: Fri, 11 Jan 2013 13:12:56 +0000 Message-Id: <1357909986-9262-9-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: ALoCoQnbfvrIQ0whsVRnLpuo1Pye8FhNEEzDcasKpnjlv2ZkJUIJSZy16AsQ+1wYUHh4TGpGpIFp The Linux Power Supply framework expects battery temperatures to have a resolution of 0.1 degree Celsius; however, the AB8500 btemp driver supplies a battery temperature resolution of 1 degree Celsius. We therefore have to use a factor 10 on the measured values. Signed-off-by: Lee Jones --- drivers/power/ab8500_btemp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/power/ab8500_btemp.c b/drivers/power/ab8500_btemp.c index efeb6dd..3ad47b0 100644 --- a/drivers/power/ab8500_btemp.c +++ b/drivers/power/ab8500_btemp.c @@ -746,22 +746,22 @@ static int ab8500_btemp_get_temp(struct ab8500_btemp *di) } else { if (di->events.btemp_low) { if (temp > di->btemp_ranges.btemp_low_limit) - temp = di->btemp_ranges.btemp_low_limit; + temp = di->btemp_ranges.btemp_low_limit * 10; else temp = di->bat_temp * 10; } else if (di->events.btemp_high) { if (temp < di->btemp_ranges.btemp_high_limit) - temp = di->btemp_ranges.btemp_high_limit; + temp = di->btemp_ranges.btemp_high_limit * 10; else temp = di->bat_temp * 10; } else if (di->events.btemp_lowmed) { if (temp > di->btemp_ranges.btemp_med_limit) - temp = di->btemp_ranges.btemp_med_limit; + temp = di->btemp_ranges.btemp_med_limit * 10; else temp = di->bat_temp * 10; } else if (di->events.btemp_medhigh) { if (temp < di->btemp_ranges.btemp_med_limit) - temp = di->btemp_ranges.btemp_med_limit; + temp = di->btemp_ranges.btemp_med_limit * 10; else temp = di->bat_temp * 10; } else @@ -1030,8 +1030,8 @@ static int __devinit ab8500_btemp_probe(struct platform_device *pdev) ab8500_btemp_periodic_work); /* Set BTEMP thermal limits. Low and Med are fixed */ - di->btemp_ranges.btemp_low_limit = BTEMP_THERMAL_LOW_LIMIT; - di->btemp_ranges.btemp_med_limit = BTEMP_THERMAL_MED_LIMIT; + di->btemp_ranges.btemp_low_limit = BTEMP_THERMAL_LOW_LIMIT * 10; + di->btemp_ranges.btemp_med_limit = BTEMP_THERMAL_MED_LIMIT * 10; ret = abx500_get_register_interruptible(di->dev, AB8500_CHARGER, AB8500_BTEMP_HIGH_TH, &val);