devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] dt-bindings: leds: add mps mp3326 LED
@ 2023-10-31  6:59 Yuxi (Yuxi) Wang
  2023-10-31  8:10 ` Krzysztof Kozlowski
  2023-10-31 12:57 ` Rob Herring
  0 siblings, 2 replies; 10+ messages in thread
From: Yuxi (Yuxi) Wang @ 2023-10-31  6:59 UTC (permalink / raw)
  To: pavel@ucw.cz, lee@kernel.org, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org
  Cc: linux-leds@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, wyx137120466@gmail.com


Document mps mp3326 LED driver devicetree bindings.

Signed-off-by: Yuxi Wang <Yuxi.Wang@monolithicpower.com>
---
 .../devicetree/bindings/leds/leds-mp3326.yaml | 184 ++++++++++++++++++
 1 file changed, 184 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-mp3326.yaml

diff --git a/Documentation/devicetree/bindings/leds/leds-mp3326.yaml b/Documentation/devicetree/bindings/leds/leds-mp3326.yaml
new file mode 100644
index 000000000000..df03c21ae53a
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/leds-mp3326.yaml
@@ -0,0 +1,184 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds-mp3326.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: LED driver for MP3326 from Monolithic Power Systems
+
+maintainers:
+  - Yuxi Wang <Yuxi.Wang@monolithicpower.com>
+
+description: |
+  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
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+  reg:
+    maxItems: 1
+
+  mps,led-protect:
+    description: |
+      LED short protection threshold.
+    enum: [0, 1, 2, 3]
+
+  multi-led:
+    type: object
+
+    properties:
+      "#address-cells":
+        const: 1
+      "#size-cells":
+        const: 0
+
+      color:
+        description: RGB module
+        const: LED_COLOR_ID_RGB
+
+      led_r:
+        type: object
+
+        properties:
+          "#address-cells":
+            const: 1
+          "#size-cells":
+            const: 0
+          reg:
+            description: Index of the LED.
+            minimum: 1
+            maximum: 16
+          color:
+            description: Red.
+            const: LED_COLOR_ID_RED
+          required:
+            - reg
+            - color
+
+      led_g:
+        type: object
+
+        properties:
+          "#address-cells":
+            const: 1
+          "#size-cells":
+            const: 0
+        reg:
+          description: Index of the LED.
+          minimum: 1
+          maximum: 16
+        color:
+          description: Green.
+          const: LED_COLOR_ID_GREEN
+        required:
+          - reg
+          - color
+
+      led_b:
+        type: object
+
+        properties:
+          "#address-cells":
+            const: 1
+          "#size-cells":
+            const: 0
+        reg:
+          description: Index of the LED.
+          minimum: 1
+          maximum: 16
+        color:
+          description: Blue.
+          const: LED_COLOR_ID_BLUE
+        required:
+          - reg
+          - color
+
+  patternProperties:
+    "^led@[0-3]$":
+      type: object
+
+      properties:
+        reg:
+          description: Index of the LED.
+          minimum: 1
+          maximum: 16
+
+        required:
+          - reg
+          - color
+
+examples:
+  - |
+    #include <dt-bindings/leds/common.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        mp3326@30 {
+            compatible = "mps,mp3326";
+            reg = <0x30>;
+            led-protect =<3>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            multi-led {
+              color = <LED_COLOR_ID_RGB>;
+              #address-cells = <1>;
+              #size-cells = <0>;
+
+              rgb_r@1 {
+                  #address-cells = <1>;
+                  #size-cells = <0>;
+                  reg  = <1>;
+                  color = <LED_COLOR_ID_RED>;
+              };
+              rgb_g@2 {
+                  #address-cells = <1>;
+                  #size-cells = <0>;
+                  reg = <2>;
+                  color = <LED_COLOR_ID_GREEN>;
+              };
+              rgb_b@3 {
+                  #address-cells = <1>;
+                  #size-cells = <0>;
+                  reg = <3>;
+                  color = <LED_COLOR_ID_BLUE>;
+              };
+            };
+        };
+    };
+
+  - |
+    #include <dt-bindings/leds/common.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        mp3326@30 {
+            compatible = "mps,mp3326";
+            reg = <0x30>;
+            led-protect =<3>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+            led0@0 {
+                #address-cells = <1>;
+                #size-cells = <0>;
+                reg= <5>;
+                color = <LED_COLOR_ID_WHITE>;
+            };
+        };
+    };
+
+...
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] dt-bindings: leds: add mps mp3326 LED
  2023-10-31  6:59 [PATCH 1/2] dt-bindings: leds: add mps mp3326 LED Yuxi (Yuxi) Wang
@ 2023-10-31  8:10 ` Krzysztof Kozlowski
  2023-10-31 12:57 ` Rob Herring
  1 sibling, 0 replies; 10+ messages in thread
From: Krzysztof Kozlowski @ 2023-10-31  8:10 UTC (permalink / raw)
  To: Yuxi (Yuxi) Wang, pavel@ucw.cz, lee@kernel.org,
	robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
	conor+dt@kernel.org
  Cc: linux-leds@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, wyx137120466@gmail.com

On 31/10/2023 07:59, Yuxi (Yuxi) Wang wrote:
> 

1. Stray blank line in your commit.
2. Send patches with proper threading (which is by default by all
tools!). Lack of threading makes it difficult to apply entire set or use
b4 diff.

> Document mps mp3326 LED driver devicetree bindings.
> 
> Signed-off-by: Yuxi Wang <Yuxi.Wang@monolithicpower.com>
> ---
>  .../devicetree/bindings/leds/leds-mp3326.yaml | 184 ++++++++++++++++++
>  1 file changed, 184 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/leds/leds-mp3326.yaml
> 
> diff --git a/Documentation/devicetree/bindings/leds/leds-mp3326.yaml b/Documentation/devicetree/bindings/leds/leds-mp3326.yaml
> new file mode 100644
> index 000000000000..df03c21ae53a
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/leds/leds-mp3326.yaml

Filename like compatible.

> @@ -0,0 +1,184 @@

> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/leds-mp3326.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: LED driver for MP3326 from Monolithic Power Systems

"driver" as Linux driver? If so, drop. MP3326 could be a WLED driver, so
"driver" as hardware term, but it does not make sense in "driver for
MPS3326"


> +
> +maintainers:
> +  - Yuxi Wang <Yuxi.Wang@monolithicpower.com>
> +
> +description: |
> +  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

It does not look like you tested the bindings, at least after quick
look. Please run `make dt_binding_check` (see
Documentation/devicetree/bindings/writing-schema.rst for instructions).
Maybe you need to update your dtschema and yamllint.

