devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nícolas F. R. A. Prado" <nfraprado@protonmail.com>
To: Pavel Machek <pavel@ucw.cz>, Dan Murphy <dmurphy@ti.com>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Andy Gross <agross@kernel.org>, Rob Herring <robh+dt@kernel.org>
Cc: linux-leds@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
	Brian Masney <masneyb@onstation.org>, Luca Weiss <luca@z3ntu.xyz>,
	Russell King <linux@armlinux.org.uk>,
	Georgi Djakov <georgi.djakov@linaro.org>,
	linux-kernel@vger.kernel.org, lkcamp@lists.libreplanetbr.org,
	andrealmeid@collabora.com
Subject: [RFC PATCH 0/3] Add support for the flash LED on Nexus 5
Date: Fri, 06 Nov 2020 16:58:04 +0000	[thread overview]
Message-ID: <20201106165737.1029106-1-nfraprado@protonmail.com> (raw)

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



             reply	other threads:[~2020-11-06 16:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-06 16:58 Nícolas F. R. A. Prado [this message]
2020-11-06 16:58 ` [RFC PATCH 1/3] leds: Add driver for QPNP flash led Nícolas F. R. A. Prado
2020-11-08 16:52   ` Jacek Anaszewski
2020-11-22  4:44   ` Bjorn Andersson
2020-11-06 16:59 ` [RFC PATCH 2/3] ARM: qcom_defconfig: Add QPNP flash LED support Nícolas F. R. A. Prado
2020-11-06 16:59 ` [RFC PATCH 3/3] ARM: dts: qcom: msm8974-hammerhead: Add support for the flash LED Nícolas F. R. A. Prado

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201106165737.1029106-1-nfraprado@protonmail.com \
    --to=nfraprado@protonmail.com \
    --cc=agross@kernel.org \
    --cc=andrealmeid@collabora.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmurphy@ti.com \
    --cc=georgi.djakov@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=lkcamp@lists.libreplanetbr.org \
    --cc=luca@z3ntu.xyz \
    --cc=masneyb@onstation.org \
    --cc=pavel@ucw.cz \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).