public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Christian Marangi <ansuelsmth@gmail.com>
To: Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>,
	Joe Hershberger <joe.hershberger@ni.com>,
	Ramon Fried <rfried.dev@gmail.com>,
	AKASHI Takahiro <akashi.tkhro@gmail.com>,
	Christian Marangi <ansuelsmth@gmail.com>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Etienne Carriere <etienne.carriere@foss.st.com>,
	Caleb Connolly <caleb.connolly@linaro.org>,
	Algapally Santosh Sagar <santoshsagar.algapally@amd.com>,
	Sean Anderson <seanga2@gmail.com>,
	Eddie James <eajames@linux.ibm.com>,
	Mattijs Korpershoek <mkorpershoek@baylibre.com>,
	Alexander Gendin <agendin@matrox.com>,
	Yang Xiwen <forbidden405@outlook.com>,
	Dario Binacchi <dario.binacchi@amarulasolutions.com>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Arseniy Krasnov <avkrasnov@salutedevices.com>,
	Heiko Schocher <hs@denx.de>,
	Michael Trimarchi <michael@amarulasolutions.com>,
	Martin Kurbanov <mmkurbanov@salutedevices.com>,
	Alexey Romanov <avromanov@salutedevices.com>,
	Artur Rojek <artur@conclusive.pl>,
	Rasmus Villemoes <rasmus.villemoes@prevas.dk>,
	Leo Yu-Chi Liang <ycliang@andestech.com>,
	Vasileios Amoiridis <vassilisamir@gmail.com>,
	Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>,
	Michael Polyntsov <michael.polyntsov@iopsys.eu>,
	Doug Zobel <douglas.zobel@climate.com>,
	Marek Vasut <marex@denx.de>,
	u-boot@lists.denx.de, John Crispin <john@phrozen.org>
Subject: [PATCH v5 09/11] doc: introduce led.rst documentation
Date: Tue,  1 Oct 2024 14:24:42 +0200	[thread overview]
Message-ID: <20241001122511.8832-10-ansuelsmth@gmail.com> (raw)
In-Reply-To: <20241001122511.8832-1-ansuelsmth@gmail.com>

Introduce simple led.rst documentation to document all the additional
Kconfig and the current limitation of LED_BLINK and GPIO software blink.

Also add missing definition for sw_blink in led_uc_plat struct.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
 doc/api/index.rst |  1 +
 doc/api/led.rst   | 10 ++++++++++
 include/led.h     | 41 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 52 insertions(+)
 create mode 100644 doc/api/led.rst

diff --git a/doc/api/index.rst b/doc/api/index.rst
index ec0b8adb2cf..9f7f23f868f 100644
--- a/doc/api/index.rst
+++ b/doc/api/index.rst
@@ -14,6 +14,7 @@ U-Boot API documentation
    event
    getopt
    interrupt
+   led
    linker_lists
    lmb
    logging
diff --git a/doc/api/led.rst b/doc/api/led.rst
new file mode 100644
index 00000000000..e52e350d1bb
--- /dev/null
+++ b/doc/api/led.rst
@@ -0,0 +1,10 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+LED
+===
+
+.. kernel-doc:: include/led.h
+   :doc: Overview
+
+.. kernel-doc:: include/led.h
+   :internal:
\ No newline at end of file
diff --git a/include/led.h b/include/led.h
index 19d92d6441a..64247cd3a70 100644
--- a/include/led.h
+++ b/include/led.h
@@ -11,6 +11,46 @@
 #include <cyclic.h>
 #include <dm/ofnode.h>
 
