Skip to contentSkip to conversation

dt-bindings: leds: add mp3326

PATCH In review Yuxi (Yuxi) Wang 2 participants 2 messages Aug 9, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 dt-bindings: leds: add mp3326

Add dt-bindings for Monolithic Power System MP3326.

---
 .../devicetree/bindings/leds/leds-mp3326.yaml | 99 +++++++++++++++++++
 1 file changed, 99 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-mp3326.yaml
Documentation/devicetree/bindings/leds/leds-mp3326.yaml new file +99 -0
new file mode 100644
index 000000000000..3a059340b902
@@ -0,0 +1,99 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/leds-mp3326.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: LED driver for MP3326 from Monolithic Power Systems.
+
+maintainers:
+  - Yuxi Wang <[email protected]>
+
+description: |
+  Bindings for the Monolithic Power Systems MP3326 LED Drivers.
+
+  For more product information please see the link below:
+    https://www.monolithicpower.com/en/products/mp3326.html
+properties:
+  compatible:
+    const: MPS,MP3326
+
+  reg:
+    description: I2C slave address of the controller.
+    maxItems: 1
+
+  led-protect:
+    description: LED short protection threshold.
+    enum:
+      - 0 #2V
+      - 1 #3V
+      - 2 #4V
+      - 3 #5V
+
+  switch_status:
+    description: Master switch for all channels.
+    enum:
+      - 0 #close all channels
+      - 1 #open all channels
+
+patternProperties:
+  "^rgb(-[0-9a-f]+)?$":
+    description: RGB group.
+    type: object
+    unevaluatedProperties: false
+    properties:
+      rgb_r:
+        description: Red light of the RGB group.
+        maxItems: 16
+        minItems: 1
+      rgb_g:
+        description: Green light of the RGB group.
+        maxItems: 16
+        minItems: 1
+      rgb_b:
+        description: Blue light of the RGB group.
+        maxItems: 16
+        minItems: 1
+      brightness:
+        description: Brightness of the RGB group.
+        maxItems: 63
+        minItems: 0
+      required:
+        - rgb_r
+        - rgb_g
+        - rgb_b
+        - brightness
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+examples:
+  - |
+    #include <dt-bindings/leds/common.h>
+    MP3326@30 {
+        compatible = "mps,MP3326";
+        reg = <0x30>;
+        led-protect =<3>;
+        switch_status=<1>;
+
+        /*RGB group 1*/
+        rgb1@0{
+            rgb_r=<1>;
+            rgb_g=<2>;
+            rgb_b=<3>;
+            brightness=<30>;
+        };
+
+        /*RGB group 2*/
+        rgb2@1{
+            rgb_r=<7>;
+            rgb_g=<8>;
+            rgb_b=<9>;
+            brightness=<30>;
+        };
+    };
+
+
+...
Signature · 1 line
2.25.1
#1 lore raw
Quoted 3 lines · Yuxi (Yuxi) Wang

Add dt-bindings for Monolithic Power System MP3326.

Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.

You missed at least DT list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time, thus I will skip this patch entirely till you follow the process allowing the patch to be tested.

Please kindly resend and include all necessary To/Cc entries.

Quoted 11 lines
---
 .../devicetree/bindings/leds/leds-mp3326.yaml | 99 +++++++++++++++++++
 1 file changed, 99 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-mp3326.yaml
Documentation/devicetree/bindings/leds/leds-mp3326.yaml new file +0 -0
new file mode 100644
index 000000000000..3a059340b902

Documentation/devicetree/bindings/leds/leds-mp3326.yaml line 7

Quoted 7 lines
Documentation/devicetree/bindings/leds/leds-mp3326.yaml new file +7 -0
@@ -0,0 +1,99 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/leds-mp3326.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: LED driver for MP3326 from Monolithic Power Systems.

Drop final dot.

Documentation/devicetree/bindings/leds/leds-mp3326.yaml line 13

Quoted 6 lines
Documentation/devicetree/bindings/leds/leds-mp3326.yaml new file +6 -0
+
+maintainers:
+  - Yuxi Wang <[email protected]>
+
+description: |
+  Bindings for the Monolithic Power Systems MP3326 LED Drivers.

Drop "Bindings for"

Documentation/devicetree/bindings/leds/leds-mp3326.yaml line 16

