diff mbox series

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

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

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, 6:21 p.m. UTC | #1
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
>
diff mbox series

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>;
+            };
+        };
+    };
+...