diff mbox series

[1/2,v3] dt-bindings: leds: Add DT binding for Richtek RT8515

Message ID 20201111011417.2275501-1-linus.walleij@linaro.org
State New
Headers show
Series [1/2,v3] dt-bindings: leds: Add DT binding for Richtek RT8515 | expand

Commit Message

Linus Walleij Nov. 11, 2020, 1:14 a.m. UTC
Add a YAML devicetree binding for the Richtek RT8515
dual channel flash/torch LED driver.

Cc: Sakari Ailus <sakari.ailus@iki.fi>
Cc: newbytee@protonmail.com
Cc: Stephan Gerhold <stephan@gerhold.net>
Cc: devicetree@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

---
ChangeLog v2->v3:
- Add Sakari to CC
- Resend
ChangeLog v1->v2:
- Explicitly inherit function, color and flash-max-timeout-us
  from common.yaml
- Add "led" node as required.
---
 .../bindings/leds/richtek,rt8515.yaml         | 59 +++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/richtek,rt8515.yaml

-- 
2.26.2

Comments

Sakari Ailus Nov. 11, 2020, 11:04 a.m. UTC | #1
Hi Linus,

Thanks for the patch (and cc'ing me).

On Wed, Nov 11, 2020 at 02:14:16AM +0100, Linus Walleij wrote:
> Add a YAML devicetree binding for the Richtek RT8515

> dual channel flash/torch LED driver.

> 

> Cc: Sakari Ailus <sakari.ailus@iki.fi>

> Cc: newbytee@protonmail.com

> Cc: Stephan Gerhold <stephan@gerhold.net>

> Cc: devicetree@vger.kernel.org

> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

> ---

> ChangeLog v2->v3:

> - Add Sakari to CC

> - Resend

> ChangeLog v1->v2:

> - Explicitly inherit function, color and flash-max-timeout-us

>   from common.yaml

> - Add "led" node as required.

> ---

>  .../bindings/leds/richtek,rt8515.yaml         | 59 +++++++++++++++++++

>  1 file changed, 59 insertions(+)

>  create mode 100644 Documentation/devicetree/bindings/leds/richtek,rt8515.yaml

> 

> diff --git a/Documentation/devicetree/bindings/leds/richtek,rt8515.yaml b/Documentation/devicetree/bindings/leds/richtek,rt8515.yaml

> new file mode 100644

> index 000000000000..0d8bb635370c

> --- /dev/null

> +++ b/Documentation/devicetree/bindings/leds/richtek,rt8515.yaml

> @@ -0,0 +1,59 @@

> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)

> +%YAML 1.2

> +---

> +$id: http://devicetree.org/schemas/leds/richtek,rt8515.yaml#

> +$schema: http://devicetree.org/meta-schemas/core.yaml#

> +

> +title: Richtek RT8515 1.5A dual channel LED driver

> +

> +maintainers:

> +  - Linus Walleij <linus.walleij@linaro.org>

> +

> +description: |

> +  The Richtek RT8515 is a dual channel (two mode) LED driver that

> +  supports driving a white LED in flash or torch mode.

> +

> +properties:

> +  compatible:

> +    const: richtek,rt8515

> +

> +  enf-gpios:

> +    maxItems: 1

> +    description: A connection to the 'ENF' (enable flash) pin.

> +

> +  ent-gpios:

> +    maxItems: 1

> +    description: A connection to the 'ENT' (enable torch) pin.

> +

> +  led:

> +    type: object

> +    $ref: common.yaml#

> +    properties:

> +      function: true

> +      color: true

> +      flash-max-timeout-us: true


Don't you also need flash-max-microamp and led-max-microamp? As the maximum
current for the LED may well be less than the driver can provide.

> +

> +required:

> +  - compatible

> +  - ent-gpios

> +  - enf-gpios

> +  - led

> +

> +additionalProperties: false

> +

> +examples:

> +  - |

> +    #include <dt-bindings/gpio/gpio.h>

> +    #include <dt-bindings/leds/common.h>

> +

> +    led-controller {

> +        compatible = "richtek,rt8515";

> +        enf-gpios = <&gpio4 12 GPIO_ACTIVE_HIGH>;

> +        ent-gpios = <&gpio4 13 GPIO_ACTIVE_HIGH>;

> +

> +        led {

> +            function = LED_FUNCTION_FLASH;

> +            color = <LED_COLOR_ID_WHITE>;

> +            flash-max-timeout-us = <250000>;

> +        };

> +    };

> -- 

> 2.26.2

> 


-- 
Kind regards,

Sakari Ailus
Linus Walleij Nov. 11, 2020, 1:44 p.m. UTC | #2
On Wed, Nov 11, 2020 at 12:05 PM Sakari Ailus <sakari.ailus@iki.fi> wrote:
> On Wed, Nov 11, 2020 at 02:14:16AM +0100, Linus Walleij wrote:


> > Add a YAML devicetree binding for the Richtek RT8515

> > dual channel flash/torch LED driver.


> > +  led:

> > +    type: object

> > +    $ref: common.yaml#

> > +    properties:

> > +      function: true

> > +      color: true

> > +      flash-max-timeout-us: true

>

> Don't you also need flash-max-microamp and led-max-microamp? As the maximum

> current for the LED may well be less than the driver can provide.


I wish I could add that.

The problem is that we don't know anything about the microamps
for this Richtek component.

There is no public datasheet available. I have asked Richtek, they
answered as follows:

"RT8515 had EOL already.
 So, we couldn't provide the datasheet.
 Thank you."

I do not quite understand their answer but they at least answered.

I have a few out-of-tree drivers, from Asus Zenfone, and from the
numerous Samsung mobiles using this. None of the outoftree code
makes any reference to the actual microamperes.

They make a setting from 1..100 "units" and that is handled by some
kind of userspace that I do not have the code for. If someone knows
of a source code for this userspace I would be happy to take a look
so we can at least figure out if it is linear.

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/leds/richtek,rt8515.yaml b/Documentation/devicetree/bindings/leds/richtek,rt8515.yaml
new file mode 100644
index 000000000000..0d8bb635370c
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/richtek,rt8515.yaml
@@ -0,0 +1,59 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/richtek,rt8515.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Richtek RT8515 1.5A dual channel LED driver
+
+maintainers:
+  - Linus Walleij <linus.walleij@linaro.org>
+
+description: |
+  The Richtek RT8515 is a dual channel (two mode) LED driver that
+  supports driving a white LED in flash or torch mode.
+
+properties:
+  compatible:
+    const: richtek,rt8515
+
+  enf-gpios:
+    maxItems: 1
+    description: A connection to the 'ENF' (enable flash) pin.
+
+  ent-gpios:
+    maxItems: 1
+    description: A connection to the 'ENT' (enable torch) pin.
+
+  led:
+    type: object
+    $ref: common.yaml#
+    properties:
+      function: true
+      color: true
+      flash-max-timeout-us: true
+
+required:
+  - compatible
+  - ent-gpios
+  - enf-gpios
+  - led
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/leds/common.h>
+
+    led-controller {
+        compatible = "richtek,rt8515";
+        enf-gpios = <&gpio4 12 GPIO_ACTIVE_HIGH>;
+        ent-gpios = <&gpio4 13 GPIO_ACTIVE_HIGH>;
+
+        led {
+            function = LED_FUNCTION_FLASH;
+            color = <LED_COLOR_ID_WHITE>;
+            flash-max-timeout-us = <250000>;
+        };
+    };