Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3133368rdb; Thu, 16 Nov 2023 00:37:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IGn+bSmtR7gc9sEAoADoi1bjKKZXQ9J7SUEN66bPOyxuAyeYi2Xq8rWW5PCTevdX6MhEBTf X-Received: by 2002:a05:6a00:ad1:b0:6c9:9e11:859d with SMTP id c17-20020a056a000ad100b006c99e11859dmr6021869pfl.1.1700123849767; Thu, 16 Nov 2023 00:37:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700123849; cv=none; d=google.com; s=arc-20160816; b=l2XZAoJUj662nbyj8a2p/ol3ot8GBo+VzQOgD1ipzdbIzULI7GI7hD/DBGjI0tqvNf BI9zBmTvgaG1wN0Vr6QvCwqhqYYvWNxmxSOOM928y06MtMu8MLL1eaty6PjYUyvA6OlD u6uozdG7Wij1ieSNLDa+9ArVixuW6DQ1QN47A7eG4KxwurGWf+V/1saugVzaP0qanxMT X589WONdOd/NFFY5spnFb8UiG7uaNc5QJohlmZBiULa0wCK0VNPB4EjgJYUo313H3K7E 6FgymexoRbtBMLqFaoSGQcic0cS+E1UJ1Kuneem8qwLo3D1hkmCe4GjUce+ARKKgEpKH xQcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=iC6re8bhGSbP0IHnm/yopCrP8EccfrztIJgc08TxhZY=; fh=eLaMr+gbHLWkAj1JLujZVnHkBmVix9SG2b0gP8PKKCQ=; b=w8RC4Qh5cGMSXbl5CJvdHJJ1gLDSCKU9XiUV5bzbXI2XEJWsDbw4/t7/77hKI0Uhz/ sTGxABQubAoJal6393hEfafFY6XuXPJrmhBRONTHfm2m5Eitc3ufNzdBNKcjeWQjhl2r J1ow9vrvweaSmhVeM8/j2/rTj5MMtHaRa9C6OXnA1U9wiC7s1C4XQolN0Gqo28IGG6V2 9Nt/B1TUue9ORenCbTeW+WYrSFVlmDCQxWI1V2JUporpur1atC4JBO8c+CB74+GxZ+ro WYW2q5POXE1M3JriFDCEs/wv7oi4yzeqE+rfb6iV1EvHYdAIetTDHuam+cjXJEIVPf0m e0IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b="NksxZ/8k"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id b136-20020a63348e000000b005c1cc97c1e7si3442926pga.661.2023.11.16.00.37.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 00:37:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b="NksxZ/8k"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 4C90E801D587; Thu, 16 Nov 2023 00:37:27 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344947AbjKPIhS (ORCPT + 99 others); Thu, 16 Nov 2023 03:37:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230228AbjKPIhQ (ORCPT ); Thu, 16 Nov 2023 03:37:16 -0500 Received: from m12.mail.163.com (m12.mail.163.com [220.181.12.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 76D7CDA; Thu, 16 Nov 2023 00:37:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Message-ID:Date:MIME-Version:Subject:From: Content-Type; bh=iC6re8bhGSbP0IHnm/yopCrP8EccfrztIJgc08TxhZY=; b=NksxZ/8kqZc/gMg7+cjw836HLhLKmXpoKmMMEIhVRsYbVTnhpB9b9uhj4T7cUS z/eeOoSyB+sG96JcnlR3cfuzA/TpE0TaV8JYl2U1lc9NEPBn5+Ao4KF/WYxHkPdR 5FHHq9aMZK10vfytGQpeh2m5nD7sJTpni1LM60Nwy+OJo= Received: from [172.20.10.2] (unknown [39.144.137.0]) by zwqz-smtp-mta-g3-0 (Coremail) with SMTP id _____wB3n9yY1FVlnTDiDA--.20924S3; Thu, 16 Nov 2023 16:36:41 +0800 (CST) Message-ID: Date: Thu, 16 Nov 2023 16:36:39 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/3] hwmon: (nct6775) Fix logic error for PWM enable To: Guenter Roeck 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 References: <20231116022330.2696-1-xingtong_wu@163.com> <20231116022330.2696-3-xingtong_wu@163.com> <4616f6a2-f81d-47cb-9574-2319d04d3f34@roeck-us.net> Content-Language: en-US From: "xingtong.wu" In-Reply-To: <4616f6a2-f81d-47cb-9574-2319d04d3f34@roeck-us.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CM-TRANSID: _____wB3n9yY1FVlnTDiDA--.20924S3 X-Coremail-Antispam: 1Uf129KBjvJXoW7Ar18GrWkArykCF4ktw4xJFb_yoW8tw4Dp3 ykXFsYkF1qqayYvF4xtayfW34fAanaqFW7JF1DCw1Fqr9xJr12gF4xKr1FyF1DAFs5Ja4j vryxtr1xC3W5AFDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jU4SrUUUUU= X-Originating-IP: [39.144.137.0] X-CM-SenderInfo: p0lqw35rqjs4rx6rljoofrz/1tbiEBoq0F8YMg7H0AABsd 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 agentk.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 (agentk.vger.email [0.0.0.0]); Thu, 16 Nov 2023 00:37:27 -0800 (PST) On 2023/11/16 16:07, Guenter Roeck wrote: > 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) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I think this description may lead to misunderstanding. There are certain fans that cannot be controlled and operate at full speed while system is running. However, there are also fans whose speed can be controlled, even if they are currently set to full speed. In this particular situation, it would be better to inform the user that the fan can still be controlled despite being at full speed. How do you think that? > - 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 >>