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: 8310621 Return-Path: X-Original-To: patchwork-linux-rockchip@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 3FAA9C02AA for ; Mon, 15 Feb 2016 07:36:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 79AE0201F5 for ; Mon, 15 Feb 2016 07:36:03 +0000 (UTC) Received: from bombadil.infradead.org (unknown [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 98BF5201F2 for ; Mon, 15 Feb 2016 07:36:02 +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 1aVDhB-0005OB-J8; Mon, 15 Feb 2016 07:35:45 +0000 Received: from mail-pf0-f196.google.com ([209.85.192.196]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aVDgP-0003o2-O2; Mon, 15 Feb 2016 07:34:59 +0000 Received: by mail-pf0-f196.google.com with SMTP id c10so7173646pfc.0; 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=Etl60f6iQxB37V5NUicDFr3fBKtVdMZt4ZVZEt1A41+vlYssdZIqwQJzaARAN5ESvs 8+k6Ojbrinj6bxGXRkc3WwyO1qWvJ+ewwVustL+9H1q2R7lwI8hVR/zuC50VdUNGEGdW j7rEe8824TnKZoOXwchT5dzUHiG/tnob2ulY4u6Navx27Lhj1Dtu6EZn/gN6EneMHNPo JubSX+0Tv1FZKvZu6F+EpB7IxJg1qKS5LMHMMRVVOJKTNS0MXEOuo7obyEjQ5WV3aDh/ HrBLrbCa6sEHqBA29B51XNc7+uM9OeSupjkN+naOnlUVSIYHWfAxEfW6qdWckKc6hq0m /tug== X-Gm-Message-State: AG10YOQJJoZwoHOEyGy/gGDCk0hq6MsG5GW6YpidlcgRI7soFNjOxQi3z9jXNAHpfZPPhA== 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160214_233458_103435_33D290C9 X-CRM114-Status: UNSURE ( 9.49 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.6 (--) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: huangtao@rock-chips.com, Dmitry Torokhov , linux-pm@vger.kernel.org, Michael Turquette , zhangqing@rock-chips.com, Stephen Boyd , linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Jeffy Chen , Zhang Rui , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Caesar Wang MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RDNS_NONE,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);