From patchwork Tue Jan 26 14:04:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Patchwork-Id: 12046733 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A4FEC4332B for ; Tue, 26 Jan 2021 14:05:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 09592230FD for ; Tue, 26 Jan 2021 14:05:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405624AbhAZOE6 (ORCPT ); Tue, 26 Jan 2021 09:04:58 -0500 Received: from mail-40131.protonmail.ch ([185.70.40.131]:38260 "EHLO mail-40131.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405608AbhAZOEz (ORCPT ); Tue, 26 Jan 2021 09:04:55 -0500 Date: Tue, 26 Jan 2021 14:04:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1611669852; bh=mbQbonKTWOJG/8gSURwb2HOD/90QOtBxSCKvG2gI4So=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=asITbJ20piki8V4dq2FdGySHW4Jz9wuRLKpSqWyrGCxQPMshDoQ/XcALmQeSuyzz4 P0eiekzy+SfZaNA9+NNENnX04w/6I5M7a2MEm894adRHiGdTYySJLBhQrACjywokPB X8I9M7BUJXOly0k33ZSgzwMDhwhXkAUoelhSjv/w= To: Pavel Machek , Dan Murphy , Bjorn Andersson , Andy Gross , Rob Herring From: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= Cc: linux-leds@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Brian Masney , Luca Weiss , Russell King , Georgi Djakov , linux-kernel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, lkcamp@lists.libreplanetbr.org, andrealmeid@collabora.com Reply-To: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= Subject: [PATCH v2 1/4] dt-bindings: leds: Add binding for qcom-spmi-flash Message-ID: <20210126140240.1517044-2-nfraprado@protonmail.com> In-Reply-To: <20210126140240.1517044-1-nfraprado@protonmail.com> References: <20210126140240.1517044-1-nfraprado@protonmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add devicetree binding for QCOM SPMI Flash LEDs, which are part of PM8941, and are used both as lantern and camera flash. Signed-off-by: NĂ­colas F. R. A. Prado --- Changes in v2: - Add this commit .../bindings/leds/leds-qcom-spmi-flash.yaml | 94 +++++++++++++++++++ .../dt-bindings/leds/leds-qcom-spmi-flash.h | 15 +++ 2 files changed, 109 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-qcom-spmi-flash.yaml create mode 100644 include/dt-bindings/leds/leds-qcom-spmi-flash.h 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..169716e14f67 --- /dev/null +++ b/Documentation/devicetree/bindings/leds/leds-qcom-spmi-flash.yaml @@ -0,0 +1,94 @@ +# 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 + +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 + + reg: + maxItems: 1 + + flash-boost-supply: + description: SMBB regulator for LED flash mode + + torch-boost-supply: + description: SMBB regulator for LED torch mode + +patternProperties: + "^led[0-1]$": + type: object + $ref: common.yaml# + + properties: + qcom,clamp-curr: + description: current to clamp at, in uA + $ref: /schemas/types.yaml#definitions/uint32 + + qcom,headroom: + description: | + headroom to use. Use one of QCOM_SPMI_FLASH_HEADROOM_* defined in + include/dt-bindings/leds/leds-qcom-spmi-flash.h + $ref: /schemas/types.yaml#definitions/uint32 + minimum: 0 + maximum: 3 + + qcom,startup-dly: + description: | + delay before flashing. Use one of QCOM_SPMI_FLASH_STARTUP_DLY_* + defined in include/dt-bindings/leds/leds-qcom-spmi-flash.h + $ref: /schemas/types.yaml#definitions/uint32 + minimum: 0 + maximum: 3 + + qcom,safety-timer: + description: include for safety timer use, otherwise watchdog timer will be used + type: boolean + +required: + - compatible + - reg + - flash-boost-supply + - torch-boost-supply + +additionalProperties: false + +examples: + - | + #include + #include + + qcom,leds@d300 { + compatible = "qcom,spmi-flash"; + reg = <0xd300 0x100>; + flash-boost-supply = <&pm8941_5vs1>; + torch-boost-supply = <&pm8941_5v>; + + led0 { + led-sources = <0>; + function = LED_FUNCTION_FLASH; + color = ; + led-max-microamp = <200000>; + flash-max-microamp = <1000000>; + flash-max-timeout-us = <1280000>; + default-state = "off"; + qcom,clamp-curr = <200000>; + qcom,headroom = ; + qcom,startup-dly = ; + qcom,safety-timer; + }; + }; +... diff --git a/include/dt-bindings/leds/leds-qcom-spmi-flash.h b/include/dt-bindings/leds/leds-qcom-spmi-flash.h new file mode 100644 index 000000000000..8bd54a8e831d --- /dev/null +++ b/include/dt-bindings/leds/leds-qcom-spmi-flash.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _DT_BINDINGS_LEDS_QCOM_SPMI_FLASH_H +#define _DT_BINDINGS_LEDS_QCOM_SPMI_FLASH_H + +#define QCOM_SPMI_FLASH_HEADROOM_250MV 0 +#define QCOM_SPMI_FLASH_HEADROOM_300MV 1 +#define QCOM_SPMI_FLASH_HEADROOM_400MV 2 +#define QCOM_SPMI_FLASH_HEADROOM_500MV 3 + +#define QCOM_SPMI_FLASH_STARTUP_DLY_10US 0 +#define QCOM_SPMI_FLASH_STARTUP_DLY_32US 1 +#define QCOM_SPMI_FLASH_STARTUP_DLY_64US 2 +#define QCOM_SPMI_FLASH_STARTUP_DLY_128US 3 + +#endif