Re: [PATCH v3 09/13] leds: flash: add support for Samsung S2M series PMIC flash LED device
From: Lee Jones
Date: Wed Mar 25 2026 - 11:17:34 EST
On Sat, 14 Mar 2026, Kaustabh Chakraborty wrote:
> On 2026-03-10 11:38 +00:00, Lee Jones wrote:
> > On Wed, 25 Feb 2026, Kaustabh Chakraborty wrote:
> >
> >> Add support for flash LEDs found in certain Samsung S2M series PMICs.
> >> The device has two channels for LEDs, typically for the back and front
> >> cameras in mobile devices. Both channels can be independently
> >> controlled, and can be operated in torch or flash modes.
> >>
> >> The driver includes initial support for the S2MU005 PMIC flash LEDs.
> >>
> >> Signed-off-by: Kaustabh Chakraborty <kauschluss@xxxxxxxxxxx>
> >> ---
> >> drivers/leds/flash/Kconfig | 12 +
> >> drivers/leds/flash/Makefile | 1 +
> >> drivers/leds/flash/leds-s2m-flash.c | 429 ++++++++++++++++++++++++++++++++++++
> >> 3 files changed, 442 insertions(+)
> >>
> >> diff --git a/drivers/leds/flash/Kconfig b/drivers/leds/flash/Kconfig
> >> index 5e08102a67841..be62e05277429 100644
> >> --- a/drivers/leds/flash/Kconfig
> >> +++ b/drivers/leds/flash/Kconfig
> >> @@ -114,6 +114,18 @@ config LEDS_RT8515
> >> To compile this driver as a module, choose M here: the module
> >> will be called leds-rt8515.
> >>
> >> +config LEDS_S2M_FLASH
> >> + tristate "Samsung S2M series PMICs flash/torch LED support"
> >> + depends on LEDS_CLASS
> >> + depends on MFD_SEC_CORE
> >> + depends on V4L2_FLASH_LED_CLASS || !V4L2_FLASH_LED_CLASS
> >> + select REGMAP_IRQ
> >> + help
> >> + This option enables support for the flash/torch LEDs found in
> >> + certain Samsung S2M series PMICs, such as the S2MU005. It has
> >> + a LED channel dedicated for every physical LED. The LEDs can
> >> + be controlled in flash and torch modes.
> >> +
> >> config LEDS_SGM3140
> >> tristate "LED support for the SGM3140"
> >> depends on V4L2_FLASH_LED_CLASS || !V4L2_FLASH_LED_CLASS
> >> diff --git a/drivers/leds/flash/Makefile b/drivers/leds/flash/Makefile
> >> index 712fb737a428e..44e6c1b4beb37 100644
> >> --- a/drivers/leds/flash/Makefile
> >> +++ b/drivers/leds/flash/Makefile
> >> @@ -10,6 +10,7 @@ obj-$(CONFIG_LEDS_MAX77693) += leds-max77693.o
> >> obj-$(CONFIG_LEDS_QCOM_FLASH) += leds-qcom-flash.o
> >> obj-$(CONFIG_LEDS_RT4505) += leds-rt4505.o
> >> obj-$(CONFIG_LEDS_RT8515) += leds-rt8515.o
> >> +obj-$(CONFIG_LEDS_S2M_FLASH) += leds-s2m-flash.o
> >> obj-$(CONFIG_LEDS_SGM3140) += leds-sgm3140.o
> >> obj-$(CONFIG_LEDS_SY7802) += leds-sy7802.o
> >> obj-$(CONFIG_LEDS_TPS6131X) += leds-tps6131x.o
[...]
> >> +static int s2mu005_fled_torch_brightness_set(struct led_classdev *cdev,
> >> + enum led_brightness value)
> >> +{
> >> + struct s2m_fled *priv = to_led_priv(to_cdev_flash(cdev));
> >> + struct regmap *regmap = priv->regmap;
> >> + int ret;
> >> +
> >> + mutex_lock(&priv->lock);
> >> +
> >> + if (value == LED_OFF) {
> >
> > These defines are deprecated.
> >
> > From include/linux/leds.h:
> >
> > /* This is obsolete/useless. We now support variable maximum brightness. */
> > enum led_brightness {
> > LED_OFF = 0,
> > LED_ON = 1,
> > LED_HALF = 127,
> > LED_FULL = 255,
> > };
> >
>
> Let me know what am I supposed to use then. The
> brightness_set_blocking() function is defined as such:
>
> int (*brightness_set_blocking)(struct led_classdev *led_cdev,
> enum led_brightness brightness);
>
> Which has enum led_brightness as one of its params.
>
> Do I just ignore the 'obsolete' param for now and replace ` == LED_OFF`
> with a logical NOT?
I'm pretty sure most places just treat this as a u8 these days.
--
Lee Jones [李琼斯]