Quoted 3 lines
Documentation/devicetree/bindings/leds/leds-mp3326.yaml new file +3 -0
+
+  For more product information please see the link below:
+    https://www.monolithicpower.com/en/products/mp3326.html

Missing blank line.

Documentation/devicetree/bindings/leds/leds-mp3326.yaml line 19

Quoted 3 lines
Documentation/devicetree/bindings/leds/leds-mp3326.yaml new file +3 -0
+properties:
+  compatible:
+    const: MPS,MP3326

Do you see anywhere, absolutely anywhere capital letters in compatibles?

Documentation/devicetree/bindings/leds/leds-mp3326.yaml line 22

Quoted 3 lines
Documentation/devicetree/bindings/leds/leds-mp3326.yaml new file +3 -0
+
+  reg:
+    description: I2C slave address of the controller.

Drop description, obvious.

Documentation/devicetree/bindings/leds/leds-mp3326.yaml line 26

Quoted 4 lines
Documentation/devicetree/bindings/leds/leds-mp3326.yaml new file +4 -0
+    maxItems: 1
+
+  led-protect:
+    description: LED short protection threshold.

Does not look like common property... missing vendor prefix. Use common unit suffix, so "-microvolt"

Documentation/devicetree/bindings/leds/leds-mp3326.yaml line 37

Quoted 11 lines
Documentation/devicetree/bindings/leds/leds-mp3326.yaml new file +11 -0
+    enum:
+      - 0 #2V
+      - 1 #3V
+      - 2 #4V
+      - 3 #5V
+
+  switch_status:
+    description: Master switch for all channels.
+    enum:
+      - 0 #close all channels
+      - 1 #open all channels

This is so bad that actually disappointing...

1. Missing vendor prefix
2. No underscores in properties
3. Missing type/ref
4. And does not look at all as hardware property. Drop.

Documentation/devicetree/bindings/leds/leds-mp3326.yaml line 40

Quoted 3 lines
Documentation/devicetree/bindings/leds/leds-mp3326.yaml new file +3 -0
+
+patternProperties:
+  "^rgb(-[0-9a-f]+)?$":

Aren't these called "led"?

Documentation/devicetree/bindings/leds/leds-mp3326.yaml line 43

Quoted 3 lines
Documentation/devicetree/bindings/leds/leds-mp3326.yaml new file +3 -0
+    description: RGB group.
+    type: object
+    unevaluatedProperties: false

Missing ref to proper LED schema.

Documentation/devicetree/bindings/leds/leds-mp3326.yaml line 45

Quoted 2 lines
Documentation/devicetree/bindings/leds/leds-mp3326.yaml new file +2 -0
+    properties:
+      rgb_r:

Nope, nope.

Quoted 20 lines
Documentation/devicetree/bindings/leds/leds-mp3326.yaml new file +20 -0
+        description: Red light of the RGB group.
+        maxItems: 16
+        minItems: 1
+      rgb_g:
+        description: Green light of the RGB group.
+        maxItems: 16
+        minItems: 1
+      rgb_b:
+        description: Blue light of the RGB group.
+        maxItems: 16
+        minItems: 1
+      brightness:
+        description: Brightness of the RGB group.
+        maxItems: 63
+        minItems: 0
+      required:
+        - rgb_r
+        - rgb_g
+        - rgb_b
+        - brightness

Documentation/devicetree/bindings/leds/leds-mp3326.yaml line 75

Quoted 10 lines
Documentation/devicetree/bindings/leds/leds-mp3326.yaml new file +10 -0
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+examples:
+  - |
+    #include <dt-bindings/leds/common.h>
+    MP3326@30 {

No, this is neither DTS nor proper bindings. Remove all this. Start FROM SCRATCH from example-schema.yaml. Entirely from scratch.

Documentation/devicetree/bindings/leds/leds-mp3326.yaml line 83

Quoted 8 lines
Documentation/devicetree/bindings/leds/leds-mp3326.yaml new file +8 -0
+        compatible = "mps,MP3326";
+        reg = <0x30>;
+        led-protect =<3>;
+        switch_status=<1>;
+
+        /*RGB group 1*/
+        rgb1@0{
+            rgb_r=<1>;

This is not even coding style for DTS...

Best regards,
Krzysztof