diff mbox series

[2/3] dt-bindings: regulator: Add regulator-output binding

Message ID 20220925220319.12572-3-zev@bewilderbeest.net
State Superseded, archived
Headers show
Series regulator: Add DT support for regulator-output connectors | expand

Checks

Context Check Description
robh/checkpatch success
robh/patch-applied success
robh/dtbs-check warning build log
robh/dt-meta-schema success

Commit Message

Zev Weiss Sept. 25, 2022, 10:03 p.m. UTC
This describes a power output supplied by a regulator, such as a
power outlet on a power distribution unit (PDU).

Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
---
 .../bindings/regulator/regulator-output.yaml  | 47 +++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/regulator-output.yaml

Comments

Rob Herring Sept. 29, 2022, 9:07 p.m. UTC | #1
On Sun, Sep 25, 2022 at 03:03:18PM -0700, Zev Weiss wrote:
> This describes a power output supplied by a regulator, such as a
> power outlet on a power distribution unit (PDU).
> 
> Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
> ---
>  .../bindings/regulator/regulator-output.yaml  | 47 +++++++++++++++++++
>  1 file changed, 47 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/regulator/regulator-output.yaml
> 
> diff --git a/Documentation/devicetree/bindings/regulator/regulator-output.yaml b/Documentation/devicetree/bindings/regulator/regulator-output.yaml
> new file mode 100644
> index 000000000000..40953ec48e9e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/regulator/regulator-output.yaml
> @@ -0,0 +1,47 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +
> +$id: http://devicetree.org/schemas/regulator/regulator-output.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Regulator output connector
> +
> +maintainers:
> +  - Zev Weiss <zev@bewilderbeest.net>
> +
> +description: |
> +  This describes a power output connector supplied by a regulator,
> +  such as a power outlet on a power distribution unit (PDU).  The
> +  connector may be standalone or merely one channel or set of pins
> +  within a ganged physical connector carrying multiple independent
> +  power outputs.
> +
> +properties:
> +  compatible:
> +    const: regulator-output
> +
> +  vout-supply:
> +    description:
> +      Phandle of the regulator supplying the output.
> +
> +  regulator-leave-on:
> +    description: |
> +      If the regulator is enabled when software relinquishes control
> +      of it (such as when shutting down) it should be left enabled
> +      instead of being turned off.
> +    type: boolean

I'm not too sure about this one as there could be various times when 
control is relinquished. It is userspace closing its access? 
driver unbind? module unload? Does a bootloader pay attention to this?

Rob
Zev Weiss Sept. 29, 2022, 9:27 p.m. UTC | #2
On Thu, Sep 29, 2022 at 02:07:14PM PDT, Rob Herring wrote:
>On Sun, Sep 25, 2022 at 03:03:18PM -0700, Zev Weiss wrote:
>> This describes a power output supplied by a regulator, such as a
>> power outlet on a power distribution unit (PDU).
>>
>> Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
>> ---
>>  .../bindings/regulator/regulator-output.yaml  | 47 +++++++++++++++++++
>>  1 file changed, 47 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/regulator/regulator-output.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/regulator/regulator-output.yaml b/Documentation/devicetree/bindings/regulator/regulator-output.yaml
>> new file mode 100644
>> index 000000000000..40953ec48e9e
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/regulator/regulator-output.yaml
>> @@ -0,0 +1,47 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +
>> +$id: http://devicetree.org/schemas/regulator/regulator-output.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Regulator output connector
>> +
>> +maintainers:
>> +  - Zev Weiss <zev@bewilderbeest.net>
>> +
>> +description: |
>> +  This describes a power output connector supplied by a regulator,
>> +  such as a power outlet on a power distribution unit (PDU).  The
>> +  connector may be standalone or merely one channel or set of pins
>> +  within a ganged physical connector carrying multiple independent
>> +  power outputs.
>> +
>> +properties:
>> +  compatible:
>> +    const: regulator-output
>> +
>> +  vout-supply:
>> +    description:
>> +      Phandle of the regulator supplying the output.
>> +
>> +  regulator-leave-on:
>> +    description: |
>> +      If the regulator is enabled when software relinquishes control
>> +      of it (such as when shutting down) it should be left enabled
>> +      instead of being turned off.
>> +    type: boolean
>
>I'm not too sure about this one as there could be various times when
>control is relinquished. It is userspace closing its access?
>driver unbind? module unload? Does a bootloader pay attention to this?
>
>Rob

