[PATCH v4 1/2] dt-bindings: hwmon: emc2305: Add fan-shutdown-percent property

florin.leotescu@oss.nxp.com posted 2 patches 2 weeks ago
There is a newer version of this series
[PATCH v4 1/2] dt-bindings: hwmon: emc2305: Add fan-shutdown-percent property
Posted by florin.leotescu@oss.nxp.com 2 weeks ago
From: Florin Leotescu <florin.leotescu@nxp.com>

The EMC2305 fan controller supports multiple independent PWM fan
outputs. Some systems require fans to enter a defined safe state
during system shutdown or reboot handoff, until firmware or the next
boot stage reconfigures the controller.

Add an optional "fan-shutdown-percent" property to fan child nodes
allowing the shutdown fan speed to be configured per fan output.

Signed-off-by: Florin Leotescu <florin.leotescu@nxp.com>
---
 .../devicetree/bindings/hwmon/microchip,emc2305.yaml      | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/hwmon/microchip,emc2305.yaml b/Documentation/devicetree/bindings/hwmon/microchip,emc2305.yaml
index d3f06ebc19fa..7bcadfab9fc4 100644
--- a/Documentation/devicetree/bindings/hwmon/microchip,emc2305.yaml
+++ b/Documentation/devicetree/bindings/hwmon/microchip,emc2305.yaml
@@ -54,6 +54,12 @@ patternProperties:
           The fan number used to determine the associated PWM channel.
         maxItems: 1
 
+      fan-shutdown-percent:
+        description:
+          Fan RPM in percent set during shutdown.
+        minimum: 0
+        maximum: 100
+
     required:
       - reg
 
@@ -80,12 +86,14 @@ examples:
             fan@0 {
                 reg = <0x0>;
                 pwms = <&fan_controller 26000 PWM_POLARITY_INVERTED 1>;
+                fan-shutdown-percent = <100>;
                 #cooling-cells = <2>;
             };
 
             fan@1 {
                 reg = <0x1>;
                 pwms = <&fan_controller 26000 0 1>;
+                fan-shutdown-percent = <50>;
                 #cooling-cells = <2>;
             };
 
-- 
2.34.1
Re: [PATCH v4 1/2] dt-bindings: hwmon: emc2305: Add fan-shutdown-percent property
Posted by Rob Herring 1 week, 2 days ago
On Fri, Mar 20, 2026 at 05:29:58PM +0200, florin.leotescu@oss.nxp.com wrote:
> From: Florin Leotescu <florin.leotescu@nxp.com>
> 
> The EMC2305 fan controller supports multiple independent PWM fan
> outputs. Some systems require fans to enter a defined safe state
> during system shutdown or reboot handoff, until firmware or the next
> boot stage reconfigures the controller.
> 
> Add an optional "fan-shutdown-percent" property to fan child nodes
> allowing the shutdown fan speed to be configured per fan output.

Why not a common fan property in fan-common.yaml?

We generally specify fan speeds in RPM (and then map RPMs to duty cycle 
for PWM).

Also, we have (or can have) cooling levels defined. Perhaps we should 
define the cooling level for shutdown? Maybe other things with cooling 
levels need a shutdown level too?

Rob
Re: [PATCH v4 1/2] dt-bindings: hwmon: emc2305: Add fan-shutdown-percent property
Posted by Guenter Roeck 1 week, 2 days ago
On 3/25/26 14:56, Rob Herring wrote:
> On Fri, Mar 20, 2026 at 05:29:58PM +0200, florin.leotescu@oss.nxp.com wrote:
>> From: Florin Leotescu <florin.leotescu@nxp.com>
>>
>> The EMC2305 fan controller supports multiple independent PWM fan
>> outputs. Some systems require fans to enter a defined safe state
>> during system shutdown or reboot handoff, until firmware or the next
>> boot stage reconfigures the controller.
>>
>> Add an optional "fan-shutdown-percent" property to fan child nodes
>> allowing the shutdown fan speed to be configured per fan output.
> 
> Why not a common fan property in fan-common.yaml?
> 
> We generally specify fan speeds in RPM (and then map RPMs to duty cycle
> for PWM).
> 

The problem here is mentioning "fan speed" instead of referring to pwm
duty cyle in the first place. It is not just misleading, it is wrong.

It is impossible to associate fan speed with a specific duty cycle because
that differs for each fan. It isn't even consistent for the same fan model -
one never knows what fan speed one gets for a given duty cycle. It depends
on the air flow in the chassis and on fan-to-fan deviations. It will change
over the lifetime of a fan. It may even change with the ambient temperature.
Fan controllers use a feedback loop for that purpose, but that doesn't
work here since, after all, this is a shutdown parameter.

I don't think anything but specifying a shutdown duty cycle is
feasible here.

