From: "Vesa Jääskeläinen" <dachaac@gmail.com>
To: Hermes Zhang <chenhui.zhang@axis.com>,
pavel@ucw.cz, dmurphy@ti.com, robh+dt@kernel.org
Cc: linux-leds@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, chenhuiz@axis.com, lkml@axis.com,
kernel@axis.com
Subject: Re: [PATCH 2/2] dt-binding: leds: Document leds-multi-gpio bindings
Date: Thu, 25 Mar 2021 07:27:33 +0200 [thread overview]
Message-ID: <0648fff2-5b38-66da-7eb0-9969e517421f@gmail.com> (raw)
In-Reply-To: <20210324075631.5004-3-chenhui.zhang@axis.com>
Hi,
See below.
On 24.3.2021 9.56, Hermes Zhang wrote:
> From: Hermes Zhang <chenhuiz@axis.com>
>
> Document the device tree bindings of the multiple GPIOs LED driver
> Documentation/devicetree/bindings/leds/leds-multi-gpio.yaml.
>
> Signed-off-by: Hermes Zhang <chenhuiz@axis.com>
> ---
> .../bindings/leds/leds-multi-gpio.yaml | 50 +++++++++++++++++++
> 1 file changed, 50 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/leds/leds-multi-gpio.yaml
>
> diff --git a/Documentation/devicetree/bindings/leds/leds-multi-gpio.yaml b/Documentation/devicetree/bindings/leds/leds-multi-gpio.yaml
> new file mode 100644
> index 000000000000..6f2b47487b90
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/leds/leds-multi-gpio.yaml
> @@ -0,0 +1,50 @@
> +# SPDX-License-Identifier: GPL-2.0
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/leds/leds-multi-gpio.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Multiple GPIOs LED driver
> +
> +maintainers:
> + - Hermes Zhang <chenhuiz@axis.com>
> +
> +description:
> + This will support some LED made of multiple GPIOs and the brightness of the
> + LED could map to different states of the GPIOs.
> +
> +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
We also have a case with multi color LEDs (which is probably a more
common than multi intensity LED. So I am wondering how these both could
co-exist.
From:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/leds/leds-gpio.yaml?h=v5.12-rc4#n58
led-0 {
gpios = <&mcu_pio 0 GPIO_ACTIVE_LOW>;
linux,default-trigger = "disk-activity";
function = LED_FUNCTION_DISK;
};
Now 'gpios' (and in LED context) and 'led-gpios' is very close to each
other and could easily be confused.
Perhaps this could be something like:
intensity-gpios = ...
or even simplified then just to gpios = <...>
> +
> + 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.
> + $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>;
> + };
> +...
>
From:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/leds/leds-lp55xx.yaml?h=v5.12-rc4#n196
There is example of multi color LED configuration. In example below I
used two-color LED with red and green as an example (which what we seem
to have most in use).
Then if try to combine these into something like:
# Multi color LED with single GPIO line per color
multi-led@2 {
compatible = "gpio-leds";
color = <LED_COLOR_ID_MULTICOLOR>;
led@0 {
color = <LED_COLOR_ID_GREEN>;
gpios = <&mcu_pio 0 GPIO_ACTIVE_LOW>;
};
led@1 {
color = <LED_COLOR_ID_RED>;
gpios = <&mcu_pio 1 GPIO_ACTIVE_LOW>;
};
};
# And with intensity GPIOs:
multi-led@2 {
compatible = "gpio-leds";
color = <LED_COLOR_ID_MULTICOLOR>;
led@0 {
color = <LED_COLOR_ID_GREEN>;
gpios = <&gpio0 23 0x1>,
<&gpio0 24 0x1>;
... see below
};
led@1 {
color = <LED_COLOR_ID_RED>;
gpios = <&gpio0 25 0x1>,
<&gpio0 26 0x1>;
... see below
};
};
# And then single GPIO with intensity GPIOs:
led@2 {
compatible = "gpio-leds";
gpios = <&gpio0 23 0x1>,
<&gpio0 24 0x1>;
gpios-brightness-levels = <0 1 2 3>
};
I changed 'led-states' to 'gpios-brightness-levels' as it describe more
that this is about brightness and not some other state information.
How would this sound?
Thanks,
Vesa Jääskeläinen
next prev parent reply other threads:[~2021-03-25 5:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-24 7:56 [PATCH 0/2] New multiple GPIOs LED driver Hermes Zhang
2021-03-24 7:56 ` [PATCH 1/2] leds: leds-multi-gpio: Add " Hermes Zhang
2021-03-24 10:34 ` Marek Behun
2021-03-24 10:40 ` Pavel Machek
2021-03-24 10:42 ` Pavel Machek
2021-03-25 6:04 ` Hermes Zhang
2021-03-25 12:26 ` Marek Behun
2021-03-24 10:41 ` Pavel Machek
2021-03-24 7:56 ` [PATCH 2/2] dt-binding: leds: Document leds-multi-gpio bindings Hermes Zhang
2021-03-24 10:40 ` Marek Behun
2021-03-25 5:27 ` Vesa Jääskeläinen [this message]
2021-03-25 18:41 ` Pavel Machek
2021-03-28 20:46 ` Vesa Jääskeläinen
2021-03-24 10:42 ` [PATCH 0/2] New multiple GPIOs LED driver Marek Behun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0648fff2-5b38-66da-7eb0-9969e517421f@gmail.com \
--to=dachaac@gmail.com \
--cc=chenhui.zhang@axis.com \
--cc=chenhuiz@axis.com \
--cc=devicetree@vger.kernel.org \
--cc=dmurphy@ti.com \
--cc=kernel@axis.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=lkml@axis.com \
--cc=pavel@ucw.cz \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).