Commit graph zephyr/drivers/led
Author SHA1 Message Date
James Bennion-Pedley
03e3ddca4b drivers: led: add aw9523b LED constant current driver
This is an 8-bit linear current source LED dimmer that
is built into the AW9523B I2C IO Expander.
This is the other mfd function alongside the GPIO_AW9523B
driver. This one also supports runtime power management (so can be
placed on a power domain).

Signed-off-by: James Bennion-Pedley <James.Bennion-Pedley@thinksmartbox.com>
2026-09-24 03:45:10 +02:00
Sergei Ovchinnikov
ec463790bb drivers: led: npm10xx: use mfd to configure GPIO usage
Centralise arbitration of GPIO usages using the MFD driver.

Signed-off-by: Sergei Ovchinnikov <sergei.ovchinnikov@nordicsemi.no>
2026-09-23 19:21:36 +02:00
Hubert Miś
dd3b6ef9d7 drivers: led: sct2024: add write_channels function
Add implementation of optional led driver API function named
write_channels. The purpose of this function is to allow the caller
update multiple channels in a single call.

Signed-off-by: Hubert Miś <hubert.mis@gmail.com>
2026-09-23 19:16:30 +02:00
Benjamin Cabé
ec119b69f9 drivers: led: pca953x: rename log module to avoid GPIO clash
The LED and GPIO PCA953x drivers both register a log module named
pca953x, so a build enabling both fails to link with a multiple
definition of log_const_pca953x. Rename the LED module to led_pca953x,
matching the led_ prefix other LED drivers use for chips that a GPIO
driver also serves.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
2026-09-16 16:19:51 +01:00
Fabio Baltieri
b3b1cefe40 device: Add DEVICE_DT_GET_COMMA macro
Add DEVICE_DT_GET_COMMA helper macro to include/zephyr/device.h to
easily get a device pointer followed by a comma when expanding
devicetree foreach iterators like DT_FOREACH_STATUS_OKAY.

Update samples, drivers, and tests to use the common definition.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Assisted-by: Antigravity:gemini-1.5-pro
2026-09-01 21:05:47 -04:00
Benjamin Cabé
5b4278c695 drivers: use inclusive SPI terminology in remaining drivers
Use controller/peripheral and SDO/SDI terminology in the remaining
SPI-using drivers (audio, auxdisplay, bluetooth HCI, dac, eeprom,
ethernet, flash, fpga, gpio, haptics, hdlc_rcp_if, ieee802154,
input, led, led_strip, lora, mfd, misc, mux, rtc, sdhc, stepper,
video, watchdog, wifi) and the ec_host_cmd SPI STM32 backend,
following coding guideline rule A.2: switch to
SPI_OP_MODE_CONTROLLER/PERIPHERAL and SPI_SDO_OVERRUN_DT, rename
Zephyr-owned identifiers (the HCI SPI header buffers, the winc1500
bus wrapper transfer parameters), and update comments, log messages
and Kconfig help prose.

Vendor and out-of-scope identifiers keep their names: STM32
LL_SPI_MODE_SLAVE in the ec_host_cmd backend, the ATWINC1500 SDK I2C
SLAVE_ADDRESS definition, and the I2S codec clock-role variable in
tlv320aic26.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-09-01 21:04:50 -04:00
Juergen Werner
c9fd736909 drivers: led: add reset-gpio to relevant PCA953x
The newly added PCA9530, PCA9531 and PCA9532 have a reset gpio pin. This
patch handles it, if set in device tree.

Signed-off-by: Juergen Werner <j.werner@aduart.de>
2026-08-23 14:41:16 -04:00
Juergen Werner
c6c08198dc drivers: led: add DT bindings for other PCA953x
Add bindings for the already implemented
* nxp,pca9530
* nxp,pca9531
* nxp,pca9532

Signed-off-by: Juergen Werner <j.werner@aduart.de>
2026-08-23 14:41:16 -04:00
Juergen Werner
ffa1e46d43 drivers: led: implement other PCA953x devices
Extend PCA953x led driver implementation to include devices PCA9530,
PCA9531 and PCA9532 in addition to the original PCA9533.

Signed-off-by: Juergen Werner <j.werner@aduart.de>
2026-08-23 14:41:16 -04:00
Juergen Werner
7ab0c3146c drivers: led: generalize naming in pca953x
Replacing all mentions of PCA9533 to implement more devices. Also
prepare a generalized device definition for the introduction of further
DT_DRV_COMPAT.

