Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1412941pxb; Fri, 6 Nov 2020 09:02:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJza1eV6PgbOtzlANRPh95g0sH8ztYA8EreJXCqd/SIGIgytFaBolGPPmhOPVFpVIvCyK6LE X-Received: by 2002:a17:906:7e55:: with SMTP id z21mr2950253ejr.154.1604682029049; Fri, 06 Nov 2020 09:00:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604682029; cv=none; d=google.com; s=arc-20160816; b=YYuSdXX3UhkU9NkU4hRlBF7mgcHHHA358d/v/lwuMVu0UKC55b29XnQmVIyEjg3o/f J6zXNdOtpx7PXh9ayjpzHEpBOEDSTdQbTlEeM2R5dDzLMiAm/AVJQimiEEXioYyfxZdK zyEWqWlLaAkYJw2fyhEfF+1Ewpnzhgp6hXowy81iA9OStP+OoAm0fxQvnLDB7vZjHT+5 8BzyC0ZDWSsrGTEK3reV5qKmFyZWmL4Hgwo2vKe3DsS6mkOUza/UGMbh2T0zkTKMi5fP nY6J+SpkVrf88a/QMae1prDtiPGH6tOXopNFsSMGNF+sjJbZPRMoQQbwuiG9VeRnkFGl XJUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:subject:reply-to:cc:from:to:dkim-signature:date; bh=Cxw7DayELvc3qFiSUFsEDeHz2abSz8ZKKvShcAZzGs4=; b=HpVndaD5y/q5eXjNaz4CXl4E/tE6k0uRdRcMvUXPh0S9AvIdF9ylebT9fYs8euM9pt hAovk241Bzz3ykBGcoEQa3hvI8+dwmPteZBTdkYSg+0tAq1noK5kwT3bGh0iSVbfWdux BlrI0ALORVTJd3QKonzoVVAHYghsZTKDR7/4N7cFCqUwTtIKiwcBX/lcz57GcL9/GW4W yXF0Ohad1+/Ei9iNsR7xGK1jxXOKmr9nDMP1+N3cILbdOJIW4m05DQeAhsYUkMWjy3fL iZtNkcEnd4pMIeXC+RtkS2Pzg0PTB7rKnToNaZsVEVMaXblbnOUxC/1fhS5PmzMSmy/x 8tEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail header.b=V4ecOcfM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g1si1428915ejf.525.2020.11.06.08.59.54; Fri, 06 Nov 2020 09:00:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail header.b=V4ecOcfM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727229AbgKFQ6O (ORCPT + 99 others); Fri, 6 Nov 2020 11:58:14 -0500 Received: from mail-40131.protonmail.ch ([185.70.40.131]:59355 "EHLO mail-40131.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726034AbgKFQ6O (ORCPT ); Fri, 6 Nov 2020 11:58:14 -0500 Date: Fri, 06 Nov 2020 16:58:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1604681891; bh=Cxw7DayELvc3qFiSUFsEDeHz2abSz8ZKKvShcAZzGs4=; h=Date:To:From:Cc:Reply-To:Subject:From; b=V4ecOcfMwrzQwVVAadDcFFrVquVfAX0sNE4d9AXx0HTmHp07Oqs6LkIksFi/PCg+b 3N3YwWdZenhBVBvceDB/vW3a1sQcnZK3rH7dAcd8SUOgzvVievVXdIBC8v+lr4ecxR GA64X6Cue7yH99ws87Hh7lMGTV3LQH9z7GN2NRLk= To: Pavel Machek , Dan Murphy , Bjorn Andersson , Andy Gross , Rob Herring From: =?utf-8?Q?N=C3=ADcolas_F=2E_R=2E_A=2E_Prado?= 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, lkcamp@lists.libreplanetbr.org, andrealmeid@collabora.com Reply-To: =?utf-8?Q?N=C3=ADcolas_F=2E_R=2E_A=2E_Prado?= Subject: [RFC PATCH 0/3] Add support for the flash LED on Nexus 5 Message-ID: <20201106165737.1029106-1-nfraprado@protonmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, this patch series adds support for the flash LED on Nexus 5. The first patch adds the driver for the QPNP flash LED. The code for the dr= iver was ported from [1], which was for the 3.4 kernel. That driver originally supported multiple LED types: WLED, Flash/Torch, RGB, MPP and KPDBL as desc= ribed in [2], but this port only contains support for Flash/Torch, and the code f= or the others was removed just because it was easier to test. Also, it was originally an SPMI driver, but here I made it into a platform driver that matches an SPMI device and uses regmap to read and write on the addresses. The second patch adds the driver as a module in qcom's defconfig, which is = the one used by the Nexus 5. The third patch adds the relevant nodes to Nexus 5's device tree. These nod= es were copied from [3] and [4], only changing the flash-boost-supply and torch-boost-supply properties to point to the regulator nodes already defin= ed upstream at qcom-pm8941.dtsi. Again, I'm not sure if the nodes should be ke= pt on separate .dtsi as they were downstream, I just did what was easier for test= ing. The flash LED can be tested on a Nexus 5 with the following: To turn the LED on: echo 1 > /sys/class/leds/led\:flash_torch/brightness To turn the LED on only for a couple seconds: echo 1 > /sys/class/leds/led\:flash_0/brightness From what I understand flash and torch correspond to the same LED, but flas= h only stays on for a couple seconds and uses a different voltage regulator. I'm not sure why there are both flash_0 and flash_1. Both seem to do the sa= me. My questions are: Is there something fundamentally wrong with this patch se= ries? Is it okay to have the driver only support the flash LEDs from QPNP (at lea= st for the time being)? But also please give me any other feedback. Thanks, N=C3=ADcolas [1] https://github.com/AICP/kernel_lge_hammerhead/blob/n7.1/drivers/leds/le= ds-qpnp.c [2] https://github.com/AICP/kernel_lge_hammerhead/blob/n7.1/Documentation/d= evicetree/bindings/leds/leds-qpnp.txt [3] https://github.com/AICP/kernel_lge_hammerhead/blob/n7.1/arch/arm/boot/d= ts/msm-pm8941.dtsi [4] https://github.com/AICP/kernel_lge_hammerhead/blob/n7.1/arch/arm/boot/d= ts/msm8974-leds.dtsi My tree: https://gitlab.com/nfraprado/linux/ N=C3=ADcolas F. R. A. Prado (3): leds: Add driver for QPNP flash led ARM: qcom_defconfig: Add QPNP flash LED support ARM: dts: qcom: msm8974-hammerhead: Add support for the flash LED .../qcom-msm8974-lge-nexus5-hammerhead.dts | 56 + arch/arm/configs/qcom_defconfig | 1 + drivers/leds/Kconfig | 9 + drivers/leds/Makefile | 1 + drivers/leds/leds-qpnp.c | 1351 +++++++++++++++++ 5 files changed, 1418 insertions(+) create mode 100644 drivers/leds/leds-qpnp.c --=20 2.29.2