Re: [PATCH 2/2] dt-binding: leds: Document leds-multi-gpio bindings

From: Marek Behun
Date: Wed Mar 24 2021 - 05:41:41 EST


On Wed, 24 Mar 2021 15:56:31 +0800
Hermes Zhang <chenhui.zhang@xxxxxxxx> wrote:

> From: Hermes Zhang <chenhuiz@xxxxxxxx>
>
> Document the device tree bindings of the multiple GPIOs LED driver
> Documentation/devicetree/bindings/leds/leds-multi-gpio.yaml.

The dt-binding should come before the actual driver. Otherwise there
will be a commit with the driver existing but no documentation for its
bindings.

> +description:
> + This will support some LED made of multiple GPIOs and the brightness of the
> + LED could map to different states of the GPIOs.

Don't use future tense. Don't mention drivers in device tree
binding documentation, if it can be helped. The device tree binding
documentation should describe devices and their nodes... (and I see
that I did a similar mistake for the cznic,turris-omnia-leds.yaml
binding, I will have to fix that).

Instead the description should be something like this:
This binding represents LED devices which are controller with
multiple GPIO lines in order to achieve more than two brightness
states.


> +
> +properties:
> + compatible:
> + const: multi-gpio-led
> +
> + led-gpios:
> + description: Array of one or more GPIOs pins used to control the LED.
> + minItems: 1
> + maxItems: 8 # Should be enough
> +
> + led-states:
> + description: |
> + The array list the supported states here which will map to brightness
> + from 0 to maximum. Each item in the array will present all the GPIOs
> + value by bit.

Again future tense...

> + $ref: /schemas/types.yaml#/definitions/uint8-array
> + minItems: 1
> + maxItems: 16 # Should be enough
> +
> +required:
> + - compatible
> + - led-gpios
> + - led-states
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + gpios-led {
> + compatible = "multi-gpio-led";
> +
> + led-gpios = <&gpio0 23 0x1>,
> + <&gpio0 24 0x1>;
> + led-states = /bits/ 8 <0x00 0x01 0x02 0x03>;
> + };
> +...