[v1,1/2] dt-bindings: media: i2c: add lm3560 binding

Message ID 20230308095209.14700-2-clamor95@gmail.com
State New
Headers
Series Add OF support for LM3560 |

Commit Message

Svyatoslav Ryhel March 8, 2023, 9:52 a.m. UTC
  Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
 .../bindings/media/i2c/ti,lm3560.yaml         | 130 ++++++++++++++++++
 1 file changed, 130 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/ti,lm3560.yaml
  

Comments

Rob Herring March 8, 2023, 2:06 p.m. UTC | #1
On Wed, 08 Mar 2023 11:52:08 +0200, Svyatoslav Ryhel wrote:
> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
> ---
>  .../bindings/media/i2c/ti,lm3560.yaml         | 130 ++++++++++++++++++
>  1 file changed, 130 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/media/i2c/ti,lm3560.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:
Error: Documentation/devicetree/bindings/media/i2c/ti,lm3560.example.dts:26.43-44 syntax error
FATAL ERROR: Unable to parse input tree
make[1]: *** [scripts/Makefile.lib:419: Documentation/devicetree/bindings/media/i2c/ti,lm3560.example.dtb] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1512: dt_binding_check] Error 2

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20230308095209.14700-2-clamor95@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.
  
Rob Herring March 8, 2023, 6:21 p.m. UTC | #2
On Wed, Mar 08, 2023 at 11:52:08AM +0200, Svyatoslav Ryhel wrote:
> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
> ---
>  .../bindings/media/i2c/ti,lm3560.yaml         | 130 ++++++++++++++++++
>  1 file changed, 130 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/media/i2c/ti,lm3560.yaml
> 
> diff --git a/Documentation/devicetree/bindings/media/i2c/ti,lm3560.yaml b/Documentation/devicetree/bindings/media/i2c/ti,lm3560.yaml
> new file mode 100644
> index 000000000000..b3c2ccb83a30
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/i2c/ti,lm3560.yaml
> @@ -0,0 +1,130 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/media/i2c/ti,lm3560.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: TI LM3560 Synchronous Boost Flash Driver
> +
> +maintainers:
> +  - Daniel Jeong <gshark.jeong@gmail.com>
> +  - Ldd-Mlp <ldd-mlp@list.ti.com>
> +
> +description: |
> +  The LM3560 is a 2-MHz fixed frequency synchronous boost
> +  converter with two 1000-mA constant current drivers for
> +  high-current white LEDs. The dual highside current sources
> +  allow for grounded cathode LED operation and can be tied
> +  together for providing flash currents at up to 2 A through
> +  a single LED. An adaptive regulation method ensures the
> +  current for each LED remains in regulation and maximizes
> +  efficiency.
> +
> +properties:
> +  compatible:
> +    items:
> +      - enum:
> +          - ti,lm3559
> +          - ti,lm3560
> +
> +  reg:
> +    maxItems: 1
> +
> +  enable-gpios:
> +    maxItems: 1
> +
> +  ti,peak-current:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    enum: [0, 0x20, 0x40, 0x60]
> +    default: 0x60
> +    description: |
> +      Peak current can be set to 4 values 1.6A (0x00),
> +      2.3A (0x20), 3.0A (0x40) and 3.6A (0x60).

Pretty sure we have common properties for this.

> +
> +  ti,max-flash-timeout:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    minimum: 32
> +    maximum: 1024
> +    default: 1024
> +    description: |
> +      Maximum flash timeout in ms with step 32ms.

And this too.

> +
> +  '#address-cells':
> +    const: 1
> +
> +  '#size-cells':
> +    const: 0
> +
> +required:
> +  - compatible
> +  - reg
> +  - '#address-cells'
> +  - '#size-cells'
> +
> +patternProperties:
> +  "^led@[01]$":
> +    type: object
> +    description: |
> +      Properties for a connected LEDs.
> +    properties:
> +      reg:
> +        minimum: 0
> +        maximum: 1
> +
> +      ti,max-flash-current:
> +        $ref: /schemas/types.yaml#/definitions/uint32
> +        minimum: 62500
> +        maximum: 1000000
> +        default: 1000000
> +        description: |
> +          Maximum current in flash mode in uA with step 62500uA.

