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: 8197771 Return-Path: X-Original-To: patchwork-linux-arm@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 DF916BEEE5 for ; Wed, 3 Feb 2016 04:15:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0F3172025B for ; Wed, 3 Feb 2016 04:15:57 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3E7A620221 for ; Wed, 3 Feb 2016 04:15:56 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aQopv-00047X-R6; Wed, 03 Feb 2016 04:14:35 +0000 Received: from mail-pf0-f194.google.com ([209.85.192.194]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aQopW-0003g2-6R; Wed, 03 Feb 2016 04:14:12 +0000 Received: by mail-pf0-f194.google.com with SMTP id 65so411467pfd.1; 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=eIrz6hNaYqVMt4CYhXrAiRTt7om/GOluKL+VKcOw2BfwMKbtiSei8sR06DxzNtC6zb gmj0BFSUTz59WYgXEEhzni4W+6MKoEBCHbgpV3dCeEX60bM+BfMq+w0jLkJPAKandQty IEbZzzkC7xQK6jSpqp+BGSxkCjdLBBOZa9+FTbk6oJwxJzjD3YCxIP9z4QLX+/t23uiz kfjRZl4rrtQys5zkk4SQlCpXneZ972FM+W9DNvr83clgDfuVjF2NIUh/UpGVvb4Cz0IE hQQQDCOIqwl1STTTA4fD6gl/hteW16YMAn4BcOzXptd7BTNCD3/72JjtBgC+7lqGM54t g1rA== X-Gm-Message-State: AG10YOS8QJNSb32ofrYKBSZrKHhi3qBDWVutgSGIt8l7xiWrtHhOkIsCJ989AxT39ShDUg== 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160202_201410_520514_FCAFF300 X-CRM114-Status: UNSURE ( 9.66 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: huangtao@rock-chips.com, Dmitry Torokhov , linux-pm@vger.kernel.org, zhangqing@rock-chips.com, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Zhang Rui , linux-arm-kernel@lists.infradead.org, Caesar Wang MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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);