linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Fenglin Wu <quic_fenglinw@quicinc.com>
Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	lee@kernel.org, krzysztof.kozlowski@linaro.org,
	linux-leds@vger.kernel.org, quic_collinsd@quicinc.com,
	quic_subbaram@quicinc.com, Luca Weiss <luca.weiss@fairphone.com>
Subject: Re: [PATCH v8 1/2] leds: flash: add driver to support flash LED module in QCOM PMICs
Date: Sat, 25 Mar 2023 18:09:57 +0100	[thread overview]
Message-ID: <20230325170957.GA2904@bug> (raw)
In-Reply-To: <20230303095023.538917-2-quic_fenglinw@quicinc.com>

Hi!
> @@ -61,6 +61,21 @@ config LEDS_MT6360
>  	  Independent current sources supply for each flash LED support torch
>  	  and strobe mode.
>  
> +config LEDS_QCOM_FLASH
> +	tristate "LED support for flash module inside Qualcomm Technologies, Inc. PMIC"
> +	depends on MFD_SPMI_PMIC || COMPILE_TEST
> +	depends on LEDS_CLASS && OF
> +	depends on V4L2_FLASH_LED_CLASS || !V4L2_FLASH_LED_CLASS
> +	select REGMAP
> +	help
> +	  This option enables support for the flash module found in Qualcomm
> +	  Technologies, Inc. PMICs. The flash module can have 3 or 4 flash LED
> +	  channels and each channel is programmable to support up to 1.5 A full
> +	  scale current. It also supports connecting two channels' output together
> +	  to supply one LED component to achieve current up to 2 A. In such case,
> +	  the total LED current will be split symmetrically on each channel and
> +	  they will be enabled/disabled at the same time.

"This can be built as a module, module will be called..."

> +static int qcom_flash_led_brightness_set(struct led_classdev *led_cdev,
> +					enum led_brightness brightness)
> +{
> +	struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(led_cdev);
> +	struct qcom_flash_led *led = flcdev_to_qcom_fled(fled_cdev);
> +	u32 current_ma = brightness * led->max_torch_current_ma / LED_FULL;
> +	bool enable = !!brightness;
> +	int rc;
> +
> +	rc = set_flash_current(led, current_ma, TORCH_MODE);
> +	if (rc)
> +		return rc;

I'd not mind supporting more than one brightness level -- AFAICT hw can do that.

BR,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  parent reply	other threads:[~2023-03-25 17:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230303095023.538917-1-quic_fenglinw@quicinc.com>
2023-03-03  9:50 ` [PATCH v8 1/2] leds: flash: add driver to support flash LED module in QCOM PMICs Fenglin Wu
2023-03-15 17:09   ` Lee Jones
2023-03-25 17:09   ` Pavel Machek [this message]
2023-03-27  4:30     ` Fenglin Wu
2023-03-25 17:33   ` Pavel Machek
2023-03-28  8:02     ` Fenglin Wu
2023-03-25 17:36   ` Pavel Machek
2023-03-28  8:13     ` Fenglin Wu
2023-03-03  9:50 ` [PATCH v8 2/2] dt-bindings: leds: add QCOM flash LED controller Fenglin Wu
2023-03-15 17:10   ` Lee Jones

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=20230325170957.GA2904@bug \
    --to=pavel@ucw.cz \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=lee@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=luca.weiss@fairphone.com \
    --cc=quic_collinsd@quicinc.com \
    --cc=quic_fenglinw@quicinc.com \
    --cc=quic_subbaram@quicinc.com \
    /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).