> Also, we have (or can have) cooling levels defined. Perhaps we should
> define the cooling level for shutdown? Maybe other things with cooling
> levels need a shutdown level too?
> 

Unless I am missing something, the thermal subsystem does not currently have
a concept of a "shutdown cooling state". The driver supports registering
with the thermal subsystem, but it is not mandatory. Even if the thermal
subsystem would support shutdown cooling states or a similar concept,
I do not think it would be a good idea to mandate its existence or in a fan
controller driver.

Thanks,
Guenter
Re: [PATCH v4 1/2] dt-bindings: hwmon: emc2305: Add fan-shutdown-percent property
Posted by Daniel Baluta 1 week, 4 days ago
On 3/20/26 17:29, florin.leotescu@oss.nxp.com wrote:
> From: Florin Leotescu <florin.leotescu@nxp.com>
>
> The EMC2305 fan controller supports multiple independent PWM fan
> outputs. Some systems require fans to enter a defined safe state
> during system shutdown or reboot handoff, until firmware or the next
> boot stage reconfigures the controller.
>
> Add an optional "fan-shutdown-percent" property to fan child nodes
> allowing the shutdown fan speed to be configured per fan output.
>
> Signed-off-by: Florin Leotescu <florin.leotescu@nxp.com>
> ---
>  .../devicetree/bindings/hwmon/microchip,emc2305.yaml      | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/hwmon/microchip,emc2305.yaml b/Documentation/devicetree/bindings/hwmon/microchip,emc2305.yaml
> index d3f06ebc19fa..7bcadfab9fc4 100644
> --- a/Documentation/devicetree/bindings/hwmon/microchip,emc2305.yaml
> +++ b/Documentation/devicetree/bindings/hwmon/microchip,emc2305.yaml
> @@ -54,6 +54,12 @@ patternProperties:
>            The fan number used to determine the associated PWM channel.
>          maxItems: 1
>  
> +      fan-shutdown-percent:
> +        description:
> +          Fan RPM in percent set during shutdown.
AI review suggests to update description to 'Fan speed percent' or 'PWM duty cycle in percent'. This could be an easy update.
More important question here is how should we proceed with the following observation:

"fan-shutdown-percent property is already defined identically in pwm-fan.yaml."

Guenter, should we move it from pwm-fan.yaml to fan-common.yaml and use it here?

Our initial thought was to add have it merged in microchip,emc2305.yaml as it is now

and then factor it out in fan-common.yaml in a later patch.


What do you think?


Re: [PATCH v4 1/2] dt-bindings: hwmon: emc2305: Add fan-shutdown-percent property
Posted by Guenter Roeck 1 week, 4 days ago
On 3/23/26 02:10, Daniel Baluta wrote:
> On 3/20/26 17:29, florin.leotescu@oss.nxp.com wrote:
>> From: Florin Leotescu <florin.leotescu@nxp.com>
>>
>> The EMC2305 fan controller supports multiple independent PWM fan
>> outputs. Some systems require fans to enter a defined safe state
>> during system shutdown or reboot handoff, until firmware or the next
>> boot stage reconfigures the controller.
>>
>> Add an optional "fan-shutdown-percent" property to fan child nodes
>> allowing the shutdown fan speed to be configured per fan output.
>>
>> Signed-off-by: Florin Leotescu <florin.leotescu@nxp.com>
>> ---
>>   .../devicetree/bindings/hwmon/microchip,emc2305.yaml      | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/hwmon/microchip,emc2305.yaml b/Documentation/devicetree/bindings/hwmon/microchip,emc2305.yaml
>> index d3f06ebc19fa..7bcadfab9fc4 100644
>> --- a/Documentation/devicetree/bindings/hwmon/microchip,emc2305.yaml
>> +++ b/Documentation/devicetree/bindings/hwmon/microchip,emc2305.yaml
>> @@ -54,6 +54,12 @@ patternProperties:
>>             The fan number used to determine the associated PWM channel.
>>           maxItems: 1
>>   
>> +      fan-shutdown-percent:
>> +        description:
>> +          Fan RPM in percent set during shutdown.
> AI review suggests to update description to 'Fan speed percent' or 'PWM duty cycle in percent'. This could be an easy update.
> More important question here is how should we proceed with the following observation:
> 
> "fan-shutdown-percent property is already defined identically in pwm-fan.yaml."
> 
> Guenter, should we move it from pwm-fan.yaml to fan-common.yaml and use it here?
> 
> Our initial thought was to add have it merged in microchip,emc2305.yaml as it is now
> 
> and then factor it out in fan-common.yaml in a later patch.
> 
> 
> What do you think?
> 

Both are fine with me, with slight preference for the second approach.
Please do whatever gets approval from DT maintainers.

Thanks,
Guenter