2020-05-04 18:45:02

by Nikita Travkin

[permalink] [raw]
Subject: [PATCH 2/3] dt-bindings: leds: Add binding for aw2013

From: Nikita Travkin <[email protected]>

Add YAML devicetree binding for AWINIC AW2013 3-channel led driver

Signed-off-by: Nikita Travkin <[email protected]>
---
.../devicetree/bindings/leds/leds-aw2013.yaml | 91 +++++++++++++++++++
1 file changed, 91 insertions(+)
create mode 100644 Documentation/devicetree/bindings/leds/leds-aw2013.yaml

diff --git a/Documentation/devicetree/bindings/leds/leds-aw2013.yaml b/Documentation/devicetree/bindings/leds/leds-aw2013.yaml
new file mode 100644
index 000000000000..f118721df1e8
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/leds-aw2013.yaml
@@ -0,0 +1,91 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/leds-aw2013.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: AWINIC AW2013 3-channel LED Driver
+
+maintainers:
+ - Nikita Travkin <[email protected]>
+
+description: |
+ The AW2013 is a 3-channel LED driver with I2C interface. It can control
+ LED brightness with PWM output.
+
+properties:
+ compatible:
+ const: awinic,aw2013
+
+ reg:
+ maxItems: 1
+
+ vcc-supply:
+ description: Regulator providing power to the "VCC" pin.
+
+ "#address-cells":
+ const: 1
+
+ "#size-cells":
+ const: 0
+
+patternProperties:
+ "^led@[0-2]$":
+ type: object
+ allOf:
+ - $ref: common.yaml#
+
+ properties:
+ reg:
+ description: Index of the LED.
+ minimum: 0
+ maximum: 2
+
+required:
+ - compatible
+ - reg
+ - "#address-cells"
+ - "#size-cells"
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/gpio/gpio.h>
+ #include <dt-bindings/leds/common.h>
+
+ i2c0 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ led-controller@45 {
+ compatible = "awinic,aw2013";
+ reg = <0x45>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ vcc-supply = <&pm8916_l17>;
+
+ led@0 {
+ reg = <0>;
+ led-max-microamp = <5000>;
+ function = LED_FUNCTION_INDICATOR;
+ color = <LED_COLOR_ID_RED>;
+ };
+
+ led@1 {
+ reg = <1>;
+ led-max-microamp = <5000>;
+ function = LED_FUNCTION_INDICATOR;
+ color = <LED_COLOR_ID_GREEN>;
+ };
+
+ led@2 {
+ reg = <2>;
+ led-max-microamp = <5000>;
+ function = LED_FUNCTION_INDICATOR;
+ color = <LED_COLOR_ID_BLUE>;
+ };
+ };
+ };
+...
--
2.20.1


2020-05-04 20:22:46

by Dan Murphy

[permalink] [raw]
Subject: Re: [PATCH 2/3] dt-bindings: leds: Add binding for aw2013

Pavel

On 5/4/20 11:29 AM, [email protected] wrote:
> From: Nikita Travkin <[email protected]>
>
> Add YAML devicetree binding for AWINIC AW2013 3-channel led driver
>
> Signed-off-by: Nikita Travkin <[email protected]>
> ---
> .../devicetree/bindings/leds/leds-aw2013.yaml | 91 +++++++++++++++++++
> 1 file changed, 91 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/leds/leds-aw2013.yaml
>
> diff --git a/Documentation/devicetree/bindings/leds/leds-aw2013.yaml b/Documentation/devicetree/bindings/leds/leds-aw2013.yaml
> new file mode 100644
> index 000000000000..f118721df1e8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/leds/leds-aw2013.yaml
> @@ -0,0 +1,91 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/leds/leds-aw2013.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: AWINIC AW2013 3-channel LED Driver
> +
> +maintainers:
> + - Nikita Travkin <[email protected]>
> +
> +description: |
> + The AW2013 is a 3-channel LED driver with I2C interface. It can control
> + LED brightness with PWM output.
> +
> +properties:
> + compatible:
> + const: awinic,aw2013
> +
> + reg:
> + maxItems: 1
> +
> + vcc-supply:
> + description: Regulator providing power to the "VCC" pin.
> +
> + "#address-cells":
> + const: 1
> +
> + "#size-cells":
> + const: 0
> +
> +patternProperties:
> + "^led@[0-2]$":
> + type: object
> + allOf:
> + - $ref: common.yaml#
> +
> + properties:
> + reg:
> + description: Index of the LED.
> + minimum: 0
> + maximum: 2
> +
> +required:
> + - compatible
> + - reg
> + - "#address-cells"
> + - "#size-cells"
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/gpio/gpio.h>
> + #include <dt-bindings/leds/common.h>
> +
> + i2c0 {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + led-controller@45 {
> + compatible = "awinic,aw2013";
> + reg = <0x45>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + vcc-supply = <&pm8916_l17>;
> +
> + led@0 {
> + reg = <0>;
> + led-max-microamp = <5000>;
> + function = LED_FUNCTION_INDICATOR;
> + color = <LED_COLOR_ID_RED>;
> + };
> +
> + led@1 {
> + reg = <1>;
> + led-max-microamp = <5000>;
> + function = LED_FUNCTION_INDICATOR;
> + color = <LED_COLOR_ID_GREEN>;
> + };
> +
> + led@2 {
> + reg = <2>;
> + led-max-microamp = <5000>;
> + function = LED_FUNCTION_INDICATOR;
> + color = <LED_COLOR_ID_BLUE>;
> + };
> + };
> + };
> +...

Would this be a good candidate for the multicolor framework?

Dan