linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: "Nícolas F. R. A. Prado" <nfraprado@protonmail.com>,
	"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,
	~postmarketos/upstreaming@lists.sr.ht,
	lkcamp@lists.libreplanetbr.org, andrealmeid@collabora.com
Subject: Re: [PATCH v2 0/4] Add support for QCOM SPMI Flash LEDs
Date: Sat, 30 Jan 2021 21:31:26 +0100	[thread overview]
Message-ID: <8323f365-e07e-6206-86f2-126690553d09@gmail.com> (raw)
In-Reply-To: <20210126140240.1517044-1-nfraprado@protonmail.com>

Hi Nicolas.

On 1/26/21 3:03 PM, Nícolas F. R. A. Prado wrote:
> 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.
> 
> Patch 1 adds the dt-bindings for the driver, together with a header for the
> values of some properties.
> 
> Patch 2 adds the driver, which was ported from downstream [1], and is now using
> the flash LED class framework.
> 
> Patch 3 enables the driver as a module in qcom_defconfig, and also enables
> CONFIG_LEDS_CLASS_FLASH since it is required by the driver.
> 
> Patch 4 adds the device tree nodes configuring the driver in the pm8941 dtsi.
> 
> After the feedback I received from the v1 RFC patch (thank you Jacek and
> Bjorn!), I implemented the flash LED class framework, renamed the driver to
> qcom-spmi-flash and added the dt-bindings. I also did a whole lot of cleanup.
> 
> Some caveats:
> - I still didn't implement get_strobe() and get_fault() for the flash LEDs,
>    because I'm still not sure how to do it. get_strobe() in particular I'm not
>    even sure if is possible, since after the flash turns off automatically after
>    the timeout, I don't see any change in the SPMI registers. So I'm unsure how
>    one would get the current strobe state.

strobe_get is optional - you can leave it uninitialized if there is no
obvious way to get strobe status.

Regarding faults - I see you have FLASH_FAULT_DETECT but have no
information on its impact whatsoever. Usually devices report the faults
by settings some register bits and then we can map those errors to
LED flash framework generic errors.

> - I have yet to add the V4L2 flash wrapper for the flash LEDs. I still didn't do
>    it because I wasn't sure if it was needed, so wanted to double check. But
>    being a camera flash it seems that would be useful. Also, it would be great if
>    someone could point me how I would go about testing the flash usage through
>    V4L2.

You need a V4L2 media device driver with which this driver would
register a V4L2 flash LED sub-device. Such a device is usually
implemented for platform ISP devices. Provided it is present in the
mainline you would have to associate this driver DT node with the
media device DT node. Then you can test the V4L2 Flash control with
v4l2-ctl or yavta user space tools.

Let's skip the V4L2 support for now - it can be added later, if needed.

> Another thing worth mentioning: for v1 the dt nodes were added in hammerhead's
> dts (just to simplify testing), but I have now moved them to pm8941's dtsi,
> since it was like that in downstream. So if folks using devices based on
> PM8941/MSM8974 other than the Nexus 5 could test it, that would be great, since
> I have only tested on the Nexus 5.
> 
> v1 RFC: https://lore.kernel.org/lkml/20201106165737.1029106-1-nfraprado@protonmail.com/
> 
> [1] https://github.com/AICP/kernel_lge_hammerhead/blob/n7.1/drivers/leds/leds-qpnp.c
> 
> Nícolas F. R. A. Prado (4):
>    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
> 
>   .../bindings/leds/leds-qcom-spmi-flash.yaml   |   94 ++
>   arch/arm/boot/dts/qcom-pm8941.dtsi            |   38 +
>   arch/arm/configs/qcom_defconfig               |    2 +
>   drivers/leds/Kconfig                          |    8 +
>   drivers/leds/Makefile                         |    1 +
>   drivers/leds/leds-qcom-spmi-flash.c           | 1153 +++++++++++++++++
>   .../dt-bindings/leds/leds-qcom-spmi-flash.h   |   15 +
>   7 files changed, 1311 insertions(+)
>   create mode 100644 Documentation/devicetree/bindings/leds/leds-qcom-spmi-flash.yaml
>   create mode 100644 drivers/leds/leds-qcom-spmi-flash.c
>   create mode 100644 include/dt-bindings/leds/leds-qcom-spmi-flash.h
> 

-- 
Best regards,
Jacek Anaszewski

  parent reply	other threads:[~2021-01-30 20:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-26 14:03 [PATCH v2 0/4] Add support for QCOM SPMI Flash LEDs Nícolas F. R. A. Prado
2021-01-26 14:04 ` [PATCH v2 1/4] dt-bindings: leds: Add binding for qcom-spmi-flash Nícolas F. R. A. Prado
2021-01-27 14:00   ` Rob Herring
2021-01-27 14:28   ` Bjorn Andersson
2021-01-30 20:32   ` Jacek Anaszewski
2021-01-26 14:05 ` [PATCH v2 2/4] leds: Add driver for QCOM SPMI Flash LEDs Nícolas F. R. A. Prado
2021-01-27  4:23   ` Bjorn Andersson
2021-01-30 20:37   ` Jacek Anaszewski
2021-02-19 11:02     ` Pavel Machek
2021-02-21 11:28       ` Jacek Anaszewski
2021-04-25 20:19         ` Pavel Machek
2021-02-19 11:01   ` Pavel Machek
2021-01-26 14:06 ` [PATCH v2 3/4] ARM: qcom_defconfig: Enable " Nícolas F. R. A. Prado
2021-01-27 14:29   ` Bjorn Andersson
2021-01-26 14:06 ` [PATCH v2 4/4] ARM: dts: qcom: pm8941: Add nodes for " Nícolas F. R. A. Prado
2021-01-27 14:32   ` Bjorn Andersson
2021-01-30 20:31 ` Jacek Anaszewski [this message]
2021-02-19 11:04 ` [PATCH v2 0/4] Add support " Pavel Machek

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=8323f365-e07e-6206-86f2-126690553d09@gmail.com \
    --to=jacek.anaszewski@gmail.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=nfraprado@protonmail.com \
    --cc=pavel@ucw.cz \
    --cc=robh+dt@kernel.org \
    --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).