Thanks for the feedback, Rob -- I'll admit I was a bit unsure how to 
approach that, and this may well not be the right answer.  What I'm 
really aiming for is an appropriate way to express that regulator on/off 
state should only ever be changed by explicit (external, e.g. userspace) 
request, never as any sort of default/automatic action.  The two obvious 
things to guard against there seem to be automatic enablement during 
initialization and automatic disablement on de-init (shutdown, unbind, 
etc.).  The former I think can be avoided by simply not setting 
regulator-boot-on, so I added this as a corresponding property to avoid 
the latter.

I'm definitely open to suggestions for a better approach though.


Thanks,
Zev
Zev Weiss Oct. 27, 2022, 6:42 p.m. UTC | #3
On Thu, Sep 29, 2022 at 02:27:20PM PDT, Zev Weiss wrote:
>On Thu, Sep 29, 2022 at 02:07:14PM PDT, Rob Herring wrote:
>>On Sun, Sep 25, 2022 at 03:03:18PM -0700, Zev Weiss wrote:
>>>This describes a power output supplied by a regulator, such as a
>>>power outlet on a power distribution unit (PDU).
>>>
>>>Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
>>>---
>>> .../bindings/regulator/regulator-output.yaml  | 47 +++++++++++++++++++
>>> 1 file changed, 47 insertions(+)
>>> create mode 100644 Documentation/devicetree/bindings/regulator/regulator-output.yaml
>>>
>>>diff --git a/Documentation/devicetree/bindings/regulator/regulator-output.yaml b/Documentation/devicetree/bindings/regulator/regulator-output.yaml
>>>new file mode 100644
>>>index 000000000000..40953ec48e9e
>>>--- /dev/null
>>>+++ b/Documentation/devicetree/bindings/regulator/regulator-output.yaml
>>>@@ -0,0 +1,47 @@
>>>+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>>>+%YAML 1.2
>>>+---
>>>+
>>>+$id: http://devicetree.org/schemas/regulator/regulator-output.yaml#
>>>+$schema: http://devicetree.org/meta-schemas/core.yaml#
>>>+
>>>+title: Regulator output connector
>>>+
>>>+maintainers:
>>>+  - Zev Weiss <zev@bewilderbeest.net>
>>>+
>>>+description: |
>>>+  This describes a power output connector supplied by a regulator,
>>>+  such as a power outlet on a power distribution unit (PDU).  The
>>>+  connector may be standalone or merely one channel or set of pins
>>>+  within a ganged physical connector carrying multiple independent
>>>+  power outputs.
>>>+
>>>+properties:
>>>+  compatible:
>>>+    const: regulator-output
>>>+
>>>+  vout-supply:
>>>+    description:
>>>+      Phandle of the regulator supplying the output.
>>>+
>>>+  regulator-leave-on:
>>>+    description: |
>>>+      If the regulator is enabled when software relinquishes control
>>>+      of it (such as when shutting down) it should be left enabled
>>>+      instead of being turned off.
>>>+    type: boolean
>>
>>I'm not too sure about this one as there could be various times when
>>control is relinquished. It is userspace closing its access?
>>driver unbind? module unload? Does a bootloader pay attention to this?
>>
>>Rob
>
>Thanks for the feedback, Rob -- I'll admit I was a bit unsure how to 
>approach that, and this may well not be the right answer.  What I'm 
>really aiming for is an appropriate way to express that regulator 
>on/off state should only ever be changed by explicit (external, e.g. 
>userspace) request, never as any sort of default/automatic action.  
>The two obvious things to guard against there seem to be automatic 
>enablement during initialization and automatic disablement on de-init 
>(shutdown, unbind, etc.).  The former I think can be avoided by simply 
>not setting regulator-boot-on, so I added this as a corresponding 
>property to avoid the latter.
>
>I'm definitely open to suggestions for a better approach though.
>

