From patchwork Thu Jan 5 04:37:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caesar Wang X-Patchwork-Id: 9498351 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5BF7A606E0 for ; Thu, 5 Jan 2017 04:39:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F7A126224 for ; Thu, 5 Jan 2017 04:39:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 509AE27D4D; Thu, 5 Jan 2017 04:39:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM,URIBL_BLACK autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F12A026C9B for ; Thu, 5 Jan 2017 04:38:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752345AbdAEEiY (ORCPT ); Wed, 4 Jan 2017 23:38:24 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:36055 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752357AbdAEEiJ (ORCPT ); Wed, 4 Jan 2017 23:38:09 -0500 Received: by mail-pg0-f67.google.com with SMTP id 75so1120883pgf.3; Wed, 04 Jan 2017 20:38:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=3/ToHsfWJrxeCQO4vo1k4rfnWUbZzovICxW22Pp+q7w=; b=FipTUhFolCdatR8YmDC0voEeIjL3YsW5PVeNzPXcUQi5JK2gv8HhzoO/KxI+qinkVY 1YB8EV+4vv3xCHordtVUPdnXHiE6cp+zgvtptC8luMf/s50iLY8jt5mnz8/58LBWTK6a HgljSHe4BeKlPy/Nfe2w80+6932Ow+Ak3cgIouXHxNKIUb5beRmSl++6Ix5Djhoi3hJG TZCKhVL8ixcufScQkd1OD7/pmPL12vp0XZvdna/Dir/MAIe07lSE+clwLbfLgh0GHLua lywqQJuRiU8fRM82YrLReWZfXH8bgzz/cprU54WWeJo2ZQm0FkAyDpQxHQfirHiOCSRk q/5g== X-Gm-Message-State: AIkVDXJx+hRRvmU+jF/lXVUFg6BOA+LuoBEky+ZPTD55HtJqal/CmUYFVRsLBobKYCue/g== X-Received: by 10.84.197.1 with SMTP id m1mr149982230pld.75.1483591087352; Wed, 04 Jan 2017 20:38:07 -0800 (PST) Received: from localhost.localdomain ([103.29.142.67]) by smtp.gmail.com with ESMTPSA id p5sm137933540pgk.23.2017.01.04.20.38.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Jan 2017 20:38:05 -0800 (PST) From: Caesar Wang To: edubezval@gmail.com Cc: rui.zhang@intel.com, linux-rockchip@lists.infradead.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, heiko@sntech.de, randy.li@rock-chips.com, ayaka@soulik.info, Caesar Wang Subject: [PATCH] thermal: rockchip: fixes the conversion table Date: Thu, 5 Jan 2017 12:37:55 +0800 Message-Id: <1483591075-17125-1-git-send-email-wxt@rock-chips.com> X-Mailer: git-send-email 2.7.4 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As Ayaka reported the thermal was abormal on rk3288 at booting time. thermal thermal_zone1: critical temperature reached(125 C),shutting down thermal thermal_zone2: critical temperature reached(125 C),shutting down thermal thermal_zone1: critical temperature reached(125 C),shutting down thermal thermal_zone2: critical temperature reached(125 C),shutting down ... The root caused by reading the invald analogic value, the value is zero will convert the 125 degree to trigger the critical temperature. Fixes it with insteading of the incorrect reading now. Fixes commit cadf29dc2a8bcaae83 ("thermal: rockchip: optimize the conversion table") Reported-by: ayaka 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 cbbf0ce..4c77965 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -464,7 +464,7 @@ static int rk_tsadcv2_code_to_temp(const struct chip_tsadc_table *table, switch (table->mode) { case ADC_DECREMENT: code &= table->data_mask; - if (code < table->id[high].code) + if (code <= table->id[high].code) return -EAGAIN; /* Incorrect reading */ while (low <= high) {