diff mbox series

[v2,1/2] dt-bindings: leds: pca995x: Add binding document for PCA995X chips

Message ID 20230705000407.153005-1-marex@denx.de
State Changes Requested, archived
Headers show
Series [v2,1/2] dt-bindings: leds: pca995x: Add binding document for PCA995X chips | expand

Checks

Context Check Description
robh/dt-meta-schema success
robh/checkpatch success
robh/patch-applied success
robh/dtbs-check warning build log

Commit Message

Marek Vasut July 5, 2023, 12:04 a.m. UTC
The PCA995x chips are I2C controlled LED drivers. Each chip has
up to 16 outputs, each one with an individual 8-bit resolution
PWM for brightness control. Add binding document.

Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Conor Dooley <conor+dt@kernel.org>
Cc: Isai Gaspar <isaiezequiel.gaspar@nxp.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: Lee Jones <lee@kernel.org>
Cc: Marek Vasut <marex@denx.de>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org
Cc: linux-leds@vger.kernel.org
---
V2: Fix the led@[0-9]+ match
---
 .../devicetree/bindings/leds/nxp,pca995x.yaml | 81 +++++++++++++++++++
 1 file changed, 81 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/nxp,pca995x.yaml

Comments

Krzysztof Kozlowski July 5, 2023, 7:11 a.m. UTC | #1
On 05/07/2023 02:04, Marek Vasut wrote:
> From: Isai Gaspar <isaiezequiel.gaspar@nxp.com>
> 
> The PCA995x chips are I2C controlled LED drivers. Each chip has
> up to 16 outputs, each one with an individual 8-bit resolution
> PWM for brightness control.
> 
> Signed-off-by: Isai Gaspar <isaiezequiel.gaspar@nxp.com>
> Signed-off-by: Marek Vasut <marex@denx.de> # Basically rewrite the driver

...