Ping...

Would something like this be preferable as a more direct description of 
that?

   regulator-manually-controlled:
     description: |
       The regulator should never be enabled or disabled automatically,
       only when explicitly requested by an external actor (e.g.  
       userspace).
     type: boolean

That would leave the question of which property takes priority if both 
regulator-manually-controlled and regulator-boot-on are set -- should 
the binding document the answer to that?  (I personally don't have a 
strong opinion on which it should be.)

Thanks,
Zev
Mark Brown Oct. 27, 2022, 6:54 p.m. UTC | #4
On Thu, Sep 29, 2022 at 02:27:19PM -0700, Zev Weiss wrote:
> On Thu, Sep 29, 2022 at 02:07:14PM PDT, Rob Herring wrote:

> never as any sort of default/automatic action.  The two obvious things to
> guard against there seem to be automatic enablement during initialization
> and automatic disablement on de-init (shutdown, unbind, etc.).  The former I
> think can be avoided by simply not setting regulator-boot-on, so I added
> this as a corresponding property to avoid the latter.

> I'm definitely open to suggestions for a better approach though.

regulator-boot-on mainly exists for handover of state from the
bootloader where we can't read back the state of the hardware rather
than as a control for boot purposes.
Krzysztof Kozlowski Oct. 28, 2022, 1:22 a.m. UTC | #5
On 27/10/2022 14:42, Zev Weiss wrote:
> On Thu, Sep 29, 2022 at 02:27:20PM PDT, Zev Weiss wrote:
>> On Thu, Sep 29, 2022 at 02:07:14PM PDT, Rob Herring wrote:
>>> On Sun, Sep 25, 2022 at 03:03:18PM -0700, Zev Weiss wrote:
>>>> This describes a power output supplied by a regulator, such as a
>>>> power outlet on a power distribution unit (PDU).
>>>>
>>>> Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
>>>> ---
>>>> .../bindings/regulator/regulator-output.yaml  | 47 +++++++++++++++++++
>>>> 1 file changed, 47 insertions(+)
>>>> create mode 100644 Documentation/devicetree/bindings/regulator/regulator-output.yaml
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/regulator/regulator-output.yaml b/Documentation/devicetree/bindings/regulator/regulator-output.yaml
>>>> new file mode 100644
>>>> index 000000000000..40953ec48e9e
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/regulator/regulator-output.yaml
>>>> @@ -0,0 +1,47 @@
>>>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>>>> +%YAML 1.2
>>>> +---
>>>> +
>>>> +$id: http://devicetree.org/schemas/regulator/regulator-output.yaml#
>>>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>>>> +
>>>> +title: Regulator output connector
>>>> +
>>>> +maintainers:
>>>> +  - Zev Weiss <zev@bewilderbeest.net>
>>>> +
>>>> +description: |
>>>> +  This describes a power output connector supplied by a regulator,
>>>> +  such as a power outlet on a power distribution unit (PDU).  The
>>>> +  connector may be standalone or merely one channel or set of pins
>>>> +  within a ganged physical connector carrying multiple independent
>>>> +  power outputs.
>>>> +
>>>> +properties:
>>>> +  compatible:
>>>> +    const: regulator-output
>>>> +
>>>> +  vout-supply:
>>>> +    description:
>>>> +      Phandle of the regulator supplying the output.
>>>> +
>>>> +  regulator-leave-on:
>>>> +    description: |
>>>> +      If the regulator is enabled when software relinquishes control
>>>> +      of it (such as when shutting down) it should be left enabled
>>>> +      instead of being turned off.
>>>> +    type: boolean
>>>
>>> I'm not too sure about this one as there could be various times when
>>> control is relinquished. It is userspace closing its access?
>>> driver unbind? module unload? Does a bootloader pay attention to this?
>>>
>>> Rob
>>
>> Thanks for the feedback, Rob -- I'll admit I was a bit unsure how to 
>> approach that, and this may well not be the right answer.  What I'm 
>> really aiming for is an appropriate way to express that regulator 
>> on/off state should only ever be changed by explicit (external, e.g. 
>> userspace) request, never as any sort of default/automatic action.  
>> The two obvious things to guard against there seem to be automatic 
>> enablement during initialization and automatic disablement on de-init 
>> (shutdown, unbind, etc.).  The former I think can be avoided by simply 
>> not setting regulator-boot-on, so I added this as a corresponding 
>> property to avoid the latter.
>>
>> I'm definitely open to suggestions for a better approach though.
>>
> 
> Ping...
> 
> Would something like this be preferable as a more direct description of 
> that?
> 
>    regulator-manually-controlled:
>      description: |
>        The regulator should never be enabled or disabled automatically,
>        only when explicitly requested by an external actor (e.g.  
>        userspace).
>      type: boolean