Signed-off-by: Juergen Werner <j.werner@aduart.de>
2026-08-23 14:41:16 -04:00
Juergen Werner
6f1bcc3a50 drivers: led: rename pca9533 to pca953x
This is the preparation for a generalized implementation of the NXP
PCA953x LED dimmer series.

Signed-off-by: Juergen Werner <j.werner@aduart.de>
2026-08-23 14:41:16 -04:00
Benjamin Cabé
7bdd9031b4 drivers: led: lp5562: fix off states using maximum brightness
Commit 62c1fb2097 replaced both minimum-brightness uses with
LED_BRIGHTNESS_MAX, so turning an LED off and the off phase of a blink
program set full brightness instead. Use 0, the minimum brightness the
LED API defines.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-19 18:39:50 -04:00
Benjamin Cabé
6483cce27d drivers: led: lp586x: Fix channel index bounds check
channel holds the last zero-based channel index an LED occupies,
so a value equal to max_channels is already one past the last
valid channel. Reject it, matching the count-based check in
write_channels.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-03 08:45:58 -04:00
Alberto Escolar Piedras
4adfe6584d drivers: led: linux-leds: Add missing dependency
This driver needs the nsi_errno conversion component.
Let's make sure we build it by selecting it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-07-31 13:22:16 -04:00
Alberto Escolar Piedras
db9a2889db drivers: led: linux_leds: Split file opening to avoid libC assumptions
To avoid the assumption that ZVFS_O_RDONLY/ZVFS_O_WRONLY match
O_RDONLY/O_WRONLY, let's just have this code be compiled with the host
libC always.
The code is also a bit more readable without all the nsi_host prefixes.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-07-29 08:19:37 -07:00
Nathan Olff
8bd72d7354 drivers: led: is31fl319x: add support for is31fl3193 led driver
Extend generic is31fl319x driver to support is31fl3193 variant.
Similar to 3194 but with slight differences on register and
features.

Reword error message.

Update example in binding of is31fl3194 as well for required
current-limit attribute.

Assisted-by: Claude:claude-sonnet-4.6 Claude-Code

Signed-off-by: Nathan Olff <nathan@kickmaker.net>
2026-07-28 12:30:05 -07:00
Flavio Ceolin
d2d9b9c52b led: Remove redundant casts in syscall handlers
The syscall handler functions forward parameters with identical casts
that are redundant since the variables already have those types.  Drop
the casts to let the compiler type-check the arguments unobstructed.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-07-15 19:04:12 -04:00
Fabio Baltieri
ec003017df drivers: led: add a Linux LED native_sim driver
Add a native_sim driver to control a Linux LED on the host using the
Zephyr LED APIs.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2026-06-16 23:16:34 +02:00
Shahin Haque
2788ff0ff7 drivers: led: lp50xx: add pm action for on/off
add functionality to turn off/on led driver lp50xx

Signed-off-by: Shahin Haque <ShahinHaque97@outlook.com>
2026-06-14 15:32:40 +02:00
Henrik Brix Andersen
d57990328f drivers: led: fake: fix fake_led_get_info_delegate() check
Fix the check in fake_led_get_info_delegate() to not compare against
unitialized memory.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2026-06-12 10:05:09 +02:00
Henrik Brix Andersen
b693811d37 drivers: led: add fake LED controller driver
Add a fake LED controller driver which can be used as either a stub or a
mock in Zephyr test suites.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2026-06-11 15:50:14 +02:00
Ashley Brighthope
56f2ee7453 led: shell: use correct length sub-specifier
use correct length sub-specifier when
printing a size_t.

Signed-off-by: Ashley Brighthope <ashley.b@reddegrees.com>
2026-06-09 11:56:11 +02:00
Sergei Ovchinnikov
6c41c00863 drivers: led: nPM10xx LED driver
Nordic's nPM10 Series PMIC LED driver and Devicetree bindings.
LED driver outputs on nPM10 devices are multiplexed with GPIOs.

Signed-off-by: Sergei Ovchinnikov <sergei.ovchinnikov@nordicsemi.no>
2026-06-08 18:59:54 +02:00
Ole Johan Walderhaug
f45be87d78 drivers: led: implement get_info for leds_group_multicolor
Implements the `get_info` API for `leds_group_multicolor`. This exposes
the `color-mapping` and `label` devicetree properties, if they are
provided.