> +
> +static struct i2c_driver pca995x_driver = {
> +	.driver = {
> +		.name = "leds-pca995x",
> +		.owner = THIS_MODULE,
> +		.of_match_table = of_match_ptr(pca995x_of_match),

Drop of_match_ptr(), it will cause warnings and is not really helpful.

Best regards,
Krzysztof
Marek Vasut July 5, 2023, 5:26 p.m. UTC | #2
On 7/5/23 09:11, Krzysztof Kozlowski wrote:
> On 05/07/2023 02:04, Marek Vasut wrote:
>> From: Isai Gaspar <isaiezequiel.gaspar@nxp.com>
>>
>> The PCA995x chips are I2C controlled LED drivers. Each chip has
>> up to 16 outputs, each one with an individual 8-bit resolution
>> PWM for brightness control.
>>
>> Signed-off-by: Isai Gaspar <isaiezequiel.gaspar@nxp.com>
>> Signed-off-by: Marek Vasut <marex@denx.de> # Basically rewrite the driver
> 
> ...
> 
>> +
>> +static struct i2c_driver pca995x_driver = {
>> +	.driver = {
>> +		.name = "leds-pca995x",
>> +		.owner = THIS_MODULE,
>> +		.of_match_table = of_match_ptr(pca995x_of_match),
> 
> Drop of_match_ptr(), it will cause warnings and is not really helpful.

Will do , thanks.

I'll wait for the bindings review before sending V3.
Rob Herring (Arm) July 5, 2023, 7:08 p.m. UTC | #3
On Wed, Jul 05, 2023 at 02:04:06AM +0200, Marek Vasut wrote:
> The PCA995x chips are I2C controlled LED drivers. Each chip has
> up to 16 outputs, each one with an individual 8-bit resolution
> PWM for brightness control. Add binding document.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
> Cc: Conor Dooley <conor+dt@kernel.org>
> Cc: Isai Gaspar <isaiezequiel.gaspar@nxp.com>
> Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
> Cc: Lee Jones <lee@kernel.org>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Pavel Machek <pavel@ucw.cz>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: devicetree@vger.kernel.org
> Cc: linux-leds@vger.kernel.org
> ---
> V2: Fix the led@[0-9]+ match
> ---
>  .../devicetree/bindings/leds/nxp,pca995x.yaml | 81 +++++++++++++++++++
>  1 file changed, 81 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/leds/nxp,pca995x.yaml
> 
> diff --git a/Documentation/devicetree/bindings/leds/nxp,pca995x.yaml b/Documentation/devicetree/bindings/leds/nxp,pca995x.yaml
> new file mode 100644
> index 0000000000000..562199d3ad820
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/leds/nxp,pca995x.yaml
> @@ -0,0 +1,81 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/leds/nxp,pca995x.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: NXP PCA995x LED controllers
> +
> +maintainers:
> +  - Isai Gaspar <isaiezequiel.gaspar@nxp.com>
> +  - Marek Vasut <marex@denx.de>
> +
> +description:
> +  The NXP PCA9952/PCA9955B are programmable LED controllers connected via I2C
> +  that can drive 16 separate lines. Each of them can be individually switched
> +  on and off, and brightness can be controlled via individual PWM.
> +
> +  Datasheets are available at
> +  https://www.nxp.com/docs/en/data-sheet/PCA9952_PCA9955.pdf
> +  https://www.nxp.com/docs/en/data-sheet/PCA9955B.pdf
> +
> +properties:
> +  compatible:
> +    enum:
> +      - nxp,pca9952
> +      - nxp,pca9955b
> +
> +  reg:
> +    maxItems: 1
> +
> +  "#address-cells":
> +    const: 1
> +
> +  "#size-cells":
> +    const: 0
> +
> +patternProperties:
> +  "^led@[0-9]+$":

Unit-addresses are hex.

> +    type: object
> +    $ref: common.yaml#
> +    unevaluatedProperties: false
> +
> +    properties:
> +      reg:
> +        minimum: 0
> +        maximum: 15
> +
> +    required:
> +      - reg
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/leds/common.h>
> +
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        led-controller@1 {
> +            compatible = "nxp,pca9955b";
> +            reg = <0x01>;
> +            #address-cells = <1>;
> +            #size-cells = <0>;
> +
> +            led@0 {
> +                reg = <0x0>;
> +                color = <LED_COLOR_ID_RED>;
> +                function = LED_FUNCTION_POWER;
> +            };
> +
> +            led@2 {
> +                reg = <0x2>;
> +                color = <LED_COLOR_ID_WHITE>;
> +                function = LED_FUNCTION_STATUS;
> +            };
> +        };
> +    };
> +
> +...
> -- 
> 2.40.1
>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/leds/nxp,pca995x.yaml b/Documentation/devicetree/bindings/leds/nxp,pca995x.yaml
new file mode 100644
index 0000000000000..562199d3ad820
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/nxp,pca995x.yaml
@@ -0,0 +1,81 @@ 
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/nxp,pca995x.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP PCA995x LED controllers
+
+maintainers:
+  - Isai Gaspar <isaiezequiel.gaspar@nxp.com>
+  - Marek Vasut <marex@denx.de>
+
+description:
+  The NXP PCA9952/PCA9955B are programmable LED controllers connected via I2C
+  that can drive 16 separate lines. Each of them can be individually switched
+  on and off, and brightness can be controlled via individual PWM.
+
+  Datasheets are available at
+  https://www.nxp.com/docs/en/data-sheet/PCA9952_PCA9955.pdf
+  https://www.nxp.com/docs/en/data-sheet/PCA9955B.pdf
+
+properties:
+  compatible:
+    enum:
+      - nxp,pca9952
+      - nxp,pca9955b
+
+  reg:
+    maxItems: 1
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+patternProperties:
+  "^led@[0-9]+$":
+    type: object
+    $ref: common.yaml#
+    unevaluatedProperties: false
+
+    properties:
+      reg:
+        minimum: 0
+        maximum: 15
+
+    required:
+      - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/leds/common.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        led-controller@1 {
+            compatible = "nxp,pca9955b";
+            reg = <0x01>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            led@0 {
+                reg = <0x0>;
+                color = <LED_COLOR_ID_RED>;
+                function = LED_FUNCTION_POWER;
+            };
+
+            led@2 {
+                reg = <0x2>;
+                color = <LED_COLOR_ID_WHITE>;
+                function = LED_FUNCTION_STATUS;
+            };
+        };
+    };
+
+...