162306a36Sopenharmony_ci# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
262306a36Sopenharmony_ci%YAML 1.2
362306a36Sopenharmony_ci---
462306a36Sopenharmony_ci$id: http://devicetree.org/schemas/leds/richtek,rt8515.yaml#
562306a36Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml#
662306a36Sopenharmony_ci
762306a36Sopenharmony_cititle: Richtek RT8515 1.5A dual channel LED driver
862306a36Sopenharmony_ci
962306a36Sopenharmony_cimaintainers:
1062306a36Sopenharmony_ci  - Linus Walleij <linus.walleij@linaro.org>
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_cidescription: |
1362306a36Sopenharmony_ci  The Richtek RT8515 is a dual channel (two mode) LED driver that
1462306a36Sopenharmony_ci  supports driving a white LED in flash or torch mode. The maximum
1562306a36Sopenharmony_ci  current for each mode is defined in hardware using two resistors
1662306a36Sopenharmony_ci  RFS and RTS.
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ciproperties:
1962306a36Sopenharmony_ci  compatible:
2062306a36Sopenharmony_ci    const: richtek,rt8515
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci  enf-gpios:
2362306a36Sopenharmony_ci    maxItems: 1
2462306a36Sopenharmony_ci    description: A connection to the 'ENF' (enable flash) pin.
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci  ent-gpios:
2762306a36Sopenharmony_ci    maxItems: 1
2862306a36Sopenharmony_ci    description: A connection to the 'ENT' (enable torch) pin.
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci  richtek,rfs-ohms:
3162306a36Sopenharmony_ci    minimum: 7680
3262306a36Sopenharmony_ci    maximum: 367000
3362306a36Sopenharmony_ci    description: The resistance value of the RFS resistor. This
3462306a36Sopenharmony_ci      resistors limits the maximum flash current. This must be set
3562306a36Sopenharmony_ci      for the property flash-max-microamp to work, the RFS resistor
3662306a36Sopenharmony_ci      defines the range of the dimmer setting (brightness) of the
3762306a36Sopenharmony_ci      flash LED.
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci  richtek,rts-ohms:
4062306a36Sopenharmony_ci    minimum: 7680
4162306a36Sopenharmony_ci    maximum: 367000
4262306a36Sopenharmony_ci    description: The resistance value of the RTS resistor. This
4362306a36Sopenharmony_ci      resistors limits the maximum torch current. This must be set
4462306a36Sopenharmony_ci      for the property torch-max-microamp to work, the RTS resistor
4562306a36Sopenharmony_ci      defines the range of the dimmer setting (brightness) of the
4662306a36Sopenharmony_ci      torch LED.
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci  led:
4962306a36Sopenharmony_ci    type: object
5062306a36Sopenharmony_ci    $ref: common.yaml#
5162306a36Sopenharmony_ci    properties:
5262306a36Sopenharmony_ci      function: true
5362306a36Sopenharmony_ci      color: true
5462306a36Sopenharmony_ci      flash-max-timeout-us: true
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci      flash-max-microamp:
5762306a36Sopenharmony_ci        maximum: 700000
5862306a36Sopenharmony_ci        description: The maximum current for flash mode
5962306a36Sopenharmony_ci          is hardwired to the component using the RFS resistor to
6062306a36Sopenharmony_ci          ground. The maximum hardware current setting is calculated
6162306a36Sopenharmony_ci          according to the formula Imax = 5500 / RFS. The lowest
6262306a36Sopenharmony_ci          allowed resistance value is 7.86 kOhm giving an absolute
6362306a36Sopenharmony_ci          maximum current of 700mA. By setting this attribute in
6462306a36Sopenharmony_ci          the device tree, you can further restrict the maximum
6562306a36Sopenharmony_ci          current below the hardware limit. This requires the RFS
6662306a36Sopenharmony_ci          to be defined as it defines the maximum range.
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci      led-max-microamp:
6962306a36Sopenharmony_ci        maximum: 700000
7062306a36Sopenharmony_ci        description: The maximum current for torch mode
7162306a36Sopenharmony_ci          is hardwired to the component using the RTS resistor to
7262306a36Sopenharmony_ci          ground. The maximum hardware current setting is calculated
7362306a36Sopenharmony_ci          according to the formula Imax = 5500 / RTS. The lowest
7462306a36Sopenharmony_ci          allowed resistance value is 7.86 kOhm giving an absolute
7562306a36Sopenharmony_ci          maximum current of 700mA. By setting this attribute in
7662306a36Sopenharmony_ci          the device tree, you can further restrict the maximum
7762306a36Sopenharmony_ci          current below the hardware limit. This requires the RTS
7862306a36Sopenharmony_ci          to be defined as it defines the maximum range.
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ci    additionalProperties: false
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_cirequired:
8362306a36Sopenharmony_ci  - compatible
8462306a36Sopenharmony_ci  - ent-gpios
8562306a36Sopenharmony_ci  - enf-gpios
8662306a36Sopenharmony_ci  - led
8762306a36Sopenharmony_ci
8862306a36Sopenharmony_ciadditionalProperties: false
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ciexamples:
9162306a36Sopenharmony_ci  - |
9262306a36Sopenharmony_ci    #include <dt-bindings/gpio/gpio.h>
9362306a36Sopenharmony_ci    #include <dt-bindings/leds/common.h>
9462306a36Sopenharmony_ci
9562306a36Sopenharmony_ci    led-controller {
9662306a36Sopenharmony_ci        compatible = "richtek,rt8515";
9762306a36Sopenharmony_ci        enf-gpios = <&gpio4 12 GPIO_ACTIVE_HIGH>;
9862306a36Sopenharmony_ci        ent-gpios = <&gpio4 13 GPIO_ACTIVE_HIGH>;
9962306a36Sopenharmony_ci        richtek,rfs-ohms = <16000>;
10062306a36Sopenharmony_ci        richtek,rts-ohms = <100000>;
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_ci        led {
10362306a36Sopenharmony_ci            function = LED_FUNCTION_FLASH;
10462306a36Sopenharmony_ci            color = <LED_COLOR_ID_WHITE>;
10562306a36Sopenharmony_ci            flash-max-timeout-us = <250000>;
10662306a36Sopenharmony_ci            flash-max-microamp = <150000>;
10762306a36Sopenharmony_ci            led-max-microamp = <25000>;
10862306a36Sopenharmony_ci        };
10962306a36Sopenharmony_ci    };
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci...
112