Skip to content

drivers: led: support variable brightness granularity #87737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jeppenodgaard opened this issue Mar 27, 2025 · 1 comment
Open

drivers: led: support variable brightness granularity #87737

jeppenodgaard opened this issue Mar 27, 2025 · 1 comment
Assignees
Labels
area: LED Label to identify LED subsystem Enhancement Changes/Updates/Additions to existing features

Comments

@jeppenodgaard
Copy link
Collaborator

jeppenodgaard commented Mar 27, 2025

Is your enhancement proposal related to a problem? Please describe.
Some LED drivers, e.g. LED PWM, supports a higher granularity than the current 0-100 range.

Increase the supported range to allow adjusting the light level with a finer granularity.

This is useful for delicate devices that needs a constant and precise lumen output from an LED.

Describe the solution you'd like

  1. Increase led_set_brightness's value type to uint16_t to allow using full granularity for all LED drivers. Maybe even uint32_t.
    Return an errno if the value is above maximum supported.

or

  1. To prevent modifying a lot of the LED code base it might be worth adding a new optional API function that allows full range and keep the existing led_set_brightness. This also allows having a brightness function that is simple to use from an application point of view. Function name and prototype suggestion:
    int led_set_brightness_raw(const struct device *dev, uint32_t led, uint32_t value)

Describe alternatives you've considered
Using DAC or PWM API directly to control an LED device.

Additional context
Discord discussion:
https://discord.com/channels/720317445772017664/1352646386113314846

@jeppenodgaard jeppenodgaard added area: LED Label to identify LED subsystem Enhancement Changes/Updates/Additions to existing features labels Mar 27, 2025
@jeppenodgaard
Copy link
Collaborator Author

I like the 2nd solution the most. What do you think @simonguinot ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: LED Label to identify LED subsystem Enhancement Changes/Updates/Additions to existing features
Projects
None yet
Development

No branches or pull requests

3 participants