
On Wed, Jun 05, 2024 at 09:21:32PM +0200, Christian Marangi wrote:
This series expand the STATUS LED framework with a new color and a big new feature. One thing that many device need is a way to communicate to the user that the device is actually doing something.
This is especially useful for recovery steps where an user (for example) insert an USB drive, keep a button pressed and the device autorecover.
There is currently no way to signal the user externally that the bootloader is processing/recoverying aside from setting a LED on.
A solid LED on is not enough and won't actually signal any kind of progress. Solution is the good old blinking LED but uboot doesn't suggest (and support) interrupts and almost all the LED are usually GPIO LED that doesn't support HW blink.
To fix this and handle the problem of device not supporting HW blink, expand the STATUS LED framework with new API.
We introduce a new config LED_STATUS_ACTIVITY, that similar to the RED, GREEN and others, takes the LED ID set in the LED_STATUS config and is used as the global LED for activity operations.
We add status_led_activity() that simulate software blink. Any function that signal activity will call this function. At each call a counter is increased. When the counter reach the freq value, the LED is toggled simulating a blink and the counter is zeroed. When the counter reach the freq value again, the LED is toggled again and so on...
Call to this function is added to the usual operation for recovery. Currently added to tftp traffic and mtd spi and nand write and erase operation.
This also contains a big fixup for the gpio_led driver that currently deviates from the Documentation and make the coloured status led feature unusable.
Thanks for the work here, this is quite interesting. My only real feedback is, can you please rewrite doc/README.LED as doc/api/led.rst (and add it to the index), and then document your new functionality there as well?