diff mbox series

[2/6] dt-bindings: regulator: Add reg-external-output binding

Message ID 20220504065252.6955-2-zev@bewilderbeest.net
State New
Headers show
Series regulator: core: Add support for external outputs | expand

Commit Message

Zev Weiss May 4, 2022, 6:52 a.m. UTC
This describes an external output supplied by a regulator, such as a
power outlet on a power distribution unit (PDU).

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

Comments

Mark Brown May 4, 2022, 12:55 p.m. UTC | #1
On Tue, May 03, 2022 at 11:52:48PM -0700, Zev Weiss wrote:
> This describes an external output supplied by a regulator, such as a
> power outlet on a power distribution unit (PDU).

OK, so this is that represnetation of the connection - which raises the
question about why the regulator needs a property?

> +description: |
> +  This describes an external output supplied by a regulator, such as
> +  a power outlet on a power distribution unit (PDU).
> +
> +properties:
> +  compatible:
> +    const: reg-external-output
> +
> +  vout-supply:
> +    description:
> +      Phandle of the regulator supplying the output, which should have
> +      the regulator-external-output property.
> +
> +required:

I think at a minimum anything like this would need some sort of
representation of how the output physically appears so that people can
work out how outputs are mapped to the hardware they see.  However we
already have a subsystem for external connectors - extcon.  Perhaps this
should be a regulator client in the extcon API?  It's common for
connectors to include some sort of power provision so it seems like this
would fit right in.
Zev Weiss May 4, 2022, 8:33 p.m. UTC | #2
On Wed, May 04, 2022 at 05:55:53AM PDT, Mark Brown wrote:
>On Tue, May 03, 2022 at 11:52:48PM -0700, Zev Weiss wrote:
>> This describes an external output supplied by a regulator, such as a
>> power outlet on a power distribution unit (PDU).
>
>OK, so this is that represnetation of the connection - which raises the
>question about why the regulator needs a property?
>
>> +description: |
>> +  This describes an external output supplied by a regulator, such as
>> +  a power outlet on a power distribution unit (PDU).
>> +
>> +properties:
>> +  compatible:
>> +    const: reg-external-output
>> +
>> +  vout-supply:
>> +    description:
>> +      Phandle of the regulator supplying the output, which should have
>> +      the regulator-external-output property.
>> +
>> +required:
>
>I think at a minimum anything like this would need some sort of
>representation of how the output physically appears so that people can
>work out how outputs are mapped to the hardware they see.

I don't quite understand what you're describing here -- could you 
elaborate on what you mean by "how the output physically appears", and 
what that might look like in a DT binding?

>However we
>already have a subsystem for external connectors - extcon.  Perhaps this
>should be a regulator client in the extcon API?  It's common for
>connectors to include some sort of power provision so it seems like this
>would fit right in.

Interesting -- I wasn't previously aware of the extcon subsystem, thanks 
for the pointer.  However, after looking at it a bit, I'm not sure I see 
how it'd be applicable here, since it looks like it's built to handle 
hardware that's at least sophisticated enough for software to tell 
whether or not something's plugged in, which isn't the case here.  The 
connector is just a ground pin and +12VDC pin, no presence-detection 
mechanism or anything else.  Outside of the regulator itself there's 
really no "device" there for software to talk to or otherwise interact 
with at all.


Thanks,
Zev
Mark Brown May 4, 2022, 8:49 p.m. UTC | #3
On Wed, May 04, 2022 at 01:33:58PM -0700, Zev Weiss wrote:
> On Wed, May 04, 2022 at 05:55:53AM PDT, Mark Brown wrote:

> > I think at a minimum anything like this would need some sort of
> > representation of how the output physically appears so that people can
> > work out how outputs are mapped to the hardware they see.

> I don't quite understand what you're describing here -- could you elaborate
> on what you mean by "how the output physically appears", and what that might
> look like in a DT binding?

For example if the output comes out on a socket then that socket should
be described.

> > However we
> > already have a subsystem for external connectors - extcon.  Perhaps this
> > should be a regulator client in the extcon API?  It's common for
> > connectors to include some sort of power provision so it seems like this
> > would fit right in.

> Interesting -- I wasn't previously aware of the extcon subsystem, thanks for
> the pointer.  However, after looking at it a bit, I'm not sure I see how
> it'd be applicable here, since it looks like it's built to handle hardware
> that's at least sophisticated enough for software to tell whether or not
> something's plugged in, which isn't the case here.  The connector is just a
> ground pin and +12VDC pin, no presence-detection mechanism or anything else.
> Outside of the regulator itself there's really no "device" there for
> software to talk to or otherwise interact with at all.