I'll stop reviewing. No point to review untested code.


Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] dt-bindings: leds: add mps mp3326 LED
  2023-10-31  6:59 [PATCH 1/2] dt-bindings: leds: add mps mp3326 LED Yuxi (Yuxi) Wang
  2023-10-31  8:10 ` Krzysztof Kozlowski
@ 2023-10-31 12:57 ` Rob Herring
  1 sibling, 0 replies; 10+ messages in thread
From: Rob Herring @ 2023-10-31 12:57 UTC (permalink / raw)
  To: Yuxi (Yuxi) Wang
  Cc: conor+dt, pavel, krzysztof.kozlowski+dt, robh+dt, lee, linux-leds,
	wyx137120466, linux-kernel, devicetree


On Tue, 31 Oct 2023 06:59:50 +0000, Yuxi (Yuxi) Wang wrote:
> 
> Document mps mp3326 LED driver devicetree bindings.
> 
> Signed-off-by: Yuxi Wang <Yuxi.Wang@monolithicpower.com>
> ---
>  .../devicetree/bindings/leds/leds-mp3326.yaml | 184 ++++++++++++++++++
>  1 file changed, 184 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/leds/leds-mp3326.yaml
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:compatible: [{'const': 'mps,mp3326'}] is not of type 'object', 'boolean'
	from schema $id: http://json-schema.org/draft-07/schema#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:multi-led:properties:led_r:properties:required: ['reg', 'color'] is not of type 'object', 'boolean'
	from schema $id: http://json-schema.org/draft-07/schema#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties: 'patternProperties' should not be valid under {'$ref': '#/definitions/json-schema-prop-names'}
	hint: A json-schema keyword was found instead of a DT property name.
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:patternProperties: 'anyOf' conditional failed, one must be fixed:
	'^led@[0-3]$' is not one of ['$ref', 'additionalItems', 'additionalProperties', 'allOf', 'anyOf', 'const', 'contains', 'default', 'dependencies', 'dependentRequired', 'dependentSchemas', 'deprecated', 'description', 'else', 'enum', 'exclusiveMaximum', 'exclusiveMinimum', 'items', 'if', 'minItems', 'minimum', 'maxItems', 'maximum', 'multipleOf', 'not', 'oneOf', 'pattern', 'patternProperties', 'properties', 'required', 'then', 'typeSize', 'unevaluatedProperties', 'uniqueItems']
	'type' was expected
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:compatible: [{'const': 'mps,mp3326'}] is not of type 'object', 'boolean'
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:multi-led:properties:led_b: 'anyOf' conditional failed, one must be fixed:
	'reg' is not one of ['$ref', 'additionalItems', 'additionalProperties', 'allOf', 'anyOf', 'const', 'contains', 'default', 'dependencies', 'dependentRequired', 'dependentSchemas', 'deprecated', 'description', 'else', 'enum', 'exclusiveMaximum', 'exclusiveMinimum', 'items', 'if', 'minItems', 'minimum', 'maxItems', 'maximum', 'multipleOf', 'not', 'oneOf', 'pattern', 'patternProperties', 'properties', 'required', 'then', 'typeSize', 'unevaluatedProperties', 'uniqueItems']
	'type' was expected
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:multi-led:properties:led_b: 'anyOf' conditional failed, one must be fixed:
	'color' is not one of ['$ref', 'additionalItems', 'additionalProperties', 'allOf', 'anyOf', 'const', 'contains', 'default', 'dependencies', 'dependentRequired', 'dependentSchemas', 'deprecated', 'description', 'else', 'enum', 'exclusiveMaximum', 'exclusiveMinimum', 'items', 'if', 'minItems', 'minimum', 'maxItems', 'maximum', 'multipleOf', 'not', 'oneOf', 'pattern', 'patternProperties', 'properties', 'required', 'then', 'typeSize', 'unevaluatedProperties', 'uniqueItems']
	'type' was expected
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:multi-led:properties:led_g: 'anyOf' conditional failed, one must be fixed:
	'reg' is not one of ['$ref', 'additionalItems', 'additionalProperties', 'allOf', 'anyOf', 'const', 'contains', 'default', 'dependencies', 'dependentRequired', 'dependentSchemas', 'deprecated', 'description', 'else', 'enum', 'exclusiveMaximum', 'exclusiveMinimum', 'items', 'if', 'minItems', 'minimum', 'maxItems', 'maximum', 'multipleOf', 'not', 'oneOf', 'pattern', 'patternProperties', 'properties', 'required', 'then', 'typeSize', 'unevaluatedProperties', 'uniqueItems']
	'type' was expected
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:multi-led:properties:led_g: 'anyOf' conditional failed, one must be fixed:
	'color' is not one of ['$ref', 'additionalItems', 'additionalProperties', 'allOf', 'anyOf', 'const', 'contains', 'default', 'dependencies', 'dependentRequired', 'dependentSchemas', 'deprecated', 'description', 'else', 'enum', 'exclusiveMaximum', 'exclusiveMinimum', 'items', 'if', 'minItems', 'minimum', 'maxItems', 'maximum', 'multipleOf', 'not', 'oneOf', 'pattern', 'patternProperties', 'properties', 'required', 'then', 'typeSize', 'unevaluatedProperties', 'uniqueItems']
	'type' was expected
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:multi-led:properties:led_r:properties: 'required' should not be valid under {'$ref': '#/definitions/json-schema-prop-names'}
	hint: A json-schema keyword was found instead of a DT property name.
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:multi-led:properties:led_r:properties:required: ['reg', 'color'] is not of type 'object', 'boolean'
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: 'oneOf' conditional failed, one must be fixed:
	'unevaluatedProperties' is a required property
	'additionalProperties' is a required property
	hint: Either unevaluatedProperties or additionalProperties must be present
	from schema $id: http://devicetree.org/meta-schemas/core.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:multi-led:properties:led_g: 'reg' is not one of ['type', 'description', 'dependencies', 'dependentRequired', 'dependentSchemas', 'properties', 'patternProperties', 'additionalProperties', 'unevaluatedProperties', 'deprecated', 'required', 'not', 'allOf', 'anyOf', 'oneOf', '$ref']
	from schema $id: http://devicetree.org/meta-schemas/nodes.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:multi-led:properties:led_g: 'color' is not one of ['type', 'description', 'dependencies', 'dependentRequired', 'dependentSchemas', 'properties', 'patternProperties', 'additionalProperties', 'unevaluatedProperties', 'deprecated', 'required', 'not', 'allOf', 'anyOf', 'oneOf', '$ref']
	from schema $id: http://devicetree.org/meta-schemas/nodes.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:multi-led:properties:led_b: 'reg' is not one of ['type', 'description', 'dependencies', 'dependentRequired', 'dependentSchemas', 'properties', 'patternProperties', 'additionalProperties', 'unevaluatedProperties', 'deprecated', 'required', 'not', 'allOf', 'anyOf', 'oneOf', '$ref']
	from schema $id: http://devicetree.org/meta-schemas/nodes.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:multi-led:properties:led_b: 'color' is not one of ['type', 'description', 'dependencies', 'dependentRequired', 'dependentSchemas', 'properties', 'patternProperties', 'additionalProperties', 'unevaluatedProperties', 'deprecated', 'required', 'not', 'allOf', 'anyOf', 'oneOf', '$ref']
	from schema $id: http://devicetree.org/meta-schemas/nodes.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: mps,led-protect: missing type definition
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: patternProperties: missing type definition
Documentation/devicetree/bindings/leds/leds-mp3326.example.dtb: /example-0/i2c/mp3326@30: failed to match any schema with compatible: ['mps,mp3326']
Documentation/devicetree/bindings/leds/leds-mp3326.example.dtb: /example-1/i2c/mp3326@30: failed to match any schema with compatible: ['mps,mp3326']

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/c8bbeb3c3d9b44049d790e90d9738a83@monolithicpower.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/2] dt-bindings: leds: add mps mp3326 LED
  2023-11-08  3:29 [PATCH 0/2] leds: add mp3326 driver Yuxi Wang
