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: 9498347 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 1B9A260235 for ; Thu, 5 Jan 2017 04:38:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2030326224 for ; Thu, 5 Jan 2017 04:38:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 14EBC26E16; Thu, 5 Jan 2017 04:38:32 +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=-2.0 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM,URIBL_BLACK autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9E71E26224 for ; Thu, 5 Jan 2017 04:38:31 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cOzos-00007r-L5; Thu, 05 Jan 2017 04:38:30 +0000 Received: from mail-pg0-f67.google.com ([74.125.83.67]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cOzoq-00006q-TH for linux-rockchip@lists.infradead.org; Thu, 05 Jan 2017 04:38:29 +0000 Received: by mail-pg0-f67.google.com with SMTP id 75so1120885pgf.3 for ; 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=SqB5027HQc1+9bTThC0HlIna6m53fQCAbusp+GlTEX9beeTONORA968SgiF/6yLgpU pntrvcin+sD/c/Lm138ga1mzdvOKCoJ0CZijGSI4XlXNxDa8OMYRYdEptMXVFEOHUAIq u4OxlIT4GQrnP+Q36FJrdfoufbcASrNNqD4VS+HtNdncClhCDZOAHkWkhZncEV978s6Y v1TeYCd+/v26bKgQ8f6dFkKVfBFhjePAmb59i2+Q92Ivuh33OSfw6155aa6X1+8kBAbu Qmouz1mbfOJ4YopxR2c79RU60rM0eECALQ+rEp5xwlqA20UdTk0DX6erlU6r+dJj6z4T ehiQ== X-Gm-Message-State: AIkVDXLZ6VXnVsizgwqR54DM8m4kiCCjsb+VhEYsuA2N2ztl1jtUtHrOg6RcVqkoHARDuw== 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170104_203828_982396_6D6B8E26 X-CRM114-Status: UNSURE ( 9.37 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heiko@sntech.de, linux-pm@vger.kernel.org, ayaka@soulik.info, randy.li@rock-chips.com, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, rui.zhang@intel.com, Caesar Wang MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.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) {