This looks like putting policy and OS behavior into DT. I guess it easy
to understand in case of Linux which disables unclaimed regulators
during. But what if other system/firmware does not behave like that?

And what is the "external actor"? OS is not an external actor?

I could not get the problem you want to solve with this property - I
looked at cover letter and at commit msg.

I can only imagine that you want to keep regulator on, after last its
user disappears... but for what purpose? Do you expect that after system
shutdown the pin will stay high so regulator will be also on? If so, you
need hardware design, e.g. with some pull up (if control is over GPIO).

> 
> That would leave the question of which property takes priority if both 
> regulator-manually-controlled and regulator-boot-on are set -- should 
> the binding document the answer to that?  (I personally don't have a 
> strong opinion on which it should be.)


Best regards,
Krzysztof
Zev Weiss Oct. 28, 2022, 4:12 a.m. UTC | #6
On Thu, Oct 27, 2022 at 06:22:10PM PDT, Krzysztof Kozlowski wrote:
>On 27/10/2022 14:42, Zev Weiss wrote:
>> On Thu, Sep 29, 2022 at 02:27:20PM PDT, Zev Weiss wrote:
>>> On Thu, Sep 29, 2022 at 02:07:14PM PDT, Rob Herring wrote:
>>>> On Sun, Sep 25, 2022 at 03:03:18PM -0700, Zev Weiss wrote:
>>>>> This describes a power output supplied by a regulator, such as a
>>>>> power outlet on a power distribution unit (PDU).
>>>>>
>>>>> Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
>>>>> ---
>>>>> .../bindings/regulator/regulator-output.yaml  | 47 +++++++++++++++++++
>>>>> 1 file changed, 47 insertions(+)
>>>>> create mode 100644 Documentation/devicetree/bindings/regulator/regulator-output.yaml
>>>>>
>>>>> diff --git a/Documentation/devicetree/bindings/regulator/regulator-output.yaml b/Documentation/devicetree/bindings/regulator/regulator-output.yaml
>>>>> new file mode 100644
>>>>> index 000000000000..40953ec48e9e
>>>>> --- /dev/null
>>>>> +++ b/Documentation/devicetree/bindings/regulator/regulator-output.yaml
>>>>> @@ -0,0 +1,47 @@
>>>>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>>>>> +%YAML 1.2
>>>>> +---
>>>>> +
>>>>> +$id: http://devicetree.org/schemas/regulator/regulator-output.yaml#
>>>>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>>>>> +
>>>>> +title: Regulator output connector
>>>>> +
>>>>> +maintainers:
>>>>> +  - Zev Weiss <zev@bewilderbeest.net>
>>>>> +
>>>>> +description: |
>>>>> +  This describes a power output connector supplied by a regulator,
>>>>> +  such as a power outlet on a power distribution unit (PDU).  The
>>>>> +  connector may be standalone or merely one channel or set of pins
>>>>> +  within a ganged physical connector carrying multiple independent
>>>>> +  power outputs.
>>>>> +
>>>>> +properties:
>>>>> +  compatible:
>>>>> +    const: regulator-output
>>>>> +
>>>>> +  vout-supply:
>>>>> +    description:
>>>>> +      Phandle of the regulator supplying the output.
>>>>> +
>>>>> +  regulator-leave-on:
>>>>> +    description: |
>>>>> +      If the regulator is enabled when software relinquishes control
>>>>> +      of it (such as when shutting down) it should be left enabled
>>>>> +      instead of being turned off.
>>>>> +    type: boolean
>>>>
>>>> I'm not too sure about this one as there could be various times when
>>>> control is relinquished. It is userspace closing its access?
>>>> driver unbind? module unload? Does a bootloader pay attention to this?
>>>>
>>>> Rob
>>>
>>> Thanks for the feedback, Rob -- I'll admit I was a bit unsure how to
>>> approach that, and this may well not be the right answer.  What I'm
>>> really aiming for is an appropriate way to express that regulator
>>> on/off state should only ever be changed by explicit (external, e.g.
>>> userspace) request, never as any sort of default/automatic action.
>>> The two obvious things to guard against there seem to be automatic
>>> enablement during initialization and automatic disablement on de-init
>>> (shutdown, unbind, etc.).  The former I think can be avoided by simply
>>> not setting regulator-boot-on, so I added this as a corresponding
>>> property to avoid the latter.
>>>
>>> I'm definitely open to suggestions for a better approach though.
>>>
>>
>> Ping...
>>
>> Would something like this be preferable as a more direct description of
>> that?
>>
>>    regulator-manually-controlled:
>>      description: |
>>        The regulator should never be enabled or disabled automatically,
>>        only when explicitly requested by an external actor (e.g.
>>        userspace).
>>      type: boolean
>
>This looks like putting policy and OS behavior into DT.