@ 2023-11-08  3:29 ` Yuxi Wang
  2023-11-08  4:15   ` Rob Herring
  2023-11-08  8:20   ` Krzysztof Kozlowski
  0 siblings, 2 replies; 10+ messages in thread
From: Yuxi Wang @ 2023-11-08  3:29 UTC (permalink / raw)
  To: pavel, lee, robh+dt, krzysztof.kozlowski+dt, conor+dt,
	wyx137120466, Yuxi.Wang
  Cc: linux-leds, devicetree, linux-kernel

Document mps mp3326 LED driver devicetree bindings.

Signed-off-by: Yuxi Wang <wyx137120466@gmail.com>
---
 .../devicetree/bindings/leds/leds-mp3326.yaml | 184 ++++++++++++++++++
 1 file changed, 184 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-mp3326.yaml

diff --git a/Documentation/devicetree/bindings/leds/leds-mp3326.yaml b/Documentation/devicetree/bindings/leds/leds-mp3326.yaml
new file mode 100644
index 000000000000..899cf568f647
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/leds-mp3326.yaml
@@ -0,0 +1,184 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mps,mp3326.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MPS MP3326 RGB/White LED Driver
+
+maintainers:
+  - Yuxi Wang <wyx137120466@gmail.com>
+
+description: |
+  The MP3326 is a RGB/White LED driver with I2C interface.
+
+  For more product information please see the link below:
+  https://www.monolithicpower.com/en/products/mp3326.html
+
+properties:
+  compatible:
+    - const: mps,mp3326
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+  reg:
+    maxItems: 1
+
+  mps,led-protect:
+    description: |
+      LED short protection threshold.
+    enum: [0, 1, 2, 3]
+
+  multi-led:
+    type: object
+
+    properties:
+      "#address-cells":
+        const: 1
+      "#size-cells":
+        const: 0
+
+      color:
+        description: RGB module
+        const: LED_COLOR_ID_RGB
+
+      led_r:
+        type: object
+
+        properties:
+          "#address-cells":
+            const: 1
+          "#size-cells":
+            const: 0
+          reg:
+            description: Index of the LED.
+            minimum: 1
+            maximum: 16
+          color:
+            description: Red.
+            const: LED_COLOR_ID_RED
+          required:
+            - reg
+            - color
+
+      led_g:
+        type: object
+
+        properties:
+          "#address-cells":
+            const: 1
+          "#size-cells":
+            const: 0
+        reg:
+          description: Index of the LED.
+          minimum: 1
+          maximum: 16
+        color:
+          description: Green.
+          const: LED_COLOR_ID_GREEN
+        required:
+          - reg
+          - color
+
+      led_b:
+        type: object
+
+        properties:
+          "#address-cells":
+            const: 1
+          "#size-cells":
+            const: 0
+        reg:
+          description: Index of the LED.
+          minimum: 1
+          maximum: 16
+        color:
+          description: Blue.
+          const: LED_COLOR_ID_BLUE
+        required:
+          - reg
+          - color
+
+  patternProperties:
+    "^led@[0-3]$":
+      type: object
+
+      properties:
+        reg:
+          description: Index of the LED.
+          minimum: 1
+          maximum: 16
+
+        required:
+          - reg
+          - color
+
+examples:
+  - |
+    #include <dt-bindings/leds/common.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        mp3326@30 {
+            compatible = "mps,mp3326";
+            reg = <0x30>;
+            led-protect =<3>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            multi-led {
+              color = <LED_COLOR_ID_RGB>;
+              #address-cells = <1>;
+              #size-cells = <0>;
+
+              rgb_r@1 {
+                  #address-cells = <1>;
+                  #size-cells = <0>;
+                  reg  = <1>;
+                  color = <LED_COLOR_ID_RED>;
+              };
+              rgb_g@2 {
+                  #address-cells = <1>;
+                  #size-cells = <0>;
+                  reg = <2>;
+                  color = <LED_COLOR_ID_GREEN>;
+              };
+              rgb_b@3 {
+                  #address-cells = <1>;
+                  #size-cells = <0>;
+                  reg = <3>;
+                  color = <LED_COLOR_ID_BLUE>;
+              };
+            };
+        };
+    };
+
+  - |
+    #include <dt-bindings/leds/common.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        mp3326@30 {
+            compatible = "mps,mp3326";
+            reg = <0x30>;
+            led-protect =<3>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+            led0@0 {
+                #address-cells = <1>;
+                #size-cells = <0>;
+                reg= <5>;
+                color = <LED_COLOR_ID_WHITE>;
+            };
+        };
+    };
+
+...
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] dt-bindings: leds: add mps mp3326 LED
  2023-11-08  3:29 ` [PATCH 1/2] dt-bindings: leds: add mps mp3326 LED Yuxi Wang