Signed-off-by: Ole Johan Walderhaug <olejodd10@gmail.com>
2026-06-02 20:22:52 +02:00
Simon Guinot
7a424d5f57 drivers: led: leds_group_multicolor: fix brightness value
Remap brightness values from the [0, 255] range to the
[0, LED_BRIGHTNESS_MAX] range before calling
led_set_brightness_dt().

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2026-05-27 08:42:50 +02:00
Florian Moesch
0c1ac1ce8e drivers: led: add LP586x I2C LED driver
Add support for the Texas Instruments LP586x family of LED drivers.

Signed-off-by: Florian Moesch <florian.moesch@draeger.com>
2026-05-20 20:05:48 -04:00
Kurt Eckhardt
11bb2bb4bb drivers: led: is31fl319x - redo color to channel
Removed the driver knowing anything about what color each channel is.
When you output to an LED with a buffer it simply writes the
channels out with buffer.

Also removed the assumptions that the leds are either
a) RGB  or b) 3 channels and instead use them the way they are defined.

That is for example if we have 4 channels, we could define an LED
with just one color in it and we could define another with three.

The user can define 4 leds each with color yellow.

For each LED it counts how many buffers were used by previous LEDs and
starts there and outputs N channels.

Decided it looked cleaner to use helper function write channels, so
implemented it and added it to the call table.

Updated sample:
It manually computes which channel maps to red, green and blue and then
uses those indexes to map the table of colors to the right channels.
Signed-off-by: Kurt Eckhardt <kurte@rockisland.com>
2026-03-17 18:27:10 -04:00
Kurt Eckhardt
e758963208 drivers: led: is31fl319x - hard coded registers
more refactoring, don't use the 94 registers everywhere.
Introduce structure, with registers and fixed values, and use it.

Signed-off-by: Kurt Eckhardt <kurte@rockisland.com>
2026-03-17 18:27:10 -04:00
Kurt Eckhardt
cd80e09e59 drivers: led: rename IS31FL3194 to 9x
In preparation to allow this driver to support more than
one IS31FL319x object such as ...97, rename the
source file and the functions to make them more
generic.

I  also changed the enumeration/creation of object
to generate the right names for the current 94 objects

Renamed the Kconfig file. Updated CMakeLists.txt to
check for different condition to build source file

The samples driver is31fl3194 was also renamed to
is31fl319x. All of the references to use 9x instead
of 94. The updated sample required an update to the
doc script redirect.py to reflect the new name.

Signed-off-by: Kurt Eckhardt <kurte@rockisland.com>
2026-03-17 18:27:10 -04:00
Benjamin Cabé
43d4644867 drivers: led: lp3943: fix unsigned integer underflow Coverity
Replace the switch statement with an array-based register lookup and a
modulo operation to resolve a Coverity "integer handling" issue and make
the code simpler.

The original subtractions (*led -= 4U/8U/12U) were guarded by switch cases
making underflow impossible in practice, but the pattern was flagged
nevertheless. The new array-based approach is semantically equivalent and
arguably more readable.

Fixes zephyrproject-rtos/zephyr#84770
Fixes Coverity CID 487606

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-02-24 16:05:56 -06:00
Pieter De Gendt
ec067db807 drivers: led: pca9533: Put API into iterable section
Use the DEVICE_API macro to put the driver API into the correct API linker
section.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2026-02-12 14:32:59 +00:00
Hubert Miś
0f6bcc6491 drivers: led: sct2024 controller
Initial implementation of SCT2024 LED controller driver

Signed-off-by: Hubert Miś <hubert.mis@gmail.com>
2026-01-26 10:09:43 -06:00
Fin Maaß
d49a55265e drivers: led: i2c: replace use of i2c_burst_write
i2c_burst_write is not portable,
as it is not supported by some drivers,
replace its use with i2c_write.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-01-07 17:30:32 +01:00
Dmitrii Sharshakov
956063604b drivers: led: shell: avoid implicit conversion to boolean
Use a clear and style-adherent condition format.

Signed-off-by: Dmitrii Sharshakov <d3dx12.xx@gmail.com>
2025-12-02 18:38:53 -05:00
Jeppe Odgaard
6fbff921c7 drivers: led: pca9533: fix ms_to_psc wrap-around
If `period_ms` is 3 or less `tmp` is 0. Since `tmp` is type `uint32`
subtracting 1 from 0 will wrap around to `UINT32_MAX` and is then clamped
to `UINT8_MAX`.

