diff mbox series

[net-next,v3,1/4] dt-bindings: net: phy: Document new LEDs active-low property

Message ID 20231213111322.6152-1-ansuelsmth@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v3,1/4] dt-bindings: net: phy: Document new LEDs active-low property | expand

Checks

Context Check Description
netdev/series_format warning Series does not have a cover letter
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/cc_maintainers success CCed 12 of 12 maintainers
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 37 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Christian Marangi Dec. 13, 2023, 11:13 a.m. UTC
Document new LEDs active-low property to define if the LED require to be
set low to be turned on.

active-low can be defined in the leds node for PHY that apply the LED
polarity globally for each attached LED or in the specific led node for
PHY that supports setting the LED polarity per LED.

Declaring both way is not supported and will result in the schema
getting rejected.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
Changes v3:
- Out of RFC
Changes v2:
- Add this patch

 .../devicetree/bindings/net/ethernet-phy.yaml | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)

Comments

Rob Herring Dec. 15, 2023, 1:48 p.m. UTC | #1
On Wed, Dec 13, 2023 at 12:13:19PM +0100, Christian Marangi wrote:
> Document new LEDs active-low property to define if the LED require to be
> set low to be turned on.
> 
> active-low can be defined in the leds node for PHY that apply the LED
> polarity globally for each attached LED or in the specific led node for
> PHY that supports setting the LED polarity per LED.
> 
> Declaring both way is not supported and will result in the schema
> getting rejected.
> 
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> ---
> Changes v3:
> - Out of RFC
> Changes v2:
> - Add this patch
> 
>  .../devicetree/bindings/net/ethernet-phy.yaml | 20 +++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/net/ethernet-phy.yaml b/Documentation/devicetree/bindings/net/ethernet-phy.yaml
> index 8fb2a6ee7e5b..9cb3981fed2a 100644
> --- a/Documentation/devicetree/bindings/net/ethernet-phy.yaml
> +++ b/Documentation/devicetree/bindings/net/ethernet-phy.yaml
> @@ -213,6 +213,11 @@ properties:
>        '#size-cells':
>          const: 0
>  
> +      'active-low':

Don't need quotes.

I think this should just be per LED. If the h/w only supports a global 
setting, then they all should match.

> +        type: boolean
> +        description:
> +          This define whether all LEDs needs to be low to be turned on.
> +
>      patternProperties:
>        '^led@[a-f0-9]+$':
>          $ref: /schemas/leds/common.yaml#
> @@ -225,11 +230,26 @@ properties:
>                driver dependent and required for ports that define multiple
>                LED for the same port.
>  
> +          'active-low':
> +            type: boolean
> +            description:
> +              This define whether the LED needs to be low to be turned on.
> +
>          required:
>            - reg
>  
>          unevaluatedProperties: false
>  
> +    allOf:
> +      - if:
> +          required:
> +            - active-low
> +        then:
> +          patternProperties:
> +            '^led@[a-f0-9]+$':
> +              properties:
> +                'active-low': false
> +
>      additionalProperties: false
>  
>  required:
> -- 
> 2.40.1
>
Christian Marangi Dec. 15, 2023, 2:24 p.m. UTC | #2
On Fri, Dec 15, 2023 at 04:48:35PM +0100, Krzysztof Kozlowski wrote:
> On 13/12/2023 12:13, Christian Marangi wrote:
> > Document new LEDs active-low property to define if the LED require to be
> > set low to be turned on.
> > 
> > active-low can be defined in the leds node for PHY that apply the LED
> > polarity globally for each attached LED or in the specific led node for
> > PHY that supports setting the LED polarity per LED.
> > 
> > Declaring both way is not supported and will result in the schema
> > getting rejected.
> > 
> > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> > ---
> > Changes v3:
> > - Out of RFC
> > Changes v2:
> > - Add this patch
> > 
> >  .../devicetree/bindings/net/ethernet-phy.yaml | 20 +++++++++++++++++++
> >  1 file changed, 20 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/net/ethernet-phy.yaml b/Documentation/devicetree/bindings/net/ethernet-phy.yaml
> > index 8fb2a6ee7e5b..9cb3981fed2a 100644
> > --- a/Documentation/devicetree/bindings/net/ethernet-phy.yaml
> > +++ b/Documentation/devicetree/bindings/net/ethernet-phy.yaml
> > @@ -213,6 +213,11 @@ properties:
> >        '#size-cells':
> >          const: 0
> >  
> > +      'active-low':
> 
> Drop quotes, no need for them.
> 
> As pointed out in other patchset, bool might not be enough.
> https://lore.kernel.org/all/74cb1d1c-64b8-4fb0-9e6d-c2fad8417232@lunn.ch/
> Anyway, both cases probably needs to be considered here.
>

Hi, thanks for pointing me to that series. Leaved some message there,
would love if you can check some ideas on how to handle the LED
polarity thing DT wise.
Krzysztof Kozlowski Dec. 15, 2023, 3:48 p.m. UTC | #3
On 13/12/2023 12:13, Christian Marangi wrote:
> Document new LEDs active-low property to define if the LED require to be
> set low to be turned on.
> 
> active-low can be defined in the leds node for PHY that apply the LED
> polarity globally for each attached LED or in the specific led node for
> PHY that supports setting the LED polarity per LED.
> 
> Declaring both way is not supported and will result in the schema
> getting rejected.
> 
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> ---
> Changes v3:
> - Out of RFC
> Changes v2:
> - Add this patch
> 
>  .../devicetree/bindings/net/ethernet-phy.yaml | 20 +++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/net/ethernet-phy.yaml b/Documentation/devicetree/bindings/net/ethernet-phy.yaml
> index 8fb2a6ee7e5b..9cb3981fed2a 100644
> --- a/Documentation/devicetree/bindings/net/ethernet-phy.yaml
> +++ b/Documentation/devicetree/bindings/net/ethernet-phy.yaml
> @@ -213,6 +213,11 @@ properties:
>        '#size-cells':
>          const: 0
>  
> +      'active-low':

Drop quotes, no need for them.

As pointed out in other patchset, bool might not be enough.
https://lore.kernel.org/all/74cb1d1c-64b8-4fb0-9e6d-c2fad8417232@lunn.ch/
Anyway, both cases probably needs to be considered here.

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/net/ethernet-phy.yaml b/Documentation/devicetree/bindings/net/ethernet-phy.yaml
index 8fb2a6ee7e5b..9cb3981fed2a 100644
--- a/Documentation/devicetree/bindings/net/ethernet-phy.yaml
+++ b/Documentation/devicetree/bindings/net/ethernet-phy.yaml
@@ -213,6 +213,11 @@  properties:
       '#size-cells':
         const: 0
 
+      'active-low':
+        type: boolean
+        description:
+          This define whether all LEDs needs to be low to be turned on.
+
     patternProperties:
       '^led@[a-f0-9]+$':
         $ref: /schemas/leds/common.yaml#
@@ -225,11 +230,26 @@  properties:
               driver dependent and required for ports that define multiple
               LED for the same port.
 
+          'active-low':
+            type: boolean
+            description:
+              This define whether the LED needs to be low to be turned on.
+
         required:
           - reg
 
         unevaluatedProperties: false
 
+    allOf:
+      - if:
+          required:
+            - active-low
+        then:
+          patternProperties:
+            '^led@[a-f0-9]+$':
+              properties:
+                'active-low': false
+
     additionalProperties: false
 
 required: