-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
LED PWM driver #29401
LED PWM driver #29401
Conversation
Two commits I used to test this driver on a STM32F070-based board have been accidentally pushed in the initial PR. I removed them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some comments. LGTM, simple and nice driver!
67abdbf
to
be2c568
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
This driver supports the PWM driven LEDs. The devices are created from the DT nodes with a compatible property matching "pwm-leds". For each child node a LED is created and its "pwms" phandle's node is used to retrieve the PWM configuration: channel, period and flags. If some of this properties are missing (it is the case for some PWM controllers), then reasonable default values are used. This driver implements the following LED API methods: - led_on - led_off - led_blink - led_set_brightness Signed-off-by: Simon Guinot <[email protected]>
This sample allows to test the led-pwm driver. The first "pwm-leds" compatible device instance found in DT is used. For each LEDs attached to this device (child nodes) the same test pattern (described below) is executed. The LED API functions are used to control the LEDs. Test pattern: For each PWM LEDs (one after the other): - turn on - turn off - increase the brightness gradually up to the maximum level - blink (0.1 sec on, 0.1 sec off) - blink (1 sec on, 1 sec off) - turn off Signed-off-by: Simon Guinot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is cool, thanks!
This pull request adds a driver (and its test sample) for the PWM driven LEDs.
The devices are created from the DT nodes with a compatible property matching "pwm-leds". For each child node a LED is created and its "pwms" phandle's node is used to retrieve the PWM configuration: channel, period and flags. If some of this properties are missing (it is the case for some PWM controllers), then reasonable default values are used.
This driver implements the following LED API methods: