From patchwork Wed Feb 3 04:12:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caesar Wang X-Patchwork-Id: 8197701 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 50B7ABEEE5 for ; Wed, 3 Feb 2016 04:15:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 81244201B4 for ; Wed, 3 Feb 2016 04:15:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A4ADF200F4 for ; Wed, 3 Feb 2016 04:15:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755874AbcBCENw (ORCPT ); Tue, 2 Feb 2016 23:13:52 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:33144 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755925AbcBCENu (ORCPT ); Tue, 2 Feb 2016 23:13:50 -0500 Received: by mail-pf0-f196.google.com with SMTP id e126so411437pfe.0; Tue, 02 Feb 2016 20:13:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3Lxngr/LyH6PNzaY7CgWjA67BQHS4YmK5jJowmhHDVA=; b=cXa3n3wjIerJwRjhD1yiM4FLPVwFDEbWz9rrA3e804vRjl84dxRrpIln4cqVGI4jef ypy5j2hYuKiU8dVOSKheZA9dqPBQkEz3aTDV1UGIYJkCrSvK29AzzVNJNnkJ2/830JIe I7XPWglwqhWhu6Mqg3lY7sQUQDA66w9PFdPJK7rtrIIBtaqKwYUy4SbTAe2519esej5W k2LTG4A+cQftGGraxHSdekTWNuhBnTVNq4Y97u61yA0oeBqLKKks89q5j7nY3lwbbnWX hFGAAuk5UCLdJR+xsfWSF6EtZFOv3GAwx8J8X0XHHb8k4jmGEXY0VUDfnmcgSpSVlIqc 4RuQ== X-Gm-Message-State: AG10YORtJlfVNGeAreMToGL57fRHq0Tvv2dhzvnGwJG3zKl1leQ/NqykKtzDOblTbYRv3g== X-Received: by 10.98.0.7 with SMTP id 7mr53197151pfa.5.1454472829531; Tue, 02 Feb 2016 20:13:49 -0800 (PST) Received: from localhost.localdomain ([103.29.142.67]) by smtp.gmail.com with ESMTPSA id cf6sm5809274pad.41.2016.02.02.20.13.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Feb 2016 20:13:48 -0800 (PST) From: Caesar Wang To: Heiko Stuebner , edubezval@gmail.com Cc: huangtao@rock-chips.com, linux-rockchip@lists.infradead.org, zhangqing@rock-chips.com, Dmitry Torokhov , Caesar Wang , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Zhang Rui , linux-arm-kernel@lists.infradead.org Subject: [PATCH 4/8] thermal: rockchip: fix calculation error for code_to_temp Date: Wed, 3 Feb 2016 12:12:43 +0800 Message-Id: <1454472767-5767-5-git-send-email-wxt@rock-chips.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1454472767-5767-1-git-send-email-wxt@rock-chips.com> References: <1454472767-5767-1-git-send-email-wxt@rock-chips.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Elaine Zhang the calculation use a global table, not their own table. so adapt the table to the correct one. Signed-off-by: Elaine Zhang Signed-off-by: Caesar Wang --- drivers/thermal/rockchip_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index 433085a..5c58d48 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -411,7 +411,7 @@ static int rk_tsadcv2_code_to_temp(struct chip_tsadc_table table, u32 code, * temperature between 2 table entries is linear and interpolate * to produce less granular result. */ - num = table.id[mid].temp - v2_code_table[mid - 1].temp; + num = table.id[mid].temp - table.id[mid - 1].temp; num *= abs(table.id[mid - 1].code - code); denom = abs(table.id[mid - 1].code - table.id[mid].code); *temp = table.id[mid - 1].temp + (num / denom);