I can see why it might look that way, but I'd argue it's actually not.  
The systems this is intended to support provide power to entirely 
separate external devices -- think of a power distribution unit that 
might have arbitrary things plugged into it.  It seems to me like a 
property of the hardware that those things shouldn't have their power 
supply turned off (or on) just because a controller in the PDU rebooted.

>I guess it easy
>to understand in case of Linux which disables unclaimed regulators
>during. But what if other system/firmware does not behave like that?
>

In this case, then no change would be needed -- a system that (unlike 
Linux) doesn't twiddle regulator state on its own would just continue to 
not do that.

>And what is the "external actor"? OS is not an external actor?

It's admittedly a bit vague, but I couldn't think of a clearer way to 
express what is a sort of nebulous concept -- essentially, some entity 
outside the "driver" (or analogous software component) using the 
information in the device-tree.  In many common cases this would 
essentially mean "a human user", since in the PDU-like systems I'm 
targeting here the only thing that should ever be deciding to turn the 
regulator on or off is an operator logged in to the system to manually 
enable or disable an outlet.  I was aiming to leave the wording a bit 
more general though, since in some other context I could imagine some 
other piece of software toggling things automatedly (e.g. lights getting 
turned on and off on a schedule or something, if that's what happens to 
be plugged in).

>
>I could not get the problem you want to solve with this property - I
>looked at cover letter and at commit msg.
>

The problem is that a driver deciding on its own to enable or disable 
the regulator (e.g. during boot or shutdown) would be a critical failure 
for the kind of systems I'm aiming to support.

>I can only imagine that you want to keep regulator on, after last its
>user disappears... but for what purpose? Do you expect that after system
>shutdown the pin will stay high so regulator will be also on? If so, you
>need hardware design, e.g. with some pull up (if control is over GPIO).
>

As described above, the regulators involved here (in these sorts of 
PDU-like systems) provide power for external systems and devices.  It is 
critical that the controller's boot and shutdown sequences not alter the 
state of the regulator.

If some additional concrete details would help clarify, the particular 
system I'm working on at the moment is the Delta Power AHE-50DC [0].  It 
has two redundant BMCs controlling 50 power outputs, each of which is 
managed by an LM25066 [1] attached to the controllers via I2C.  The 
LM25066s maintain their power state independently of the controllers 
booting or shutting down, and it's very important that if one controller 
reboots (for a firmware update, say) that it not send I2C commands to 
all the LM25066s telling them to turn off their outputs.