@ 2023-11-08  4:15   ` Rob Herring
  2023-11-08  8:20   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 10+ messages in thread
From: Rob Herring @ 2023-11-08  4:15 UTC (permalink / raw)
  To: Yuxi Wang
  Cc: linux-leds, Yuxi.Wang, krzysztof.kozlowski+dt, lee, conor+dt,
	linux-kernel, devicetree, robh+dt, pavel


On Wed, 08 Nov 2023 11:29:20 +0800, Yuxi Wang wrote:
> Document mps mp3326 LED driver devicetree bindings.
> 
> Signed-off-by: Yuxi Wang <wyx137120466@gmail.com>
> ---
>  .../devicetree/bindings/leds/leds-mp3326.yaml | 184 ++++++++++++++++++
>  1 file changed, 184 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/leds/leds-mp3326.yaml
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:multi-led:properties:led_r:properties:required: ['reg', 'color'] is not of type 'object', 'boolean'
	from schema $id: http://json-schema.org/draft-07/schema#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:compatible: [{'const': 'mps,mp3326'}] is not of type 'object', 'boolean'
	from schema $id: http://json-schema.org/draft-07/schema#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties: 'patternProperties' should not be valid under {'$ref': '#/definitions/json-schema-prop-names'}
	hint: A json-schema keyword was found instead of a DT property name.
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:multi-led:properties:led_r:properties: 'required' should not be valid under {'$ref': '#/definitions/json-schema-prop-names'}
	hint: A json-schema keyword was found instead of a DT property name.
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:multi-led:properties:led_r:properties:required: ['reg', 'color'] is not of type 'object', 'boolean'
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:multi-led:properties:led_g: 'anyOf' conditional failed, one must be fixed:
	'reg' is not one of ['$ref', 'additionalItems', 'additionalProperties', 'allOf', 'anyOf', 'const', 'contains', 'default', 'dependencies', 'dependentRequired', 'dependentSchemas', 'deprecated', 'description', 'else', 'enum', 'exclusiveMaximum', 'exclusiveMinimum', 'items', 'if', 'minItems', 'minimum', 'maxItems', 'maximum', 'multipleOf', 'not', 'oneOf', 'pattern', 'patternProperties', 'properties', 'required', 'then', 'typeSize', 'unevaluatedProperties', 'uniqueItems']
	'type' was expected
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:multi-led:properties:led_g: 'anyOf' conditional failed, one must be fixed:
	'color' is not one of ['$ref', 'additionalItems', 'additionalProperties', 'allOf', 'anyOf', 'const', 'contains', 'default', 'dependencies', 'dependentRequired', 'dependentSchemas', 'deprecated', 'description', 'else', 'enum', 'exclusiveMaximum', 'exclusiveMinimum', 'items', 'if', 'minItems', 'minimum', 'maxItems', 'maximum', 'multipleOf', 'not', 'oneOf', 'pattern', 'patternProperties', 'properties', 'required', 'then', 'typeSize', 'unevaluatedProperties', 'uniqueItems']
	'type' was expected
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:multi-led:properties:led_b: 'anyOf' conditional failed, one must be fixed:
	'reg' is not one of ['$ref', 'additionalItems', 'additionalProperties', 'allOf', 'anyOf', 'const', 'contains', 'default', 'dependencies', 'dependentRequired', 'dependentSchemas', 'deprecated', 'description', 'else', 'enum', 'exclusiveMaximum', 'exclusiveMinimum', 'items', 'if', 'minItems', 'minimum', 'maxItems', 'maximum', 'multipleOf', 'not', 'oneOf', 'pattern', 'patternProperties', 'properties', 'required', 'then', 'typeSize', 'unevaluatedProperties', 'uniqueItems']
	'type' was expected
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:multi-led:properties:led_b: 'anyOf' conditional failed, one must be fixed:
	'color' is not one of ['$ref', 'additionalItems', 'additionalProperties', 'allOf', 'anyOf', 'const', 'contains', 'default', 'dependencies', 'dependentRequired', 'dependentSchemas', 'deprecated', 'description', 'else', 'enum', 'exclusiveMaximum', 'exclusiveMinimum', 'items', 'if', 'minItems', 'minimum', 'maxItems', 'maximum', 'multipleOf', 'not', 'oneOf', 'pattern', 'patternProperties', 'properties', 'required', 'then', 'typeSize', 'unevaluatedProperties', 'uniqueItems']
	'type' was expected
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:compatible: [{'const': 'mps,mp3326'}] is not of type 'object', 'boolean'
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:patternProperties: 'anyOf' conditional failed, one must be fixed:
	'^led@[0-3]$' is not one of ['$ref', 'additionalItems', 'additionalProperties', 'allOf', 'anyOf', 'const', 'contains', 'default', 'dependencies', 'dependentRequired', 'dependentSchemas', 'deprecated', 'description', 'else', 'enum', 'exclusiveMaximum', 'exclusiveMinimum', 'items', 'if', 'minItems', 'minimum', 'maxItems', 'maximum', 'multipleOf', 'not', 'oneOf', 'pattern', 'patternProperties', 'properties', 'required', 'then', 'typeSize', 'unevaluatedProperties', 'uniqueItems']
	'type' was expected
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: 'oneOf' conditional failed, one must be fixed:
	'unevaluatedProperties' is a required property
	'additionalProperties' is a required property
	hint: Either unevaluatedProperties or additionalProperties must be present
	from schema $id: http://devicetree.org/meta-schemas/core.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:multi-led:properties:led_g: 'reg' is not one of ['type', 'description', 'dependencies', 'dependentRequired', 'dependentSchemas', 'properties', 'patternProperties', 'additionalProperties', 'unevaluatedProperties', 'deprecated', 'required', 'not', 'allOf', 'anyOf', 'oneOf', '$ref']
	from schema $id: http://devicetree.org/meta-schemas/nodes.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:multi-led:properties:led_g: 'color' is not one of ['type', 'description', 'dependencies', 'dependentRequired', 'dependentSchemas', 'properties', 'patternProperties', 'additionalProperties', 'unevaluatedProperties', 'deprecated', 'required', 'not', 'allOf', 'anyOf', 'oneOf', '$ref']
	from schema $id: http://devicetree.org/meta-schemas/nodes.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:multi-led:properties:led_b: 'reg' is not one of ['type', 'description', 'dependencies', 'dependentRequired', 'dependentSchemas', 'properties', 'patternProperties', 'additionalProperties', 'unevaluatedProperties', 'deprecated', 'required', 'not', 'allOf', 'anyOf', 'oneOf', '$ref']
	from schema $id: http://devicetree.org/meta-schemas/nodes.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: properties:multi-led:properties:led_b: 'color' is not one of ['type', 'description', 'dependencies', 'dependentRequired', 'dependentSchemas', 'properties', 'patternProperties', 'additionalProperties', 'unevaluatedProperties', 'deprecated', 'required', 'not', 'allOf', 'anyOf', 'oneOf', '$ref']
	from schema $id: http://devicetree.org/meta-schemas/nodes.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: $id: Cannot determine base path from $id, relative path/filename doesn't match actual path or filename
 	 $id: http://devicetree.org/schemas/mps,mp3326.yaml
 	file: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: mps,led-protect: missing type definition
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/leds-mp3326.yaml: patternProperties: missing type definition
Documentation/devicetree/bindings/leds/leds-mp3326.example.dtb: /example-0/i2c/mp3326@30: failed to match any schema with compatible: ['mps,mp3326']
Documentation/devicetree/bindings/leds/leds-mp3326.example.dtb: /example-1/i2c/mp3326@30: failed to match any schema with compatible: ['mps,mp3326']

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20231108032921.3134115-2-wyx137120466@gmail.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] dt-bindings: leds: add mps mp3326 LED
  2023-11-08  3:29 ` [PATCH 1/2] dt-bindings: leds: add mps mp3326 LED Yuxi Wang
  2023-11-08  4:15   ` Rob Herring
@ 2023-11-08  8:20   ` Krzysztof Kozlowski
  2023-11-08  9:30     ` Yuxi (Yuxi) Wang
  1 sibling, 1 reply; 10+ messages in thread
From: Krzysztof Kozlowski @ 2023-11-08  8:20 UTC (permalink / raw)
  To: Yuxi Wang, pavel, lee, robh+dt, krzysztof.kozlowski+dt, conor+dt,
	Yuxi.Wang
  Cc: linux-leds, devicetree, linux-kernel

On 08/11/2023 04:29, Yuxi Wang wrote:
> Document mps mp3326 LED driver devicetree bindings.
> 
> Signed-off-by: Yuxi Wang <wyx137120466@gmail.com>
> ---
>  .../devicetree/bindings/leds/leds-mp3326.yaml | 184 ++++++++++++++++++
>  1 file changed, 184 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/leds/leds-mp3326.yaml

Except that this was not tested :(, few more comments.

Filename like compatible.

> 
> diff --git a/Documentation/devicetree/bindings/leds/leds-mp3326.yaml b/Documentation/devicetree/bindings/leds/leds-mp3326.yaml
> new file mode 100644
> index 000000000000..899cf568f647
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/leds/leds-mp3326.yaml
> @@ -0,0 +1,184 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/mps,mp3326.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: MPS MP3326 RGB/White LED Driver
> +
> +maintainers:
> +  - Yuxi Wang <wyx137120466@gmail.com>
> +
> +description: |
> +  The MP3326 is a RGB/White LED driver with I2C interface.
> +
> +  For more product information please see the link below:
> +  https://www.monolithicpower.com/en/products/mp3326.html
> +
> +properties:
> +  compatible:
> +    - const: mps,mp3326
> +
> +  "#address-cells":
> +    const: 1
> +
> +  "#size-cells":
> +    const: 0
> +
> +  reg:
> +    maxItems: 1
> +
> +  mps,led-protect:
> +    description: |
> +      LED short protection threshold.

threshold? So in some units? What does it mean? What do the values mean?

> +    enum: [0, 1, 2, 3]
> +
> +  multi-led:
> +    type: object
> +
> +    properties:
> +      "#address-cells":
> +        const: 1
> +      "#size-cells":
> +        const: 0
> +
> +      color:
> +        description: RGB module
> +        const: LED_COLOR_ID_RGB
> +
> +      led_r:

Nope. First, no underscores in names. Second, please open existing
bindings and look how it is done there.

> +        type: object
> +
> +        properties:
> +          "#address-cells":
> +            const: 1
> +          "#size-cells":
> +            const: 0

Why do you have the,?

> +          reg:
> +            description: Index of the LED.
> +            minimum: 1
> +            maximum: 16

Please format it properly. You miss blank lines between each property
description.

> +          color:
> +            description: Red.
> +            const: LED_COLOR_ID_RED
> +          required:
> +            - reg
> +            - color
> +
> +      led_g:
> +        type: object
> +
> +        properties:
> +          "#address-cells":
> +            const: 1
> +          "#size-cells":
> +            const: 0
> +        reg:
> +          description: Index of the LED.
> +          minimum: 1
> +          maximum: 16
> +        color:
> +          description: Green.
> +          const: LED_COLOR_ID_GREEN
> +        required:
> +          - reg
> +          - color
> +
> +      led_b:
> +        type: object
> +
> +        properties:
> +          "#address-cells":
> +            const: 1
> +          "#size-cells":
> +            const: 0
> +        reg:
> +          description: Index of the LED.
> +          minimum: 1
> +          maximum: 16
> +        color:
> +          description: Blue.
> +          const: LED_COLOR_ID_BLUE
> +        required:
> +          - reg
> +          - color
> +
> +  patternProperties:
> +    "^led@[0-3]$":
> +      type: object
> +
> +      properties:
> +        reg:
> +          description: Index of the LED.
> +          minimum: 1
> +          maximum: 16
> +
> +        required:
> +          - reg
> +          - color

Missing required, additionalProperties.

Open existing binding and use it as example.

> +
> +examples:
> +  - |
> +    #include <dt-bindings/leds/common.h>
> +
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        mp3326@30 {

Node names should be generic. See also an explanation and list of
examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation


> +            compatible = "mps,mp3326";
> +            reg = <0x30>;
> +            led-protect =<3>;
> +            #address-cells = <1>;
> +            #size-cells = <0>;
> +
> +            multi-led {
> +              color = <LED_COLOR_ID_RGB>;
> +              #address-cells = <1>;
> +              #size-cells = <0>;
> +
> +              rgb_r@1 {
> +                  #address-cells = <1>;
> +                  #size-cells = <0>;
> +                  reg  = <1>;
> +                  color = <LED_COLOR_ID_RED>;
> +              };
> +              rgb_g@2 {
> +                  #address-cells = <1>;
> +                  #size-cells = <0>;
> +                  reg = <2>;
> +                  color = <LED_COLOR_ID_GREEN>;
> +              };
> +              rgb_b@3 {
> +                  #address-cells = <1>;
> +                  #size-cells = <0>;
> +                  reg = <3>;
> +                  color = <LED_COLOR_ID_BLUE>;
> +              };
> +            };
> +        };
> +    };
> +
> +  - |
> +    #include <dt-bindings/leds/common.h>
> +
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        mp3326@30 {

Node names should be generic. See also an explanation and list of
examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation


> +            compatible = "mps,mp3326";
> +            reg = <0x30>;
> +            led-protect =<3>;
> +            #address-cells = <1>;
> +            #size-cells = <0>;
> +            led0@0 {
> +                #address-cells = <1>;
> +                #size-cells = <0>;
> +                reg= <5>;
> +                color = <LED_COLOR_ID_WHITE>;
> +            };
> +        };
> +    };
> +
> +...

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH 1/2] dt-bindings: leds: add mps mp3326 LED
  2023-11-08  8:20   ` Krzysztof Kozlowski
