From patchwork Tue Aug 3 16:26:37 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: 491081 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=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 D97BDC4320A for ; Tue, 3 Aug 2021 16:27:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C18B060F94 for ; Tue, 3 Aug 2021 16:27:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233478AbhHCQ1V (ORCPT ); Tue, 3 Aug 2021 12:27:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233464AbhHCQ1V (ORCPT ); Tue, 3 Aug 2021 12:27:21 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E0B7C061757; Tue, 3 Aug 2021 09:27:10 -0700 (PDT) Received: from localhost.localdomain (unknown [IPv6:2804:14c:1a9:2434:b693:c9:5cb6:b688]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: nfraprado) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 13F7D1F423F0; Tue, 3 Aug 2021 17:27:03 +0100 (BST) From: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= To: Pavel Machek , Dan Murphy , Bjorn Andersson , Andy Gross , Rob Herring , Jacek Anaszewski 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, phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, ~lkcamp/patches@lists.sr.ht, =?utf-8?q?Andr=C3=A9_Almeida?= , kernel@collabora.com Subject: [PATCH v3 1/5] dt-bindings: leds: Add binding for qcom-spmi-flash Date: Tue, 3 Aug 2021 13:26:37 -0300 Message-Id: <20210803162641.1525980-2-nfraprado@collabora.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210803162641.1525980-1-nfraprado@collabora.com> References: <20210803162641.1525980-1-nfraprado@collabora.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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 --- 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 + +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 + + 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 + + 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-max-microamp = <200000>; + flash-max-microamp = <1000000>; + flash-max-timeout-us = <1280000>; + }; + }; +... From patchwork Tue Aug 3 16:26:39 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: 491080 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=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 B3A26C19F34 for ; Tue, 3 Aug 2021 16:27:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 948E961037 for ; Tue, 3 Aug 2021 16:27:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233573AbhHCQ1e (ORCPT ); Tue, 3 Aug 2021 12:27:34 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:51932 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233496AbhHCQ1c (ORCPT ); Tue, 3 Aug 2021 12:27:32 -0400 Received: from localhost.localdomain (unknown [IPv6:2804:14c:1a9:2434:b693:c9:5cb6:b688]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: nfraprado) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 527AC1F423F0; Tue, 3 Aug 2021 17:27:15 +0100 (BST) From: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= To: Pavel Machek , Dan Murphy , Bjorn Andersson , Andy Gross , Rob Herring , Jacek Anaszewski 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, phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, ~lkcamp/patches@lists.sr.ht, =?utf-8?q?Andr=C3=A9_Almeida?= , kernel@collabora.com Subject: [PATCH v3 3/5] ARM: qcom_defconfig: Enable QCOM SPMI Flash LEDs Date: Tue, 3 Aug 2021 13:26:39 -0300 Message-Id: <20210803162641.1525980-4-nfraprado@collabora.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210803162641.1525980-1-nfraprado@collabora.com> References: <20210803162641.1525980-1-nfraprado@collabora.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Enable module for the Qualcomm SPMI Flash LEDs present on the PM8941 PMIC. These LEDs are used on phones based on the MSM8974 SoC like the Nexus 5. Also enable LED flash class since these LEDs make use of it. Signed-off-by: Nícolas F. R. A. Prado --- Changes in v3: - Made CONFIG_LEDS_CLASS_FLASH =m Changes in v2: - Enabled CONFIG_LEDS_CLASS_FLASH since the driver now depends on it. arch/arm/configs/qcom_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/configs/qcom_defconfig b/arch/arm/configs/qcom_defconfig index 9c286861a9c0..1be619a12637 100644 --- a/arch/arm/configs/qcom_defconfig +++ b/arch/arm/configs/qcom_defconfig @@ -206,6 +206,7 @@ CONFIG_MMC_SDHCI_PLTFM=y CONFIG_MMC_SDHCI_MSM=y CONFIG_NEW_LEDS=y CONFIG_LEDS_CLASS=y +CONFIG_LEDS_CLASS_FLASH=m CONFIG_LEDS_GPIO=y CONFIG_LEDS_PM8058=y CONFIG_LEDS_TRIGGERS=y @@ -308,3 +309,4 @@ CONFIG_QCOM_WDT=y CONFIG_ARM_PSCI=y CONFIG_CPU_FREQ=y CONFIG_CPUFREQ_DT=y +CONFIG_LEDS_QCOM_SPMI_FLASH=m From patchwork Tue Aug 3 16:26:41 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: 491079 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=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 5E37EC4320A for ; Tue, 3 Aug 2021 16:27:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4DF3060F9C for ; Tue, 3 Aug 2021 16:27:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233689AbhHCQ1t (ORCPT ); Tue, 3 Aug 2021 12:27:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232252AbhHCQ1t (ORCPT ); Tue, 3 Aug 2021 12:27:49 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7557C061757; Tue, 3 Aug 2021 09:27:37 -0700 (PDT) Received: from localhost.localdomain (unknown [IPv6:2804:14c:1a9:2434:b693:c9:5cb6:b688]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: nfraprado) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 946C51F42408; Tue, 3 Aug 2021 17:27:26 +0100 (BST) From: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= To: Pavel Machek , Dan Murphy , Bjorn Andersson , Andy Gross , Rob Herring , Jacek Anaszewski 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, phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, ~lkcamp/patches@lists.sr.ht, =?utf-8?q?Andr=C3=A9_Almeida?= , kernel@collabora.com Subject: [PATCH v3 5/5] ARM: dts: qcom: msm8974-hammerhead: Enable and configure flash LED node Date: Tue, 3 Aug 2021 13:26:41 -0300 Message-Id: <20210803162641.1525980-6-nfraprado@collabora.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210803162641.1525980-1-nfraprado@collabora.com> References: <20210803162641.1525980-1-nfraprado@collabora.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Enable the flash LED node from PM8941 and configure the LEDs. This enables the Nexus 5 to make use of the LEDs as flash or lantern. Signed-off-by: Nícolas F. R. A. Prado --- Added in v3 .../qcom-msm8974-lge-nexus5-hammerhead.dts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts b/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts index 30ee913faae6..78ac56be81b3 100644 --- a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts +++ b/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts @@ -759,4 +759,24 @@ otg { }; }; }; + + pm8941@1 { + spmi-flash-leds@d300 { + status = "okay"; + + led@0 { + led-max-microamp = <200000>; + flash-max-microamp = <1000000>; + flash-max-timeout-us = <1280000>; + default-state = "off"; + }; + + led@1 { + led-max-microamp = <200000>; + flash-max-microamp = <1000000>; + flash-max-timeout-us = <1280000>; + default-state = "off"; + }; + }; + }; };