Sure, but there's no reason why it can't scale down to something
simpler.  It's easier to support something simpler than have to extend
to support something more complicated.
Zev Weiss May 4, 2022, 9:35 p.m. UTC | #4
[Adding extcon maintainers...]

On Wed, May 04, 2022 at 01:49:12PM PDT, Mark Brown wrote:
>On Wed, May 04, 2022 at 01:33:58PM -0700, Zev Weiss wrote:
>> On Wed, May 04, 2022 at 05:55:53AM PDT, Mark Brown wrote:
>
>> > I think at a minimum anything like this would need some sort of
>> > representation of how the output physically appears so that people can
>> > work out how outputs are mapped to the hardware they see.
>
>> I don't quite understand what you're describing here -- could you elaborate
>> on what you mean by "how the output physically appears", and what that might
>> look like in a DT binding?
>
>For example if the output comes out on a socket then that socket should
>be described.
>

Okay -- in the case of an Open19 power shelf like the ahe-50dc, there 
are 50 instances of this, 48 of which are in four ganged connectors each 
with 12 pairs of pins, but two of which have their own dedicated little 
individual sockets.  The connectors are physically different, but 
they're all identical as far as software is concerned, so I'm not clear 
on why it would need to be expressed in any DT properties or the like.  
Or did you just mean explanatory free-form text in the description 
field?

>> > However we
>> > already have a subsystem for external connectors - extcon.  Perhaps this
>> > should be a regulator client in the extcon API?  It's common for
>> > connectors to include some sort of power provision so it seems like this
>> > would fit right in.
>
>> Interesting -- I wasn't previously aware of the extcon subsystem, thanks for
>> the pointer.  However, after looking at it a bit, I'm not sure I see how
>> it'd be applicable here, since it looks like it's built to handle hardware
>> that's at least sophisticated enough for software to tell whether or not
>> something's plugged in, which isn't the case here.  The connector is just a
>> ground pin and +12VDC pin, no presence-detection mechanism or anything else.
>> Outside of the regulator itself there's really no "device" there for
>> software to talk to or otherwise interact with at all.
>
>Sure, but there's no reason why it can't scale down to something
>simpler.  It's easier to support something simpler than have to extend
>to support something more complicated.

Alright, so would you suggest creating something like 
drivers/extcon/extcon-regulator-output.c, and just having its extcon 
functionality be something of a stub for now?


Thanks,
Zev
Mark Brown May 5, 2022, 12:05 p.m. UTC | #5
On Wed, May 04, 2022 at 02:35:08PM -0700, Zev Weiss wrote:
> On Wed, May 04, 2022 at 01:49:12PM PDT, Mark Brown wrote:

> > For example if the output comes out on a socket then that socket should
> > be described.

> Okay -- in the case of an Open19 power shelf like the ahe-50dc, there are 50
> instances of this, 48 of which are in four ganged connectors each with 12
> pairs of pins, but two of which have their own dedicated little individual
> sockets.  The connectors are physically different, but they're all identical
> as far as software is concerned, so I'm not clear on why it would need to be
> expressed in any DT properties or the like.  Or did you just mean
> explanatory free-form text in the description field?

Explanatory description would be one example of something that should be
described, yes - if there is control for switching the supplies on and
off the user is going to need to be able to figure out which software
control corresponds to which physical connection.  Other devices may
have more things that need autoamtion (eg, jack detection).

> > Sure, but there's no reason why it can't scale down to something
> > simpler.  It's easier to support something simpler than have to extend
> > to support something more complicated.

> Alright, so would you suggest creating something like
> drivers/extcon/extcon-regulator-output.c, and just having its extcon
> functionality be something of a stub for now?

I'm not super familiar with extcon but that seems plausible.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/regulator/reg-external-output.yaml b/Documentation/devicetree/bindings/regulator/reg-external-output.yaml
new file mode 100644
index 000000000000..c00bee5bd9f2
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/reg-external-output.yaml
@@ -0,0 +1,37 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+
+$id: http://devicetree.org/schemas/regulator/reg-external-output.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Regulator external output
+
+maintainers:
+  - Zev Weiss <zev@bewilderbeest.net>
+
+description: |
+  This describes an external output supplied by a regulator, such as
+  a power outlet on a power distribution unit (PDU).
+
+properties:
+  compatible:
+    const: reg-external-output
+
+  vout-supply:
+    description:
+      Phandle of the regulator supplying the output, which should have
+      the regulator-external-output property.
+
+required:
+  - compatible
+  - vout-supply
+
+additionalProperties: false
+
+examples:
+  - |
+      output {
+          compatible = "reg-external-output";
+          vout-supply = <&output_reg>;
+      };