Re: [PATCH v3 1/5] dt-bindings: leds: Add binding for qcom-spmi-flash

From: Rob Herring
Date: Wed Aug 11 2021 - 14:36:09 EST


On Tue, Aug 03, 2021 at 01:26:37PM -0300, Nícolas F. R. A. Prado wrote:
> Add devicetree binding for Qualcomm's SPMI Flash LEDs which are part of
> the PM8941 PMIC. These LEDs are used both as lantern and camera flash on
> phones based on the MSM8974 SoC, like the Nexus 5.
>
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@xxxxxxxxxxxxx>
> ---
>
> Changes in v3:
> - Removed clamp-curr, headroom, startup-dly and safety-timer properties since
> they didn't impact the behavior. They're now hardcoded in the driver (patch 2)
> - Added valid ranges for led-max-microamp, flash-max-microamp and
> flash-max-timeout-us
> - Removed dt-bindings header file that held some constants (moved to inside the
> driver in patch 2)
>
> Added in v2
>
> .../bindings/leds/leds-qcom-spmi-flash.yaml | 93 +++++++++++++++++++
> 1 file changed, 93 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/leds/leds-qcom-spmi-flash.yaml
>
> diff --git a/Documentation/devicetree/bindings/leds/leds-qcom-spmi-flash.yaml b/Documentation/devicetree/bindings/leds/leds-qcom-spmi-flash.yaml
> new file mode 100644
> index 000000000000..da674d73c033
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/leds/leds-qcom-spmi-flash.yaml
> @@ -0,0 +1,93 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/leds/leds-qcom-spmi-flash.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Qualcomm SPMI Flash LEDs
> +
> +maintainers:
> + - Nícolas F. R. A. Prado <n@xxxxxxxxxxxxx>
> +
> +description: |
> + The Qualcomm SPMI Flash LEDs are part of Qualcomm PMICs and are used primarily
> + as a camera or video flash. They can also be used as a lantern when on torch
> + mode.
> + The PMIC is connected to Host processor via SPMI bus.
> +
> +properties:
> + compatible:
> + const: qcom,spmi-flash-leds
> +
> + reg:
> + maxItems: 1
> +
> + flash-boost-supply:
> + description: SMBB regulator for LED flash mode
> +
> + torch-boost-supply:
> + description: SMBB regulator for LED torch mode
> +
> + '#address-cells':
> + const: 1
> +
> + '#size-cells':
> + const: 0
> +
> +patternProperties:
> + "^led@[0-1]$":
> + type: object
> + $ref: common.yaml#
> +
> + properties:
> + reg:
> + maxItems: 1

Instead of maxItems, this would be a bit more specific:

enum: [ 0, 1 ]

With that,

Reviewed-by: Rob Herring <robh@xxxxxxxxxx>

> +
> + led-max-microamp:
> + minimum: 12500
> + maximum: 200000
> + multipleOf: 12500
> +
> + flash-max-microamp:
> + minimum: 12500
> + maximum: 1000000
> + multipleOf: 12500
> +
> + flash-max-timeout-us:
> + minimum: 10000
> + maximum: 1280000
> + multipleOf: 10000
> +
> + required:
> + - reg
> +
> +required:
> + - compatible
> + - reg
> + - flash-boost-supply
> + - torch-boost-supply
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/leds/common.h>
> +
> + spmi-flash-leds@d300 {
> + compatible = "qcom,spmi-flash-leds";
> + reg = <0xd300 0x100>;
> + flash-boost-supply = <&pm8941_5vs1>;
> + torch-boost-supply = <&pm8941_5v>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + led@0 {
> + reg = <0>;
> + function = LED_FUNCTION_FLASH;
> + color = <LED_COLOR_ID_WHITE>;
> + led-max-microamp = <200000>;
> + flash-max-microamp = <1000000>;
> + flash-max-timeout-us = <1280000>;
> + };
> + };
> +...
> --
> 2.32.0
>
>