From nobody Sun Feb 8 02:55:41 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3267C7EE29 for ; Tue, 6 Jun 2023 16:11:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237090AbjFFQLt (ORCPT ); Tue, 6 Jun 2023 12:11:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229866AbjFFQLq (ORCPT ); Tue, 6 Jun 2023 12:11:46 -0400 X-Greylist: delayed 2498 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 06 Jun 2023 09:11:45 PDT Received: from finn.localdomain (finn.gateworks.com [108.161.129.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D43D10D5; Tue, 6 Jun 2023 09:11:45 -0700 (PDT) Received: from 068-189-091-139.biz.spectrum.com ([68.189.91.139] helo=tharvey.pdc.gateworks.com) by finn.localdomain with esmtp (Exim 4.93) (envelope-from ) id 1q6YdK-0067n4-A9; Tue, 06 Jun 2023 15:30:06 +0000 From: Tim Harvey To: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org Cc: Guenter Roeck , Jean Delvare , Tim Harvey Subject: [PATCH] hwmon: (gsc-hwmon) fix fan pwm temperature scaling Date: Tue, 6 Jun 2023 08:30:04 -0700 Message-Id: <20230606153004.1448086-1-tharvey@gateworks.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The GSC fan pwm temperature register is in centidegrees celcius but the Linux hwmon convention is to use milidegrees celcius. Fix the scaling. Fixes: 3bce5377ef66 ("hwmon: Add Gateworks System Controller support") Signed-off-by: Tim Harvey --- drivers/hwmon/gsc-hwmon.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/hwmon/gsc-hwmon.c b/drivers/hwmon/gsc-hwmon.c index 73e5d92b200b..1501ceb551e7 100644 --- a/drivers/hwmon/gsc-hwmon.c +++ b/drivers/hwmon/gsc-hwmon.c @@ -82,8 +82,8 @@ static ssize_t pwm_auto_point_temp_store(struct device *d= ev, if (kstrtol(buf, 10, &temp)) return -EINVAL; =20 - temp =3D clamp_val(temp, 0, 10000); - temp =3D DIV_ROUND_CLOSEST(temp, 10); + temp =3D clamp_val(temp, 0, 100000); + temp =3D DIV_ROUND_CLOSEST(temp, 100); =20 regs[0] =3D temp & 0xff; regs[1] =3D (temp >> 8) & 0xff; @@ -100,7 +100,7 @@ static ssize_t pwm_auto_point_pwm_show(struct device *d= ev, { struct sensor_device_attribute *attr =3D to_sensor_dev_attr(devattr); =20 - return sprintf(buf, "%d\n", 255 * (50 + (attr->index * 10)) / 100); + return sprintf(buf, "%d\n", 255 * (50 + (attr->index * 10))); } =20 static SENSOR_DEVICE_ATTR_RO(pwm1_auto_point1_pwm, pwm_auto_point_pwm, 0); --=20 2.25.1