Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3137763rdb; Thu, 16 Nov 2023 00:49:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IH64mSSc+N5wEH6CmqCE6+VWETwVT84dMMS6wVb4uApLlFKoDmUVjQ9sSXVcPfNcbqdQFLf X-Received: by 2002:a05:6a21:19a:b0:17a:e981:7fe4 with SMTP id le26-20020a056a21019a00b0017ae9817fe4mr1838687pzb.16.1700124542807; Thu, 16 Nov 2023 00:49:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700124542; cv=none; d=google.com; s=arc-20160816; b=MQqhfSGgXGQKDDwvttrhHduSSByVfTUkgO59FSoQjQwTxSI9g399AkOcS7LnXuK6Rn qbtwYiw6xZHTCDkMkw1V3cOFlnk19WUjssg4VSlwVpHDzX3uLMLr28jn2nqSZTuXztA3 vjwEa2BrWVs8EOFj2/DVsaXI5v8FPngQ4wz2osFOz/vHezea4tHRl0hdVzpqGJ+OKzA6 rnhNLdQAzrOI2SlQG8OhWuwpK+T/AxHCRhKRoM/SjSZ/DItNZPD8Gv6G/tEYs94a7N0t sWI1WfgZF2ZQaBzklXn1+2jAC7qSy3L57r2bRxoRaOVZBlRppgHMGbKeqrMHfkqCGQH0 MYfw== 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=GATFXn7/IsnPuYULBYePL+KlFeFXebf1N/cHiHpyv74=; fh=QveltzLCnWYotX3d3RXhAHONeumDggUOgdQI7Wnk1Dc=; b=ZTuEdnsqoHHSJIPcvSD+jB1KF3vlBZrSGTRydXia8mf0fIH3sWrgA8c8U9ra7PCceM XA3EMZ2zMF9VG7SkRMaDJVtJWfPWxkLm1s1wsGCjljczKBZgICedMHiY4TMdOxLWKGGa 1NmgBKB+BlWg5cnB9SGbidfOe081WHrQGlVvVtDC4Iwsa7KYMqg6B0aP/7KCwd2e/VmL 4OS4sROLwIy/ry1dCL4Vlwy01+1L8meSOIz/ZeKpsIQ2QyUzalG6jnKHFEG70vxVqvcV BlLwbA/iQ/6QxqIADS8V7FTfDoIy/IZRbh2pF2QoVJW/mn5zLNbDx8Ym5bHq3zwUiSsT A/rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bs8d3ZcA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id l198-20020a633ecf000000b005be2508ce03si11844650pga.569.2023.11.16.00.49.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 00:49:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bs8d3ZcA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 7EC06810EC20; Thu, 16 Nov 2023 00:49:00 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344948AbjKPIsu (ORCPT + 99 others); Thu, 16 Nov 2023 03:48:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344930AbjKPIss (ORCPT ); Thu, 16 Nov 2023 03:48:48 -0500 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B0A5182; Thu, 16 Nov 2023 00:48:44 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1cc53d0030fso4320745ad.0; Thu, 16 Nov 2023 00:48:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700124523; x=1700729323; 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=GATFXn7/IsnPuYULBYePL+KlFeFXebf1N/cHiHpyv74=; b=bs8d3ZcAqmndMrC3EH/a02p2Rrp2TYu7vjsu9CH50ygTMLQcK9qZxw9PCh4mjAfIgK 9FD2Bbp2QwoF47mTk4D8ROl4ukWYAdggcWbRrY0/SKhvkfUuBcMsJ7e1fkMrl6hqxXA3 9WVHHeUduU+IO+jgp89ZDcbn34uiKXQwEC9MmCKcJ3VHY5SBXDxCCRy4GhzTPA4gblTL CrThTsVFhdoNekWaUgoqiFqkK4FftbdRY6YuqjuoNgWm/XZwMkr7TrnkBRgtfwXKl0fv ClueT5Z0qQf4zXZlWOaFOSXGGlfi7QAX5/aVOf2xaO5yX2iP5HTwJa0JoOJkUlvClSl3 jNAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700124523; x=1700729323; 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=GATFXn7/IsnPuYULBYePL+KlFeFXebf1N/cHiHpyv74=; b=NtaGKSzfsCyi8cQhZHEWzQ+gM8LGlVk+2bVdUa3T0wviTvoAs+pS4oKnghvwNV6qeA 64novsimN2hUzjzl1hq31ZPab0v//8y6+MjHFjOV+K3JgAN4vJ5XKBAEo6+5ed4YJOsp aoJ9EUlZrIdY3zzC16bBCEps9+2lVlQA2P5p1bmjo+MXvGEyYY6LQww8BAXlV2IFVn9W 7vLpCSHMhMgvBjpred240df92G6KM006cF1mZVPeSJZpJy2l5qPk2JplgeWoGmlt7/3s 8p9rCRHQO8dTlwbMLqSC0EXlehE5HKSOvm0yBkFUeP9tHdURfqzmdC3O/L2lPcZyoztP /lgA== X-Gm-Message-State: AOJu0YwB8xOlMaBYtbKHWPovlgNDY9zMBa26GvjDjHb4MvQjC5y8736F NzSKtsdB6zN23Ts0d1WIuL0= X-Received: by 2002:a17:902:e551:b0:1cc:4d4e:bfb4 with SMTP id n17-20020a170902e55100b001cc4d4ebfb4mr1450943plf.12.1700124523376; Thu, 16 Nov 2023 00:48:43 -0800 (PST) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id ik12-20020a170902ab0c00b001cc54202429sm8907783plb.288.2023.11.16.00.48.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 00:48:42 -0800 (PST) Sender: Guenter Roeck Date: Thu, 16 Nov 2023 00:48:42 -0800 From: Guenter Roeck To: "xingtong.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: <0547e422-4a2a-4082-9ff8-62afb4cb79b4@roeck-us.net> References: <20231116022330.2696-1-xingtong_wu@163.com> <20231116022330.2696-3-xingtong_wu@163.com> <4616f6a2-f81d-47cb-9574-2319d04d3f34@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, 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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Thu, 16 Nov 2023 00:49:00 -0800 (PST) On Thu, Nov 16, 2023 at 04:36:39PM +0800, xingtong.wu wrote: > > 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? We need to be consistent. Yes, it might be arguable that we should not return 0 if fan control can not be disabled by the chip, but that would effectively be a behavioral change. We don't know if there is some userspace program which expects to be able to disable fan control completely (and, when doing so, setting fan speed to its maximum). Given that, I don't think it is feasible to change the behavior. Guenter