@ 2023-11-08  9:30     ` Yuxi (Yuxi) Wang
  2023-11-08 10:42       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 10+ messages in thread
From: Yuxi (Yuxi) Wang @ 2023-11-08  9:30 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Yuxi Wang, pavel@ucw.cz, lee@kernel.org,
	robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
	conor+dt@kernel.org
  Cc: linux-leds@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, Yuxi (Yuxi) Wang

> On 08/11/2023 04:29, Yuxi Wang wrote:
> > Document mps mp3326 LED driver devicetree bindings.
> >
> > Signed-off-by: Yuxi Wang <wyx137120466@gmail.com>
> > ---
> >  .../devicetree/bindings/leds/leds-mp3326.yaml | 184 ++++++++++++++++++
> >  1 file changed, 184 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/leds/leds-mp3326.yaml
> 
> Except that this was not tested :(, few more comments.
> 
> Filename like compatible.
> 
Thank you for pointing this out. I will use mps,mp3326.yaml in the next version.

> >
> > diff --git a/Documentation/devicetree/bindings/leds/leds-mp3326.yaml b/Documentation/devicetree/bindings/leds/leds-
> mp3326.yaml
> > new file mode 100644
> > index 000000000000..899cf568f647
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/leds/leds-mp3326.yaml
> > @@ -0,0 +1,184 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id:
> https://urldefense.com/v3/__http://devicetree.org/schemas/mps,mp3326.yaml*__;Iw!!FIHMVlGrYVGa5kwGHCY!X_Ejb8ueivebvMv2
> RooVy9MVgqWRElf75NTk8JPqFXaYwWNyzupK7XKN5UKAvJRo-WMQmvxIuJPq5isKHeoqFbKZ4_cH81h24frs$
> > +$schema: https://urldefense.com/v3/__http://devicetree.org/meta-
> schemas/core.yaml*__;Iw!!FIHMVlGrYVGa5kwGHCY!X_Ejb8ueivebvMv2RooVy9MVgqWRElf75NTk8JPqFXaYwWNyzupK7XKN5UKAvJR
> o-WMQmvxIuJPq5isKHeoqFbKZ4_cH88smmVyA$
> > +
> > +title: MPS MP3326 RGB/White LED Driver
> > +
> > +maintainers:
> > +  - Yuxi Wang <wyx137120466@gmail.com>
> > +
> > +description: |
> > +  The MP3326 is a RGB/White LED driver with I2C interface.
> > +
> > +  For more product information please see the link below:
> > +  https://www.monolithicpower.com/en/products/mp3326.html
> > +
> > +properties:
> > +  compatible:
> > +    - const: mps,mp3326
> > +
> > +  "#address-cells":
> > +    const: 1
> > +
> > +  "#size-cells":
> > +    const: 0
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  mps,led-protect:
> > +    description: |
> > +      LED short protection threshold.
> 
> threshold? So in some units? What does it mean? What do the values mean?
> 
Yes, it indicates short protection threshold in mp3326.
But they do not have the units. They just indicate the corresponding bits value of register which can configure short protection value.

> > +    enum: [0, 1, 2, 3]
> > +
> > +  multi-led:
> > +    type: object
> > +
> > +    properties:
> > +      "#address-cells":
> > +        const: 1
> > +      "#size-cells":
> > +        const: 0
> > +
> > +      color:
> > +        description: RGB module
> > +        const: LED_COLOR_ID_RGB
> > +
> > +      led_r:
> 
> Nope. First, no underscores in names. Second, please open existing
> bindings and look how it is done there.
> 
Thank you for pointing out this, I will Fixed it in the next version.
> > +        type: object
> > +
> > +        properties:
> > +          "#address-cells":
> > +            const: 1
> > +          "#size-cells":
> > +            const: 0
> 
> Why do you have the,?
> 

Sorry,  here in no , .
what do you mean?

> > +          reg:
> > +            description: Index of the LED.
> > +            minimum: 1
> > +            maximum: 16
> 
> Please format it properly. You miss blank lines between each property
> description.
> 
Thank you for pointing this out. I will add the blank lines in the next version.
> > +          color:
> > +            description: Red.
> > +            const: LED_COLOR_ID_RED
> > +          required:
> > +            - reg
> > +            - color
> > +
> > +      led_g:
> > +        type: object
> > +
> > +        properties:
> > +          "#address-cells":
> > +            const: 1
> > +          "#size-cells":
> > +            const: 0
> > +        reg:
> > +          description: Index of the LED.
> > +          minimum: 1
> > +          maximum: 16
> > +        color:
> > +          description: Green.
> > +          const: LED_COLOR_ID_GREEN
> > +        required:
> > +          - reg
> > +          - color
> > +
> > +      led_b:
> > +        type: object
> > +
> > +        properties:
> > +          "#address-cells":
> > +            const: 1
> > +          "#size-cells":
> > +            const: 0
> > +        reg:
> > +          description: Index of the LED.
> > +          minimum: 1
> > +          maximum: 16
> > +        color:
> > +          description: Blue.
> > +          const: LED_COLOR_ID_BLUE
> > +        required:
> > +          - reg
> > +          - color
> > +
> > +  patternProperties:
> > +    "^led@[0-3]$":
> > +      type: object
> > +
> > +      properties:
> > +        reg:
> > +          description: Index of the LED.
> > +          minimum: 1
> > +          maximum: 16
> > +
> > +        required:
> > +          - reg
> > +          - color
> 
> Missing required, additionalProperties.
> 
> Open existing binding and use it as example.
> 
Thank you for pointing this out. I will add the additional Properties in the next version.
> > +
> > +examples:
> > +  - |
> > +    #include <dt-bindings/leds/common.h>
> > +
> > +    i2c {
> > +        #address-cells = <1>;
> > +        #size-cells = <0>;
> > +
> > +        mp3326@30 {
> 
> Node names should be generic. See also an explanation and list of
> examples (not exhaustive) in DT specification:
> https://urldefense.com/v3/__https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html*generic-
> names-
> recommendation__;Iw!!FIHMVlGrYVGa5kwGHCY!X_Ejb8ueivebvMv2RooVy9MVgqWRElf75NTk8JPqFXaYwWNyzupK7XKN5UKAvJRo-
> WMQmvxIuJPq5isKHeoqFbKZ4_cH8-K2cXo8$
> 
Thank you for sharing this, I will check it and change it in the next version.
> 
> > +            compatible = "mps,mp3326";
> > +            reg = <0x30>;
> > +            led-protect =<3>;
> > +            #address-cells = <1>;
> > +            #size-cells = <0>;
> > +
> > +            multi-led {
> > +              color = <LED_COLOR_ID_RGB>;
> > +              #address-cells = <1>;
> > +              #size-cells = <0>;
> > +
> > +              rgb_r@1 {
> > +                  #address-cells = <1>;
> > +                  #size-cells = <0>;
> > +                  reg  = <1>;
> > +                  color = <LED_COLOR_ID_RED>;
> > +              };
> > +              rgb_g@2 {
> > +                  #address-cells = <1>;
> > +                  #size-cells = <0>;
> > +                  reg = <2>;
> > +                  color = <LED_COLOR_ID_GREEN>;
> > +              };
> > +              rgb_b@3 {
> > +                  #address-cells = <1>;
> > +                  #size-cells = <0>;
> > +                  reg = <3>;
> > +                  color = <LED_COLOR_ID_BLUE>;
> > +              };
> > +            };
> > +        };
> > +    };
> > +
> > +  - |
> > +    #include <dt-bindings/leds/common.h>
> > +
> > +    i2c {
> > +        #address-cells = <1>;
> > +        #size-cells = <0>;
> > +
> > +        mp3326@30 {
> 
> Node names should be generic. See also an explanation and list of
> examples (not exhaustive) in DT specification:
> https://urldefense.com/v3/__https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html*generic-
> names-
> recommendation__;Iw!!FIHMVlGrYVGa5kwGHCY!X_Ejb8ueivebvMv2RooVy9MVgqWRElf75NTk8JPqFXaYwWNyzupK7XKN5UKAvJRo-
> WMQmvxIuJPq5isKHeoqFbKZ4_cH8-K2cXo8$
> 
Thank you for sharing this, I will check it and change it in the next version.
> 
> > +            compatible = "mps,mp3326";
> > +            reg = <0x30>;
> > +            led-protect =<3>;
> > +            #address-cells = <1>;
> > +            #size-cells = <0>;
> > +            led0@0 {
> > +                #address-cells = <1>;
> > +                #size-cells = <0>;
> > +                reg= <5>;
> > +                color = <LED_COLOR_ID_WHITE>;
> > +            };
> > +        };
> > +    };
> > +
> > +...
> 
> Best regards,
> Krzysztof


Best Regards.

Yuxi Wang 




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] dt-bindings: leds: add mps mp3326 LED
  2023-11-08  9:30     ` Yuxi (Yuxi) Wang
