All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Kurbanov <mmkurbanov@sberdevices.ru>
To: Pavel Machek <pavel@ucw.cz>, Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: <linux-leds@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-doc@vger.kernel.org>,
	<kernel@sberdevices.ru>,
	Martin Kurbanov <mmkurbanov@sberdevices.ru>
Subject: [PATCH v1 1/2] dt-bindings: leds: add binding for aw200xx
Date: Thu, 24 Nov 2022 23:48:06 +0300	[thread overview]
Message-ID: <20221124204807.1593241-2-mmkurbanov@sberdevices.ru> (raw)
In-Reply-To: <20221124204807.1593241-1-mmkurbanov@sberdevices.ru>

Add YAML devicetree binding for AWINIC AW20036/AW20052/AW20074
led driver.

Signed-off-by: Martin Kurbanov <mmkurbanov@sberdevices.ru>
---
 .../bindings/leds/leds-aw200xx.yaml           | 110 ++++++++++++++++++
 include/dt-bindings/leds/leds-aw200xx.h       |  48 ++++++++
 2 files changed, 158 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-aw200xx.yaml
 create mode 100644 include/dt-bindings/leds/leds-aw200xx.h

diff --git a/Documentation/devicetree/bindings/leds/leds-aw200xx.yaml b/Documentation/devicetree/bindings/leds/leds-aw200xx.yaml
new file mode 100644
index 000000000000..3bdadcbc2ee2
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/leds-aw200xx.yaml
@@ -0,0 +1,110 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/leds-aw200xx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: AWINIC AW200XX LED Driver
+
+maintainers:
+  - Martin Kurbanov <mmkurbanov@sberdevices.ru>
+
+description: |
+  This controller is present on AW20036/AW20054/AW20072.
+  It is a 3x12/6x9/6x12 matrix LED driver programmed via
+  an I2C interface, up to 36/54/72 LEDs or 12/18/24 RGBs,
+  3 pattern controllers for auto breathing or group dimming control.
+
+  For more product information please see the link below:
+  aw20036 - https://www.awinic.com/Public/Uploads/uploadfile/files/20200509/20200509151532_5eb65894d205a.pdf
+  aw20054 - https://www.awinic.com/Public/Uploads/uploadfile/files/20200509/20200509151602_5eb658b2b77cb.pdf
+  aw20072 - https://www.awinic.com/Public/Uploads/uploadfile/files/20200509/20200509151754_5eb659227a145.pdf
+
+properties:
+  compatible:
+    enum:
+      - awinic,aw20036
+      - awinic,aw20054
+      - awinic,aw20072
+
+  reg:
+    maxItems: 1
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+  interrupts:
+    maxItems: 1
+
+  display-size:
+    maxItems: 1
+    description:
+      Leds matrix size, see dt-bindings/leds/leds-aw200xx.h
+
+  imax:
+    maxItems: 1
+    description:
+      Maximum supply current, see dt-bindings/leds/leds-aw200xx.h
+
+patternProperties:
+  "^led@[0-9a-f]$":
+    type: object
+    $ref: common.yaml#
+
+    properties:
+      reg:
+        description:
+          LED number
+        maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - "#address-cells"
+  - "#size-cells"
+  - display-size
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/leds/common.h>
+    #include <dt-bindings/leds/leds-aw200xx.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        led-controller@3a {
+            compatible = "awinic,aw20036";
+            reg = <0x3a>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+            interrupt-parent = <&gpio_intc>;
+            interrupts = <13 IRQ_TYPE_LEVEL_LOW>;
+
+            display-size = <AW20036_DSIZE_3X12>;
+            imax = <AW200XX_IMAX_60MA>;
+
+            led@0 {
+                reg = <0x0>;
+                color = <LED_COLOR_ID_RED>;
+            };
+
+            led@1 {
+                reg = <0x1>;
+                color = <LED_COLOR_ID_GREEN>;
+            };
+
+            led@2 {
+                reg = <0x2>;
+                color = <LED_COLOR_ID_BLUE>;
+            };
+        };
+    };
+
+...
diff --git a/include/dt-bindings/leds/leds-aw200xx.h b/include/dt-bindings/leds/leds-aw200xx.h
new file mode 100644
index 000000000000..6b2ba4c3c6b1
--- /dev/null
+++ b/include/dt-bindings/leds/leds-aw200xx.h
@@ -0,0 +1,48 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/**
+ * This header provides constants for aw200xx LED bindings.
+ *
+ * Copyright (c) 2022, SberDevices. All Rights Reserved.
+ *
+ * Author: Martin Kurbanov <mmkurbanov@sberdevices.ru>
+ */
+#ifndef _DT_BINDINGS_LEDS_AW200XX_H
+#define _DT_BINDINGS_LEDS_AW200XX_H
+
+/* Global max current (IMAX) */
+#define AW200XX_IMAX_3_3MA  8
+#define AW200XX_IMAX_6_7MA  9
+#define AW200XX_IMAX_10MA   0
+#define AW200XX_IMAX_13_3MA 11
+#define AW200XX_IMAX_20MA   1
+#define AW200XX_IMAX_26_7MA 13
+#define AW200XX_IMAX_30MA   2
+#define AW200XX_IMAX_40MA   3
+#define AW200XX_IMAX_53_3MA 15
+#define AW200XX_IMAX_60MA   4
+#define AW200XX_IMAX_80MA   5
+#define AW200XX_IMAX_120MA  6
+#define AW200XX_IMAX_160MA  7
+
+/* Display size for aw20036 */
+#define AW20036_DSIZE_1X12 0
+#define AW20036_DSIZE_2X12 1
+#define AW20036_DSIZE_3X12 2
+
+/* Display size for aw20054 */
+#define AW20054_DSIZE_1X9 0
+#define AW20054_DSIZE_2X9 1
+#define AW20054_DSIZE_3X9 2
+#define AW20054_DSIZE_4X9 3
+#define AW20054_DSIZE_5X9 4
+#define AW20054_DSIZE_6X9 5
+
+/* Display size for aw20072 */
+#define AW20072_DSIZE_1X12 0
+#define AW20072_DSIZE_2X12 1
+#define AW20072_DSIZE_3X12 2
+#define AW20072_DSIZE_4X12 3
+#define AW20072_DSIZE_5X12 4
+#define AW20072_DSIZE_6X12 5
+
+#endif /* !_DT_BINDINGS_LEDS_AW200XX_H */
-- 
2.38.1


  reply	other threads:[~2022-11-24 20:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-24 20:48 [PATCH v1 0/2] leds: add aw20xx driver Martin Kurbanov
2022-11-24 20:48 ` Martin Kurbanov [this message]
2022-11-25  8:29   ` [PATCH v1 1/2] dt-bindings: leds: add binding for aw200xx Krzysztof Kozlowski
2022-11-28 17:43     ` Martin Kurbanov
2022-12-02 16:41       ` Krzysztof Kozlowski
2022-12-02 18:53         ` Dmitry Rokosov
2022-12-03 10:44           ` Krzysztof Kozlowski
2022-11-24 20:48 ` [PATCH v1 2/2] leds: add aw20xx driver Martin Kurbanov
2022-11-25  2:37   ` kernel test robot
2022-11-25  8:19   ` Krzysztof Kozlowski
2022-11-28 17:45     ` Martin Kurbanov
2022-12-07 19:48       ` Pavel Machek
2022-11-25 19:17   ` kernel test robot
2022-12-07 19:49   ` Pavel Machek
2022-12-31 15:44   ` kernel test robot

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=20221124204807.1593241-2-mmkurbanov@sberdevices.ru \
    --to=mmkurbanov@sberdevices.ru \
    --cc=andy.shevchenko@gmail.com \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=kernel@sberdevices.ru \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.