From patchwork Tue Apr 12 19:54:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 12811221 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D31ABC433F5 for ; Tue, 12 Apr 2022 19:56:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=wYl4+HeunhZirzyzFvq8EOzXXbMb18XA7s8Mf+LggIU=; b=dTCt3XztL/OD8i EjUjFx5YUtHhAepVazEYEUvfZoh1TZDv1R60JL5clwt5qRe/IsyMfZ3b23+PzMjjNpsPt1DLEasm7 Fwff9Nb9rSMRS7wqvd3/EDCAcoNJ/VvEEJJSagn5RNvoQQEnWkLxapXxKDnNyweoTrJAX6NWnGUrR e8g3eZqlBWUFxSyB2yEFBtkWK1sY/MXtgWjej5lm9QKPf5wFAc9I4GeNSsiNLhm4qbwJ/5TGylNT3 RYawmwPpCBERWc61XJ11ziq0bfJdJp89vymNwkrQLFoQGYcoGhrTQnELXSn/iMLv9VAYg+2DBDXck LenEZqPUZYHKzUnAzSjA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1neMbT-00Fdnc-Ec; Tue, 12 Apr 2022 19:55:07 +0000 Received: from mout.kundenserver.de ([212.227.126.134]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1neMbQ-00Fdlk-11; Tue, 12 Apr 2022 19:55:05 +0000 Received: from localhost.localdomain ([37.4.249.94]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MO9qz-1nKC7Y43lB-00OUo9; Tue, 12 Apr 2022 21:54:54 +0200 From: Stefan Wahren To: Florian Fainelli , "Rafael J . Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui Cc: bcm-kernel-feedback-list@broadcom.com, Nicolas Saenz Julienne , linux-pm@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Stefan Wahren Subject: [PATCH] thermal: bcm2711_thermal: Don't clamp temperature at zero Date: Tue, 12 Apr 2022 21:54:23 +0200 Message-Id: <20220412195423.104511-1-stefan.wahren@i2se.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Provags-ID: V03:K1:+i8XMmcNKW3lfYXVWU6LxSEO33j+KiiS8sH073h7LXB4Bp+EtYy ktmzHl+sfrevQYkju8llxe4wY0O077uR5UUdo57ZNkbM+Fc4GXiasX/7Mv9gm2KzEIcMm26 2fJm9tLAFP4FQUzujo40xTwSAkHpwiWV5Bm0CNU0TjELAC+TsT/W4hbAP4PTOa1RB5bXJKu zZFj7oNEiosWjaRqeU5dg== X-UI-Out-Filterresults: notjunk:1;V03:K0:F06av8L7Aho=:R+YpjLZuiRQPqoolWRuSpU 0iFKdnXF6NaVNcUT6H+fmZu9y4wJd/4df5SaTcWb6idd/EU5bU1hlJnA8+VNr747ItOQ2KTO3 e2+awDanHZZUd4JZEiOum4rG4FRppDy/xSdodH01Jh0flOw2KhQc350GItoyDuDe7KLVwnqO+ Tv06T2gxJBcJJFGVJkMsoBb0LBMuXCqIVfpZRk5KXoMEto5sG47DfdPSpNWSfQFCtTzCtx0Gl PIvwxf5Tj1FHKa4MaE0V2SxfsCQlbBG2YQmQXK8KkCSJUFJ0/LOVmz4AgN7TPjpquVEomX1lL LehKVaUXKOBCHORl1vGEz9u/YjAnwFA/HyGi97pNQlUU2on68hpCR8Jmf+OuuQL/8MMXku15L +TWnGarkGGe/S5g0zCqgmxdDV4lDDYI+O2UeHvJnGCFD76yAgHufdahAZPVYcCYtSqaZ8EuT2 d7J+bLASJe/3AJv7tKvjtp6C/ZI1K2cAHoreq/Pdlx1Fmm4fWpFsKaSE61EXXbegfin5z1tcl OrpYyfso9I+NRIyzXFDbGWf+NtI7ksjyE6CzDhBAxKPQnMaklhd1aQ3iwXP9Kn117CLntSsWy F762hjgFr2smrW53WBfBirlUhjTUV03aEQZyMerP21jP2LD1AvR8tP7eIIOQf0bg1+rBUhLNB +Kmn9Q93Cwx/skH44kRKoQcOKgBnhwu1fO/DN5Cp1Ys+YIIy/lYM5szRpAjvvFdG9vy4s2dH4 ijqiOGKJGME96JMx X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220412_125504_385246_5CC1B50F X-CRM114-Status: GOOD ( 10.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The thermal sensor on BCM2711 is capable of negative temperatures, so don't clamp the measurements at zero. Since this was the only use for variable t, drop it. This change based on a patch by Dom Cobley, who also tested the fix. Fixes: 59b781352dc4 ("thermal: Add BCM2711 thermal driver") Signed-off-by: Stefan Wahren Acked-by: Florian Fainelli --- drivers/thermal/broadcom/bcm2711_thermal.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/thermal/broadcom/bcm2711_thermal.c b/drivers/thermal/broadcom/bcm2711_thermal.c index 1ec57d9ecf53..e9bef5c3414b 100644 --- a/drivers/thermal/broadcom/bcm2711_thermal.c +++ b/drivers/thermal/broadcom/bcm2711_thermal.c @@ -38,7 +38,6 @@ static int bcm2711_get_temp(void *data, int *temp) int offset = thermal_zone_get_offset(priv->thermal); u32 val; int ret; - long t; ret = regmap_read(priv->regmap, AVS_RO_TEMP_STATUS, &val); if (ret) @@ -50,9 +49,7 @@ static int bcm2711_get_temp(void *data, int *temp) val &= AVS_RO_TEMP_STATUS_DATA_MSK; /* Convert a HW code to a temperature reading (millidegree celsius) */ - t = slope * val + offset; - - *temp = t < 0 ? 0 : t; + *temp = slope * val + offset; return 0; }