From patchwork Fri Jan 17 16:05:53 2020 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: 11339521 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B6292184C for ; Fri, 17 Jan 2020 16:06:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9563D21D56 for ; Fri, 17 Jan 2020 16:06:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729288AbgAQQGL (ORCPT ); Fri, 17 Jan 2020 11:06:11 -0500 Received: from bin-mail-out-06.binero.net ([195.74.38.229]:2759 "EHLO bin-mail-out-06.binero.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729203AbgAQQGL (ORCPT ); Fri, 17 Jan 2020 11:06:11 -0500 X-Halon-ID: 465bcabd-3943-11ea-a00b-005056917a89 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (p54ac5d7b.dip0.t-ipconnect.de [84.172.93.123]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA id 465bcabd-3943-11ea-a00b-005056917a89; Fri, 17 Jan 2020 17:06:09 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: linux-pm@vger.kernel.org, Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org, =?utf-8?q?Niklas_S=C3=B6derlund?= Subject: [PATCH v3 1/2] thermal: rcar_thermal: Remove temperature bound Date: Fri, 17 Jan 2020 17:05:53 +0100 Message-Id: <20200117160554.3812787-2-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200117160554.3812787-1-niklas.soderlund+renesas@ragnatech.se> References: <20200117160554.3812787-1-niklas.soderlund+renesas@ragnatech.se> MIME-Version: 1.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org The hardware manual states that the operation of the sensor is not guaranteed outside the range of -45°C to 125°C, not that the readings are invalid. Remove the bound check and try to deliver temperature readings even if we are outside the guaranteed operation range. Signed-off-by: Niklas Söderlund --- * Changes since v2 - s/ragne/range/ * Changes since v1 - Preserver the guaranteed operating range in a comment. --- drivers/thermal/rcar_thermal.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index d0873de718da9218..49d351f77bf6e6fc 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c @@ -275,12 +275,7 @@ static int rcar_thermal_get_current_temp(struct rcar_thermal_priv *priv, tmp = MCELSIUS((priv->ctemp * 5) - 60); mutex_unlock(&priv->lock); - if ((tmp < MCELSIUS(-45)) || (tmp > MCELSIUS(125))) { - struct device *dev = rcar_priv_to_dev(priv); - - dev_err(dev, "it couldn't measure temperature correctly\n"); - return -EIO; - } + /* Guaranteed operating range is -45C to 125C. */ *temp = tmp; From patchwork Fri Jan 17 16:05:54 2020 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: 11339525 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 603EA92A for ; Fri, 17 Jan 2020 16:06:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3F99E214AF for ; Fri, 17 Jan 2020 16:06:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728831AbgAQQGL (ORCPT ); Fri, 17 Jan 2020 11:06:11 -0500 Received: from bin-mail-out-06.binero.net ([195.74.38.229]:44100 "EHLO bin-mail-out-06.binero.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729108AbgAQQGL (ORCPT ); Fri, 17 Jan 2020 11:06:11 -0500 X-Halon-ID: 46b97440-3943-11ea-a00b-005056917a89 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (p54ac5d7b.dip0.t-ipconnect.de [84.172.93.123]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA id 46b97440-3943-11ea-a00b-005056917a89; Fri, 17 Jan 2020 17:06:10 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: linux-pm@vger.kernel.org, Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org, =?utf-8?q?Niklas_S=C3=B6derlund?= Subject: [PATCH v3 2/2] thermal: rcar_gen3_thermal: Remove temperature bound Date: Fri, 17 Jan 2020 17:05:54 +0100 Message-Id: <20200117160554.3812787-3-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200117160554.3812787-1-niklas.soderlund+renesas@ragnatech.se> References: <20200117160554.3812787-1-niklas.soderlund+renesas@ragnatech.se> MIME-Version: 1.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org The hardware manual states that the operation of the sensor is not guaranteed with temperatures above 125°C, not that the readings are invalid. Remove the bound check and try to deliver temperature readings even if we are outside the guaranteed operation range. Signed-off-by: Niklas Söderlund --- * Changes since v2 - s/ragne/range/ * Changes since v1 - Preserve the guaranteed operating range in a comment. --- drivers/thermal/rcar_gen3_thermal.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c index 1460cf9d9f1c397b..72877bdc072daaed 100644 --- a/drivers/thermal/rcar_gen3_thermal.c +++ b/drivers/thermal/rcar_gen3_thermal.c @@ -182,9 +182,7 @@ static int rcar_gen3_thermal_get_temp(void *devdata, int *temp) tsc->coef.a2); mcelsius = FIXPT_TO_MCELSIUS(val); - /* Make sure we are inside specifications */ - if ((mcelsius < MCELSIUS(-40)) || (mcelsius > MCELSIUS(125))) - return -EIO; + /* Guaranteed operating range is -40C to 125C. */ /* Round value to device granularity setting */ *temp = rcar_gen3_thermal_round(mcelsius);