@ 2023-11-08 10:42       ` Krzysztof Kozlowski
  0 siblings, 0 replies; 10+ messages in thread
From: Krzysztof Kozlowski @ 2023-11-08 10:42 UTC (permalink / raw)
  To: Yuxi (Yuxi) Wang, Yuxi Wang, pavel@ucw.cz, lee@kernel.org,
	robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
	conor+dt@kernel.org
  Cc: linux-leds@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org

On 08/11/2023 10:30, Yuxi (Yuxi) Wang wrote:
>>> +  reg:
>>> +    maxItems: 1
>>> +
>>> +  mps,led-protect:
>>> +    description: |
>>> +      LED short protection threshold.
>>
>> threshold? So in some units? What does it mean? What do the values mean?
>>
> Yes, it indicates short protection threshold in mp3326.
> But they do not have the units. They just indicate the corresponding bits value of register which can configure short protection value.

I meant, what are the real, not how you wrote it here, values?

What do the values mean? Description should state that and according to
this, you might have to use standard unit suffixes so these will be real
values.

> 
>>> +    enum: [0, 1, 2, 3]
>>> +
>>> +  multi-led:
>>> +    type: object
>>> +
>>> +    properties:
>>> +      "#address-cells":
>>> +        const: 1
>>> +      "#size-cells":
>>> +        const: 0
>>> +
>>> +      color:
>>> +        description: RGB module
>>> +        const: LED_COLOR_ID_RGB
>>> +
>>> +      led_r:
>>
>> Nope. First, no underscores in names. Second, please open existing
>> bindings and look how it is done there.
>>
> Thank you for pointing out this, I will Fixed it in the next version.
>>> +        type: object
>>> +
>>> +        properties:
>>> +          "#address-cells":
>>> +            const: 1
>>> +          "#size-cells":
>>> +            const: 0
>>
>> Why do you have the,?
>>
> 
> Sorry,  here in no , .
> what do you mean?

s/the,/them/

Why do you need these?

> 
>>> +          reg:
>>> +            description: Index of the LED.
>>> +            minimum: 1
>>> +            maximum: 16
>>


Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/2] dt-bindings: leds: add mps mp3326 LED
  2023-11-24  9:30 [PATCH 0/2] leds: Add a driver for MP3326 Yuxi Wang
@ 2023-11-24  9:30 ` Yuxi Wang
  2023-11-25 10:44   ` Krzysztof Kozlowski
  0 siblings, 1 reply; 10+ messages in thread
From: Yuxi Wang @ 2023-11-24  9:30 UTC (permalink / raw)
  To: pavel, lee, robh+dt, krzysztof.kozlowski+dt, conor+dt, Yuxi.Wang
  Cc: linux-kernel, linux-leds, devicetree, wyx137120466

Document mps mp3326 LED driver devicetree bindings.

Signed-off-by: Yuxi Wang <Yuxi.Wang@monolithicpower.com>
---
 .../devicetree/bindings/leds/mps,mp3326.yaml  | 143 ++++++++++++++++++
 1 file changed, 143 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/mps,mp3326.yaml

diff --git a/Documentation/devicetree/bindings/leds/mps,mp3326.yaml b/Documentation/devicetree/bindings/leds/mps,mp3326.yaml
new file mode 100644
index 000000000000..5f6bde46ccc8
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/mps,mp3326.yaml
@@ -0,0 +1,143 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/mps,mp3326.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MPS MP3326 RGB/White LED Driver
+
+maintainers:
+  - Yuxi Wang <Yuxi.Wang@monolithicpower.com>
+
+description: |
+  The MP3326 is a RGB/White LED driver with I2C interface.
+
+  For more product information please see the link below:
+  https://www.monolithicpower.com/en/products/mp3326.html
+
+properties:
+  compatible:
+    const: mps,mp3326
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+  reg:
+    maxItems: 1
+
+  multi-led:
+    type: object
+    unevaluatedProperties: false
+
+    properties:
+      "#address-cells":
+        const: 1
+
+      "#size-cells":
+        const: 0
+
+      color:
+        description: RGB module
+
+    patternProperties:
+      "^led@[0-3]$":
+        type: object
+        $ref: common.yaml#
+        unevaluatedProperties: false
+
+        properties:
+          reg:
+            description: Index of the LED.
+            minimum: 1
+            maximum: 16
+
+        required:
+          - reg
+          - color
+
+    required:
+      - "#address-cells"
+      - "#size-cells"
+      - color
+
+patternProperties:
+  "^led@[0-9]$":
+    type: object
+    $ref: common.yaml#
+    unevaluatedProperties: false
+
+    properties:
+      reg:
+        description: Index of the LED.
+        minimum: 1
+        maximum: 16
+
+    required:
+      - reg
+
+required:
+  - compatible
+  - reg
+  - "#address-cells"
+  - "#size-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/leds/common.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        led-controller@30 {
+            #address-cells = <1>;
+            #size-cells = <0>;
+            compatible = "mps,mp3326";
+            reg = <0x30>;
+            multi-led {
+              #address-cells = <1>;
+              #size-cells = <0>;
+              color = <LED_COLOR_ID_RGB>;
+
+              led@0 {
+                  reg  = <1>;
+                  color = <LED_COLOR_ID_RED>;
+              };
+
+              led@1 {
+                  reg = <2>;
+                  color = <LED_COLOR_ID_GREEN>;
+              };
+
+              led@2 {
+                  reg = <3>;
+                  color = <LED_COLOR_ID_BLUE>;
+              };
+            };
+        };
+    };
+
+  - |
+    #include <dt-bindings/leds/common.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        led-controller@30 {
+            compatible = "mps,mp3326";
+            reg = <0x30>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            led@0 {
+                reg= <5>;
+                color = <LED_COLOR_ID_WHITE>;
+            };
+        };
+    };
+...
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] dt-bindings: leds: add mps mp3326 LED
  2023-11-24  9:30 ` [PATCH 1/2] dt-bindings: leds: add mps mp3326 LED Yuxi Wang
