linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nícolas F. R. A. Prado" <nfraprado@collabora.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>,
	Jacek Anaszewski <jacek.anaszewski@gmail.com>
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, phone-devel@vger.kernel.org,
	~postmarketos/upstreaming@lists.sr.ht,
	~lkcamp/patches@lists.sr.ht,
	"André Almeida" <andrealmeid@collabora.com>,
	kernel@collabora.com
Subject: [PATCH v3 0/5] Add support for QCOM SPMI Flash LEDs
Date: Tue,  3 Aug 2021 13:26:36 -0300	[thread overview]
Message-ID: <20210803162641.1525980-1-nfraprado@collabora.com> (raw)

Hi,

this patch series adds support for Qualcomm's SPMI Flash LEDs present in the
PM8941 PMIC. It is used as part of MSM8974 based devices, like the Nexus 5
(hammerhead), as a camera flash or as a lantern when in torch mode.

The driver code is based on the parts of the QPNP LEDs driver from downstream
[1] that handled the flash LED.

This hardware doesn't have any publicly available documentation, so all my
knowledge about its behavior came from reading the downstream driver code and
from inspecting the SPMI registers used for the LED operations. I have collected
my findings at [2].

Bjorn, Jacek and Pavel, big thanks for your review in v2. I didn't answer the
emails but I believe I addressed all of the feedback you gave me. Sorry for the
long delay, I'll try to actually answer the feedback this time, and in a timely
manner too.

The changes in this v3 are too many to list, but the biggest ones were:
- The two LEDs can now be operated independently even when in torch mode
- The flashes can now strobe consecutive times without needing to manually
  disable them between strobes
- Implemented strobe_get()
- Moved dt parsing to a separate function
- Split multiplexed torch/flash on/off and torch/flash regulator on/off
  functions
- Removed configurations from the dt-binding that didn't have any visible
  impact, instead hardcoding them inside the driver
- Moved LED dt nodes configuration to hammerhead dts
- Set current on brightness callback and timeout on timeout callback, instead of
  setting everything every time when strobing/turning torch on

Fault detection and V4L2 flash wrapper support are still missing but, as others
have pointed out before, they can be implemented later if desired.

Thanks,
Nícolas

v2: https://lore.kernel.org/linux-arm-msm/20210126140240.1517044-1-nfraprado@protonmail.com/
v1 RFC: https://lore.kernel.org/linux-arm-msm/20201106165737.1029106-1-nfraprado@protonmail.com/

[1] https://github.com/AICP/kernel_lge_hammerhead/blob/n7.1/drivers/leds/leds-qpnp.c
[2] https://gitlab.collabora.com/nfraprado/linux/-/wikis/PM8941-Flash-LEDs

Nícolas F. R. A. Prado (5):
  dt-bindings: leds: Add binding for qcom-spmi-flash
  leds: Add driver for QCOM SPMI Flash LEDs
  ARM: qcom_defconfig: Enable QCOM SPMI Flash LEDs
  ARM: dts: qcom: pm8941: Add nodes for QCOM SPMI Flash LEDs
  ARM: dts: qcom: msm8974-hammerhead: Enable and configure flash LED
    node

 .../bindings/leds/leds-qcom-spmi-flash.yaml   |   93 ++
 .../qcom-msm8974-lge-nexus5-hammerhead.dts    |   20 +
 arch/arm/boot/dts/qcom-pm8941.dtsi            |   25 +
 arch/arm/configs/qcom_defconfig               |    2 +
 drivers/leds/flash/Kconfig                    |    8 +
 drivers/leds/flash/Makefile                   |    1 +
 drivers/leds/flash/leds-qcom-spmi-flash.c     | 1251 +++++++++++++++++
 7 files changed, 1400 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-qcom-spmi-flash.yaml
 create mode 100644 drivers/leds/flash/leds-qcom-spmi-flash.c

-- 
2.32.0


             reply	other threads:[~2021-08-03 16:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-03 16:26 Nícolas F. R. A. Prado [this message]
2021-08-03 16:26 ` [PATCH v3 1/5] dt-bindings: leds: Add binding for qcom-spmi-flash Nícolas F. R. A. Prado
2021-08-11 18:35   ` Rob Herring
2021-08-03 16:26 ` [PATCH v3 2/5] leds: Add driver for QCOM SPMI Flash LEDs Nícolas F. R. A. Prado
2021-08-16 22:03   ` Jacek Anaszewski
2021-08-24 21:45     ` Nícolas F. R. A. Prado
2021-08-29 11:15       ` Jacek Anaszewski
2021-08-29 17:59         ` Pavel Machek
2021-10-08  2:12         ` Nícolas F. R. A. Prado
2021-08-03 16:26 ` [PATCH v3 3/5] ARM: qcom_defconfig: Enable " Nícolas F. R. A. Prado
2021-08-03 16:26 ` [PATCH v3 4/5] ARM: dts: qcom: pm8941: Add nodes for " Nícolas F. R. A. Prado
2021-08-03 16:26 ` [PATCH v3 5/5] ARM: dts: qcom: msm8974-hammerhead: Enable and configure flash LED node 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=20210803162641.1525980-1-nfraprado@collabora.com \
    --to=nfraprado@collabora.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=jacek.anaszewski@gmail.com \
    --cc=kernel@collabora.com \
    --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=luca@z3ntu.xyz \
    --cc=masneyb@onstation.org \
    --cc=pavel@ucw.cz \
    --cc=phone-devel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=~lkcamp/patches@lists.sr.ht \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /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).