+/**
+ * DOC: Overview
+ *
+ * Generic LED API provided when a supported compatible is defined in DeviceTree.
+ *
+ * To enable support for LEDs, enable the `CONFIG_LED` Kconfig option.
+ *
+ * The most common implementation is for GPIO-connected LEDs. If using GPIO-connected LEDs,
+ * enable the `LED_GPIO` Kconfig option.
+ *
+ * `LED_BLINK` support requires LED driver support and is therefore optional. If LED blink
+ * functionality is needed, enable the `LED_BLINK` Kconfig option. If LED driver doesn't
+ * support HW Blink, SW Blink can be used with the Cyclic framework by enabling the
+ * CONFIG_LED_SW_BLINK.
+ *
+ * Boot and Activity LEDs are also supported. These LEDs can signal various system operations
+ * during runtime, such as boot initialization, file transfers, and flash write/erase operations.
+ *
+ * To enable a Boot LED, enable `CONFIG_LED_BOOT` and define in `/options/u-boot` root node the
+ * property `boot-led`. This will enable the specified LED to blink and turn ON when
+ * the bootloader initializes correctly.
+ *
+ * To enable an Activity LED, enable `CONFIG_LED_ACTIVITY` and define in `/options/u-boot` root
+ * node the property `activity-led`.
+ * This will enable the specified LED to blink and turn ON during file transfers or flash
+ * write/erase operations.
+ *
+ * Both Boot and Activity LEDs provide a simple API to turn the LED ON or OFF:
+ * `led_boot_on()`, `led_boot_off()`, `led_activity_on()`, and `led_activity_off()`.
+ *
+ * Both configurations can optionally define a `boot/activity-led-period` property
+ * if `CONFIG_LED_BLINK` or `CONFIG_LED_SW_BLINK` is enabled for LED blink operations, which
+ * is usually used by the Activity LED. If not defined the default value of 250 (ms) is used.
+ *
+ * When `CONFIG_LED_BLINK` or `CONFIG_LED_SW_BLINK` is enabled, additional APIs are exposed:
+ * `led_boot_blink()` and `led_activity_blink()`. Note that if `CONFIG_LED_BLINK` or
+ * `CONFIG_LED_SW_BLINK` is disabled, these APIs will behave like the `led_boot_on()` and
+ * `led_activity_on()` APIs, respectively.
+ */
+
 struct udevice;
 
 enum led_state_t {
@@ -41,6 +81,7 @@ struct led_sw_blink {
  *
  * @label:	LED label
  * @default_state:	LED default state
+ * @sw_blink:	LED software blink struct
  */
 struct led_uc_plat {
 	const char *label;
-- 
2.45.2


  parent reply	other threads:[~2024-10-01 13:21 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-01 12:24 [PATCH v5 00/11] led: introduce LED boot and activity function Christian Marangi
2024-10-01 12:24 ` [PATCH v5 01/11] led: toggle LED on initial SW blink Christian Marangi
2024-10-02 22:55   ` Simon Glass
2024-10-02 22:59     ` Christian Marangi
2024-10-03  6:22   ` Michael Nazzareno Trimarchi
2024-10-03 10:59     ` Christian Marangi
2024-10-01 12:24 ` [PATCH v5 02/11] dm: core: implement ofnode_options helpers Christian Marangi
2024-10-01 12:24 ` [PATCH v5 03/11] led: implement LED boot API Christian Marangi
2024-10-02 22:55   ` Simon Glass
2024-10-02 23:00     ` Christian Marangi
2024-10-03 17:30       ` Simon Glass
2024-11-02 19:33     ` Simon Glass
2024-11-02 19:36       ` Christian Marangi
2024-11-02 19:50         ` Simon Glass
2024-11-02 19:52           ` Christian Marangi
2024-11-03 14:46             ` Simon Glass
2024-11-04 23:13               ` Christian Marangi
2024-11-05 15:12                 ` Simon Glass
2024-11-05 15:15                   ` Christian Marangi
2024-10-01 12:24 ` [PATCH v5 04/11] common: board_r: rework BOOT LED handling Christian Marangi
2024-10-01 12:24 ` [PATCH v5 05/11] led: implement LED activity API Christian Marangi
2024-10-02 22:55   ` Simon Glass
2024-10-01 12:24 ` [PATCH v5 06/11] tftp: implement support for LED activity Christian Marangi
2024-10-01 12:24 ` [PATCH v5 07/11] mtd: " Christian Marangi
2024-10-02 22:55   ` Simon Glass
2024-10-01 12:24 ` [PATCH v5 08/11] ubi: " Christian Marangi
2024-10-01 12:24 ` Christian Marangi [this message]
2024-10-01 12:24 ` [PATCH v5 10/11] test: dm: Add tests for LED boot and activity Christian Marangi
2024-10-01 12:24 ` [PATCH v5 11/11] test: dm: Expand ofnode options test with new helper Christian Marangi
2024-10-11 17:35 ` [PATCH v5 00/11] led: introduce LED boot and activity function Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241001122511.8832-10-ansuelsmth@gmail.com \
    --to=ansuelsmth@gmail.com \
    --cc=agendin@matrox.com \
    --cc=akashi.tkhro@gmail.com \
    --cc=artur@conclusive.pl \
    --cc=avkrasnov@salutedevices.com \
    --cc=avromanov@salutedevices.com \
    --cc=caleb.connolly@linaro.org \
    --cc=dario.binacchi@amarulasolutions.com \
    --cc=douglas.zobel@climate.com \
    --cc=eajames@linux.ibm.com \
    --cc=etienne.carriere@foss.st.com \
    --cc=forbidden405@outlook.com \
    --cc=hs@denx.de \
    --cc=ilias.apalodimas@linaro.org \
    --cc=joe.hershberger@ni.com \
    --cc=john@phrozen.org \
    --cc=marex@denx.de \
    --cc=michael.polyntsov@iopsys.eu \
    --cc=michael@amarulasolutions.com \
    --cc=mikhail.kshevetskiy@iopsys.eu \
    --cc=miquel.raynal@bootlin.com \
    --cc=mkorpershoek@baylibre.com \
    --cc=mmkurbanov@salutedevices.com \
    --cc=rasmus.villemoes@prevas.dk \
    --cc=rfried.dev@gmail.com \
    --cc=santoshsagar.algapally@amd.com \
    --cc=seanga2@gmail.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=vassilisamir@gmail.com \
    --cc=xypron.glpk@gmx.de \
    --cc=ycliang@andestech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox