Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: Peter Korsgaard <peter@korsgaard.com>
To: Rob Herring <robh@kernel.org>
Cc: Guenter Roeck <linux@roeck-us.net>,
	devicetree@vger.kernel.org, linux-hwmon@vger.kernel.org,
	Jean Delvare <jdelvare@suse.com>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 1/2] dt-bindings: hwmon: pwm-fan: Document default-pwm property
Date: Sun, 5 Jan 2025 17:10:42 +0100	[thread overview]
Message-ID: <dbf7cdd3-c5ab-4801-be85-163124b8a898@korsgaard.com> (raw)
In-Reply-To: <20250103195810.GA2624225-robh@kernel.org>

On 1/3/25 20:58, Rob Herring wrote:

> I still don't agree. Quoting Guenter:
> 
>> The two values are also orthogonal. The fan rpm is fan dependent.
>> Each fan will require a different pwm value to reach the target speed.
>> Trying to use target-rpm to set a default pwm value would really
>> not make much if any sense.

> But RPM is ultimately what you care about and is the fan parameter
> that's universal yet independent of the underlying control. RPM is what
> determines noise and power consumption.
> 
> There's 2 cases to consider: you have a tach signal and know the fan RPM
> or you don't know the RPM. If you have a tach signal, we probably
> wouldn't be discussing this because target-rpm would be enough. So I'm
> assuming this is the case and you have no idea what RPM the fan runs at.

Correct, no tacho.


> The fan-common.yaml binding is a bit incomplete for this. What you need
> is some map of fan speed to PWM duty cycle as most likely it is not
> linear response. I think there are 2 options here:
> 
> Use the 'cooling-levels' property. Fan "speed" is the index of the
> array. So you just need a 'default-cooling-level' property that's the
> default index.

I am not sure I what you mean with the RPM reference here? The 
cooling-levels support in the fan-pwm.c driver is a mapping between 
cooling levels and PWM values, NOT RPM value.


> The other option is define an array of (fan RPM, PWM duty cycle) tuples.
> Then target-rpm can be used to select the entry. We already have
> something like this with 'gpio-fan,speed-map'.

Where should these "invented" RPM values come from when there is no 
tacho signal? That sounds backwards / complicated for the very trivial 
"what should the default PWM value be at driver probe time" use case.


> There's also no definition of the minimum RPM or duty cycle in the
> pwm-fan binding. We have min-rpm in fan-common, but that doesn't work
> without a tach. A map would help here as well

The minimum PWM is presumably 0, E.G. signal always low?


> This problem to me is similar to LEDs. Ultimately it's brightness that
> you care about, not the current or PWM duty cycle to get there.

The use case (as described in the commit message) is to drive the fan 
less hard to limit noise and/or power consumption. The input to the fan 
drive control is a PWM setting, so it IMHO makes sense to specify that, 
as that is the interface provided by the fan-pwm driver - E.G. you boot 
up and tweak the pwm1 property in sysfs until you have a value that 
suits the noise/power consumption requirements and stick that value in 
the dts.


> Finally, whatever we end up with, it should go in fan-common.yaml. That
> supports PWMs too, so whatever we end up with is applicable to any PWM
> controlled fan.

What makes this "default-pwm" (or whatever it will be called) more 
generic than E.G. the recently added "fan-stop-to-start-percent" / 
"fan-stop-to-start-usec" properties added to pwm-fan.yaml by commit 
80bc64201e78 ("dt-bindings: hwmon: pwm-fan: Document start from stopped 
state properties")?

-- 
Bye, Peter Korsgaard

  reply	other threads:[~2025-01-05 16:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-03 10:14 [PATCH v4 1/2] dt-bindings: hwmon: pwm-fan: Document default-pwm property Peter Korsgaard
2025-01-03 10:14 ` [PATCH v4 2/2] hwmon: (pwm-fan): Make default PWM duty cycle configurable Peter Korsgaard
2025-01-03 19:58 ` [PATCH v4 1/2] dt-bindings: hwmon: pwm-fan: Document default-pwm property Rob Herring
2025-01-05 16:10   ` Peter Korsgaard [this message]
2025-01-06 17:38     ` Rob Herring
2025-01-06 18:32       ` Guenter Roeck
2025-01-10 20:06       ` Peter Korsgaard
2025-01-11 17:15         ` Guenter Roeck
2025-01-11 18:24           ` Peter Korsgaard
2025-01-11 22:45             ` Guenter Roeck
2025-01-05 16:42   ` Guenter Roeck
2025-01-05 17:22   ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dbf7cdd3-c5ab-4801-be85-163124b8a898@korsgaard.com \
    --to=peter@korsgaard.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jdelvare@suse.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox