mbox series

[v2,0/4] leds: bcm63138: Add some new bindings and code

Message ID 20240928-bcm63138-leds-v2-0-f6aa4d4d6ef2@linaro.org
Headers show
Series leds: bcm63138: Add some new bindings and code | expand

Message

Linus Walleij Sept. 27, 2024, 10:29 p.m. UTC
This brings over the few know-how items and little things
I found about the BCMBCA LEDs in my previous duplicate driver.

This was tested on the BCM6846-based Genexis XG6846B.

The main addition is the ability to define the number shifting
bits in the serial shift register which is necessary if the
previous boot stages have not set up the hardware properly
before.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
Changes in v2:
- Drop the u32 $ref in the schema, -bits is a standard suffix.
- Fix algorithm for shift register configuration.
- Fix spelling errors and numbering errors.
- Link to v1: https://lore.kernel.org/r/20240920-bcm63138-leds-v1-0-c150871324a0@linaro.org

---
Linus Walleij (4):
      dt-bindings: leds: bcm63138: Add shift register bits
      leds: bcm63138: Use scopes and guards
      leds: bcm63138: Handle shift register config
      leds: bcm63138: Add some register defines

 .../devicetree/bindings/leds/leds-bcm63138.yaml    | 12 ++++++++++
 drivers/leds/blink/leds-bcm63138.c                 | 28 ++++++++++++----------
 2 files changed, 28 insertions(+), 12 deletions(-)
---
base-commit: 5724faee6be4109d7a3168625357e4127f42b5d2
change-id: 20240920-bcm63138-leds-1bc5f41c47cd

Best regards,

Comments

Krzysztof Kozlowski Sept. 28, 2024, 8:05 a.m. UTC | #1
On Sat, Sep 28, 2024 at 12:29:47AM +0200, Linus Walleij wrote:
> The BCM63138 family of serial LED controllers has a register
> where we can set up bits for the shift registers. These are
> the number of rounds the bits need to be shifted before all
> bits have been shifted through the external shift registers.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> ChangeLog v1->v2:
> - Drop the $ref to u32 since the new property is suffixed
>   with "-bits" and thus get standard treatment.
> ---
>  Documentation/devicetree/bindings/leds/leds-bcm63138.yaml | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/leds/leds-bcm63138.yaml b/Documentation/devicetree/bindings/leds/leds-bcm63138.yaml
> index bb20394fca5c..b3d530c46061 100644
> --- a/Documentation/devicetree/bindings/leds/leds-bcm63138.yaml
> +++ b/Documentation/devicetree/bindings/leds/leds-bcm63138.yaml
> @@ -41,6 +41,17 @@ properties:
>    "#size-cells":
>      const: 0
>  
> +  brcm,serial-shift-bits:

bits is an uint32-array, so you need to limit number of items, e.g.
items:
 - minimum: 1
   maximum: 32

default: [0]? or something else?

> +    minimum: 1
> +    maximum: 32
> +    description:
> +      This describes the number of 8-bit serial shifters
> +      connected to the LED controller block. The hardware
> +      is typically using 8-bit shift registers with 8 LEDs
> +      per shift register, so 4 shifters results in 32 LEDs
> +      or 2 shifters give 16 LEDs etc, but the hardware
> +      supports any odd number of registers.

Best regards,
Krzysztof
Linus Walleij Oct. 1, 2024, 11:18 a.m. UTC | #2
On Sat, Sep 28, 2024 at 10:05 AM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> On Sat, Sep 28, 2024 at 12:29:47AM +0200, Linus Walleij wrote:
> > +  brcm,serial-shift-bits:
>
> bits is an uint32-array, so you need to limit number of items, e.g.
> items:
>  - minimum: 1
>    maximum: 32

OK this is what I do on the next lines:

> > +    minimum: 1
> > +    maximum: 32

Am I doing something wrong here? I see you have a dash
  - minimum in your comment but when I grep through the
existing bindings for stuff ending with -bits it seems they
do what I do.

> default: [0]? or something else?

Since we need to stay compatible with older device trees
the default is whatever is in the hardware after boot :/

I guess I could write something about it in the description.

Yours,
Linus Walleij
Rob Herring (Arm) Oct. 2, 2024, 7:30 p.m. UTC | #3
On Tue, Oct 01, 2024 at 01:18:29PM +0200, Linus Walleij wrote:
> On Sat, Sep 28, 2024 at 10:05 AM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> > On Sat, Sep 28, 2024 at 12:29:47AM +0200, Linus Walleij wrote:
> > > +  brcm,serial-shift-bits:
> >
> > bits is an uint32-array, so you need to limit number of items, e.g.
> > items:
> >  - minimum: 1
> >    maximum: 32
> 
> OK this is what I do on the next lines:
> 
> > > +    minimum: 1
> > > +    maximum: 32
> 
> Am I doing something wrong here? I see you have a dash
>   - minimum in your comment but when I grep through the
> existing bindings for stuff ending with -bits it seems they
> do what I do.

All the unit suffixes started as single values, but then we found some 
cases with more than 1 (and even a matrix for opp-hz) and had to extend 
them. 

I think what you have here is fine. We can imply it's 1 entry given the 
scalar constraints.

> 
> > default: [0]? or something else?
> 
> Since we need to stay compatible with older device trees
> the default is whatever is in the hardware after boot :/
> 
> I guess I could write something about it in the description.
> 
> Yours,
> Linus Walleij