[PATCH v2 11/11] dt-bindings: leds: aw200xx: fix led pattern and add reg constraints

Dmitry Rokosov posted 11 patches 2 years, 1 month ago
There is a newer version of this series
[PATCH v2 11/11] dt-bindings: leds: aw200xx: fix led pattern and add reg constraints
Posted by Dmitry Rokosov 2 years, 1 month ago
AW200XX controllers have the capability to declare more than 0xf LEDs,
therefore, it is necessary to accept LED names using an appropriate
regex pattern.

The register offsets can be adjusted within the specified range, with
the maximum value corresponding to the highest number of LEDs that can
be connected to the controller.

Fixes: e338a05e76ca ("dt-bindings: leds: Add binding for AW200xx")
Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com>
---
 .../devicetree/bindings/leds/awinic,aw200xx.yaml       | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/leds/awinic,aw200xx.yaml b/Documentation/devicetree/bindings/leds/awinic,aw200xx.yaml
index efb18ddce383..677c73aa6232 100644
--- a/Documentation/devicetree/bindings/leds/awinic,aw200xx.yaml
+++ b/Documentation/devicetree/bindings/leds/awinic,aw200xx.yaml
@@ -42,16 +42,18 @@ properties:
     maxItems: 1
 
 patternProperties:
-  "^led@[0-9a-f]$":
+  "^led@[0-9a-f]+$":
     type: object
     $ref: common.yaml#
     unevaluatedProperties: false
 
     properties:
       reg:
-        description:
-          LED number
-        maxItems: 1
+        items:
+          description:
+            LED number
+          minimum: 0
+          maximum: 108
 
       led-max-microamp:
         default: 9780
-- 
2.36.0
Re: [PATCH v2 11/11] dt-bindings: leds: aw200xx: fix led pattern and add reg constraints
Posted by Conor Dooley 2 years, 1 month ago
On Wed, Oct 18, 2023 at 09:29:43PM +0300, Dmitry Rokosov wrote:
> AW200XX controllers have the capability to declare more than 0xf LEDs,
> therefore, it is necessary to accept LED names using an appropriate
> regex pattern.
> 
> The register offsets can be adjusted within the specified range, with
> the maximum value corresponding to the highest number of LEDs that can
> be connected to the controller.

Do all of these controllers have identical max numbers of LEDs?

Cheers,
Conor.

> 
> Fixes: e338a05e76ca ("dt-bindings: leds: Add binding for AW200xx")
> Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com>
> ---
>  .../devicetree/bindings/leds/awinic,aw200xx.yaml       | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/leds/awinic,aw200xx.yaml b/Documentation/devicetree/bindings/leds/awinic,aw200xx.yaml
> index efb18ddce383..677c73aa6232 100644
> --- a/Documentation/devicetree/bindings/leds/awinic,aw200xx.yaml
> +++ b/Documentation/devicetree/bindings/leds/awinic,aw200xx.yaml
> @@ -42,16 +42,18 @@ properties:
>      maxItems: 1
>  
>  patternProperties:
> -  "^led@[0-9a-f]$":
> +  "^led@[0-9a-f]+$":
>      type: object
>      $ref: common.yaml#
>      unevaluatedProperties: false
>  
>      properties:
>        reg:
> -        description:
> -          LED number
> -        maxItems: 1
> +        items:
> +          description:
> +            LED number
> +          minimum: 0
> +          maximum: 108
>  
>        led-max-microamp:
>          default: 9780
> -- 
> 2.36.0
> 
Re: [PATCH v2 11/11] dt-bindings: leds: aw200xx: fix led pattern and add reg constraints
Posted by Dmitry Rokosov 2 years, 1 month ago
On Thu, Oct 19, 2023 at 03:08:38PM +0100, Conor Dooley wrote:
> On Wed, Oct 18, 2023 at 09:29:43PM +0300, Dmitry Rokosov wrote:
> > AW200XX controllers have the capability to declare more than 0xf LEDs,
> > therefore, it is necessary to accept LED names using an appropriate
> > regex pattern.
> > 
> > The register offsets can be adjusted within the specified range, with
> > the maximum value corresponding to the highest number of LEDs that can
> > be connected to the controller.
> 
> Do all of these controllers have identical max numbers of LEDs?

Nope... I believe you are hinting at some conditional logic based on the
value of 'compatible'. I will figure it out and send the appropriate
implementation in the next version.

> > 
> > Fixes: e338a05e76ca ("dt-bindings: leds: Add binding for AW200xx")
> > Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com>
> > ---
> >  .../devicetree/bindings/leds/awinic,aw200xx.yaml       | 10 ++++++----
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/leds/awinic,aw200xx.yaml b/Documentation/devicetree/bindings/leds/awinic,aw200xx.yaml
> > index efb18ddce383..677c73aa6232 100644
> > --- a/Documentation/devicetree/bindings/leds/awinic,aw200xx.yaml
> > +++ b/Documentation/devicetree/bindings/leds/awinic,aw200xx.yaml
> > @@ -42,16 +42,18 @@ properties:
> >      maxItems: 1
> >  
> >  patternProperties:
> > -  "^led@[0-9a-f]$":
> > +  "^led@[0-9a-f]+$":
> >      type: object
> >      $ref: common.yaml#
> >      unevaluatedProperties: false
> >  
> >      properties:
> >        reg:
> > -        description:
> > -          LED number
> > -        maxItems: 1
> > +        items:
> > +          description:
> > +            LED number
> > +          minimum: 0
> > +          maximum: 108
> >  
> >        led-max-microamp:
> >          default: 9780
> > -- 
> > 2.36.0
> > 



-- 
Thank you,
Dmitry