[PATCH v2 2/2] dt-bindings: hwmon: pwm-fan: add retain-state-shutdown property

Akinobu Mita posted 2 patches 1 month ago
[PATCH v2 2/2] dt-bindings: hwmon: pwm-fan: add retain-state-shutdown property
Posted by Akinobu Mita 1 month ago
Document new retain-state-shutdown property.

Cc: Jean Delvare <jdelvare@suse.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Rob Herring <robh@kernel.org>
Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
Cc: Conor Dooley <conor+dt@kernel.org>
Cc: Billy Tsai <billy_tsai@aspeedtech.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
 Documentation/devicetree/bindings/hwmon/pwm-fan.yaml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml b/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml
index 4e5abf7580cc..86a069969e29 100644
--- a/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml
+++ b/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml
@@ -40,6 +40,10 @@ properties:
     maximum: 4
     default: 2
 
+  retain-state-shutdown:
+    description: Retain the state of the PWM on shutdown.
+    $ref: /schemas/types.yaml#/definitions/flag
+
   pwms:
     description: The PWM that is used to control the fan.
     maxItems: 1
-- 
2.34.1
Re: [PATCH v2 2/2] dt-bindings: hwmon: pwm-fan: add retain-state-shutdown property
Posted by Krzysztof Kozlowski 4 weeks ago
On Sat, Oct 26, 2024 at 05:05:35PM +0900, Akinobu Mita wrote:
> Document new retain-state-shutdown property.
> 
> Cc: Jean Delvare <jdelvare@suse.com>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Rob Herring <robh@kernel.org>
> Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
> Cc: Conor Dooley <conor+dt@kernel.org>
> Cc: Billy Tsai <billy_tsai@aspeedtech.com>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> ---
>  Documentation/devicetree/bindings/hwmon/pwm-fan.yaml | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml b/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml
> index 4e5abf7580cc..86a069969e29 100644
> --- a/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml
> +++ b/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml
> @@ -40,6 +40,10 @@ properties:
>      maximum: 4
>      default: 2
>  
> +  retain-state-shutdown:
> +    description: Retain the state of the PWM on shutdown.

You described the desired Linux feature or behavior, not the actual
hardware. The bindings are about the latter, so instead you need to
rephrase the property and its description to match actual hardware
capabilities/features/configuration etc.

Best regards,
Krzysztof
Re: [PATCH v2 2/2] dt-bindings: hwmon: pwm-fan: add retain-state-shutdown property
Posted by Akinobu Mita 4 weeks ago
2024年10月28日(月) 5:38 Krzysztof Kozlowski <krzk@kernel.org>:
>
> On Sat, Oct 26, 2024 at 05:05:35PM +0900, Akinobu Mita wrote:
> > Document new retain-state-shutdown property.
> >
> > Cc: Jean Delvare <jdelvare@suse.com>
> > Cc: Guenter Roeck <linux@roeck-us.net>
> > Cc: Rob Herring <robh@kernel.org>
> > Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
> > Cc: Conor Dooley <conor+dt@kernel.org>
> > Cc: Billy Tsai <billy_tsai@aspeedtech.com>
> > Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> > ---
> >  Documentation/devicetree/bindings/hwmon/pwm-fan.yaml | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml b/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml
> > index 4e5abf7580cc..86a069969e29 100644
> > --- a/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml
> > +++ b/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml
> > @@ -40,6 +40,10 @@ properties:
> >      maximum: 4
> >      default: 2
> >
> > +  retain-state-shutdown:
> > +    description: Retain the state of the PWM on shutdown.
>
> You described the desired Linux feature or behavior, not the actual
> hardware. The bindings are about the latter, so instead you need to
> rephrase the property and its description to match actual hardware
> capabilities/features/configuration etc.

Is this description okay?
(Reused the description of retain-state-shutdown in leds-gpio.yaml)

description:
  Retain the state of the PWM on shutdown. Useful in BMC systems, for
  example, when the BMC is rebooted while the host remains up, the fan
  will not stop.
