From patchwork Mon Feb 15 07:33:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caesar Wang X-Patchwork-Id: 8310701 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 2CD4DC02AA for ; Mon, 15 Feb 2016 07:37:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4E3A4204EB for ; Mon, 15 Feb 2016 07:37:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 66F2A204AD for ; Mon, 15 Feb 2016 07:37:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752358AbcBOHej (ORCPT ); Mon, 15 Feb 2016 02:34:39 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:33813 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752090AbcBOHeh (ORCPT ); Mon, 15 Feb 2016 02:34:37 -0500 Received: by mail-pf0-f194.google.com with SMTP id 71so7175496pfv.1; Sun, 14 Feb 2016 23:34:37 -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=HAAM9JcuJPZRkOysC7pUk1qs3pE8FpxZN4udjrTgSVHuEjVI+/Byu94SPr7MnD2yJv QENq8mSR4C0sIQfSVLm9qdJvlymDBXSjO8Wt4kUSTMrZ8+AMybDwIRzS6qO/KKlZRJ+9 F4D+/bgMHfilJ/Q78Kfplb6DFWzQ2+CJXOVyft9anCHCkndguPTIyovahtELOkXKLaJP GVZ/Ax3Fee77UmRR3mBVlMqBr9iSVhoqOBtawn6LuSzLooKHus46zQuf3aIWZ/K4TmWl EJ6NnrDZ/OD8N5Yb9H6AUC5RTwECrZfamAGmzqSrLZeZBhPkZm4j3x6TPkbf3HvEzhGU X8cQ== X-Gm-Message-State: AG10YOSV9CxxlOxFiBfT1aUu3GynWizK1Rba4szHt7rUI89fc/Nn5KC4I68OwwYpCOcSuQ== X-Received: by 10.98.42.85 with SMTP id q82mr21246704pfq.18.1455521677147; Sun, 14 Feb 2016 23:34:37 -0800 (PST) Received: from localhost.localdomain ([103.29.142.67]) by smtp.gmail.com with ESMTPSA id o17sm36040286pfj.50.2016.02.14.23.34.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 14 Feb 2016 23:34:36 -0800 (PST) From: Caesar Wang To: Heiko Stuebner , edubezval@gmail.com Cc: huangtao@rock-chips.com, Michael Turquette , linux-pm@vger.kernel.org, Stephen Boyd , zhangqing@rock-chips.com, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Dmitry Torokhov , Jeffy Chen , Zhang Rui , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Caesar Wang Subject: [RESEND PATCH 4/8] thermal: rockchip: fix calculation error for code_to_temp Date: Mon, 15 Feb 2016 15:33:29 +0800 Message-Id: <1455521613-27340-5-git-send-email-wxt@rock-chips.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1455521613-27340-1-git-send-email-wxt@rock-chips.com> References: <1455521613-27340-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=-6.9 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);