Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3120639rdb; Thu, 16 Nov 2023 00:07:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IG+GpsYAU5WK1+6xH1N+s4v9GzPmN1ebjtQqPPnpTGIWFd0b4Bbprym7Epive05GsDc6eq3 X-Received: by 2002:a17:90b:1bca:b0:280:53b2:4b9b with SMTP id oa10-20020a17090b1bca00b0028053b24b9bmr14003442pjb.15.1700122037634; Thu, 16 Nov 2023 00:07:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700122037; cv=none; d=google.com; s=arc-20160816; b=UjpeWXTBFsyflohAhgSQ+MQ4J6+yeQBp0r8d2Li8QZ/Wu03CFN7hQCeZt225kYdjdt VbdIh4+q+MhYDGa7yLJWse1sZdv7gqT819RvkzH93Xk9yZqo/c13Iz1hi+pZaGAs3nUN Rso9iHcrZHI5+EFQOhYZ2HhIk4BNSTk7T3Cwyv+C0crItUNWyyO8F6Z3jnxENQk/Erhk 0vL3TIfIGo0SCI7QXqj00P8kl7y8eebR/BqnZYkv9ie3Aofb00jYEunLkRtfjkb0GRMn S/IhdUDenRhCw88+fBwH63SWuXhkFRAMk033kwGGndE6N1r7ZkQk111fOYiiHWt60ryT 2j8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=ylEbJqf5nzYlj2CjniIYkSjKgcOsYzRZT9btvlXuXoU=; fh=ggDe2hCABdhwmBjYSig27+eDVHOAwsQ/7OKY9cqtB5g=; b=g4QIoeSISk62Lh4a1VyssFo9JxYI3jP9HaqrO46xcC5GRV2Ih44AId/+mtgkfwkA2O h15AI3F1KFekURiiDmxpSqxymYP5D9C8gy3qYLL1J6cwELFxDJ/QsisFUwgCuLv7KVee gxrqZLGHSCnW3aiPi32Ixld+hQ1RditkBfEKXOE24gpZziO04XqB8XyLcTo4P5tOIL3O +KJ9aEE3WF2BADpqQbJyrMnu0n9dgu3W9ZCNQtPzbD/0+/Un400RzNICJ0FnY/oCEXQC mwLRTEhYQ+vcijDYHjV8iMbkm4Y4kexMPPPZakeEETkcoejiWE3hMXENvGuebIUoYwr1 Yrag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZU+PBPzc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id p4-20020a17090a4f0400b0027ffcd44adasi1521600pjh.133.2023.11.16.00.07.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 00:07:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZU+PBPzc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 77A15815D7DB; Thu, 16 Nov 2023 00:07:16 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230078AbjKPIHQ (ORCPT + 99 others); Thu, 16 Nov 2023 03:07:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229984AbjKPIHO (ORCPT ); Thu, 16 Nov 2023 03:07:14 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B30AEC1; Thu, 16 Nov 2023 00:07:09 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1cc7077d34aso4531255ad.2; Thu, 16 Nov 2023 00:07:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700122029; x=1700726829; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=ylEbJqf5nzYlj2CjniIYkSjKgcOsYzRZT9btvlXuXoU=; b=ZU+PBPzcqSeS1kvwkK7ovQlU5sDEHDV3O+2knxzhpJj/sCT8FXoD57iYPvZuX96/Pv aSZIAOBgb/CeIP6Ji1kKxyN3fj9uWuNsZe8kbAeALmXWzseZuTjeqeC0/u0BMQccH+JH pOXdomuFZaFg5b226sQPPmkd80hS7ZePVXZRcSQhxLuj+UAOItN/Hs1R5BfqZKN1LQZi R9CvIFEvT1PQZhnZVCTT4fyp/Iva98blRG+FRl6eF/OTdkgptXDWat9GVJBCHtLEde9/ qwSSmuXFVjIPDsyFGp2tHv534I+FHJQ3RwuNUI3jUrI87uaeNgjabpxclbj6OIBWoMuV WWcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700122029; x=1700726829; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ylEbJqf5nzYlj2CjniIYkSjKgcOsYzRZT9btvlXuXoU=; b=eGeC0MvhMaQL+xAOXGT8EOIXLm4emiKH/7tDjBIMFML6hPrJzqUh1jOTFMAJ64jAp3 lc7WFFFbdVm4419ZhYxrSdI75GzcWXn86ar7VWB7li39ftfJgEWdtKnhgr3AdfEpErzX ccxNBOF1H3zK1X4yTRviH/DqtmM8pNjJ7VCsFMbhMTHts1QUXsxdFZcfah//8cfCXHci ECeY3Pzt51eY1TEw07jyWYU10WOhcAnJstzsoucWBiR8aKpDPSd+2QCM18qVCbPO8fzq RwByjzyIrqVJSr8yT7fcjHjC42+Ou5mUp2eMNUDlCiDvWDa+FDkiJs4RbrWOEuqgiO+n 7kOg== X-Gm-Message-State: AOJu0YwiAqXpRrwJtTrIo9UwoXpwbVPtNu96b4+tOB6GHTcpPv8dauNU gEqn8/DOq9sIh0w2gLH+peA= X-Received: by 2002:a17:902:ea10:b0:1cc:51ca:52e5 with SMTP id s16-20020a170902ea1000b001cc51ca52e5mr8260400plg.44.1700122029012; Thu, 16 Nov 2023 00:07:09 -0800 (PST) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id 10-20020a170902c20a00b001b7f40a8959sm8601819pll.76.2023.11.16.00.07.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 00:07:08 -0800 (PST) Sender: Guenter Roeck Date: Thu, 16 Nov 2023 00:07:06 -0800 From: Guenter Roeck To: Xing Tong Wu Cc: Jean Delvare , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, xingtong.wu@siemens.com, tobias.schaffner@siemens.com, gerd.haeussler.ext@siemens.com Subject: Re: [PATCH 2/3] hwmon: (nct6775) Fix logic error for PWM enable Message-ID: <4616f6a2-f81d-47cb-9574-2319d04d3f34@roeck-us.net> References: <20231116022330.2696-1-xingtong_wu@163.com> <20231116022330.2696-3-xingtong_wu@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231116022330.2696-3-xingtong_wu@163.com> X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Thu, 16 Nov 2023 00:07:16 -0800 (PST) On Thu, Nov 16, 2023 at 10:23:29AM +0800, Xing Tong Wu wrote: > 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. The chip specification is irrelevant. What is relevant is the hwmon ABI, which says What: /sys/class/hwmon/hwmonX/pwmY_enable Description: Fan speed control method: - 0: no fan speed control (i.e. fan at full speed) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - 1: manual fan speed control enabled (using `pwmY`) - 2+: automatic fan speed control enabled which is what the code currently implements or at least tries to implement. Guenter > > 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 >