Fix the issue by changing `tmp` and `1` to signed types.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-12-02 11:22:48 +01:00
Josuah Demangeon
30950b888d style: drivers: sort Kconfig and CMake includes
Use the "zephyr-keep-sorted-start/stop" comment to have CI check
the alphabetical order of includes, to help reducing the chance
of conflicts while contributing drivers.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-11-17 13:48:03 -05:00
Van Petrosyan
7c845f14d4 drivers: led: Implemented PCA9533 driver with PM support
• Supports led_on/off, led_set_brightness (0–100 %, 152 Hz default),
  and led_blink (7 ms – 1.685 s) with automatic sharing of the two
  on-chip PWM engines; returns –EBUSY when a third distinct pair is
  requested.

• Includes basic runtime-PM boilerplate to honour power-domain control;
  the device itself has no dedicated low-power states.

Signed-off-by: Van Petrosyan <van.petrosyan@sensirion.com>
2025-07-28 16:43:48 -04:00
Yishai Jaffe
ee7834997b drivers: led: shell: add blink cmd
Add blink command to led shell module

Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
2025-07-21 13:07:07 -04:00
Simon Guinot
ec0fb2c92c drivers: led: add leds-group-multicolor driver
This driver supports multi-color LEDs built with several monochromatic
LEDs. ->set_color is the only LED driver API method implemented.

Instead of calling led_set_brightness() for each monochromatic LED,
led_set_color() can be called on the leds-group-multicolor device to
set all colors at once.

See the leds-group-multicolor DT binding for details.

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2025-07-19 15:39:29 -04:00
Simon Guinot
e1aaf8761e drivers: led: pwm: automatically select PWM
For all LED drivers, the underlying subsystem is automatically selected
in Kconfig if their compatible node is found in DT.

The only exception is the PWM LED driver which depends on PWM instead
of selecting it. The PWM Kconfig option must be explicitely selected in
order to have LED_PWM enabled.

This patch updates the Kconfig of the PWM LED driver to have the same
behavior as other LED drivers: PWM is now automatically selected if a
"pwm-leds" compatible node is found in DT.

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2025-07-19 15:39:29 -04:00
Sergei Ovchinnikov
645159dc26 drivers: npm13xx: add support for nPM1304
Add support for nPM1304 in the npm13xx drivers. The nPM1304 supports
different voltage and current ranges which are handled through the
initialization macros.

Signed-off-by: Sergei Ovchinnikov <sergei.ovchinnikov@nordicsemi.no>
2025-06-23 16:19:43 +01:00
Sergei Ovchinnikov
89b8383633 drivers: npm13xx: rename npm1300 to npm13xx
Rename npm1300 to npm13xx in function names, documentation, etc. where
applicable for all the npm13xx drivers

Signed-off-by: Sergei Ovchinnikov <sergei.ovchinnikov@nordicsemi.no>
2025-06-23 16:19:43 +01:00
Sergei Ovchinnikov
fb007db50a drivers: npm1300: rename to npm13xx
Rename npm1300 drivers and header files to npm13xx to allow for usage
with other nPM13xx product variants.

Signed-off-by: Sergei Ovchinnikov <sergei.ovchinnikov@nordicsemi.no>
2025-06-23 16:19:43 +01:00
Benjamin Cabé
7b001ed059 drivers: led: adopt SHELL_HELP
Adopt SHELL_HELP macro for LED shell

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-18 07:38:17 +02:00
Benjamin Cabé
f72942067a drivers: led: fix LED_BRIGTHNESS_MAX typo
Renames LED_BRIGTHNESS_MAX to LED_BRIGHTNESS_MAX in led.h and all
in-tree users of the macro.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-09 14:50:33 -07:00
Fabio Baltieri
ac1dec0498 led: drop led_context.h
led_context.h contains a single struct with max and min period, current
drivers that use it have hardcoded values and they set it at init.

This data is not used anywhere, and it makes very little sense to use
some SRAM for it.

Hardcode the limit for each driver and drop the struct and file.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-05-22 02:21:51 +02:00
Fabio Baltieri
39e56e9a71 led: drop a bunch of now redundant brightness validations
This check is now part of the API, individual drivers don't need to do
it.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-05-14 16:27:18 +02:00
Fabio Baltieri
6f47466899 led: drop a bunch of on/off wrappers
These are now handled at API level, drop them from the drivers.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-05-14 16:27:18 +02:00
Fabio Baltieri
62c1fb2097 led: drop min/max brightness from struct led_data
This is always 0 to 100, hardcode the range.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-05-14 16:27:18 +02:00
Fabio Baltieri
69e739359f led: check for valid brightness range at API level
The API specifies that brightness is 0 to 100, no point checking it in
the individual drivers.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-05-14 16:27:18 +02:00