lkml.org 
[lkml]   [2019]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC 06/25] dt-bindings: leds: Add Titan Micro Electronics TM1628
    On Thu, Dec 12, 2019 at 04:39:33AM +0100, Andreas Färber wrote:
    > Add a YAML schema binding for TM1628 LED controller.
    >
    > Cc: zypeng@titanmec.com
    > Signed-off-by: Andreas Färber <afaerber@suse.de>
    > ---
    > @Rob: How could we express constraints on two-cell reg value ranges here?

    It's encoded as a matrix, so something like this:

    reg:
    items:
    items:
    - # constraints on 1st cell value
    - # constraints on 2nd cell value


    > Should we also model constraints on reg range by #grids property?

    So the value of #grid defines the max values in reg? Unfortunately,
    we can't yet for json-schema. There's been some proposals, but nothing
    final I think.

    > .../devicetree/bindings/leds/titanmec,tm1628.yaml | 80 ++++++++++++++++++++++
    > 1 file changed, 80 insertions(+)
    > create mode 100644 Documentation/devicetree/bindings/leds/titanmec,tm1628.yaml
    >
    > diff --git a/Documentation/devicetree/bindings/leds/titanmec,tm1628.yaml b/Documentation/devicetree/bindings/leds/titanmec,tm1628.yaml
    > new file mode 100644
    > index 000000000000..024875656e79
    > --- /dev/null
    > +++ b/Documentation/devicetree/bindings/leds/titanmec,tm1628.yaml
    > @@ -0,0 +1,80 @@
    > +# SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause)
    > +%YAML 1.2
    > +---
    > +$id: http://devicetree.org/schemas/leds/titanmec,tm1628.yaml#
    > +$schema: http://devicetree.org/meta-schemas/core.yaml#
    > +
    > +title: Titan Micro Electronics TM1628 LED controller
    > +
    > +maintainers:
    > + - Andreas Färber <afaerber@suse.de>
    > +
    > +properties:
    > + compatible:
    > + enum:
    > + - titanmec,tm1628
    > +
    > + reg:
    > + maxItems: 1
    > +
    > + "#grids":

    I'd be more a fan of using '#' prefix if we'd been better at using it
    when appropriate, so I'd probably drop the '#'.

    > + description: |
    > + Number of GRID output lines to use.
    > + This limits the number of available SEG output lines.
    > + minimum: 4
    > + maximum: 7
    > +
    > + "#address-cells":
    > + const: 2
    > +
    > + "#size-cells":
    > + const: 0
    > +
    > +required:
    > + - compatible
    > + - reg
    > +
    > +patternProperties:
    > + "^.*@[1-7],([1-9]|1[02-4])$":
    > + type: object
    > + description: |
    > + Properties for a single LED.

    Please describe the unit-address format. I assume it's <grid>,<segment>.

    > +
    > + properties:
    > + reg:
    > + description: |
    > + 1-based grid number, followed by 1-based segment number.
    > + maxItems: 1
    > +
    > + linux,default-trigger: true
    > +
    > + required:
    > + - reg
    > +
    > +examples:
    > + - |
    > + #include <dt-bindings/leds/common.h>
    > +
    > + spi {
    > + #address-cells = <1>;
    > + #size-cells = <0>;
    > +
    > + led-controller@0 {
    > + compatible = "titanmec,tm1628";
    > + reg = <0>;
    > + spi-3-wire;
    > + spi-lsb-first;
    > + spi-max-frequency = <500000>;
    > + #grids = <7>;
    > + #address-cells = <2>;
    > + #size-cells = <0>;
    > +
    > + colon@5,4 {
    > + reg = <5 4>;
    > + color = <LED_COLOR_ID_WHITE>;
    > + function = LED_FUNCTION_INDICATOR;
    > + linux,default-trigger = "heartbeat";
    > + };
    > + };
    > + };
    > +...
    > --
    > 2.16.4
    >

    \
     
     \ /
      Last update: 2019-12-20 00:04    [W:3.935 / U:0.176 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site