All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Jacek Anaszewski <jacek.anaszewski@gmail.com>,
	Pavel Machek <pavel@ucw.cz>, Dan Murphy <dmurphy@ti.com>,
	linux-leds@vger.kernel.org, Sakari Ailus <sakari.ailus@iki.fi>,
	newbytee@protonmail.com, Stephan Gerhold <stephan@gerhold.net>,
	phone-devel@vger.kernel.org, linux-media@vger.kernel.org,
	devicetree@vger.kernel.org,
	Sakari Ailus <sakari.ailus@linux.intel.com>
Subject: Re: [PATCH 1/2 v7] dt-bindings: leds: Add DT binding for Richtek RT8515
Date: Wed, 9 Dec 2020 10:31:57 -0600	[thread overview]
Message-ID: <20201209163157.GA501745@robh.at.kernel.org> (raw)
In-Reply-To: <20201201101350.1401956-1-linus.walleij@linaro.org>

On Tue, Dec 01, 2020 at 11:13:49AM +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: phone-devel@vger.kernel.org
> Cc: linux-media@vger.kernel.org
> Cc: devicetree@vger.kernel.org
> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> ChangeLog v6->v7:
> - Use led-max-microamp for the torch mode max current.
> - Drop the torch-specific new property from common.yaml in
>   favor of this property.
> - Collect Sakari's review tag.
> ChangeLog v5->v6:
> - Use the suffix -ohms for the resistor values as this gets
>   recognized by default by dtschema and is nominal.
> ChangeLog v4->v5:
> - Fix the RFS/RTS resistors to reference the u32 schema.
> - Fix resisitor speling error.
> ChangeLog v3->v4:
> - Add DT attributes for the RFS and RTS resistors, so that
>   the hardware-defined maximum current can be determined.
> - Add torch-max-microamp to the common bindings so we can
>   set an attribute for the max microamp in torch mode.
> - Add flash-max-microamp and torch-max-microamp as optional
>   to the LED node.
> - Slot in some elabortative descriptions of the new
>   properties and describe what the hardware is doing.
> - Cc phone-devel@vger.kernel.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         | 109 ++++++++++++++++++
>  1 file changed, 109 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..3190e4fcfdf2
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/leds/richtek,rt8515.yaml
> @@ -0,0 +1,109 @@
> +# 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. The maximum
> +  current for each mode is defined in hardware using two resistors
> +  RFS and RTS.
> +
> +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.
> +
> +  richtek,rfs-ohms:
> +    minimum: 7680
> +    maximum: 367000
> +    description: The resistance value of the RFS resistor. This
> +      resistors limits the maximum flash current. This must be set
> +      for the property flash-max-microamp to work, the RFS resistor
> +      defines the range of the dimmer setting (brightness) of the
> +      flash LED.
> +
> +  richtek,rts-ohms:
> +    minimum: 7680
> +    maximum: 367000
> +    description: The resistance value of the RTS resistor. This
> +      resistors limits the maximum torch current. This must be set
> +      for the property torch-max-microamp to work, the RTS resistor
> +      defines the range of the dimmer setting (brightness) of the
> +      torch LED.
> +
> +  led:
> +    type: object
> +    $ref: common.yaml#

       additionalProperties: false

And then fix the error in the example.

With that,

Reviewed-by: Rob Herring <robh@kernel.org>

> +    properties:
> +      function: true
> +      color: true
> +      flash-max-timeout-us: true
> +
> +      flash-max-microamp:
> +        maximum: 700000
> +        description: The maximum current for flash mode
> +          is hardwired to the component using the RFS resistor to
> +          ground. The maximum hardware current setting is calculated
> +          according to the formula Imax = 5500 / RFS. The lowest
> +          allowed resistance value is 7.86 kOhm giving an absolute
> +          maximum current of 700mA. By setting this attribute in
> +          the device tree, you can further restrict the maximum
> +          current below the hardware limit. This requires the RFS
> +          to be defined as it defines the maximum range.
> +
> +      led-max-microamp:
> +        maximum: 700000
> +        description: The maximum current for torch mode
> +          is hardwired to the component using the RTS resistor to
> +          ground. The maximum hardware current setting is calculated
> +          according to the formula Imax = 5500 / RTS. The lowest
> +          allowed resistance value is 7.86 kOhm giving an absolute
> +          maximum current of 700mA. By setting this attribute in
> +          the device tree, you can further restrict the maximum
> +          current below the hardware limit. This requires the RTS
> +          to be defined as it defines the maximum range.
> +
> +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>;
> +        richtek,rfs-ohms = <16000>;
> +        richtek,rts-ohms = <100000>;
> +
> +        led {
> +            function = LED_FUNCTION_FLASH;
> +            color = <LED_COLOR_ID_WHITE>;
> +            flash-max-timeout-us = <250000>;
> +            flash-max-microamp = <150000>;
> +            torch-max-microamp = <25000>;

hint ^^^

> +        };
> +    };
> +
> +...
> -- 
> 2.26.2
> 

      parent reply	other threads:[~2020-12-09 16:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01 10:13 [PATCH 1/2 v7] dt-bindings: leds: Add DT binding for Richtek RT8515 Linus Walleij
2020-12-01 10:13 ` [PATCH 2/2 v7] leds: rt8515: Add Richtek RT8515 LED driver Linus Walleij
2020-12-30 19:09   ` Pavel Machek
2021-01-01 14:19     ` Linus Walleij
2020-12-30 20:32   ` Andy Shevchenko
2020-12-09 16:31 ` Rob Herring [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201209163157.GA501745@robh.at.kernel.org \
    --to=robh@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmurphy@ti.com \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=newbytee@protonmail.com \
    --cc=pavel@ucw.cz \
    --cc=phone-devel@vger.kernel.org \
    --cc=sakari.ailus@iki.fi \
    --cc=sakari.ailus@linux.intel.com \
    --cc=stephan@gerhold.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.