Re: [PATCH v8 1/2] leds: flash: add driver to support flash LED module in QCOM PMICs
From: Pavel Machek
Date: Sat Mar 25 2023 - 13:10:06 EST
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