Or maybe it's these per LED settings that are common.

BTW, anything with units, should have a standard unit suffix.

> +
> +      ti,max-torch-current:
> +        $ref: /schemas/types.yaml#/definitions/uint32
> +        minimum: 31250
> +        maximum: 250000
> +        default: 250000
> +        description: |
> +          Maximum current in tourch mode in uA with step 31250uA.
> +
> +    required:
> +      - reg
> +
> +    additionalProperties: false
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        flash-led@53 {

led-controller@53

> +            compatible = "ti,lm3559";
> +            reg = <0x53>;
> +
> +            enable-gpios = <&gpio 219 GPIO_ACTIVE_HIGH>;
> +
> +            ti,peak-current = <0>;
> +            ti,max-flash-timeout = <1024>;
> +
> +            #address-cells = <1>;
> +            #size-cells = <0>;
> +
> +            led@0 {
> +                reg = <0>;
> +
> +                ti,max-flash-current = <562500>;
> +                ti,max-torch-current = <156250>;
> +            };
> +
> +            led@1 {
> +                reg = <1>;
> +
> +                ti,max-flash-current = <562500>;
> +                ti,max-torch-current = <156250>;
> +            };
> +        };
> +    };
> +...
> -- 
> 2.37.2
>
  

Patch

diff --git a/Documentation/devicetree/bindings/media/i2c/ti,lm3560.yaml b/Documentation/devicetree/bindings/media/i2c/ti,lm3560.yaml
new file mode 100644
index 000000000000..b3c2ccb83a30
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/ti,lm3560.yaml
@@ -0,0 +1,130 @@ 
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/ti,lm3560.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TI LM3560 Synchronous Boost Flash Driver
+
+maintainers:
+  - Daniel Jeong <gshark.jeong@gmail.com>
+  - Ldd-Mlp <ldd-mlp@list.ti.com>
+
+description: |
+  The LM3560 is a 2-MHz fixed frequency synchronous boost
+  converter with two 1000-mA constant current drivers for
+  high-current white LEDs. The dual highside current sources
+  allow for grounded cathode LED operation and can be tied
+  together for providing flash currents at up to 2 A through
+  a single LED. An adaptive regulation method ensures the
+  current for each LED remains in regulation and maximizes
+  efficiency.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - ti,lm3559
+          - ti,lm3560
+
+  reg:
+    maxItems: 1
+
+  enable-gpios:
+    maxItems: 1
+
+  ti,peak-current:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [0, 0x20, 0x40, 0x60]
+    default: 0x60
+    description: |
+      Peak current can be set to 4 values 1.6A (0x00),
+      2.3A (0x20), 3.0A (0x40) and 3.6A (0x60).
+
+  ti,max-flash-timeout:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 32
+    maximum: 1024
+    default: 1024
+    description: |
+      Maximum flash timeout in ms with step 32ms.
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 0
+
+required:
+  - compatible
+  - reg
+  - '#address-cells'
+  - '#size-cells'
+
+patternProperties:
+  "^led@[01]$":
+    type: object
+    description: |
+      Properties for a connected LEDs.
+    properties:
+      reg:
+        minimum: 0
+        maximum: 1
+
+      ti,max-flash-current:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        minimum: 62500
+        maximum: 1000000
+        default: 1000000
+        description: |
+          Maximum current in flash mode in uA with step 62500uA.
+
+      ti,max-torch-current:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        minimum: 31250
+        maximum: 250000
+        default: 250000
+        description: |
+          Maximum current in tourch mode in uA with step 31250uA.
+
+    required:
+      - reg
+
+    additionalProperties: false
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        flash-led@53 {
+            compatible = "ti,lm3559";
+            reg = <0x53>;
+
+            enable-gpios = <&gpio 219 GPIO_ACTIVE_HIGH>;
+
+            ti,peak-current = <0>;
+            ti,max-flash-timeout = <1024>;
+
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            led@0 {
+                reg = <0>;
+
+                ti,max-flash-current = <562500>;
+                ti,max-torch-current = <156250>;
+            };
+
+            led@1 {
+                reg = <1>;
+
+                ti,max-flash-current = <562500>;
+                ti,max-torch-current = <156250>;
+            };
+        };
+    };
+...