diff mbox series

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

Message ID 20241026080535.444903-3-akinobu.mita@gmail.com (mailing list archive)
State New
Headers show
Series hwmon: (pwm-fan) add option to leave fan on shutdown | expand

Commit Message

Akinobu Mita Oct. 26, 2024, 8:05 a.m. UTC
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(+)

Comments

Krzysztof Kozlowski Oct. 27, 2024, 8:38 p.m. UTC | #1
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
Akinobu Mita Oct. 28, 2024, 12:42 p.m. UTC | #2
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.
Krzysztof Kozlowski Oct. 28, 2024, 2:22 p.m. UTC | #3
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
Akinobu Mita Oct. 28, 2024, 2:57 p.m. UTC | #4
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.
Krzysztof Kozlowski Oct. 30, 2024, 3:18 p.m. UTC | #5
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
Akinobu Mita Oct. 30, 2024, 3:34 p.m. UTC | #6
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.
Billy Tsai Nov. 4, 2024, 7:45 a.m. UTC | #7
> >
> > 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.

In our hardware, if the system reboots and power remains on the PWM controller
will retain its original settings. However, the pwm-fan.c driver currently disables
the PWM controller during a system reboot. I need this property to prevent pwm-fan.c
from disabling the PWM when the system reboots.
In my point of view, the description can be:
Retain the state of the PWM on shutdown. Some platforms (e.g., BMC) will maintain
the PWM status after the system reboot. Add this property to prevent the PWM from being
disabled during the system reboot.

Thanks

Billy Tsai
Krzysztof Kozlowski Nov. 4, 2024, 11:47 a.m. UTC | #8
On 04/11/2024 08:45, Billy Tsai wrote:
>>>
>>> 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.
> 
> In our hardware, if the system reboots and power remains on the PWM controller
> will retain its original settings. However, the pwm-fan.c driver currently disables
> the PWM controller during a system reboot. I need this property to prevent pwm-fan.c

If we change the PWM core not to disable it, then we have to change
bindings?

How is this binding applicable on system (e.g. on *BSD) which does not
disable PWM on reboot?

> from disabling the PWM when the system reboots.
> In my point of view, the description can be:
> Retain the state of the PWM on shutdown. Some platforms (e.g., BMC) will maintain
> the PWM status after the system reboot. Add this property to prevent the PWM from being
> disabled during the system reboot.

You again describe what OS should do. First and last sentences are the same.

Probably what you want to say is that fan is some critical component
which should not be turned off or left unattended. Or that this hardware
keeps last state of register on reset, so some boards might want to use
it? If the first, then probably different property name. If the second,
current seems fine, just choose some description describing actual hardware.

Best regards,
Krzysztof
Billy Tsai Nov. 5, 2024, 8:16 a.m. UTC | #9
> >>>
> >>> 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.
> >
> > In our hardware, if the system reboots and power remains on the PWM controller
> > will retain its original settings. However, the pwm-fan.c driver currently disables
> > the PWM controller during a system reboot. I need this property to prevent pwm-fan.c

> If we change the PWM core not to disable it, then we have to change
> bindings?

If the pwm-fan.c driver doesn't disable the PWM controller, we don't need to add this property.

> How is this binding applicable on system (e.g. on *BSD) which does not
> disable PWM on reboot?

That's why we need this property?

> > from disabling the PWM when the system reboots.
> > In my point of view, the description can be:
> > Retain the state of the PWM on shutdown. Some platforms (e.g., BMC) will maintain
> > the PWM status after the system reboot. Add this property to prevent the PWM from being
> > disabled during the system reboot.

> You again describe what OS should do. First and last sentences are the same.

> Probably what you want to say is that fan is some critical component
> which should not be turned off or left unattended. Or that this hardware
> keeps last state of register on reset, so some boards might want to use
> it? If the first, then probably different property name. If the second,
> current seems fine, just choose some description describing actual hardware.

I think it will be the second one. Is it okay to change the description to the following?
Retain the state of the PWM on shutdown. Some platforms (e.g., BMC) require the PWM to maintain
its last register status on system reboot. Add this property to prevent the PWM from being disabled
during system reboot.

Thanks

Billy Tsai
diff mbox series

Patch

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