Re: [PATCH v2 2/2] dt-bindings: hwmon: pwm-fan: add retain-state-shutdown property
Posted by Krzysztof Kozlowski 3 weeks, 6 days ago
On 28/10/2024 13:42, Akinobu Mita wrote:
> 2024年10月28日(月) 5:38 Krzysztof Kozlowski <krzk@kernel.org>:
>>
>> On Sat, Oct 26, 2024 at 05:05:35PM +0900, Akinobu Mita wrote:
>>> Document new retain-state-shutdown property.
>>>
>>> Cc: Jean Delvare <jdelvare@suse.com>
>>> Cc: Guenter Roeck <linux@roeck-us.net>
>>> Cc: Rob Herring <robh@kernel.org>
>>> Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
>>> Cc: Conor Dooley <conor+dt@kernel.org>
>>> Cc: Billy Tsai <billy_tsai@aspeedtech.com>
>>> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
>>> ---
>>>  Documentation/devicetree/bindings/hwmon/pwm-fan.yaml | 4 ++++
>>>  1 file changed, 4 insertions(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml b/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml
>>> index 4e5abf7580cc..86a069969e29 100644
>>> --- a/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml
>>> +++ b/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml
>>> @@ -40,6 +40,10 @@ properties:
>>>      maximum: 4
>>>      default: 2
>>>
>>> +  retain-state-shutdown:
>>> +    description: Retain the state of the PWM on shutdown.
>>
>> You described the desired Linux feature or behavior, not the actual
>> hardware. The bindings are about the latter, so instead you need to
>> rephrase the property and its description to match actual hardware
>> capabilities/features/configuration etc.
> 
> Is this description okay?
> (Reused the description of retain-state-shutdown in leds-gpio.yaml)
> 
> description:
>   Retain the state of the PWM on shutdown. Useful in BMC systems, for
>   example, when the BMC is rebooted while the host remains up, the fan
>   will not stop.

Nothing improved in the property. You still say what the system should
do. This is user-space choice, not DT.

Best regards,
Krzysztof

Re: [PATCH v2 2/2] dt-bindings: hwmon: pwm-fan: add retain-state-shutdown property
Posted by Akinobu Mita 3 weeks, 6 days ago
2024年10月28日(月) 23:22 Krzysztof Kozlowski <krzk@kernel.org>:
>
> On 28/10/2024 13:42, Akinobu Mita wrote:
> > 2024年10月28日(月) 5:38 Krzysztof Kozlowski <krzk@kernel.org>:
> >>
> >> On Sat, Oct 26, 2024 at 05:05:35PM +0900, Akinobu Mita wrote:
> >>> Document new retain-state-shutdown property.
> >>>
> >>> Cc: Jean Delvare <jdelvare@suse.com>
> >>> Cc: Guenter Roeck <linux@roeck-us.net>
> >>> Cc: Rob Herring <robh@kernel.org>
> >>> Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
> >>> Cc: Conor Dooley <conor+dt@kernel.org>
> >>> Cc: Billy Tsai <billy_tsai@aspeedtech.com>
> >>> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> >>> ---
> >>>  Documentation/devicetree/bindings/hwmon/pwm-fan.yaml | 4 ++++
> >>>  1 file changed, 4 insertions(+)
> >>>
> >>> diff --git a/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml b/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml
> >>> index 4e5abf7580cc..86a069969e29 100644
> >>> --- a/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml
> >>> +++ b/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml
> >>> @@ -40,6 +40,10 @@ properties:
> >>>      maximum: 4
> >>>      default: 2
> >>>
> >>> +  retain-state-shutdown:
> >>> +    description: Retain the state of the PWM on shutdown.
> >>
> >> You described the desired Linux feature or behavior, not the actual
> >> hardware. The bindings are about the latter, so instead you need to
> >> rephrase the property and its description to match actual hardware
> >> capabilities/features/configuration etc.
> >
> > Is this description okay?
> > (Reused the description of retain-state-shutdown in leds-gpio.yaml)
> >
> > description:
> >   Retain the state of the PWM on shutdown. Useful in BMC systems, for
> >   example, when the BMC is rebooted while the host remains up, the fan
> >   will not stop.
>
> Nothing improved in the property. You still say what the system should
> do. This is user-space choice, not DT.

It seems better to implement it as a device attribute.
Re: [PATCH v2 2/2] dt-bindings: hwmon: pwm-fan: add retain-state-shutdown property
Posted by Krzysztof Kozlowski 3 weeks, 4 days ago
On 28/10/2024 15:57, Akinobu Mita wrote:
>>>>
>>>> You described the desired Linux feature or behavior, not the actual
>>>> hardware. The bindings are about the latter, so instead you need to
>>>> rephrase the property and its description to match actual hardware
>>>> capabilities/features/configuration etc.
>>>
>>> Is this description okay?
>>> (Reused the description of retain-state-shutdown in leds-gpio.yaml)
>>>
>>> description:
>>>   Retain the state of the PWM on shutdown. Useful in BMC systems, for
>>>   example, when the BMC is rebooted while the host remains up, the fan
>>>   will not stop.
>>
>> Nothing improved in the property. You still say what the system should
>> do. This is user-space choice, not DT.
> 
> It seems better to implement it as a device attribute.

I don't know about that. To repeat: if you say what system is supposed
to be doing, it is a policy. Describe the hardware and its configuration
and maybe this would be suitable for DT.

Best regards,
Krzysztof
Re: [PATCH v2 2/2] dt-bindings: hwmon: pwm-fan: add retain-state-shutdown property
Posted by Akinobu Mita 3 weeks, 4 days ago
2024年10月31日(木) 0:18 Krzysztof Kozlowski <krzk@kernel.org>:
>
> On 28/10/2024 15:57, Akinobu Mita wrote:
> >>>>
> >>>> You described the desired Linux feature or behavior, not the actual
> >>>> hardware. The bindings are about the latter, so instead you need to
> >>>> rephrase the property and its description to match actual hardware
> >>>> capabilities/features/configuration etc.
> >>>
> >>> Is this description okay?
> >>> (Reused the description of retain-state-shutdown in leds-gpio.yaml)
> >>>
> >>> description:
> >>>   Retain the state of the PWM on shutdown. Useful in BMC systems, for
> >>>   example, when the BMC is rebooted while the host remains up, the fan
> >>>   will not stop.
> >>
> >> Nothing improved in the property. You still say what the system should
> >> do. This is user-space choice, not DT.
> >
> > It seems better to implement it as a device attribute.
>
> I don't know about that. To repeat: if you say what system is supposed
> to be doing, it is a policy. Describe the hardware and its configuration
> and maybe this would be suitable for DT.

Billy, could you please write a proper description for this property?
I'm not the right person for this.