[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201106165737.1029106-1-nfraprado@protonmail.com>
Date: Fri, 06 Nov 2020 16:58:04 +0000
From: Nícolas F. R. A. Prado
<nfraprado@...tonmail.com>
To: Pavel Machek <pavel@....cz>, Dan Murphy <dmurphy@...com>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Andy Gross <agross@...nel.org>,
Rob Herring <robh+dt@...nel.org>
Cc: linux-leds@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-arm-msm@...r.kernel.org, devicetree@...r.kernel.org,
Brian Masney <masneyb@...tation.org>,
Luca Weiss <luca@...tu.xyz>,
Russell King <linux@...linux.org.uk>,
Georgi Djakov <georgi.djakov@...aro.org>,
linux-kernel@...r.kernel.org, lkcamp@...ts.libreplanetbr.org,
andrealmeid@...labora.com
Subject: [RFC PATCH 0/3] Add support for the flash LED on Nexus 5
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 driver
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 described
in [2], but this port only contains support for Flash/Torch, and the code for
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 nodes
were copied from [3] and [4], only changing the flash-boost-supply and
torch-boost-supply properties to point to the regulator nodes already defined
upstream at qcom-pm8941.dtsi. Again, I'm not sure if the nodes should be kept on
separate .dtsi as they were downstream, I just did what was easier for testing.
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 flash
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 same.
My questions are: Is there something fundamentally wrong with this patch series?
Is it okay to have the driver only support the flash LEDs from QPNP (at least
for the time being)?
But also please give me any other feedback.
Thanks,
Nícolas
[1] https://github.com/AICP/kernel_lge_hammerhead/blob/n7.1/drivers/leds/leds-qpnp.c
[2] https://github.com/AICP/kernel_lge_hammerhead/blob/n7.1/Documentation/devicetree/bindings/leds/leds-qpnp.txt
[3] https://github.com/AICP/kernel_lge_hammerhead/blob/n7.1/arch/arm/boot/dts/msm-pm8941.dtsi
[4] https://github.com/AICP/kernel_lge_hammerhead/blob/n7.1/arch/arm/boot/dts/msm8974-leds.dtsi
My tree: https://gitlab.com/nfraprado/linux/
Nícolas 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
--
2.29.2
Powered by blists - more mailing lists