From patchwork Mon Dec 12 14:18:05 2016 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: 9470769 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 1BE69607D6 for ; Mon, 12 Dec 2016 14:20:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02CA528497 for ; Mon, 12 Dec 2016 14:20:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB88E284AB; Mon, 12 Dec 2016 14:20:28 +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=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 A0B5B284AF for ; Mon, 12 Dec 2016 14:20:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752938AbcLLOUS (ORCPT ); Mon, 12 Dec 2016 09:20:18 -0500 Received: from smtp-4.sys.kth.se ([130.237.48.193]:52503 "EHLO smtp-4.sys.kth.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752847AbcLLOUQ (ORCPT ); Mon, 12 Dec 2016 09:20:16 -0500 Received: from smtp-4.sys.kth.se (localhost.localdomain [127.0.0.1]) by smtp-4.sys.kth.se (Postfix) with ESMTP id 9AAD3328B; Mon, 12 Dec 2016 15:20:14 +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 nXvCTZp5nsSp; Mon, 12 Dec 2016 15:20:14 +0100 (CET) X-KTH-Auth: niso [89.233.230.99] X-KTH-mail-from: niklas.soderlund@ragnatech.se Received: from bismarck.berto.se (unknown [89.233.230.99]) by smtp-4.sys.kth.se (Postfix) with ESMTPSA id 732A731A5; Mon, 12 Dec 2016 15:20:13 +0100 (CET) From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= To: linux-pm@vger.kernel.org, Wolfram Sang , Khiem Nguyen , Kuninori Morimoto Cc: linux-renesas-soc@vger.kernel.org, Zhang Rui , Eduardo Valentin , Geert Uytterhoeven , =?UTF-8?q?Niklas=20S=C3=B6derlund?= Subject: [PATCHv5 5/5] thermal: rcar_gen3_thermal: Add delay in .thermal_init on r8a7795 Date: Mon, 12 Dec 2016 15:18:05 +0100 Message-Id: <20161212141805.14946-6-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161212141805.14946-1-niklas.soderlund@ragnatech.se> References: <20161212141805.14946-1-niklas.soderlund@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 From: Niklas Söderlund The .thermal_init needs to be delayed a short amount of time after setting REG_GEN3_CTSR to allow for the TEMP register to contain something useful. If it's not delayed theses 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. Signed-off-by: Niklas Söderlund --- 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 7d78498..085daec 100644 --- a/drivers/thermal/rcar_gen3_thermal.c +++ b/drivers/thermal/rcar_gen3_thermal.c @@ -199,6 +199,8 @@ static void r8a7795_thermal_init(struct rcar_gen3_thermal_tsc *tsc) rcar_gen3_thermal_write(tsc, REG_GEN3_CTSR, CTSR_PONM | CTSR_AOUT | CTSR_THBGR | CTSR_VMEN | CTSR_VMST | CTSR_THSST); + + usleep_range(1000, 2000); } static void r8a7796_thermal_init(struct rcar_gen3_thermal_tsc *tsc)