From patchwork Fri Mar 17 15:52:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 9631023 X-Patchwork-Delegate: eduardo.valentin@ti.com 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 68255602D7 for ; Fri, 17 Mar 2017 16:02:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64B8728178 for ; Fri, 17 Mar 2017 16:02:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5976F28066; Fri, 17 Mar 2017 16:02:27 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable 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 D50A227E5A for ; Fri, 17 Mar 2017 16:02:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751222AbdCQQCN (ORCPT ); Fri, 17 Mar 2017 12:02:13 -0400 Received: from smtp-4.sys.kth.se ([130.237.48.193]:56589 "EHLO smtp-4.sys.kth.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751037AbdCQQCI (ORCPT ); Fri, 17 Mar 2017 12:02:08 -0400 Received: from smtp-4.sys.kth.se (localhost.localdomain [127.0.0.1]) by smtp-4.sys.kth.se (Postfix) with ESMTP id 353BB3605; Fri, 17 Mar 2017 16:53:22 +0100 (CET) X-Virus-Scanned: by amavisd-new at kth.se Received: from smtp-4.sys.kth.se ([127.0.0.1]) by smtp-4.sys.kth.se (smtp-4.sys.kth.se [127.0.0.1]) (amavisd-new, port 10024) with LMTP id L8s6c_JvgMME; Fri, 17 Mar 2017 16:53:21 +0100 (CET) X-KTH-Auth: niso [89.233.230.99] X-KTH-mail-from: niklas.soderlund+renesas@ragnatech.se Received: from bismarck.berto.se (unknown [89.233.230.99]) by smtp-4.sys.kth.se (Postfix) with ESMTPSA id 4470935A8; Fri, 17 Mar 2017 16:53:21 +0100 (CET) From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= To: linux-pm@vger.kernel.org, Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org, Zhang Rui , Eduardo Valentin , =?UTF-8?q?Niklas=20S=C3=B6derlund?= Subject: [PATCH v2 1/7] thermal: rcar_gen3_thermal: add delay in .thermal_init on r8a7796 Date: Fri, 17 Mar 2017 16:52:54 +0100 Message-Id: <20170317155300.21566-2-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170317155300.21566-1-niklas.soderlund+renesas@ragnatech.se> References: <20170317155300.21566-1-niklas.soderlund+renesas@ragnatech.se> MIME-Version: 1.0 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 The .thermal_init needs to be delayed a short amount of time to allow for the TEMP register to contain something useful. If it's not delayed these warnings are common during boot: thermal thermal_zone0: failed to read out thermal zone (-5) thermal thermal_zone1: failed to read out thermal zone (-5) thermal thermal_zone2: failed to read out thermal zone (-5) The warnings are triggered by the first call to .get_temp() while the TEMP register contains 0 and rcar_gen3_thermal_get_temp() returns -EIO since a TEMP value of 0 will result in a temperature reading which is out of specifications. This should have been done in the initial commit which adds the driver as the same issue was found and corrected for r8a7795. Fixes: 564e73d283af9d4c ("thermal: rcar_gen3_thermal: Add R-Car Gen3 thermal driver") Signed-off-by: Niklas Söderlund Reviewed-by: Geert Uytterhoeven Reviewed-by: Wolfram Sang --- drivers/thermal/rcar_gen3_thermal.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c index d33c845244b1d819..ec477d47d0bae8e5 100644 --- a/drivers/thermal/rcar_gen3_thermal.c +++ b/drivers/thermal/rcar_gen3_thermal.c @@ -222,6 +222,8 @@ static void r8a7796_thermal_init(struct rcar_gen3_thermal_tsc *tsc) reg_val = rcar_gen3_thermal_read(tsc, REG_GEN3_THCTR); reg_val |= THCTR_THSST; rcar_gen3_thermal_write(tsc, REG_GEN3_THCTR, reg_val); + + usleep_range(1000, 2000); } static const struct rcar_gen3_thermal_data r8a7795_data = {