[0] https://www.open19.org/marketplace/delta-16kw-power-shelf/
[1] https://www.ti.com/lit/ds/symlink/lm25066.pdf


Thanks,
Zev
Mark Brown Oct. 28, 2022, 3:51 p.m. UTC | #7
On Thu, Oct 27, 2022 at 09:12:22PM -0700, Zev Weiss wrote:

> I can see why it might look that way, but I'd argue it's actually not.  The
> systems this is intended to support provide power to entirely separate
> external devices -- think of a power distribution unit that might have
> arbitrary things plugged into it.  It seems to me like a property of the
> hardware that those things shouldn't have their power supply turned off (or
> on) just because a controller in the PDU rebooted.

We don't turn things off on reboot?  We don't do anything in particular
on reboot...

> > I guess it easy
> > to understand in case of Linux which disables unclaimed regulators
> > during. But what if other system/firmware does not behave like that?

> In this case, then no change would be needed -- a system that (unlike Linux)
> doesn't twiddle regulator state on its own would just continue to not do
> that.

We don't turn unclaimed regulators off until userspace has had a chance
to start, if there's some problem with system integrators arranging to
do this we can look into how that works, for example making the delay
tunable.  I don't think this is really meaningfully different from a
driver deciding to turn things off from a binding point of view.

> > And what is the "external actor"? OS is not an external actor?

> It's admittedly a bit vague, but I couldn't think of a clearer way to
> express what is a sort of nebulous concept -- essentially, some entity
> outside the "driver" (or analogous software component) using the information
> in the device-tree.  In many common cases this would essentially mean "a
> human user", since in the PDU-like systems I'm targeting here the only thing
> that should ever be deciding to turn the regulator on or off is an operator
> logged in to the system to manually enable or disable an outlet.  I was
> aiming to leave the wording a bit more general though, since in some other
> context I could imagine some other piece of software toggling things
> automatedly (e.g. lights getting turned on and off on a schedule or
> something, if that's what happens to be plugged in).

This is policy stuff, it doesn't translate into DTs at all.

> > I could not get the problem you want to solve with this property - I
> > looked at cover letter and at commit msg.

> The problem is that a driver deciding on its own to enable or disable the
> regulator (e.g. during boot or shutdown) would be a critical failure for the
> kind of systems I'm aiming to support.

If the driver is doing something like this it should be addressed in the
driver.

> > I can only imagine that you want to keep regulator on, after last its
> > user disappears... but for what purpose? Do you expect that after system
> > shutdown the pin will stay high so regulator will be also on? If so, you
> > need hardware design, e.g. with some pull up (if control is over GPIO).

> As described above, the regulators involved here (in these sorts of PDU-like
> systems) provide power for external systems and devices.  It is critical
> that the controller's boot and shutdown sequences not alter the state of the
> regulator.

This really sounds like a full stack system integration problem, not
something that can be resolved with one software component.
Zev Weiss Oct. 28, 2022, 7:44 p.m. UTC | #8
On Fri, Oct 28, 2022 at 08:51:54AM PDT, Mark Brown wrote:
>On Thu, Oct 27, 2022 at 09:12:22PM -0700, Zev Weiss wrote:
>
>> I can see why it might look that way, but I'd argue it's actually not.  The
>> systems this is intended to support provide power to entirely separate
>> external devices -- think of a power distribution unit that might have
>> arbitrary things plugged into it.  It seems to me like a property of the
>> hardware that those things shouldn't have their power supply turned off (or
>> on) just because a controller in the PDU rebooted.
>
>We don't turn things off on reboot?  We don't do anything in particular
>on reboot...
>

Okay, perhaps not on reboot specifically, but the userspace-consumer 
driver has a regulator_bulk_disable() in its .remove function, so it 
would be triggered at least by a module unload (which is sort of why I 
ended up with the "when software relinquishes control" wording in the 
patch).  If we're going to continue with the plan of using that driver 
for this functionality (which seems overall quite reasonable to me), we 
need a way to express that that must not happen on this hardware.


