summaryrefslogtreecommitdiff
path: root/doc/usage
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2025-12-03 11:04:32 -0600
committerTom Rini <[email protected]>2025-12-03 12:18:16 -0600
commitd300702c5be5a846032834abe4f01dcd3f50b3a8 (patch)
treeae5eeffc4919a8ddeb8fe56974c632d2205547d5 /doc/usage
parentdca19206acf2af2d339087bb62aa0b8ee1b0e326 (diff)
parenteb02d87c7579f83f6fe153c80d420e5f53bde4c1 (diff)
Merge patch series "led: remove u-boot,boot-led and u-boot,error-led + add cmd doc"
Quentin Schulz <[email protected]> says: u-boot,boot-led and u-boot,error-led aren't actually handled by some generic code but rather by board or architecture specific code. They also aren't properties that are part of the official dt-binding so they cannot be upstreamed. For u-boot,boot-led, there's actually a proper replacement which is /options/u-boot/boot-led[1] (+ CONFIG_LED_BOOT=y). For Rockchip boards, either nothing (for RK3066, PX30 and RK3399) was using that property or (for RK3188) the code handling it was guarded by symbols that were not enabled in the defconfig. For those, the property and guarded code are removed. For the Sam9x60 Curiosity, it seems that even though the LED is controlled whenever CONFIG_LED is enabled, it isn't enabled by default in the defconfig (but the code was added without modifying the defconfig, explicitly leaving a choice to the user). I decided to keep that feature by simply migrating it to the new API, though I cannot test it as I do not own the device. The STM32 boards will be migrated in the near future once their upstream (kernel) Device Trees gain the new way to specify this (via /options/u-boot/boot-led). I'll let Patrice handle this, see https://lore.kernel.org/u-boot/[email protected]/ and https://lore.kernel.org/u-boot/[email protected]/ After this, only one user of u-boot,boot-led will be left, based on STM32: board/dhelectronics/dh_stm32mp1/board.c. @Patrice, maybe that's something you want to have a look at as well, this seems to be some evaluation kit? The only users of u-boot,error-led are STM32 boards, so I'll leave this to Patrice as well, I do not know what's the way to go for that one. In any case, I would like to not encourage people to use out-of-spec DT properties when there is another option (u-boot,boot-led), so I remove the properties from the dt-binding document from U-Boot. The help text for the blink subcommand of the led command was misleading so this is now fixed. This also moves the content of doc/README.LED into the doc/api/led.rst, while clearly stating one shouldn't be using this anymore. This also gets rid of dt-binding that we already have in dts/upstream. Finally, this adds documentation for the led shell command. [1] https://github.com/devicetree-org/dt-schema/blob/v2025.08/dtschema/schemas/options/u-boot.yaml#L113-L116 Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'doc/usage')
-rw-r--r--doc/usage/cmd/led.rst95
1 files changed, 95 insertions, 0 deletions
diff --git a/doc/usage/cmd/led.rst b/doc/usage/cmd/led.rst
new file mode 100644
index 00000000000..b5623895c7e
--- /dev/null
+++ b/doc/usage/cmd/led.rst
@@ -0,0 +1,95 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+.. index::
+ single: led (command)
+
+led command
+===========
+
+Synopsis
+--------
+
+::
+
+ led <led_label> <on|off|toggle>
+ led <led_label> blink <blink-freq in ms>
+ led <led_label>
+ led list
+
+led <led_label>
+---------------
+
+Get state of the LED whose label is the one passed as ``<led_label>`` argument.
+
+Provided ``<led_label>`` is *module_led*, the possible outputs for this command
+are::
+
+ LED 'module_led': off
+ LED 'module_led': on
+ LED 'module_led': blink
+
+led <led_label> on|off|toggle
+-----------------------------
+
+Turn on, off or toggle state of the LED whose label is the one passed as
+``<led_label>`` argument.
+
+led <led_label> blink <blink-freq in ms>
+----------------------------------------
+
+Make the LED whose label is the one passed as ``<led_label>`` argument blink at
+a frequency specified by the argument ``<blink-freq in ms>``.
+
+The frequency is parsed as a decimal number and its unit is milliseconds. The
+duty cycle is 50%. Example::
+
+ led blue blink 1000
+
+will make the *blue*-labeled LED blink with a state (on or off) kept for 500ms
+before switching to the other state (respectively off or on) for 500ms,
+looping endlessly.
+
+led list
+--------
+
+List all available LEDs by their label and provide their known state, which can
+be either *off*, *on* or *blink*.
+
+If a LED has not been probed yet, its state will be shown as *<inactive>* in the
+list.
+
+Examples
+--------
+
+::
+
+ => led list
+ module_led on
+ sd_card_led <inactive>
+ => led module_led
+ LED 'module_led': on
+ => led module_led off
+ => led module_led
+ LED 'module_led': off
+ => led module_led toggle
+ => led module_led
+ LED 'module_led': on
+ => led module_led toggle
+ => led module_led
+ LED 'module_led': off
+ => led module_led blink 1000
+ => led module_led
+ LED 'module_led': blink
+ => led sd_card_led
+ LED 'sd_card_led': off
+ => led list
+ module_led blink
+ sd_card_led off
+
+Configuration
+-------------
+
+The *led* commands are only available if ``CONFIG_CMD_LED=y``.
+
+The *led <led_label> blink* command is only available if ``CONFIG_CMD_LED=y``
+and either ``CONFIG_LED_BLINK=y`` or ``CONFIG_LED_SW_BLINK=y``.