Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp82097rdb; Thu, 7 Sep 2023 14:25:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHu2yihWsfs6BaNPnSekSm1E5aWdMRWeNHOp/6BI2dBqlM6j7K0QReOXur4YHOnZo5Avppq X-Received: by 2002:a17:906:cd2:b0:9a2:292d:ea60 with SMTP id l18-20020a1709060cd200b009a2292dea60mr414917ejh.40.1694121909959; Thu, 07 Sep 2023 14:25:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694121909; cv=none; d=google.com; s=arc-20160816; b=S/n7X6HY9KW96GswjMaanKfjJISZ02oIJk3sNe9C7bvFIsCwiEoa1RypIZVkU9ONQU g+WMeYCRz9EzZRGTyTYoDDdQnQhWTk2O3YU5tnsEU+oyLV/dlmwPoXUtzppQ/T3N7Dnh FLMOtEyzxp5tLyAc7H0pxUlyTLWcXhYtmNPjlfGZJDgWL/BsQPG6bKqfpw8Dsr/Zs9T2 BUp9sZI1KDQmaQwKcKbGWlgdgHUntYmRbsmgak+79MIAFbDQrEajdO5b1ueATDb9ObBj MwLPK7oMJqpgFKh3Dr7Bf2LL4I5d7ZcI8EhM8Zj5Oa+WzznxFMAYyupDqxp/bnHsHnkO BsFw== 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:dkim-signature; bh=begPMhnnVXJSmMtpE8IUwLSauBidiSI5/IplVhM0+x0=; fh=fEEzv6phhaqRC8iTsvPIA8mrP4OiwpElzsPDIm3GFss=; b=vafEU2dWn2eRd1BGU0VuEsZ7Zw/DtH9+U3/OhWWuWF/ROX1k6awg9Ms/80opGQNcaS Co0LQ+950s7o/BN8nM3eOrCJ9vRa/XOd3Z0S23PPNKsBDdJn19QgGq8Bsoy7jYeIa74+ Fcd5oz1YYV2NODH0KFm5O7ppwgdtmrNWmFZiAF/qsZdc6M0cj9/RHGEtcOv9yvtm7BCH suqyUJJGlrOdZU6/kOvP/c42pn4YrINLt1gEEB7ylguGYf05bVxy4i6Jo72lV8dsNyLe uHlD0DjqcF6HQvazHNnRY5rq6kdQ1sL3dIrGagF84eZJZMu7j+sDeRsVdJV2/anaXM82 Cq1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LBkzCyN6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a7-20020a17090680c700b0098874379199si167523ejx.163.2023.09.07.14.24.39; Thu, 07 Sep 2023 14:25:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LBkzCyN6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236695AbjIGTn6 (ORCPT + 99 others); Thu, 7 Sep 2023 15:43:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232173AbjIGTn6 (ORCPT ); Thu, 7 Sep 2023 15:43:58 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B373CE9; Thu, 7 Sep 2023 12:43:54 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A5F7C433C7; Thu, 7 Sep 2023 19:43:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694115834; bh=XNJ6eaiy6oOw6b1KlAbPBrj8EtJk96f0FRUMDyQiiPw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LBkzCyN6TBJDyL3szlqcxnUz72Sedly9MEc8nJDUoDQRryvSruVBTgamW/W2No+3a PP+prYSndor/ivzTvcAhKwJjvhGbQbfB+i/ROmxf5MjZZ6oZDEt9kg6NKR3k+zd89f aPkYv6BJfJbgqJMlDCKSt/MSP2b83tJBOSL4vwEpHuVaVq8YO9o5oR991tFG+rf8Q5 YUD/zqAq8N9lkT0GyBdHvuAbeDH6IeBZA1GEhg5JRk9r+Xagqzv0bLjaMKnptFVG+T qsx5821KeoE6/HPF+iR0oRIIuUj1FsMP2rUCKGh2xlT6BVfw5J8Qz/oHF7V5Q9Gm9e E1HoIz9ceZQFQ== Received: (nullmailer pid 2204967 invoked by uid 1000); Thu, 07 Sep 2023 19:43:51 -0000 Date: Thu, 7 Sep 2023 14:43:51 -0500 From: Rob Herring To: Billy Tsai Cc: "jdelvare@suse.com" , "linux@roeck-us.net" , "krzysztof.kozlowski+dt@linaro.org" , "joel@jms.id.au" , "andrew@aj.id.au" , "corbet@lwn.net" , "thierry.reding@gmail.com" , "u.kleine-koenig@pengutronix.de" , "p.zabel@pengutronix.de" , "naresh.solanki@9elements.com" , "linux-hwmon@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-aspeed@lists.ozlabs.org" , "linux-kernel@vger.kernel.org" , "linux-doc@vger.kernel.org" , "linux-pwm@vger.kernel.org" , BMC-SW , "patrick@stwcx.xyz" Subject: Re: [PATCH v8 1/3] dt-bindings: hwmon: fan: Add fan binding to schema Message-ID: <20230907194351.GA2033402-robh@kernel.org> References: <20230830123202.3408318-1-billy_tsai@aspeedtech.com> <20230830123202.3408318-2-billy_tsai@aspeedtech.com> <20230905170010.GA3505375-robh@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS 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 On Thu, Sep 07, 2023 at 07:17:55AM +0000, Billy Tsai wrote: > On Wed, Aug 30, 2023 at 08:32:00PM +0800, Billy Tsai wrote: > >> From: Naresh Solanki > >> > >> Add common fan properties bindings to a schema. > >> > >> Bindings for fan controllers can reference the common schema for the > >> fan > >> +properties: > >> + max-rpm: > >> + description: > >> + Max RPM supported by fan. > >> + $ref: /schemas/types.yaml#/definitions/uint32 > > > Physics will limit this to something much less than 2^32. Add some > > constraints. 10000? > > > >> + > >> + min-rpm: > >> + description: > >> + Min RPM supported by fan. > >> + $ref: /schemas/types.yaml#/definitions/uint32 > > > ditto > > >> + > >> + pulses-per-revolution: > >> + description: > >> + The number of pulse from fan sensor per revolution. > >> + $ref: /schemas/types.yaml#/definitions/uint32 > > >Needs constraints. I assume this is never more than 4 (or 2 even)? > > Do you think we should add the contraint in the common binding? > In my option, the limit of the max/min rpm should be declared by > the binding if necessary, because the usage of each fan monitor is > based on the connection of the tach pin. Yes, I think we should have default limits. Unless we go as far as a schema for every specific fan model, then there is actually no way we can have specific limits unless the fan controllers have some limits. The most I see in tree for pulses-per-revolution is 2. There's no value in more. So set the max to 4 and then if anyone needs more they can bump the value. Or maybe there's some electrical/mechanical design reason fans are 1 or 2 pulses and we'll never see anything else? This document[1] seems to indicate that is indeed the case. (First hit googling "fan tach signal pulses") > > > >> + div: > > > Too generic of a name. > > >> + description: > >> + Fan clock divisor > > > But what is a fan clock? > > This is the divisor for the tachometer sampling clock, which determines the sensitivity of the tach pin. > So, if the name of the property changes to 'tach-div,' is it acceptable to you? That sounds like a property of the controller, not the fan, so it belongs in the controller binding. Is this really a common thing? > >> + $ref: /schemas/types.yaml#/definitions/uint32 > >> + > >> + target-rpm: > >> + description: > >> + Target RPM the fan should be configured during driver probe. > > > What driver? By the time the OS driver runs, a bunch of other boot > > software has already run on modern systems. So this value would likely > > be used much earlier. The point is that when exactly is outside the > > scope of DT. This is "what RPM do I use in case of no other information > > (e.g. temperature)". > > So, the description should be changed to 'The default desired fan speed in RPM,' > and we shouldn't mention the timing of the property's operation in the DT, is that correct? Correct. > > >> + $ref: /schemas/types.yaml#/definitions/uint32 > >> + > >> + mode: > > > Too generic. > > >> + description: > >> + Select the operational mode of the fan. > > > What are modes? Spin and don't spin? > > The mode is used to indicate the driving mode of the fan (DC, PWM and so on). > So, if the name of the property changes to 'fan-driving-mode,' is it acceptable to you? I tend to think that should be implied from the parent node and/or other properties. PWM if "pwms" property is present. DC if the supply is variable. We could also use compatible strings in the fan nodes if there's a need. That reminds me, both of these modes probably need a table of voltage/duty-cycle to RPMs. I imagine it's not always a linear response. Naresh also privately sent me (don't do that) an updated common binding which we discussed the need for this. I expect him to comment further with details. > >> + $ref: /schemas/types.yaml#/definitions/uint32 > >> + > >> + pwms: > >> + description: > >> + PWM provider. > > > maxItems: 1 > > > I don't think there are fans with more than 1 PWM input? > > Ok, I will add the constraint for the pwm input. > > >> + > >> + tach-ch: > >> + description: > >> + The tach channel used for the fan. > >> + $ref: /schemas/types.yaml#/definitions/uint32 > > > The existing ASpeed version of this property allows more than 1 entry. I > > don't understand how a fan would have 2 tach signals, but if so, the > > generic property should allow for that. > > Ok, I will modify it to the uint32-array Perhaps uint8-array to align with existing versions of the property. > > > Perhaps 'reg' should be defined in here with some text saying 'reg' > > corresponds to the fan controller specific id which may be the PWM+TACH > > channel, PWM channel (deprecated), or TACH channel. I think there are > > examples of all 3 of these cases. > > I don't think it's necessary for the 'reg' because the case you mentioned is > already covered by the property 'tach-ch' and the 'pwms'. Yes, but when we have N child nodes of the same thing, we usually have "reg" and its value corresponds to how the parent identifies each child. We already have a mixture using PWM or tach channel. Yes, this can all just be in the fan controllers binding, but putting it here would just document the options. Rob [1] http://www.comairrotron.com/methods-monitoring-fan-performance