@ 2023-11-25 10:44   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 10+ messages in thread
From: Krzysztof Kozlowski @ 2023-11-25 10:44 UTC (permalink / raw)
  To: Yuxi Wang, pavel, lee, robh+dt, krzysztof.kozlowski+dt, conor+dt
  Cc: linux-kernel, linux-leds, devicetree, wyx137120466

On 24/11/2023 10:30, Yuxi Wang wrote:
> Document mps mp3326 LED driver devicetree bindings.
> 
> Signed-off-by: Yuxi Wang <Yuxi.Wang@monolithicpower.com>
> ---
>  .../devicetree/bindings/leds/mps,mp3326.yaml  | 143 ++++++++++++++++++
>  1 file changed, 143 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/leds/mps,mp3326.yaml
> 
> diff --git a/Documentation/devicetree/bindings/leds/mps,mp3326.yaml b/Documentation/devicetree/bindings/leds/mps,mp3326.yaml
> new file mode 100644
> index 000000000000..5f6bde46ccc8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/leds/mps,mp3326.yaml
> @@ -0,0 +1,143 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/leds/mps,mp3326.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: MPS MP3326 RGB/White LED Driver
> +
> +maintainers:
> +  - Yuxi Wang <Yuxi.Wang@monolithicpower.com>
> +
> +description: |
> +  The MP3326 is a RGB/White LED driver with I2C interface.
> +
> +  For more product information please see the link below:
> +  https://www.monolithicpower.com/en/products/mp3326.html
> +
> +properties:
> +  compatible:
> +    const: mps,mp3326
> +
> +  "#address-cells":
> +    const: 1
> +
> +  "#size-cells":
> +    const: 0
> +
> +  reg:
> +    maxItems: 1
> +
> +  multi-led:
> +    type: object

