* [PATCH v6 0/3] leds: Add driver for MAX8907 LED cell
@ 2026-11-15 9:05 Svyatoslav Ryhel
2026-11-15 9:05 ` [PATCH v6 1/3] regulator: dt-bindings: maxim,max8907: Document LED support Svyatoslav Ryhel
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Svyatoslav Ryhel @ 2026-11-15 9:05 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Lee Jones, Pavel Machek, Griffin Kroah-Hartman,
Svyatoslav Ryhel
Cc: linux-kernel, devicetree, linux-leds, mfd
Add a small driver to control the LED cell provided by the MAX8907 PMIC.
The LED does not require any specific configuration and is folded into the
PMIC's node.
Patch 1 of the series requires this patch:
("regulator: dt-bindings: maxim,max8907: Convert to DT schema")
https://lore.kernel.org/lkml/20261027114634.79706-2-clamor95@gmail.com/
---
Changes in v2:
- rebased so patch is now applicable to linux/next
Changes in v3:
- added check if led is off for get callback
- added dedicated MAX8907_REG_WLED_MODE_ON mask
- switched to devm_led_classdev_register_ext
Changes in v4:
- platform_set_drvdata dropped
- init_data.devicename dropped
- added MODULE_ALIAS
Changes in v5:
- add and document a dedicated node for LED
- split adding led cell to mfd into separate commit
- expand Kconfig description
- populate devicename and default_label of init_data
- unfold platform_driver->driver
Changes in v6:
- converted to devm_kzalloc_obj
---
Svyatoslav Ryhel (3):
regulator: dt-bindings: maxim,max8907: Document LED support
leds: Add driver for MAX8907 LED cell
mfd: max8907: Add LED cell
.../bindings/regulator/maxim,max8907.yaml | 4 +
drivers/leds/Kconfig | 10 ++
drivers/leds/Makefile | 1 +
drivers/leds/leds-max8907.c | 99 +++++++++++++++++++
drivers/mfd/max8907.c | 1 +
include/linux/mfd/max8907.h | 2 +-
6 files changed, 116 insertions(+), 1 deletion(-)
create mode 100644 drivers/leds/leds-max8907.c
--
2.53.0
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH v6 1/3] regulator: dt-bindings: maxim,max8907: Document LED support 2026-11-15 9:05 [PATCH v6 0/3] leds: Add driver for MAX8907 LED cell Svyatoslav Ryhel @ 2026-11-15 9:05 ` Svyatoslav Ryhel 2026-11-15 11:39 ` Mark Brown 2026-11-15 9:05 ` [PATCH v6 2/3] leds: Add driver for MAX8907 LED cell Svyatoslav Ryhel 2026-11-15 9:05 ` [PATCH v6 3/3] mfd: max8907: Add " Svyatoslav Ryhel 2 siblings, 1 reply; 11+ messages in thread From: Svyatoslav Ryhel @ 2026-11-15 9:05 UTC (permalink / raw) To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones, Pavel Machek, Griffin Kroah-Hartman, Svyatoslav Ryhel Cc: linux-kernel, devicetree, linux-leds, mfd The Maxim MAX8907 PMIC supports a single LED; document it. Reviewed-by: Rob Herring (Arm) <robh@kernel.org> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> --- .../devicetree/bindings/regulator/maxim,max8907.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/regulator/maxim,max8907.yaml b/Documentation/devicetree/bindings/regulator/maxim,max8907.yaml index 6cf8e93867e1a..ee1a305d1c210 100644 --- a/Documentation/devicetree/bindings/regulator/maxim,max8907.yaml +++ b/Documentation/devicetree/bindings/regulator/maxim,max8907.yaml @@ -31,6 +31,10 @@ properties: description: The input supply for MBATT, BBAT, SDBY, VRTC. + led: + $ref: /schemas/leds/common.yaml# + unevaluatedProperties: false + regulators: type: object additionalProperties: false -- 2.53.0 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v6 1/3] regulator: dt-bindings: maxim,max8907: Document LED support 2026-11-15 9:05 ` [PATCH v6 1/3] regulator: dt-bindings: maxim,max8907: Document LED support Svyatoslav Ryhel @ 2026-11-15 11:39 ` Mark Brown 2026-11-26 12:29 ` Lee Jones 0 siblings, 1 reply; 11+ messages in thread From: Mark Brown @ 2026-11-15 11:39 UTC (permalink / raw) To: Svyatoslav Ryhel Cc: Liam Girdwood, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones, Pavel Machek, Griffin Kroah-Hartman, linux-kernel, devicetree, linux-leds, mfd [-- Attachment #1: Type: text/plain, Size: 170 bytes --] On Sun, Nov 15, 2026 at 11:05:18AM +0200, Svyatoslav Ryhel wrote: > The Maxim MAX8907 PMIC supports a single LED; document it. Acked-by: Mark Brown <broonie@kernel.org> [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v6 1/3] regulator: dt-bindings: maxim,max8907: Document LED support 2026-11-15 11:39 ` Mark Brown @ 2026-11-26 12:29 ` Lee Jones 2026-11-26 13:24 ` Mark Brown 0 siblings, 1 reply; 11+ messages in thread From: Lee Jones @ 2026-11-26 12:29 UTC (permalink / raw) To: Mark Brown Cc: Svyatoslav Ryhel, Liam Girdwood, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Pavel Machek, Griffin Kroah-Hartman, linux-kernel, devicetree, linux-leds, mfd On Sun, 15 Nov 2026, Mark Brown wrote: > On Sun, Nov 15, 2026 at 11:05:18AM +0200, Svyatoslav Ryhel wrote: > > The Maxim MAX8907 PMIC supports a single LED; document it. > > Acked-by: Mark Brown <broonie@kernel.org> You should just apply this, I think. -- Lee Jones ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v6 1/3] regulator: dt-bindings: maxim,max8907: Document LED support 2026-11-26 12:29 ` Lee Jones @ 2026-11-26 13:24 ` Mark Brown 2026-11-26 13:30 ` Svyatoslav Ryhel 0 siblings, 1 reply; 11+ messages in thread From: Mark Brown @ 2026-11-26 13:24 UTC (permalink / raw) To: Lee Jones Cc: Svyatoslav Ryhel, Liam Girdwood, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Pavel Machek, Griffin Kroah-Hartman, linux-kernel, devicetree, linux-leds, mfd [-- Attachment #1: Type: text/plain, Size: 376 bytes --] On Thu, Nov 26, 2026 at 12:29:36PM +0000, Lee Jones wrote: > On Sun, 15 Nov 2026, Mark Brown wrote: > > > On Sun, Nov 15, 2026 at 11:05:18AM +0200, Svyatoslav Ryhel wrote: > > > The Maxim MAX8907 PMIC supports a single LED; document it. > > > > Acked-by: Mark Brown <broonie@kernel.org> > > You should just apply this, I think. Well, it doesn't apply so... :/ [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v6 1/3] regulator: dt-bindings: maxim,max8907: Document LED support 2026-11-26 13:24 ` Mark Brown @ 2026-11-26 13:30 ` Svyatoslav Ryhel 2026-12-02 16:11 ` Lee Jones 0 siblings, 1 reply; 11+ messages in thread From: Svyatoslav Ryhel @ 2026-11-26 13:30 UTC (permalink / raw) To: Mark Brown, Lee Jones Cc: Liam Girdwood, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Pavel Machek, Griffin Kroah-Hartman, linux-kernel, devicetree, linux-leds, mfd чт, 26 лист. 2026 р. о 15:24 Mark Brown <broonie@kernel.org> пише: > > On Thu, Nov 26, 2026 at 12:29:36PM +0000, Lee Jones wrote: > > On Sun, 15 Nov 2026, Mark Brown wrote: > > > > > On Sun, Nov 15, 2026 at 11:05:18AM +0200, Svyatoslav Ryhel wrote: > > > > The Maxim MAX8907 PMIC supports a single LED; document it. > > > > > > Acked-by: Mark Brown <broonie@kernel.org> > > > > You should just apply this, I think. > > Well, it doesn't apply so... :/ Obviously, Lee did not pick up https://lore.kernel.org/lkml/20261123150224.199601-1-clamor95@gmail.com/ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v6 1/3] regulator: dt-bindings: maxim,max8907: Document LED support 2026-11-26 13:30 ` Svyatoslav Ryhel @ 2026-12-02 16:11 ` Lee Jones 0 siblings, 0 replies; 11+ messages in thread From: Lee Jones @ 2026-12-02 16:11 UTC (permalink / raw) To: Svyatoslav Ryhel Cc: Mark Brown, Liam Girdwood, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Pavel Machek, Griffin Kroah-Hartman, linux-kernel, devicetree, linux-leds, mfd On Thu, 26 Nov 2026, Svyatoslav Ryhel wrote: > чт, 26 лист. 2026 р. о 15:24 Mark Brown <broonie@kernel.org> пише: > > > > On Thu, Nov 26, 2026 at 12:29:36PM +0000, Lee Jones wrote: > > > On Sun, 15 Nov 2026, Mark Brown wrote: > > > > > > > On Sun, Nov 15, 2026 at 11:05:18AM +0200, Svyatoslav Ryhel wrote: > > > > > The Maxim MAX8907 PMIC supports a single LED; document it. > > > > > > > > Acked-by: Mark Brown <broonie@kernel.org> > > > > > > You should just apply this, I think. > > > > Well, it doesn't apply so... :/ > > Obviously, Lee did not pick up > https://lore.kernel.org/lkml/20261123150224.199601-1-clamor95@gmail.com/ No, it's still in my review queue. Why are you sending patches based on other sets which haven't been merged yet? Let's put this one on hold then. -- Lee Jones ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v6 2/3] leds: Add driver for MAX8907 LED cell 2026-11-15 9:05 [PATCH v6 0/3] leds: Add driver for MAX8907 LED cell Svyatoslav Ryhel 2026-11-15 9:05 ` [PATCH v6 1/3] regulator: dt-bindings: maxim,max8907: Document LED support Svyatoslav Ryhel @ 2026-11-15 9:05 ` Svyatoslav Ryhel 2026-11-26 12:31 ` (subset) " Lee Jones 2026-11-15 9:05 ` [PATCH v6 3/3] mfd: max8907: Add " Svyatoslav Ryhel 2 siblings, 1 reply; 11+ messages in thread From: Svyatoslav Ryhel @ 2026-11-15 9:05 UTC (permalink / raw) To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones, Pavel Machek, Griffin Kroah-Hartman, Svyatoslav Ryhel Cc: linux-kernel, devicetree, linux-leds, mfd Add a small driver to control the LED cell provided by the MAX8907 PMIC. The LED node is a child of the PMIC node. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> --- drivers/leds/Kconfig | 10 ++++ drivers/leds/Makefile | 1 + drivers/leds/leds-max8907.c | 99 +++++++++++++++++++++++++++++++++++++ include/linux/mfd/max8907.h | 2 +- 4 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 drivers/leds/leds-max8907.c diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 788e689fe875c..d4e0f514bd667 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -813,6 +813,16 @@ config LEDS_MAX77705 help LED driver for MAX77705 PMIC from Maxim Integrated. +config LEDS_MAX8907 + tristate "LED support for MAX8907 PMIC" + depends on LEDS_CLASS && MFD_MAX8907 + help + This option enables support for on-chip LED drivers on + MAXIM MAX8907 PMIC. + + To compile this driver as a module, choose M here: the module + will be called leds-max8907. + config LEDS_MAX8997 tristate "LED support for MAX8997 PMIC" depends on LEDS_CLASS && MFD_MAX8997 diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index 3da746279bb81..24efda3fbaa44 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile @@ -67,6 +67,7 @@ obj-$(CONFIG_LEDS_LTC3220) += leds-ltc3220.o obj-$(CONFIG_LEDS_MAX5970) += leds-max5970.o obj-$(CONFIG_LEDS_MAX77650) += leds-max77650.o obj-$(CONFIG_LEDS_MAX77705) += leds-max77705.o +obj-$(CONFIG_LEDS_MAX8907) += leds-max8907.o obj-$(CONFIG_LEDS_MAX8997) += leds-max8997.o obj-$(CONFIG_LEDS_MC13783) += leds-mc13783.o obj-$(CONFIG_LEDS_MENF21BMC) += leds-menf21bmc.o diff --git a/drivers/leds/leds-max8907.c b/drivers/leds/leds-max8907.c new file mode 100644 index 0000000000000..46c60fde4ee39 --- /dev/null +++ b/drivers/leds/leds-max8907.c @@ -0,0 +1,99 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#include <linux/cleanup.h> +#include <linux/err.h> +#include <linux/leds.h> +#include <linux/mfd/max8907.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/platform_device.h> +#include <linux/property.h> +#include <linux/regmap.h> + +#define MAX8907_REG_WLED_MODE_ON BIT(0) + +struct max8907_led_data { + struct regmap *regmap; + struct led_classdev cdev; +}; + +static enum led_brightness max8907_led_get_brightness(struct led_classdev *cdev) +{ + struct max8907_led_data *ddata = container_of(cdev, struct max8907_led_data, cdev); + unsigned int brightness_lvl; + int ret; + + ret = regmap_read(ddata->regmap, MAX8907_REG_WLED_MODE_CNTL, &brightness_lvl); + if (ret || !(brightness_lvl & MAX8907_REG_WLED_MODE_ON)) + return LED_OFF; + + ret = regmap_read(ddata->regmap, MAX8907_REG_WLED_CNTL, &brightness_lvl); + if (ret) + return LED_OFF; + + return brightness_lvl; +} + +static int max8907_led_set_brightness(struct led_classdev *cdev, + enum led_brightness brightness) +{ + struct max8907_led_data *ddata = container_of(cdev, struct max8907_led_data, cdev); + int brightness_lvl, ret; + + brightness_lvl = clamp(brightness, LED_OFF, LED_FULL); + + if (brightness_lvl) { + ret = regmap_write(ddata->regmap, MAX8907_REG_WLED_CNTL, brightness_lvl); + if (ret) + return ret; + } + + return regmap_update_bits(ddata->regmap, MAX8907_REG_WLED_MODE_CNTL, + MAX8907_REG_WLED_MODE_ON, + brightness_lvl ? MAX8907_REG_WLED_MODE_ON : 0); +} + +static int max8907_led_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct device_node *led_np __free(device_node) = + of_get_available_child_by_name(dev_of_node(dev->parent), "led"); + struct max8907 *max8907 = dev_get_drvdata(dev->parent); + struct led_init_data init_data = { }; + struct max8907_led_data *ddata; + + if (!led_np) + return -ENODEV; + + ddata = devm_kzalloc_obj(dev, struct max8907_led_data); + if (!ddata) + return -ENOMEM; + + ddata->regmap = max8907->regmap_gen; + + init_data.fwnode = of_fwnode_handle(led_np); + init_data.devicename = "max8907"; + init_data.default_label = ":wled"; + + ddata->cdev.brightness = LED_OFF; + ddata->cdev.flags = LED_CORE_SUSPENDRESUME; + ddata->cdev.max_brightness = LED_FULL; + + ddata->cdev.brightness_get = max8907_led_get_brightness; + ddata->cdev.brightness_set_blocking = max8907_led_set_brightness; + + return devm_led_classdev_register_ext(dev, &ddata->cdev, &init_data); +} + +static struct platform_driver max8907_led_driver = { + .driver = { + .name = "max8907-leds", + }, + .probe = max8907_led_probe, +}; +module_platform_driver(max8907_led_driver); + +MODULE_ALIAS("platform:max8907-leds"); +MODULE_AUTHOR("Svyatoslav Ryhel <clamor95@gmail.com>"); +MODULE_DESCRIPTION("MAX8907 LED driver"); +MODULE_LICENSE("GPL"); diff --git a/include/linux/mfd/max8907.h b/include/linux/mfd/max8907.h index 025874e5f8808..9865ae52877fd 100644 --- a/include/linux/mfd/max8907.h +++ b/include/linux/mfd/max8907.h @@ -112,7 +112,7 @@ #define MAX8907_REG_CHG_IRQ2_MASK 0x81 #define MAX8907_REG_CHG_STAT 0x82 #define MAX8907_REG_WLED_MODE_CNTL 0x84 -#define MAX8907_REG_ILED_CNTL 0x84 +#define MAX8907_REG_WLED_CNTL 0x85 #define MAX8907_REG_II1RR 0x8E #define MAX8907_REG_II2RR 0x8F #define MAX8907_REG_LDOCTL20 0x9C -- 2.53.0 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: (subset) [PATCH v6 2/3] leds: Add driver for MAX8907 LED cell 2026-11-15 9:05 ` [PATCH v6 2/3] leds: Add driver for MAX8907 LED cell Svyatoslav Ryhel @ 2026-11-26 12:31 ` Lee Jones 0 siblings, 0 replies; 11+ messages in thread From: Lee Jones @ 2026-11-26 12:31 UTC (permalink / raw) To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones, Pavel Machek, Griffin Kroah-Hartman, Svyatoslav Ryhel Cc: linux-kernel, devicetree, linux-leds, mfd On Sun, 15 Nov 2026 11:05:19 +0200, Svyatoslav Ryhel wrote: > Add a small driver to control the LED cell provided by the MAX8907 PMIC. > The LED node is a child of the PMIC node. Applied, thanks! [2/3] leds: Add driver for MAX8907 LED cell commit: 7c804d7bde4a002a676509df6d1474f1d2a2434e -- Lee Jones [李琼斯] ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v6 3/3] mfd: max8907: Add LED cell 2026-11-15 9:05 [PATCH v6 0/3] leds: Add driver for MAX8907 LED cell Svyatoslav Ryhel 2026-11-15 9:05 ` [PATCH v6 1/3] regulator: dt-bindings: maxim,max8907: Document LED support Svyatoslav Ryhel 2026-11-15 9:05 ` [PATCH v6 2/3] leds: Add driver for MAX8907 LED cell Svyatoslav Ryhel @ 2026-11-15 9:05 ` Svyatoslav Ryhel 2026-11-26 12:31 ` (subset) " Lee Jones 2 siblings, 1 reply; 11+ messages in thread From: Svyatoslav Ryhel @ 2026-11-15 9:05 UTC (permalink / raw) To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones, Pavel Machek, Griffin Kroah-Hartman, Svyatoslav Ryhel Cc: linux-kernel, devicetree, linux-leds, mfd Add the LED cell name to the list of MAX8907 cells. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> --- drivers/mfd/max8907.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mfd/max8907.c b/drivers/mfd/max8907.c index b57c497334ea6..f492ade8e4cf1 100644 --- a/drivers/mfd/max8907.c +++ b/drivers/mfd/max8907.c @@ -20,6 +20,7 @@ #include <linux/slab.h> static const struct mfd_cell max8907_cells[] = { + { .name = "max8907-leds", }, { .name = "max8907-regulator", }, { .name = "max8907-rtc", }, }; -- 2.53.0 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: (subset) [PATCH v6 3/3] mfd: max8907: Add LED cell 2026-11-15 9:05 ` [PATCH v6 3/3] mfd: max8907: Add " Svyatoslav Ryhel @ 2026-11-26 12:31 ` Lee Jones 0 siblings, 0 replies; 11+ messages in thread From: Lee Jones @ 2026-11-26 12:31 UTC (permalink / raw) To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones, Pavel Machek, Griffin Kroah-Hartman, Svyatoslav Ryhel Cc: linux-kernel, devicetree, linux-leds, mfd On Sun, 15 Nov 2026 11:05:20 +0200, Svyatoslav Ryhel wrote: > Add the LED cell name to the list of MAX8907 cells. Applied, thanks! [3/3] mfd: max8907: Add LED cell commit: dc71f64fc283661d77d6a9a4bf38af94b4daeb5a -- Lee Jones [李琼斯] ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-12-02 16:11 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2026-11-15 9:05 [PATCH v6 0/3] leds: Add driver for MAX8907 LED cell Svyatoslav Ryhel 2026-11-15 9:05 ` [PATCH v6 1/3] regulator: dt-bindings: maxim,max8907: Document LED support Svyatoslav Ryhel 2026-11-15 11:39 ` Mark Brown 2026-11-26 12:29 ` Lee Jones 2026-11-26 13:24 ` Mark Brown 2026-11-26 13:30 ` Svyatoslav Ryhel 2026-12-02 16:11 ` Lee Jones 2026-11-15 9:05 ` [PATCH v6 2/3] leds: Add driver for MAX8907 LED cell Svyatoslav Ryhel 2026-11-26 12:31 ` (subset) " Lee Jones 2026-11-15 9:05 ` [PATCH v6 3/3] mfd: max8907: Add " Svyatoslav Ryhel 2026-11-26 12:31 ` (subset) " Lee Jones
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®