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>
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>
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
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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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.
Fixeszephyrproject-rtos/zephyr#84770
Fixes Coverity CID 487606
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
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>
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>
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>
• 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>
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>
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>
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>
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>
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>
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>
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>
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>