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: 1966011 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 74FD23FF0F for ; Fri, 11 Jan 2013 13:21:02 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TteTx-0003QB-56; Fri, 11 Jan 2013 13:17:13 +0000 Received: from mail-wg0-f47.google.com ([74.125.82.47]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TteQT-0001MN-TG for linux-arm-kernel@lists.infradead.org; Fri, 11 Jan 2013 13:13:41 +0000 Received: by mail-wg0-f47.google.com with SMTP id dq11so794534wgb.26 for ; Fri, 11 Jan 2013 05:13:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=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=cmoDnmgSt0a17YT7Chu0SFou15WnJmY6+Q/Hrw3mewB9tGu8XBicwr4H/TL20EPm4f qEPClqpM4nWwc5jGWj6f8JTGXy81gLmUmcAngsMTOEeBGw6J+x5PYo/DsQ22XowIMcf3 uF9jgbgzeVN4u05Tpx/3E2pghGVXoLrfYKHQvAoh+8cNTq5lSOCdYLU3KvC9/i2VQiKo fin1y+E6WYJoXfRFxcZfapEmFxejU8Hh8af81aR2xuSeCIWOhleCZ9jb1/ZZj3BZUDh0 s9hVHUgBGRtJfBSZhCf1fIHUnsETHPF5Vu2f+O1YedhhHU9oG8SP5C8tU2nEyZEE6NAX ADYA== 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 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: ALoCoQkC0WA4bUtWOpMkmg5Y2OocibHAfer+EIuljd3m2+mt+RN3krn3osrqeMsdQ3xexA7lDXoz X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130111_081338_486798_2FCAE453 X-CRM114-Status: GOOD ( 12.56 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.47 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Lee Jones , linus.walleij@stericsson.com, arnd@arndb.de, cbouatmailru@gmail.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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);