Missing ref to multi-led class. Please open existing bindings with such
node and take a look how it is done there.

> +    unevaluatedProperties: false
> +
> +    properties:
> +      "#address-cells":
> +        const: 1
> +
> +      "#size-cells":
> +        const: 0
> +
> +      color:
> +        description: RGB module

Drop property

> +
> +    patternProperties:
> +      "^led@[0-3]$":

This says 4...

> +        type: object
> +        $ref: common.yaml#
> +        unevaluatedProperties: false
> +
> +        properties:
> +          reg:
> +            description: Index of the LED.
> +            minimum: 1
> +            maximum: 16

But this says 16.

Also reg does not match unit address. Minimum reg is 1, but unit address
is 0.

> +
> +        required:
> +          - reg
> +          - color
> +
> +    required:
> +      - "#address-cells"
> +      - "#size-cells"
> +      - color

Drop color, it is coming with class-multicolor


> +
> +patternProperties:
> +  "^led@[0-9]$":

It's even weirded. Here you have 10 leds with indices 0-9

> +    type: object
> +    $ref: common.yaml#
> +    unevaluatedProperties: false
> +
> +    properties:
> +      reg:
> +        description: Index of the LED.
> +        minimum: 1
> +        maximum: 16

bu there 16! With indices 1-16.

It's a mess.


> +    required:
> +      - reg
> +
> +required:
> +  - compatible
> +  - reg
> +  - "#address-cells"
> +  - "#size-cells"
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/leds/common.h>
> +
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        led-controller@30 {
> +            #address-cells = <1>;
> +            #size-cells = <0>;
> +            compatible = "mps,mp3326";
> +            reg = <0x30>;
> +            multi-led {
> +              #address-cells = <1>;
> +              #size-cells = <0>;
> +              color = <LED_COLOR_ID_RGB>;
> +
> +              led@0 {
> +                  reg  = <1>;

OK, you did not test it. Test your DTS before sending.

Also, messed indentation. Use 4 spaces.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-11-25 10:44 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-31  6:59 [PATCH 1/2] dt-bindings: leds: add mps mp3326 LED Yuxi (Yuxi) Wang
2023-10-31  8:10 ` Krzysztof Kozlowski
2023-10-31 12:57 ` Rob Herring
  -- strict thread matches above, loose matches on Subject: below --
2023-11-08  3:29 [PATCH 0/2] leds: add mp3326 driver Yuxi Wang
2023-11-08  3:29 ` [PATCH 1/2] dt-bindings: leds: add mps mp3326 LED Yuxi Wang
2023-11-08  4:15   ` Rob Herring
2023-11-08  8:20   ` Krzysztof Kozlowski
2023-11-08  9:30     ` Yuxi (Yuxi) Wang
2023-11-08 10:42       ` Krzysztof Kozlowski
2023-11-24  9:30 [PATCH 0/2] leds: Add a driver for MP3326 Yuxi Wang
2023-11-24  9:30 ` [PATCH 1/2] dt-bindings: leds: add mps mp3326 LED Yuxi Wang
2023-11-25 10:44   ` Krzysztof Kozlowski

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).