Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3009664rdb; Wed, 15 Nov 2023 18:39:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IHqKjtBIMrXKT0AMrf1F+HuKm6DiTFvRKMzkr4rmnZhf1r0s0X0CUMHpFBQPSysLmOXOqpl X-Received: by 2002:a05:6a21:6da2:b0:187:b581:cf4b with SMTP id wl34-20020a056a216da200b00187b581cf4bmr697874pzb.49.1700102392276; Wed, 15 Nov 2023 18:39:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700102392; cv=none; d=google.com; s=arc-20160816; b=0+DQfJwN+lpV/5OklV1tMhFMrXVvqv/NCHIxis54doXUDLUQqvGqumOC8D8zyzB+HO plvnhwoxtkJfnYN7G41JxSQSf4ZUUipqHz76C4qZFU5Boj0O4/UOTtKRHMs6NWVuIXMk nO/8IS9m1f0dP/f80ZEeW9W1Zmz7WN3LRNOVkQa49saS3taN9lEXJgtcB+u8qVSSSJOV CZCIe+twkVEYmVtctAdhC9662BNjFrYfbNSbHs9AL6w7OY8HCq0TRbTPFW6qEU/bLb0S SGQ4EfdWWGkfPWhSdHGHQqGciWN4MJw4jFS0qsHh+VCmPrqO6suNYbtndtNp6bNL9raV 1WAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cHgkt6wFw4yulka3yAnNtGtv/ycgWvgfCPluWVrqKrA=; fh=brTD9uWwHSBEuDMsNSIyrWZVEeJXt4Ae/wkRCvfJiZk=; b=qnLfIt5w6++6Rn5KL2pzKM+CvMeBnZiP9Wf9Gk5hj3BJbRcx0I9z3Fcw/Ev8I7ZKK0 7bcMNPpEHjYOIed6KJdQQ3clYTYTfSQdVhnevjIH2UpD9KYrhDEFPwpcz4NzVjEKvEhP UnbFXitCE7y/DZLqsrNhfaiZPnxb4F/l8gMTXGuzNU/W6WBeqeCVrD7AzHu39XgciNVO iDkybUpVjWM6yH8w/8+4B9Hle+Cq+P6wxwhzA0sB8Yz2urRFFTp0AlBZPkxjy/2vm7n0 kRjeug1qJzWmPxGv37014NMAGKi/Cr3JzBtcCIuhWJ8NATBaY+BKWfsVsTYtcIGmKC1U ZsnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=kzXMORIJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id 11-20020a170902c14b00b001ce160421d4si10767971plj.179.2023.11.15.18.39.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 18:39:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=kzXMORIJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 68874809B74B; Wed, 15 Nov 2023 18:39:49 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344386AbjKPCjo (ORCPT + 99 others); Wed, 15 Nov 2023 21:39:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235571AbjKPCjm (ORCPT ); Wed, 15 Nov 2023 21:39:42 -0500 Received: from m12.mail.163.com (m12.mail.163.com [220.181.12.216]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 02F6C19F; Wed, 15 Nov 2023 18:39:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=cHgkt 6wFw4yulka3yAnNtGtv/ycgWvgfCPluWVrqKrA=; b=kzXMORIJgWIWLtVcRBc6+ CHeJZmWclLrJHzUWHTD+48VXG07e45AXH1BXU+NO/pGWL7xLsEDaknuskHNX+f/W KOgLW4dXiv7qJfKdb+CRmIIygvCNbOEOhVNFbHJzS9ZrAIwaxMUXUIHczM5GU0Me CJcOEsJLJOxemzngAD7zUc= Received: from localhost.localdomain (unknown [39.144.137.125]) by zwqz-smtp-mta-g4-4 (Coremail) with SMTP id _____wD3H2U+fVVl5bnXDA--.19779S4; Thu, 16 Nov 2023 10:24:09 +0800 (CST) From: Xing Tong Wu To: Guenter Roeck , Jean Delvare , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Cc: xingtong.wu@siemens.com, tobias.schaffner@siemens.com, gerd.haeussler.ext@siemens.com Subject: [PATCH 2/3] hwmon: (nct6775) Fix logic error for PWM enable Date: Thu, 16 Nov 2023 10:23:29 +0800 Message-Id: <20231116022330.2696-3-xingtong_wu@163.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231116022330.2696-1-xingtong_wu@163.com> References: <20231116022330.2696-1-xingtong_wu@163.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: _____wD3H2U+fVVl5bnXDA--.19779S4 X-Coremail-Antispam: 1Uf129KBjvdXoW7Wry8Kr4xXw17trWfGF4Uurg_yoWkKFX_Ww 4rGrZ7Zw1Y9r13CF4jgF4rtFW2ka1UWr17Jw1xKa98J347AFn5Cr1kXrZxZrnru3yDZF93 Xa1DAr4Iy342vjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUeo7K5UUUUU== X-Originating-IP: [39.144.137.125] X-CM-SenderInfo: p0lqw35rqjs4rx6rljoofrz/1tbiTA4q0GI0cSnRZAAAsD X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 15 Nov 2023 18:39:49 -0800 (PST) From: Xing Tong Wu The determination of the "pwm_enable" should be based solely on the mode, regardless of the pwm value. According to the specification, the default values for pwm and pwm_enable are 255 and 0 respectively. However, there is a bug in the code where the fan control is actually enabled, but the file "pwm_enable" incorrectly displays "off", indicating that fan control is disabled. This contradiction needs to be addressed and resolved. Solution: Update the logic so that "pwm_enable" is determined by mode + 1, remove the "off" value for "pwm_enable" since it is not specified in the documentation. Signed-off-by: Xing Tong Wu --- drivers/hwmon/nct6775-core.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/hwmon/nct6775-core.c b/drivers/hwmon/nct6775-core.c index 2111f0cd9787..575db6cb96e9 100644 --- a/drivers/hwmon/nct6775-core.c +++ b/drivers/hwmon/nct6775-core.c @@ -900,8 +900,6 @@ static const u16 NCT6116_REG_TSI_TEMP[] = { 0x59, 0x5b }; static enum pwm_enable reg_to_pwm_enable(int pwm, int mode) { - if (mode == 0 && pwm == 255) - return off; return mode + 1; } -- 2.25.1