Thanks,
Zev
Mark Brown Oct. 31, 2022, 3:45 p.m. UTC | #9
On Fri, Oct 28, 2022 at 12:44:50PM -0700, Zev Weiss wrote:
> On Fri, Oct 28, 2022 at 08:51:54AM PDT, Mark Brown wrote:

> > We don't turn things off on reboot?  We don't do anything in particular
> > on reboot...

> Okay, perhaps not on reboot specifically, but the userspace-consumer driver
> has a regulator_bulk_disable() in its .remove function, so it would be
> triggered at least by a module unload (which is sort of why I ended up with
> the "when software relinquishes control" wording in the patch).  If we're
> going to continue with the plan of using that driver for this functionality
> (which seems overall quite reasonable to me), we need a way to express that
> that must not happen on this hardware.

Ah, that would be the test driver not intended to be used in production
then...  That shouldn't be a blocker for the DT binding, and if there's
a different compatible string for this application then we can either
make the userspace consumer do something different based on that
compatible string or have a new driver which does something more
sensible and perhaps has a better userspace ABI.  Either way so long as
we can tell the thing being described is a BMC output from the DT
binding I think we can leave it up to the OS to do something constructive
with that rather than trying to control the specific behaviour in the
binding.
Zev Weiss Oct. 31, 2022, 6:50 p.m. UTC | #10
On Mon, Oct 31, 2022 at 08:45:34AM PDT, Mark Brown wrote:
>On Fri, Oct 28, 2022 at 12:44:50PM -0700, Zev Weiss wrote:
>> On Fri, Oct 28, 2022 at 08:51:54AM PDT, Mark Brown wrote:
>
>> > We don't turn things off on reboot?  We don't do anything in particular
>> > on reboot...
>
>> Okay, perhaps not on reboot specifically, but the userspace-consumer driver
>> has a regulator_bulk_disable() in its .remove function, so it would be
>> triggered at least by a module unload (which is sort of why I ended up with
>> the "when software relinquishes control" wording in the patch).  If we're
>> going to continue with the plan of using that driver for this functionality
>> (which seems overall quite reasonable to me), we need a way to express that
>> that must not happen on this hardware.
>
>Ah, that would be the test driver not intended to be used in production
>then...  That shouldn't be a blocker for the DT binding, and if there's
>a different compatible string for this application then we can either
>make the userspace consumer do something different based on that
>compatible string or have a new driver which does something more
>sensible and perhaps has a better userspace ABI.  Either way so long as
>we can tell the thing being described is a BMC output from the DT
>binding I think we can leave it up to the OS to do something constructive
>with that rather than trying to control the specific behaviour in the
>binding.

Ah, alright -- that seems like a nice (obvious in retrospect, of course) 
solution that should work well I think.  I'll post a v2 with that 
approach soon.


Thanks,
Zev
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/regulator/regulator-output.yaml b/Documentation/devicetree/bindings/regulator/regulator-output.yaml
new file mode 100644
index 000000000000..40953ec48e9e
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/regulator-output.yaml
@@ -0,0 +1,47 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+
+$id: http://devicetree.org/schemas/regulator/regulator-output.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Regulator output connector
+
+maintainers:
+  - Zev Weiss <zev@bewilderbeest.net>
+
+description: |
+  This describes a power output connector supplied by a regulator,
+  such as a power outlet on a power distribution unit (PDU).  The
+  connector may be standalone or merely one channel or set of pins
+  within a ganged physical connector carrying multiple independent
+  power outputs.
+
+properties:
+  compatible:
+    const: regulator-output
+
+  vout-supply:
+    description:
+      Phandle of the regulator supplying the output.
+
+  regulator-leave-on:
+    description: |
+      If the regulator is enabled when software relinquishes control
+      of it (such as when shutting down) it should be left enabled
+      instead of being turned off.
+    type: boolean
+
+required:
+  - compatible
+  - vout-supply
+
+additionalProperties: false
+
+examples:
+  - |
+      output {
+          compatible = "regulator-output";
+          vout-supply = <&output_reg>;
+          regulator-leave-on;
+      };