* [PATCH v5 00/11] led: introduce LED boot and activity function
@ 2024-10-01 12:24 Christian Marangi
2024-10-01 12:24 ` [PATCH v5 01/11] led: toggle LED on initial SW blink Christian Marangi
` (11 more replies)
0 siblings, 12 replies; 30+ messages in thread
From: Christian Marangi @ 2024-10-01 12:24 UTC (permalink / raw)
To: Simon Glass, Tom Rini, Joe Hershberger, Ramon Fried,
AKASHI Takahiro, Christian Marangi, Ilias Apalodimas,
Etienne Carriere, Caleb Connolly, Algapally Santosh Sagar,
Sean Anderson, Eddie James, Mattijs Korpershoek, Alexander Gendin,
Yang Xiwen, Dario Binacchi, Heinrich Schuchardt, Miquel Raynal,
Arseniy Krasnov, Heiko Schocher, Michael Trimarchi,
Martin Kurbanov, Alexey Romanov, Artur Rojek, Rasmus Villemoes,
Leo Yu-Chi Liang, Vasileios Amoiridis, Mikhail Kshevetskiy,
Michael Polyntsov, Doug Zobel, Marek Vasut, u-boot, John Crispin
This series is a reworked version of the previous seried:
misc: introduce STATUS LED activity function
This series port and expand the legacy concept of LED boot from
the legacy Status LED API to new LED API.
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.
Additional Kconfg are also introduced to set the LED boot and
activity. Those are referenced by label.
A documentation for old and these new LED API is created.
(world tested with the azure pipeline)
Changes v5:
- Use led_get_by_label and don't cache led dev
- Improve Kconfig for /options location
- Add Reviewed-by tags
- Enable blink also on MTD read
- Drop additional get_state in led_sw_on_state_change from v4
Changes v4:
- Drop led_set_state/period_by_label
- Switch to /options/u-boot
- Rework to cache label and dev in led uclass
- Add multiple patch for additional helper
- Rework patches to limit ifdef in some place
Changes v3:
- Switch to /config property
Changes v2:
- Drop GPIO SW implementation
- Add fix for new LED SW BLINK
Christian Marangi (11):
led: toggle LED on initial SW blink
dm: core: implement ofnode_options helpers
led: implement LED boot API
common: board_r: rework BOOT LED handling
led: implement LED activity API
tftp: implement support for LED activity
mtd: implement support for LED activity
ubi: implement support for LED activity
doc: introduce led.rst documentation
test: dm: Add tests for LED boot and activity
test: dm: Expand ofnode options test with new helper
arch/sandbox/dts/test.dts | 5 ++
cmd/mtd.c | 9 +++
cmd/ubi.c | 13 ++-
common/board_r.c | 28 +++++--
doc/api/index.rst | 1 +
doc/api/led.rst | 10 +++
drivers/core/ofnode.c | 33 ++++++++
drivers/led/Kconfig | 24 ++++++
drivers/led/led-uclass.c | 162 +++++++++++++++++++++++++++++++++++++
drivers/led/led_sw_blink.c | 17 +++-
include/dm/ofnode.h | 41 ++++++++++
include/led.h | 147 ++++++++++++++++++++++++++++++++-
include/status_led.h | 13 +++
net/net.c | 4 +
net/tftp.c | 5 ++
test/dm/led.c | 72 +++++++++++++++++
test/dm/ofnode.c | 9 +++
17 files changed, 579 insertions(+), 14 deletions(-)
create mode 100644 doc/api/led.rst
--
2.45.2
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v5 01/11] led: toggle LED on initial SW blink
2024-10-01 12:24 [PATCH v5 00/11] led: introduce LED boot and activity function Christian Marangi
@ 2024-10-01 12:24 ` Christian Marangi
2024-10-02 22:55 ` Simon Glass
2024-10-03 6:22 ` Michael Nazzareno Trimarchi
2024-10-01 12:24 ` [PATCH v5 02/11] dm: core: implement ofnode_options helpers Christian Marangi
` (10 subsequent siblings)
11 siblings, 2 replies; 30+ messages in thread
From: Christian Marangi @ 2024-10-01 12:24 UTC (permalink / raw)
To: Simon Glass, Tom Rini, Joe Hershberger, Ramon Fried,
AKASHI Takahiro, Christian Marangi, Ilias Apalodimas,
Etienne Carriere, Caleb Connolly, Algapally Santosh Sagar,
Sean Anderson, Eddie James, Mattijs Korpershoek, Alexander Gendin,
Yang Xiwen, Dario Binacchi, Heinrich Schuchardt, Miquel Raynal,
Arseniy Krasnov, Heiko Schocher, Michael Trimarchi,
Martin Kurbanov, Alexey Romanov, Artur Rojek, Rasmus Villemoes,
Leo Yu-Chi Liang, Vasileios Amoiridis, Mikhail Kshevetskiy,
Michael Polyntsov, Doug Zobel, Marek Vasut, u-boot, John Crispin
We currently init the LED OFF when SW blink is triggered when
on_state_change() is called. This can be problematic for very short
period as the ON/OFF blink might never trigger.
Toggle the LED (ON if OFF, OFF if ON) on initial SW blink to handle this
corner case and better display a LED blink from the user.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/led/led_sw_blink.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/drivers/led/led_sw_blink.c b/drivers/led/led_sw_blink.c
index 9e36edbee47..06a43db340c 100644
--- a/drivers/led/led_sw_blink.c
+++ b/drivers/led/led_sw_blink.c
@@ -103,8 +103,21 @@ bool led_sw_on_state_change(struct udevice *dev, enum led_state_t state)
return false;
if (state == LEDST_BLINK) {
- /* start blinking on next led_sw_blink() call */
- sw_blink->state = LED_SW_BLINK_ST_OFF;
+ struct led_ops *ops = led_get_ops(dev);
+
+ /*
+ * toggle LED initially and start blinking on next
+ * led_sw_blink() call.
+ */
+ switch (ops->get_state(dev)) {
+ case LEDST_ON:
+ ops->set_state(dev, LEDST_OFF);
+ sw_blink->state = LED_SW_BLINK_ST_OFF;
+ default:
+ ops->set_state(dev, LEDST_ON);
+ sw_blink->state = LED_SW_BLINK_ST_ON;
+ }
+
return true;
}
--
2.45.2
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v5 02/11] dm: core: implement ofnode_options helpers
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-01 12:24 ` Christian Marangi
2024-10-01 12:24 ` [PATCH v5 03/11] led: implement LED boot API Christian Marangi
` (9 subsequent siblings)
11 siblings, 0 replies; 30+ messages in thread
From: Christian Marangi @ 2024-10-01 12:24 UTC (permalink / raw)
To: Simon Glass, Tom Rini, Joe Hershberger, Ramon Fried,
AKASHI Takahiro, Christian Marangi, Ilias Apalodimas,
Etienne Carriere, Caleb Connolly, Algapally Santosh Sagar,
Sean Anderson, Eddie James, Mattijs Korpershoek, Alexander Gendin,
Yang Xiwen, Dario Binacchi, Heinrich Schuchardt, Miquel Raynal,
Arseniy Krasnov, Heiko Schocher, Michael Trimarchi,
Martin Kurbanov, Alexey Romanov, Artur Rojek, Rasmus Villemoes,
Leo Yu-Chi Liang, Vasileios Amoiridis, Mikhail Kshevetskiy,
Michael Polyntsov, Doug Zobel, Marek Vasut, u-boot, John Crispin
Implement ofnode_options helpers to read options in /options/u-boot to
adapt to the new way to declare options as described in [1].
[1] dtschema/schemas/options/u-boot.yaml
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
drivers/core/ofnode.c | 33 +++++++++++++++++++++++++++++++++
include/dm/ofnode.h | 41 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 74 insertions(+)
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 4d563b47a5a..4404c4f4bab 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -1734,6 +1734,39 @@ const char *ofnode_conf_read_str(const char *prop_name)
return ofnode_read_string(node, prop_name);
}
+bool ofnode_options_read_bool(const char *prop_name)
+{
+ ofnode uboot;
+
+ uboot = ofnode_path("/options/u-boot");
+ if (!ofnode_valid(uboot))
+ return false;
+
+ return ofnode_read_bool(uboot, prop_name);
+}
+
+int ofnode_options_read_int(const char *prop_name, int default_val)
+{
+ ofnode uboot;
+
+ uboot = ofnode_path("/options/u-boot");
+ if (!ofnode_valid(uboot))
+ return default_val;
+
+ return ofnode_read_u32_default(uboot, prop_name, default_val);
+}
+
+const char *ofnode_options_read_str(const char *prop_name)
+{
+ ofnode uboot;
+
+ uboot = ofnode_path("/options/u-boot");
+ if (!ofnode_valid(uboot))
+ return NULL;
+
+ return ofnode_read_string(uboot, prop_name);
+}
+
int ofnode_read_bootscript_address(u64 *bootscr_address, u64 *bootscr_offset)
{
int ret;
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index 5795115c490..0787758926f 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -1587,6 +1587,47 @@ int ofnode_conf_read_int(const char *prop_name, int default_val);
*/
const char *ofnode_conf_read_str(const char *prop_name);
+/**
+ * ofnode_options_read_bool() - Read a boolean value from the U-Boot options
+ *
+ * This reads a property from the /options/u-boot/ node of the devicetree.
+ *
+ * This only works with the control FDT.
+ *
+ * See dtschema/schemas/options/u-boot.yaml in dt-schema project for bindings
+ *
+ * @prop_name: property name to look up
+ * Return: true, if it exists, false if not
+ */
+bool ofnode_options_read_bool(const char *prop_name);
+
+/**
+ * ofnode_options_read_int() - Read an integer value from the U-Boot options
+ *
+ * This reads a property from the /options/u-boot/ node of the devicetree.
+ *
+ * See dtschema/schemas/options/u-boot.yaml in dt-schema project for bindings
+ *
+ * @prop_name: property name to look up
+ * @default_val: default value to return if the property is not found
+ * Return: integer value, if found, or @default_val if not
+ */
+int ofnode_options_read_int(const char *prop_name, int default_val);
+
+/**
+ * ofnode_options_read_str() - Read a string value from the U-Boot options
+ *
+ * This reads a property from the /options/u-boot/ node of the devicetree.
+ *
+ * This only works with the control FDT.
+ *
+ * See dtschema/schemas/options/u-boot.yaml in dt-schema project for bindings
+ *
+ * @prop_name: property name to look up
+ * Return: string value, if found, or NULL if not
+ */
+const char *ofnode_options_read_str(const char *prop_name);
+
/**
* ofnode_read_bootscript_address() - Read bootscr-address or bootscr-ram-offset
*
--
2.45.2
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v5 03/11] led: implement LED boot API
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-01 12:24 ` [PATCH v5 02/11] dm: core: implement ofnode_options helpers Christian Marangi
@ 2024-10-01 12:24 ` Christian Marangi
2024-10-02 22:55 ` Simon Glass
2024-10-01 12:24 ` [PATCH v5 04/11] common: board_r: rework BOOT LED handling Christian Marangi
` (8 subsequent siblings)
11 siblings, 1 reply; 30+ messages in thread
From: Christian Marangi @ 2024-10-01 12:24 UTC (permalink / raw)
To: Simon Glass, Tom Rini, Joe Hershberger, Ramon Fried,
AKASHI Takahiro, Christian Marangi, Ilias Apalodimas,
Etienne Carriere, Caleb Connolly, Algapally Santosh Sagar,
Sean Anderson, Eddie James, Mattijs Korpershoek, Alexander Gendin,
Yang Xiwen, Dario Binacchi, Heinrich Schuchardt, Miquel Raynal,
Arseniy Krasnov, Heiko Schocher, Michael Trimarchi,
Martin Kurbanov, Alexey Romanov, Artur Rojek, Rasmus Villemoes,
Leo Yu-Chi Liang, Vasileios Amoiridis, Mikhail Kshevetskiy,
Michael Polyntsov, Doug Zobel, Marek Vasut, u-boot, John Crispin
Implement LED boot API to signal correct boot of the system.
led_boot_on/off/blink() are introduced to turn ON, OFF and BLINK the
designated boot LED.
New Kconfig is introduced, CONFIG_LED_BOOT to enable the feature.
This makes use of the /options/u-boot property "boot-led" to the
define the boot LED.
It's also introduced a new /options/u-boot property "boot-led-period"
to define the default period when the LED is set to blink mode.
If "boot-led-period" is not defined, the value of 250 (ms) is
used by default.
If CONFIG_LED_BLINK or CONFIG_LED_SW_BLINK is not enabled,
led_boot_blink call will fallback to simple LED ON.
To cache the data we repurpose the now unused led_uc_priv for storage of
global LED uclass info.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/led/Kconfig | 11 ++++++
drivers/led/led-uclass.c | 85 ++++++++++++++++++++++++++++++++++++++++
include/led.h | 55 +++++++++++++++++++++++++-
3 files changed, 149 insertions(+), 2 deletions(-)
diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig
index bee74b25751..59b007a7ef5 100644
--- a/drivers/led/Kconfig
+++ b/drivers/led/Kconfig
@@ -9,6 +9,17 @@ config LED
can provide access to board-specific LEDs. Use of the device tree
for configuration is encouraged.
+config LED_BOOT
+ bool "Enable LED boot support"
+ help
+ Enable LED boot support.
+
+ LED boot is a specific LED assigned to signal boot operation status.
+ Defined in Device Tree /options/u-boot node. Refer here for the supported
+ options [1].
+
+ [1] dtschema/schemas/options/u-boot.yaml
+
config LED_BCM6328
bool "LED Support for BCM6328"
depends on LED && ARCH_BMIPS
diff --git a/drivers/led/led-uclass.c b/drivers/led/led-uclass.c
index 199d68bc25a..54113213dcf 100644
--- a/drivers/led/led-uclass.c
+++ b/drivers/led/led-uclass.c
@@ -94,6 +94,75 @@ int led_set_period(struct udevice *dev, int period_ms)
return -ENOSYS;
}
+#ifdef CONFIG_LED_BOOT
+static int led_boot_get(struct udevice **devp, int *period_ms)
+{
+ struct led_uc_priv *priv;
+ struct uclass *uc;
+ int ret;
+
+ ret = uclass_get(UCLASS_LED, &uc);
+ if (ret)
+ return ret;
+
+ priv = uclass_get_priv(uc);
+ if (!priv->boot_led_label)
+ return -ENOENT;
+
+ if (period_ms)
+ *period_ms = priv->boot_led_period;
+
+ return led_get_by_label(priv->boot_led_label, devp);
+}
+
+int led_boot_on(void)
+{
+ struct udevice *dev;
+ int ret;
+
+ ret = led_boot_get(&dev, NULL);
+ if (ret)
+ return ret;
+
+ return led_set_state(dev, LEDST_ON);
+}
+
+int led_boot_off(void)
+{
+ struct udevice *dev;
+ int ret;
+
+ ret = led_boot_get(&dev, NULL);
+ if (ret)
+ return ret;
+
+ return led_set_state(dev, LEDST_OFF);
+}
+
+#if defined(CONFIG_LED_BLINK) || defined(CONFIG_LED_SW_BLINK)
+int led_boot_blink(void)
+{
+ struct udevice *dev;
+ int period_ms, ret;
+
+ ret = led_boot_get(&dev, &period_ms);
+ if (ret)
+ return ret;
+
+ ret = led_set_period(dev, period_ms);
+ if (ret) {
+ if (ret != -ENOSYS)
+ return ret;
+
+ /* fallback to ON with no set_period and no SW_BLINK */
+ return led_set_state(dev, LEDST_ON);
+ }
+
+ return led_set_state(dev, LEDST_BLINK);
+}
+#endif
+#endif
+
static int led_post_bind(struct udevice *dev)
{
struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev);
@@ -158,10 +227,26 @@ static int led_post_probe(struct udevice *dev)
return ret;
}
+#ifdef CONFIG_LED_BOOT
+static int led_init(struct uclass *uc)
+{
+ struct led_uc_priv *priv = uclass_get_priv(uc);
+
+ priv->boot_led_label = ofnode_options_read_str("boot-led");
+ priv->boot_led_period = ofnode_options_read_int("boot-led-period", 250);
+
+ return 0;
+}
+#endif
+
UCLASS_DRIVER(led) = {
.id = UCLASS_LED,
.name = "led",
.per_device_plat_auto = sizeof(struct led_uc_plat),
.post_bind = led_post_bind,
.post_probe = led_post_probe,
+#ifdef CONFIG_LED_BOOT
+ .init = led_init,
+ .priv_auto = sizeof(struct led_uc_priv),
+#endif
};
diff --git a/include/led.h b/include/led.h
index 99f93c5ef86..49ec2998a33 100644
--- a/include/led.h
+++ b/include/led.h
@@ -9,6 +9,7 @@
#include <stdbool.h>
#include <cyclic.h>
+#include <dm/ofnode.h>
struct udevice;
@@ -52,10 +53,15 @@ struct led_uc_plat {
/**
* struct led_uc_priv - Private data the uclass stores about each device
*
- * @period_ms: Flash period in milliseconds
+ * @boot_led_label: Boot LED label
+ * @boot_led_dev: Boot LED dev
+ * @boot_led_period: Boot LED blink period
*/
struct led_uc_priv {
- int period_ms;
+#ifdef CONFIG_LED_BOOT
+ const char *boot_led_label;
+ int boot_led_period;
+#endif
};
struct led_ops {
@@ -141,4 +147,49 @@ int led_sw_set_period(struct udevice *dev, int period_ms);
bool led_sw_is_blinking(struct udevice *dev);
bool led_sw_on_state_change(struct udevice *dev, enum led_state_t state);
+#ifdef CONFIG_LED_BOOT
+
+/**
+ * led_boot_on() - turn ON the designated LED for booting
+ *
+ * Return: 0 if OK, -ve on error
+ */
+int led_boot_on(void);
+
+/**
+ * led_boot_off() - turn OFF the designated LED for booting
+ *
+ * Return: 0 if OK, -ve on error
+ */
+int led_boot_off(void);
+
+#if defined(CONFIG_LED_BLINK) || defined(CONFIG_LED_SW_BLINK)
+/**
+ * led_boot_blink() - turn ON the designated LED for booting
+ *
+ * Return: 0 if OK, -ve on error
+ */
+int led_boot_blink(void);
+
+#else
+/* If LED BLINK is not supported/enabled, fallback to LED ON */
+#define led_boot_blink led_boot_on
+#endif
+#else
+static inline int led_boot_on(void)
+{
+ return -ENOSYS;
+}
+
+static inline int led_boot_off(void)
+{
+ return -ENOSYS;
+}
+
+static inline int led_boot_blink(void)
+{
+ return -ENOSYS;
+}
+#endif
+
#endif
--
2.45.2
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v5 04/11] common: board_r: rework BOOT LED handling
2024-10-01 12:24 [PATCH v5 00/11] led: introduce LED boot and activity function Christian Marangi
` (2 preceding siblings ...)
2024-10-01 12:24 ` [PATCH v5 03/11] led: implement LED boot API Christian Marangi
@ 2024-10-01 12:24 ` Christian Marangi
2024-10-01 12:24 ` [PATCH v5 05/11] led: implement LED activity API Christian Marangi
` (7 subsequent siblings)
11 siblings, 0 replies; 30+ messages in thread
From: Christian Marangi @ 2024-10-01 12:24 UTC (permalink / raw)
To: Simon Glass, Tom Rini, Joe Hershberger, Ramon Fried,
AKASHI Takahiro, Christian Marangi, Ilias Apalodimas,
Etienne Carriere, Caleb Connolly, Algapally Santosh Sagar,
Sean Anderson, Eddie James, Mattijs Korpershoek, Alexander Gendin,
Yang Xiwen, Dario Binacchi, Heinrich Schuchardt, Miquel Raynal,
Arseniy Krasnov, Heiko Schocher, Michael Trimarchi,
Martin Kurbanov, Alexey Romanov, Artur Rojek, Rasmus Villemoes,
Leo Yu-Chi Liang, Vasileios Amoiridis, Mikhail Kshevetskiy,
Michael Polyntsov, Doug Zobel, Marek Vasut, u-boot, John Crispin
Rework BOOT LED handling. There is currently one legacy implementation
for BOOT LED from Status Led API.
This work on ancient implementation used by BOOTP by setting the LED
to Blink on boot and to turn it OFF when the firmware was correctly
received by network.
Now that we new LED implementation have support for LED boot, rework
this by also set the new BOOT LED to blink and also set it to ON before
entering main loop to confirm successful boot.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
common/board_r.c | 28 ++++++++++++++++++++--------
include/status_led.h | 13 +++++++++++++
2 files changed, 33 insertions(+), 8 deletions(-)
diff --git a/common/board_r.c b/common/board_r.c
index d4ba245ac69..c3f8dd5d4ee 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -39,6 +39,7 @@
#include <initcall.h>
#include <kgdb.h>
#include <irq_func.h>
+#include <led.h>
#include <malloc.h>
#include <mapmem.h>
#include <miiphy.h>
@@ -459,17 +460,28 @@ static int initr_malloc_bootparams(void)
}
#endif
-#if defined(CONFIG_LED_STATUS)
static int initr_status_led(void)
{
-#if defined(CONFIG_LED_STATUS_BOOT)
- status_led_set(CONFIG_LED_STATUS_BOOT, CONFIG_LED_STATUS_BLINKING);
-#else
status_led_init();
-#endif
+
+ return 0;
+}
+
+static int initr_boot_led_blink(void)
+{
+ status_led_boot_blink();
+
+ led_boot_blink();
+
+ return 0;
+}
+
+static int initr_boot_led_on(void)
+{
+ led_boot_on();
+
return 0;
}
-#endif
#ifdef CONFIG_CMD_NET
static int initr_net(void)
@@ -713,9 +725,8 @@ static init_fnc_t init_sequence_r[] = {
#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_M68K)
timer_init, /* initialize timer */
#endif
-#if defined(CONFIG_LED_STATUS)
initr_status_led,
-#endif
+ initr_boot_led_blink,
/* PPC has a udelay(20) here dating from 2002. Why? */
#ifdef CONFIG_BOARD_LATE_INIT
board_late_init,
@@ -738,6 +749,7 @@ static init_fnc_t init_sequence_r[] = {
#if defined(CFG_PRAM)
initr_mem,
#endif
+ initr_boot_led_on,
run_main_loop,
};
diff --git a/include/status_led.h b/include/status_led.h
index 6707ab1d29d..1282022253e 100644
--- a/include/status_led.h
+++ b/include/status_led.h
@@ -39,6 +39,13 @@ void status_led_init(void);
void status_led_tick(unsigned long timestamp);
void status_led_set(int led, int state);
+static inline void status_led_boot_blink(void)
+{
+#ifdef CONFIG_LED_STATUS_BOOT_ENABLE
+ status_led_set(CONFIG_LED_STATUS_BOOT, CONFIG_LED_STATUS_BLINKING);
+#endif
+}
+
/***** MVS v1 **********************************************************/
#if (defined(CONFIG_MVS) && CONFIG_MVS < 2)
# define STATUS_LED_PAR im_ioport.iop_pdpar
@@ -72,6 +79,12 @@ void __led_blink(led_id_t mask, int freq);
# include <asm/status_led.h>
#endif
+#else
+
+static inline void status_led_init(void) { }
+static inline void status_led_set(int led, int state) { }
+static inline void status_led_boot_blink(void) { }
+
#endif /* CONFIG_LED_STATUS */
/*
--
2.45.2
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v5 05/11] led: implement LED activity API
2024-10-01 12:24 [PATCH v5 00/11] led: introduce LED boot and activity function Christian Marangi
` (3 preceding siblings ...)
2024-10-01 12:24 ` [PATCH v5 04/11] common: board_r: rework BOOT LED handling Christian Marangi
@ 2024-10-01 12:24 ` 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
` (6 subsequent siblings)
11 siblings, 1 reply; 30+ messages in thread
From: Christian Marangi @ 2024-10-01 12:24 UTC (permalink / raw)
To: Simon Glass, Tom Rini, Joe Hershberger, Ramon Fried,
AKASHI Takahiro, Christian Marangi, Ilias Apalodimas,
Etienne Carriere, Caleb Connolly, Algapally Santosh Sagar,
Sean Anderson, Eddie James, Mattijs Korpershoek, Alexander Gendin,
Yang Xiwen, Dario Binacchi, Heinrich Schuchardt, Miquel Raynal,
Arseniy Krasnov, Heiko Schocher, Michael Trimarchi,
Martin Kurbanov, Alexey Romanov, Artur Rojek, Rasmus Villemoes,
Leo Yu-Chi Liang, Vasileios Amoiridis, Mikhail Kshevetskiy,
Michael Polyntsov, Doug Zobel, Marek Vasut, u-boot, John Crispin
Implement LED activity API similar to BOOT LED API.
Usual activity might be a file transfer with TFTP, a flash write...
User of this API will call led_activity_on/off/blink() to signal these
kind of activity.
New Kconfig is implemented similar to BOOT LED, LED_ACTIVITY to
enable support for it.
It's introduced a new /options/u-boot property "activity-led" and
"activity-led-period" to define the activity LED label and the
default period when the activity LED is set to blink mode.
If "activity-led-period" is not defined, the value of 250 (ms) is
used by default.
If CONFIG_LED_BLINK or CONFIG_LED_SW_BLINK is not enabled,
led_boot_blink call will fallback to simple LED ON.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/led/Kconfig | 13 +++++++
drivers/led/led-uclass.c | 81 +++++++++++++++++++++++++++++++++++++++-
include/led.h | 51 +++++++++++++++++++++++++
3 files changed, 143 insertions(+), 2 deletions(-)
diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig
index 59b007a7ef5..c98cbf92fab 100644
--- a/drivers/led/Kconfig
+++ b/drivers/led/Kconfig
@@ -20,6 +20,19 @@ config LED_BOOT
[1] dtschema/schemas/options/u-boot.yaml
+config LED_ACTIVITY
+ bool "Enable LED activity support"
+ help
+ Enable LED activity support.
+
+ LED activity is a specific LED assigned to signal activity operation
+ like file trasnfer, flash write/erase...
+
+ Defined in Device Tree /options/u-boot node. Refer here for the supported
+ options [1].
+
+ [1] dtschema/schemas/options/u-boot.yaml
+
config LED_BCM6328
bool "LED Support for BCM6328"
depends on LED && ARCH_BMIPS
diff --git a/drivers/led/led-uclass.c b/drivers/led/led-uclass.c
index 54113213dcf..05e09909b7d 100644
--- a/drivers/led/led-uclass.c
+++ b/drivers/led/led-uclass.c
@@ -163,6 +163,75 @@ int led_boot_blink(void)
#endif
#endif
+#ifdef CONFIG_LED_ACTIVITY
+static int led_activity_get(struct udevice **devp, int *period_ms)
+{
+ struct led_uc_priv *priv;
+ struct uclass *uc;
+ int ret;
+
+ ret = uclass_get(UCLASS_LED, &uc);
+ if (ret)
+ return ret;
+
+ priv = uclass_get_priv(uc);
+ if (!priv->activity_led_label)
+ return -ENOENT;
+
+ if (period_ms)
+ *period_ms = priv->activity_led_period;
+
+ return led_get_by_label(priv->activity_led_label, devp);
+}
+
+int led_activity_on(void)
+{
+ struct udevice *dev;
+ int ret;
+
+ ret = led_activity_get(&dev, NULL);
+ if (ret)
+ return ret;
+
+ return led_set_state(dev, LEDST_ON);
+}
+
+int led_activity_off(void)
+{
+ struct udevice *dev;
+ int ret;
+
+ ret = led_activity_get(&dev, NULL);
+ if (ret)
+ return ret;
+
+ return led_set_state(dev, LEDST_OFF);
+}
+
+#if defined(CONFIG_LED_BLINK) || defined(CONFIG_LED_SW_BLINK)
+int led_activity_blink(void)
+{
+ struct udevice *dev;
+ int period_ms, ret;
+
+ ret = led_activity_get(&dev, &period_ms);
+ if (ret)
+ return ret;
+
+ ret = led_set_period(dev, period_ms);
+ if (ret) {
+ if (ret != -ENOSYS)
+ return ret;
+
+ /* fallback to ON with no set_period and no SW_BLINK */
+ return led_set_state(dev, LEDST_ON);
+ }
+
+ return led_set_state(dev, LEDST_BLINK);
+}
+#endif
+#endif
+
static int led_post_bind(struct udevice *dev)
{
struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev);
@@ -227,13 +296,21 @@ static int led_post_probe(struct udevice *dev)
return ret;
}
-#ifdef CONFIG_LED_BOOT
+#if defined(CONFIG_LED_BOOT) || defined(CONFIG_LED_ACTIVITY)
static int led_init(struct uclass *uc)
{
struct led_uc_priv *priv = uclass_get_priv(uc);
+#ifdef CONFIG_LED_BOOT
priv->boot_led_label = ofnode_options_read_str("boot-led");
priv->boot_led_period = ofnode_options_read_int("boot-led-period", 250);
+#endif
+
+#ifdef CONFIG_LED_ACTIVITY
+ priv->activity_led_label = ofnode_options_read_str("activity-led");
+ priv->activity_led_period = ofnode_options_read_int("activity-led-period",
+ 250);
+#endif
return 0;
}
@@ -245,7 +322,7 @@ UCLASS_DRIVER(led) = {
.per_device_plat_auto = sizeof(struct led_uc_plat),
.post_bind = led_post_bind,
.post_probe = led_post_probe,
-#ifdef CONFIG_LED_BOOT
+#if defined(CONFIG_LED_BOOT) || defined(CONFIG_LED_ACTIVITY)
.init = led_init,
.priv_auto = sizeof(struct led_uc_priv),
#endif
diff --git a/include/led.h b/include/led.h
index 49ec2998a33..19d92d6441a 100644
--- a/include/led.h
+++ b/include/led.h
@@ -54,14 +54,21 @@ struct led_uc_plat {
* struct led_uc_priv - Private data the uclass stores about each device
*
* @boot_led_label: Boot LED label
+ * @activity_led_label: Activity LED label
* @boot_led_dev: Boot LED dev
+ * @activity_led_dev: Activity LED dev
* @boot_led_period: Boot LED blink period
+ * @activity_led_period: Activity LED blink period
*/
struct led_uc_priv {
#ifdef CONFIG_LED_BOOT
const char *boot_led_label;
int boot_led_period;
#endif
+#ifdef CONFIG_LED_ACTIVITY
+ const char *activity_led_label;
+ int activity_led_period;
+#endif
};
struct led_ops {
@@ -192,4 +199,48 @@ static inline int led_boot_blink(void)
}
#endif
+#ifdef CONFIG_LED_ACTIVITY
+
+/**
+ * led_activity_on() - turn ON the designated LED for activity
+ *
+ * Return: 0 if OK, -ve on error
+ */
+int led_activity_on(void);
+
+/**
+ * led_activity_off() - turn OFF the designated LED for activity
+ *
+ * Return: 0 if OK, -ve on error
+ */
+int led_activity_off(void);
+
+#if defined(CONFIG_LED_BLINK) || defined(CONFIG_LED_SW_BLINK)
+/**
+ * led_activity_blink() - turn ON the designated LED for activity
+ *
+ * Return: 0 if OK, -ve on error
+ */
+int led_activity_blink(void);
+#else
+/* If LED BLINK is not supported/enabled, fallback to LED ON */
+#define led_activity_blink led_activity_on
+#endif
+#else
+static inline int led_activity_on(void)
+{
+ return -ENOSYS;
+}
+
+static inline int led_activity_off(void)
+{
+ return -ENOSYS;
+}
+
+static inline int led_activity_blink(void)
+{
+ return -ENOSYS;
+}
+#endif
+
#endif
--
2.45.2
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v5 06/11] tftp: implement support for LED activity
2024-10-01 12:24 [PATCH v5 00/11] led: introduce LED boot and activity function Christian Marangi
` (4 preceding siblings ...)
2024-10-01 12:24 ` [PATCH v5 05/11] led: implement LED activity API Christian Marangi
@ 2024-10-01 12:24 ` Christian Marangi
2024-10-01 12:24 ` [PATCH v5 07/11] mtd: " Christian Marangi
` (5 subsequent siblings)
11 siblings, 0 replies; 30+ messages in thread
From: Christian Marangi @ 2024-10-01 12:24 UTC (permalink / raw)
To: Simon Glass, Tom Rini, Joe Hershberger, Ramon Fried,
AKASHI Takahiro, Christian Marangi, Ilias Apalodimas,
Etienne Carriere, Caleb Connolly, Algapally Santosh Sagar,
Sean Anderson, Eddie James, Mattijs Korpershoek, Alexander Gendin,
Yang Xiwen, Dario Binacchi, Heinrich Schuchardt, Miquel Raynal,
Arseniy Krasnov, Heiko Schocher, Michael Trimarchi,
Martin Kurbanov, Alexey Romanov, Artur Rojek, Rasmus Villemoes,
Leo Yu-Chi Liang, Vasileios Amoiridis, Mikhail Kshevetskiy,
Michael Polyntsov, Doug Zobel, Marek Vasut, u-boot, John Crispin
Implement support for LED activity. If the feature is enabled,
make the defined ACTIVITY LED to signal traffic.
Also turn the ACTIVITY LED OFF if a CTRL-C is detected in the main
net loop function.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
net/net.c | 4 ++++
net/tftp.c | 5 +++++
2 files changed, 9 insertions(+)
diff --git a/net/net.c b/net/net.c
index d9bc9df643f..94bfde43f85 100644
--- a/net/net.c
+++ b/net/net.c
@@ -87,6 +87,7 @@
#include <env_internal.h>
#include <errno.h>
#include <image.h>
+#include <led.h>
#include <log.h>
#include <net.h>
#include <net6.h>
@@ -659,6 +660,9 @@ restart:
/* Invalidate the last protocol */
eth_set_last_protocol(BOOTP);
+ /* Turn off activity LED if triggered */
+ led_activity_off();
+
puts("\nAbort\n");
/* include a debug print as well incase the debug
messages are directed to stderr */
diff --git a/net/tftp.c b/net/tftp.c
index 2e073183d5a..5cb06d2038b 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -10,6 +10,7 @@
#include <efi_loader.h>
#include <env.h>
#include <image.h>
+#include <led.h>
#include <lmb.h>
#include <log.h>
#include <mapmem.h>
@@ -192,6 +193,7 @@ static void new_transfer(void)
#ifdef CONFIG_CMD_TFTPPUT
tftp_put_final_block_sent = 0;
#endif
+ led_activity_blink();
}
#ifdef CONFIG_CMD_TFTPPUT
@@ -301,6 +303,9 @@ static void tftp_complete(void)
time_start * 1000, "/s");
}
puts("\ndone\n");
+
+ led_activity_off();
+
if (!tftp_put_active)
efi_set_bootdev("Net", "", tftp_filename,
map_sysmem(tftp_load_addr, 0),
--
2.45.2
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v5 07/11] mtd: implement support for LED activity
2024-10-01 12:24 [PATCH v5 00/11] led: introduce LED boot and activity function Christian Marangi
` (5 preceding siblings ...)
2024-10-01 12:24 ` [PATCH v5 06/11] tftp: implement support for LED activity Christian Marangi
@ 2024-10-01 12:24 ` Christian Marangi
2024-10-02 22:55 ` Simon Glass
2024-10-01 12:24 ` [PATCH v5 08/11] ubi: " Christian Marangi
` (4 subsequent siblings)
11 siblings, 1 reply; 30+ messages in thread
From: Christian Marangi @ 2024-10-01 12:24 UTC (permalink / raw)
To: Simon Glass, Tom Rini, Joe Hershberger, Ramon Fried,
AKASHI Takahiro, Christian Marangi, Ilias Apalodimas,
Etienne Carriere, Caleb Connolly, Algapally Santosh Sagar,
Sean Anderson, Eddie James, Mattijs Korpershoek, Alexander Gendin,
Yang Xiwen, Dario Binacchi, Heinrich Schuchardt, Miquel Raynal,
Arseniy Krasnov, Heiko Schocher, Michael Trimarchi,
Martin Kurbanov, Alexey Romanov, Artur Rojek, Rasmus Villemoes,
Leo Yu-Chi Liang, Vasileios Amoiridis, Mikhail Kshevetskiy,
Michael Polyntsov, Doug Zobel, Marek Vasut, u-boot, John Crispin
Implement support for LED activity. If the feature is enabled,
make the defined ACTIVITY LED to signal mtd operations.
LED activity is implemented HERE and not in the subsystem side to limit
any performance degradation in case multiple call to MTD subsystem read/write
are done.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
cmd/mtd.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/cmd/mtd.c b/cmd/mtd.c
index 795aaa2b37d..f178d7bea61 100644
--- a/cmd/mtd.c
+++ b/cmd/mtd.c
@@ -10,6 +10,7 @@
#include <command.h>
#include <console.h>
+#include <led.h>
#if CONFIG_IS_ENABLED(CMD_MTD_OTP)
#include <hexdump.h>
#endif
@@ -558,6 +559,8 @@ static int do_mtd_io(struct cmd_tbl *cmdtp, int flag, int argc,
while (mtd_block_isbad(mtd, off))
off += mtd->erasesize;
+ led_activity_blink();
+
/* Loop over the pages to do the actual read/write */
while (remaining) {
/* Skip the block if it is bad */
@@ -585,6 +588,8 @@ static int do_mtd_io(struct cmd_tbl *cmdtp, int flag, int argc,
io_op.oobbuf += io_op.oobretlen;
}
+ led_activity_off();
+
if (!ret && dump)
mtd_dump_device_buf(mtd, start_off, buf, len, woob);
@@ -652,6 +657,8 @@ static int do_mtd_erase(struct cmd_tbl *cmdtp, int flag, int argc,
erase_op.addr = off;
erase_op.len = mtd->erasesize;
+ led_activity_blink();
+
while (len) {
if (!scrub) {
ret = mtd_block_isbad(mtd, erase_op.addr);
@@ -680,6 +687,8 @@ static int do_mtd_erase(struct cmd_tbl *cmdtp, int flag, int argc,
erase_op.addr += mtd->erasesize;
}
+ led_activity_off();
+
if (ret && ret != -EIO)
ret = CMD_RET_FAILURE;
else
--
2.45.2
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v5 08/11] ubi: implement support for LED activity
2024-10-01 12:24 [PATCH v5 00/11] led: introduce LED boot and activity function Christian Marangi
` (6 preceding siblings ...)
2024-10-01 12:24 ` [PATCH v5 07/11] mtd: " Christian Marangi
@ 2024-10-01 12:24 ` Christian Marangi
2024-10-01 12:24 ` [PATCH v5 09/11] doc: introduce led.rst documentation Christian Marangi
` (3 subsequent siblings)
11 siblings, 0 replies; 30+ messages in thread
From: Christian Marangi @ 2024-10-01 12:24 UTC (permalink / raw)
To: Simon Glass, Tom Rini, Joe Hershberger, Ramon Fried,
AKASHI Takahiro, Christian Marangi, Ilias Apalodimas,
Etienne Carriere, Caleb Connolly, Algapally Santosh Sagar,
Sean Anderson, Eddie James, Mattijs Korpershoek, Alexander Gendin,
Yang Xiwen, Dario Binacchi, Heinrich Schuchardt, Miquel Raynal,
Arseniy Krasnov, Heiko Schocher, Michael Trimarchi,
Martin Kurbanov, Alexey Romanov, Artur Rojek, Rasmus Villemoes,
Leo Yu-Chi Liang, Vasileios Amoiridis, Mikhail Kshevetskiy,
Michael Polyntsov, Doug Zobel, Marek Vasut, u-boot, John Crispin
Implement support for LED activity. If the feature is enabled,
make the defined ACTIVITY LED to signal ubi write operation.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
cmd/ubi.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/cmd/ubi.c b/cmd/ubi.c
index 0e62e449327..56d7da82629 100644
--- a/cmd/ubi.c
+++ b/cmd/ubi.c
@@ -14,6 +14,7 @@
#include <command.h>
#include <env.h>
#include <exports.h>
+#include <led.h>
#include <malloc.h>
#include <memalign.h>
#include <mtd.h>
@@ -488,10 +489,18 @@ exit:
int ubi_volume_write(char *volume, void *buf, loff_t offset, size_t size)
{
+ int ret;
+
+ led_activity_blink();
+
if (!offset)
- return ubi_volume_begin_write(volume, buf, size, size);
+ ret = ubi_volume_begin_write(volume, buf, size, size);
+ else
+ ret = ubi_volume_offset_write(volume, buf, offset, size);
- return ubi_volume_offset_write(volume, buf, offset, size);
+ led_activity_off();
+
+ return ret;
}
int ubi_volume_read(char *volume, char *buf, loff_t offset, size_t size)
--
2.45.2
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v5 09/11] doc: introduce led.rst documentation
2024-10-01 12:24 [PATCH v5 00/11] led: introduce LED boot and activity function Christian Marangi
` (7 preceding siblings ...)
2024-10-01 12:24 ` [PATCH v5 08/11] ubi: " Christian Marangi
@ 2024-10-01 12:24 ` Christian Marangi
2024-10-01 12:24 ` [PATCH v5 10/11] test: dm: Add tests for LED boot and activity Christian Marangi
` (2 subsequent siblings)
11 siblings, 0 replies; 30+ messages in thread
From: Christian Marangi @ 2024-10-01 12:24 UTC (permalink / raw)
To: Simon Glass, Tom Rini, Joe Hershberger, Ramon Fried,
AKASHI Takahiro, Christian Marangi, Ilias Apalodimas,
Etienne Carriere, Caleb Connolly, Algapally Santosh Sagar,
Sean Anderson, Eddie James, Mattijs Korpershoek, Alexander Gendin,
Yang Xiwen, Dario Binacchi, Heinrich Schuchardt, Miquel Raynal,
Arseniy Krasnov, Heiko Schocher, Michael Trimarchi,
Martin Kurbanov, Alexey Romanov, Artur Rojek, Rasmus Villemoes,
Leo Yu-Chi Liang, Vasileios Amoiridis, Mikhail Kshevetskiy,
Michael Polyntsov, Doug Zobel, Marek Vasut, u-boot, John Crispin
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
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v5 10/11] test: dm: Add tests for LED boot and activity
2024-10-01 12:24 [PATCH v5 00/11] led: introduce LED boot and activity function Christian Marangi
` (8 preceding siblings ...)
2024-10-01 12:24 ` [PATCH v5 09/11] doc: introduce led.rst documentation Christian Marangi
@ 2024-10-01 12:24 ` 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
11 siblings, 0 replies; 30+ messages in thread
From: Christian Marangi @ 2024-10-01 12:24 UTC (permalink / raw)
To: Simon Glass, Tom Rini, Joe Hershberger, Ramon Fried,
AKASHI Takahiro, Christian Marangi, Ilias Apalodimas,
Etienne Carriere, Caleb Connolly, Algapally Santosh Sagar,
Sean Anderson, Eddie James, Mattijs Korpershoek, Alexander Gendin,
Yang Xiwen, Dario Binacchi, Heinrich Schuchardt, Miquel Raynal,
Arseniy Krasnov, Heiko Schocher, Michael Trimarchi,
Martin Kurbanov, Alexey Romanov, Artur Rojek, Rasmus Villemoes,
Leo Yu-Chi Liang, Vasileios Amoiridis, Mikhail Kshevetskiy,
Michael Polyntsov, Doug Zobel, Marek Vasut, u-boot, John Crispin
Add tests for LED boot and activity feature and add required property in
sandbox test DTS.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
arch/sandbox/dts/test.dts | 2 ++
test/dm/led.c | 72 +++++++++++++++++++++++++++++++++++++++
2 files changed, 74 insertions(+)
diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index 5fb5eac862e..25859ad852d 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -101,6 +101,8 @@
bootscr-ram-offset = /bits/ 64 <0x12345678>;
bootscr-flash-offset = /bits/ 64 <0>;
bootscr-flash-size = /bits/ 64 <0x2000>;
+ boot-led = "sandbox:green";
+ activity-led = "sandbox:red";
};
};
diff --git a/test/dm/led.c b/test/dm/led.c
index c28fa044f45..4b019c71f3a 100644
--- a/test/dm/led.c
+++ b/test/dm/led.c
@@ -137,3 +137,75 @@ static int dm_test_led_blink(struct unit_test_state *uts)
}
DM_TEST(dm_test_led_blink, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
#endif
+
+/* Test LED boot */
+#ifdef CONFIG_LED_BOOT
+static int dm_test_led_boot(struct unit_test_state *uts)
+{
+ struct udevice *dev
+
+ /* options/u-boot/boot-led is set to "sandbox:green" */
+ ut_assertok(led_get_by_label("sandbox:green", &dev));
+ ut_asserteq(LEDST_OFF, led_get_state(dev));
+ ut_assertok(led_boot_on());
+ ut_asserteq(LEDST_ON, led_get_state(dev));
+ ut_assertok(led_boot_off());
+ ut_asserteq(LEDST_OFF, led_get_state(dev));
+
+ return 0;
+}
+
+/* Test LED boot blink fallback */
+#ifndef CONFIG_LED_BLINK
+static int dm_test_led_boot(struct unit_test_state *uts)
+{
+ struct udevice *dev
+
+ /* options/u-boot/boot-led is set to "sandbox:green" */
+ ut_assertok(led_get_by_label("sandbox:green", &dev));
+ ut_asserteq(LEDST_OFF, led_get_state(dev));
+ ut_assertok(led_boot_blink());
+ ut_asserteq(LEDST_ON, led_get_state(dev));
+ ut_assertok(led_boot_off());
+ ut_asserteq(LEDST_OFF, led_get_state(dev));
+
+ return 0;
+}
+#endif
+#endif
+
+/* Test LED activity */
+#ifdef CONFIG_LED_ACTIVITY
+static int dm_test_led_boot(struct unit_test_state *uts)
+{
+ struct udevice *dev
+
+ /* options/u-boot/activity-led is set to "sandbox:red" */
+ ut_assertok(led_get_by_label("sandbox:red", &dev));
+ ut_asserteq(LEDST_OFF, led_get_state(dev));
+ ut_assertok(led_activity_on());
+ ut_asserteq(LEDST_ON, led_get_state(dev));
+ ut_assertok(led_activity_off());
+ ut_asserteq(LEDST_OFF, led_get_state(dev));
+
+ return 0;
+}
+
+/* Test LED activity blink fallback */
+#ifndef CONFIG_LED_BLINK
+static int dm_test_led_boot(struct unit_test_state *uts)
+{
+ struct udevice *dev
+
+ /* options/u-boot/activity-led is set to "sandbox:red" */
+ ut_assertok(led_get_by_label("sandbox:red", &dev));
+ ut_asserteq(LEDST_OFF, led_get_state(dev));
+ ut_assertok(led_activity_blink());
+ ut_asserteq(LEDST_ON, led_get_state(dev));
+ ut_assertok(led_activity_off());
+ ut_asserteq(LEDST_OFF, led_get_state(dev));
+
+ return 0;
+}
+#endif
+#endif
--
2.45.2
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v5 11/11] test: dm: Expand ofnode options test with new helper
2024-10-01 12:24 [PATCH v5 00/11] led: introduce LED boot and activity function Christian Marangi
` (9 preceding siblings ...)
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 ` Christian Marangi
2024-10-11 17:35 ` [PATCH v5 00/11] led: introduce LED boot and activity function Tom Rini
11 siblings, 0 replies; 30+ messages in thread
From: Christian Marangi @ 2024-10-01 12:24 UTC (permalink / raw)
To: Simon Glass, Tom Rini, Joe Hershberger, Ramon Fried,
AKASHI Takahiro, Christian Marangi, Ilias Apalodimas,
Etienne Carriere, Caleb Connolly, Algapally Santosh Sagar,
Sean Anderson, Eddie James, Mattijs Korpershoek, Alexander Gendin,
Yang Xiwen, Dario Binacchi, Heinrich Schuchardt, Miquel Raynal,
Arseniy Krasnov, Heiko Schocher, Michael Trimarchi,
Martin Kurbanov, Alexey Romanov, Artur Rojek, Rasmus Villemoes,
Leo Yu-Chi Liang, Vasileios Amoiridis, Mikhail Kshevetskiy,
Michael Polyntsov, Doug Zobel, Marek Vasut, u-boot, John Crispin
Expand ofnode options test with new generic helper for bool, int and
string.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
arch/sandbox/dts/test.dts | 3 +++
test/dm/ofnode.c | 9 +++++++++
2 files changed, 12 insertions(+)
diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index 25859ad852d..e5381b56da4 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -103,6 +103,9 @@
bootscr-flash-size = /bits/ 64 <0x2000>;
boot-led = "sandbox:green";
activity-led = "sandbox:red";
+ testing-bool;
+ testing-int = <123>;
+ testing-str = "testing";
};
};
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index 39191d7f52b..7c0adcd596b 100644
--- a/test/dm/ofnode.c
+++ b/test/dm/ofnode.c
@@ -614,6 +614,15 @@ static int dm_test_ofnode_options(struct unit_test_state *uts)
u64 bootscr_address, bootscr_offset;
u64 bootscr_flash_offset, bootscr_flash_size;
+ ut_assert(!ofnode_options_read_bool("missing"));
+ ut_assert(ofnode_options_read_bool("testing-bool"));
+
+ ut_asserteq(123, ofnode_options_read_int("testing-int", 0));
+ ut_asserteq(6, ofnode_options_read_int("missing", 6));
+
+ ut_assertnull(ofnode_options_read_str("missing"));
+ ut_asserteq_str("testing", ofnode_options_read_str("testing-str"));
+
ut_assertok(ofnode_read_bootscript_address(&bootscr_address,
&bootscr_offset));
ut_asserteq_64(0, bootscr_address);
--
2.45.2
^ permalink raw reply related [flat|nested] 30+ messages in thread
* Re: [PATCH v5 01/11] led: toggle LED on initial SW blink
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
1 sibling, 1 reply; 30+ messages in thread
From: Simon Glass @ 2024-10-02 22:55 UTC (permalink / raw)
To: Christian Marangi
Cc: Tom Rini, Joe Hershberger, Ramon Fried, AKASHI Takahiro,
Ilias Apalodimas, Etienne Carriere, Caleb Connolly,
Algapally Santosh Sagar, Sean Anderson, Eddie James,
Mattijs Korpershoek, Alexander Gendin, Yang Xiwen, Dario Binacchi,
Heinrich Schuchardt, Miquel Raynal, Arseniy Krasnov,
Heiko Schocher, Michael Trimarchi, Martin Kurbanov,
Alexey Romanov, Artur Rojek, Rasmus Villemoes, Leo Yu-Chi Liang,
Vasileios Amoiridis, Mikhail Kshevetskiy, Michael Polyntsov,
Doug Zobel, Marek Vasut, u-boot, John Crispin
On Tue, 1 Oct 2024 at 06:25, Christian Marangi <ansuelsmth@gmail.com> wrote:
>
> We currently init the LED OFF when SW blink is triggered when
> on_state_change() is called. This can be problematic for very short
> period as the ON/OFF blink might never trigger.
>
> Toggle the LED (ON if OFF, OFF if ON) on initial SW blink to handle this
> corner case and better display a LED blink from the user.
>
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> ---
> drivers/led/led_sw_blink.c | 17 +++++++++++++++--
> 1 file changed, 15 insertions(+), 2 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
Running a little bit blind here without a changelog. If you use patman
it will do this automatically.
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 03/11] led: implement LED boot API
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-11-02 19:33 ` Simon Glass
0 siblings, 2 replies; 30+ messages in thread
From: Simon Glass @ 2024-10-02 22:55 UTC (permalink / raw)
To: Christian Marangi
Cc: Tom Rini, Joe Hershberger, Ramon Fried, AKASHI Takahiro,
Ilias Apalodimas, Etienne Carriere, Caleb Connolly,
Algapally Santosh Sagar, Sean Anderson, Eddie James,
Mattijs Korpershoek, Alexander Gendin, Yang Xiwen, Dario Binacchi,
Heinrich Schuchardt, Miquel Raynal, Arseniy Krasnov,
Heiko Schocher, Michael Trimarchi, Martin Kurbanov,
Alexey Romanov, Artur Rojek, Rasmus Villemoes, Leo Yu-Chi Liang,
Vasileios Amoiridis, Mikhail Kshevetskiy, Michael Polyntsov,
Doug Zobel, Marek Vasut, u-boot, John Crispin
On Tue, 1 Oct 2024 at 06:25, Christian Marangi <ansuelsmth@gmail.com> wrote:
>
> Implement LED boot API to signal correct boot of the system.
>
> led_boot_on/off/blink() are introduced to turn ON, OFF and BLINK the
> designated boot LED.
>
> New Kconfig is introduced, CONFIG_LED_BOOT to enable the feature.
> This makes use of the /options/u-boot property "boot-led" to the
> define the boot LED.
> It's also introduced a new /options/u-boot property "boot-led-period"
> to define the default period when the LED is set to blink mode.
BTW could you please send a schema update for this so that Linux accepts it?
>
> If "boot-led-period" is not defined, the value of 250 (ms) is
> used by default.
>
> If CONFIG_LED_BLINK or CONFIG_LED_SW_BLINK is not enabled,
> led_boot_blink call will fallback to simple LED ON.
>
> To cache the data we repurpose the now unused led_uc_priv for storage of
> global LED uclass info.
>
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> ---
> drivers/led/Kconfig | 11 ++++++
> drivers/led/led-uclass.c | 85 ++++++++++++++++++++++++++++++++++++++++
> include/led.h | 55 +++++++++++++++++++++++++-
> 3 files changed, 149 insertions(+), 2 deletions(-)
>
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 05/11] led: implement LED activity API
2024-10-01 12:24 ` [PATCH v5 05/11] led: implement LED activity API Christian Marangi
@ 2024-10-02 22:55 ` Simon Glass
0 siblings, 0 replies; 30+ messages in thread
From: Simon Glass @ 2024-10-02 22:55 UTC (permalink / raw)
To: Christian Marangi
Cc: Tom Rini, Joe Hershberger, Ramon Fried, AKASHI Takahiro,
Ilias Apalodimas, Etienne Carriere, Caleb Connolly,
Algapally Santosh Sagar, Sean Anderson, Eddie James,
Mattijs Korpershoek, Alexander Gendin, Yang Xiwen, Dario Binacchi,
Heinrich Schuchardt, Miquel Raynal, Arseniy Krasnov,
Heiko Schocher, Michael Trimarchi, Martin Kurbanov,
Alexey Romanov, Artur Rojek, Rasmus Villemoes, Leo Yu-Chi Liang,
Vasileios Amoiridis, Mikhail Kshevetskiy, Michael Polyntsov,
Doug Zobel, Marek Vasut, u-boot, John Crispin
On Tue, 1 Oct 2024 at 06:25, Christian Marangi <ansuelsmth@gmail.com> wrote:
>
> Implement LED activity API similar to BOOT LED API.
>
> Usual activity might be a file transfer with TFTP, a flash write...
>
> User of this API will call led_activity_on/off/blink() to signal these
> kind of activity.
>
> New Kconfig is implemented similar to BOOT LED, LED_ACTIVITY to
> enable support for it.
>
> It's introduced a new /options/u-boot property "activity-led" and
> "activity-led-period" to define the activity LED label and the
> default period when the activity LED is set to blink mode.
>
> If "activity-led-period" is not defined, the value of 250 (ms) is
> used by default.
>
> If CONFIG_LED_BLINK or CONFIG_LED_SW_BLINK is not enabled,
> led_boot_blink call will fallback to simple LED ON.
>
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> ---
> drivers/led/Kconfig | 13 +++++++
> drivers/led/led-uclass.c | 81 +++++++++++++++++++++++++++++++++++++++-
> include/led.h | 51 +++++++++++++++++++++++++
> 3 files changed, 143 insertions(+), 2 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 07/11] mtd: implement support for LED activity
2024-10-01 12:24 ` [PATCH v5 07/11] mtd: " Christian Marangi
@ 2024-10-02 22:55 ` Simon Glass
0 siblings, 0 replies; 30+ messages in thread
From: Simon Glass @ 2024-10-02 22:55 UTC (permalink / raw)
To: Christian Marangi
Cc: Tom Rini, Joe Hershberger, Ramon Fried, AKASHI Takahiro,
Ilias Apalodimas, Etienne Carriere, Caleb Connolly,
Algapally Santosh Sagar, Sean Anderson, Eddie James,
Mattijs Korpershoek, Alexander Gendin, Yang Xiwen, Dario Binacchi,
Heinrich Schuchardt, Miquel Raynal, Arseniy Krasnov,
Heiko Schocher, Michael Trimarchi, Martin Kurbanov,
Alexey Romanov, Artur Rojek, Rasmus Villemoes, Leo Yu-Chi Liang,
Vasileios Amoiridis, Mikhail Kshevetskiy, Michael Polyntsov,
Doug Zobel, Marek Vasut, u-boot, John Crispin
On Tue, 1 Oct 2024 at 06:25, Christian Marangi <ansuelsmth@gmail.com> wrote:
>
> Implement support for LED activity. If the feature is enabled,
> make the defined ACTIVITY LED to signal mtd operations.
>
> LED activity is implemented HERE and not in the subsystem side to limit
> any performance degradation in case multiple call to MTD subsystem read/write
> are done.
>
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> ---
> cmd/mtd.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 01/11] led: toggle LED on initial SW blink
2024-10-02 22:55 ` Simon Glass
@ 2024-10-02 22:59 ` Christian Marangi
0 siblings, 0 replies; 30+ messages in thread
From: Christian Marangi @ 2024-10-02 22:59 UTC (permalink / raw)
To: Simon Glass
Cc: Tom Rini, Joe Hershberger, Ramon Fried, AKASHI Takahiro,
Ilias Apalodimas, Etienne Carriere, Caleb Connolly,
Algapally Santosh Sagar, Sean Anderson, Eddie James,
Mattijs Korpershoek, Alexander Gendin, Yang Xiwen, Dario Binacchi,
Heinrich Schuchardt, Miquel Raynal, Arseniy Krasnov,
Heiko Schocher, Michael Trimarchi, Martin Kurbanov,
Alexey Romanov, Artur Rojek, Rasmus Villemoes, Leo Yu-Chi Liang,
Vasileios Amoiridis, Mikhail Kshevetskiy, Michael Polyntsov,
Doug Zobel, Marek Vasut, u-boot, John Crispin
On Wed, Oct 02, 2024 at 04:55:41PM -0600, Simon Glass wrote:
> On Tue, 1 Oct 2024 at 06:25, Christian Marangi <ansuelsmth@gmail.com> wrote:
> >
> > We currently init the LED OFF when SW blink is triggered when
> > on_state_change() is called. This can be problematic for very short
> > period as the ON/OFF blink might never trigger.
> >
> > Toggle the LED (ON if OFF, OFF if ON) on initial SW blink to handle this
> > corner case and better display a LED blink from the user.
> >
> > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> > ---
> > drivers/led/led_sw_blink.c | 17 +++++++++++++++--
> > 1 file changed, 15 insertions(+), 2 deletions(-)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> Running a little bit blind here without a changelog. If you use patman
> it will do this automatically.
The cover letter didn't slip in the mailing list? Changelog is there or
I'm missing something?
--
Ansuel
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 03/11] led: implement LED boot API
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
1 sibling, 1 reply; 30+ messages in thread
From: Christian Marangi @ 2024-10-02 23:00 UTC (permalink / raw)
To: Simon Glass
Cc: Tom Rini, Joe Hershberger, Ramon Fried, AKASHI Takahiro,
Ilias Apalodimas, Etienne Carriere, Caleb Connolly,
Algapally Santosh Sagar, Sean Anderson, Eddie James,
Mattijs Korpershoek, Alexander Gendin, Yang Xiwen, Dario Binacchi,
Heinrich Schuchardt, Miquel Raynal, Arseniy Krasnov,
Heiko Schocher, Michael Trimarchi, Martin Kurbanov,
Alexey Romanov, Artur Rojek, Rasmus Villemoes, Leo Yu-Chi Liang,
Vasileios Amoiridis, Mikhail Kshevetskiy, Michael Polyntsov,
Doug Zobel, Marek Vasut, u-boot, John Crispin
On Wed, Oct 02, 2024 at 04:55:42PM -0600, Simon Glass wrote:
> On Tue, 1 Oct 2024 at 06:25, Christian Marangi <ansuelsmth@gmail.com> wrote:
> >
> > Implement LED boot API to signal correct boot of the system.
> >
> > led_boot_on/off/blink() are introduced to turn ON, OFF and BLINK the
> > designated boot LED.
> >
> > New Kconfig is introduced, CONFIG_LED_BOOT to enable the feature.
> > This makes use of the /options/u-boot property "boot-led" to the
> > define the boot LED.
> > It's also introduced a new /options/u-boot property "boot-led-period"
> > to define the default period when the LED is set to blink mode.
>
> BTW could you please send a schema update for this so that Linux accepts it?
>
I open a PR there [1] or should I use other way?
[1] https://github.com/devicetree-org/dt-schema/pull/144
> >
> > If "boot-led-period" is not defined, the value of 250 (ms) is
> > used by default.
> >
> > If CONFIG_LED_BLINK or CONFIG_LED_SW_BLINK is not enabled,
> > led_boot_blink call will fallback to simple LED ON.
> >
> > To cache the data we repurpose the now unused led_uc_priv for storage of
> > global LED uclass info.
> >
> > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> > ---
> > drivers/led/Kconfig | 11 ++++++
> > drivers/led/led-uclass.c | 85 ++++++++++++++++++++++++++++++++++++++++
> > include/led.h | 55 +++++++++++++++++++++++++-
> > 3 files changed, 149 insertions(+), 2 deletions(-)
> >
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
--
Ansuel
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 01/11] led: toggle LED on initial SW blink
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-03 6:22 ` Michael Nazzareno Trimarchi
2024-10-03 10:59 ` Christian Marangi
1 sibling, 1 reply; 30+ messages in thread
From: Michael Nazzareno Trimarchi @ 2024-10-03 6:22 UTC (permalink / raw)
To: Christian Marangi
Cc: Simon Glass, Tom Rini, Joe Hershberger, Ramon Fried,
AKASHI Takahiro, Ilias Apalodimas, Etienne Carriere,
Caleb Connolly, Algapally Santosh Sagar, Sean Anderson,
Eddie James, Mattijs Korpershoek, Alexander Gendin, Yang Xiwen,
Dario Binacchi, Heinrich Schuchardt, Miquel Raynal,
Arseniy Krasnov, Heiko Schocher, Martin Kurbanov, Alexey Romanov,
Artur Rojek, Rasmus Villemoes, Leo Yu-Chi Liang,
Vasileios Amoiridis, Mikhail Kshevetskiy, Michael Polyntsov,
Doug Zobel, Marek Vasut, u-boot, John Crispin
Hi
On Tue, Oct 1, 2024 at 2:25 PM Christian Marangi <ansuelsmth@gmail.com> wrote:
>
> We currently init the LED OFF when SW blink is triggered when
> on_state_change() is called. This can be problematic for very short
> period as the ON/OFF blink might never trigger.
>
> Toggle the LED (ON if OFF, OFF if ON) on initial SW blink to handle this
> corner case and better display a LED blink from the user.
>
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> ---
> drivers/led/led_sw_blink.c | 17 +++++++++++++++--
> 1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/led/led_sw_blink.c b/drivers/led/led_sw_blink.c
> index 9e36edbee47..06a43db340c 100644
> --- a/drivers/led/led_sw_blink.c
> +++ b/drivers/led/led_sw_blink.c
> @@ -103,8 +103,21 @@ bool led_sw_on_state_change(struct udevice *dev, enum led_state_t state)
> return false;
>
> if (state == LEDST_BLINK) {
> - /* start blinking on next led_sw_blink() call */
> - sw_blink->state = LED_SW_BLINK_ST_OFF;
> + struct led_ops *ops = led_get_ops(dev);
> +
> + /*
> + * toggle LED initially and start blinking on next
> + * led_sw_blink() call.
> + */
> + switch (ops->get_state(dev)) {
> + case LEDST_ON:
> + ops->set_state(dev, LEDST_OFF);
> + sw_blink->state = LED_SW_BLINK_ST_OFF;
> + default:
> + ops->set_state(dev, LEDST_ON);
> + sw_blink->state = LED_SW_BLINK_ST_ON;
> + }
> +
> return true;
I think here error is not take in account. Is somenthing that we
should care? and if not we should
warning the user?
Apart of that
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
michael
> }
>
> --
> 2.45.2
>
--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
michael@amarulasolutions.com
__________________________________
Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
info@amarulasolutions.com
www.amarulasolutions.com
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 01/11] led: toggle LED on initial SW blink
2024-10-03 6:22 ` Michael Nazzareno Trimarchi
@ 2024-10-03 10:59 ` Christian Marangi
0 siblings, 0 replies; 30+ messages in thread
From: Christian Marangi @ 2024-10-03 10:59 UTC (permalink / raw)
To: Michael Nazzareno Trimarchi
Cc: Simon Glass, Tom Rini, Joe Hershberger, Ramon Fried,
AKASHI Takahiro, Ilias Apalodimas, Etienne Carriere,
Caleb Connolly, Algapally Santosh Sagar, Sean Anderson,
Eddie James, Mattijs Korpershoek, Alexander Gendin, Yang Xiwen,
Dario Binacchi, Heinrich Schuchardt, Miquel Raynal,
Arseniy Krasnov, Heiko Schocher, Martin Kurbanov, Alexey Romanov,
Artur Rojek, Rasmus Villemoes, Leo Yu-Chi Liang,
Vasileios Amoiridis, Mikhail Kshevetskiy, Michael Polyntsov,
Doug Zobel, Marek Vasut, u-boot, John Crispin
On Thu, Oct 03, 2024 at 08:22:21AM +0200, Michael Nazzareno Trimarchi wrote:
> Hi
>
> On Tue, Oct 1, 2024 at 2:25 PM Christian Marangi <ansuelsmth@gmail.com> wrote:
> >
> > We currently init the LED OFF when SW blink is triggered when
> > on_state_change() is called. This can be problematic for very short
> > period as the ON/OFF blink might never trigger.
> >
> > Toggle the LED (ON if OFF, OFF if ON) on initial SW blink to handle this
> > corner case and better display a LED blink from the user.
> >
> > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> > ---
> > drivers/led/led_sw_blink.c | 17 +++++++++++++++--
> > 1 file changed, 15 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/led/led_sw_blink.c b/drivers/led/led_sw_blink.c
> > index 9e36edbee47..06a43db340c 100644
> > --- a/drivers/led/led_sw_blink.c
> > +++ b/drivers/led/led_sw_blink.c
> > @@ -103,8 +103,21 @@ bool led_sw_on_state_change(struct udevice *dev, enum led_state_t state)
> > return false;
> >
> > if (state == LEDST_BLINK) {
> > - /* start blinking on next led_sw_blink() call */
> > - sw_blink->state = LED_SW_BLINK_ST_OFF;
> > + struct led_ops *ops = led_get_ops(dev);
> > +
> > + /*
> > + * toggle LED initially and start blinking on next
> > + * led_sw_blink() call.
> > + */
> > + switch (ops->get_state(dev)) {
> > + case LEDST_ON:
> > + ops->set_state(dev, LEDST_OFF);
> > + sw_blink->state = LED_SW_BLINK_ST_OFF;
> > + default:
> > + ops->set_state(dev, LEDST_ON);
> > + sw_blink->state = LED_SW_BLINK_ST_ON;
> > + }
> > +
> > return true;
>
> I think here error is not take in account. Is somenthing that we
> should care? and if not we should
> warning the user?
Yes it's intended. Here it's assumed these function works and are
present. The check are already done before calling the on_state_change.
>
> Apart of that
> Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
>
> michael
>
> > }
> >
> > --
> > 2.45.2
> >
>
>
> --
> Michael Nazzareno Trimarchi
> Co-Founder & Chief Executive Officer
> M. +39 347 913 2170
> michael@amarulasolutions.com
> __________________________________
>
> Amarula Solutions BV
> Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
> T. +31 (0)85 111 9172
> info@amarulasolutions.com
> www.amarulasolutions.com
--
Ansuel
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 03/11] led: implement LED boot API
2024-10-02 23:00 ` Christian Marangi
@ 2024-10-03 17:30 ` Simon Glass
0 siblings, 0 replies; 30+ messages in thread
From: Simon Glass @ 2024-10-03 17:30 UTC (permalink / raw)
To: Christian Marangi
Cc: Tom Rini, Joe Hershberger, Ramon Fried, AKASHI Takahiro,
Ilias Apalodimas, Etienne Carriere, Caleb Connolly,
Algapally Santosh Sagar, Sean Anderson, Eddie James,
Mattijs Korpershoek, Alexander Gendin, Yang Xiwen, Dario Binacchi,
Heinrich Schuchardt, Miquel Raynal, Arseniy Krasnov,
Heiko Schocher, Michael Trimarchi, Martin Kurbanov,
Alexey Romanov, Artur Rojek, Rasmus Villemoes, Leo Yu-Chi Liang,
Vasileios Amoiridis, Mikhail Kshevetskiy, Michael Polyntsov,
Doug Zobel, Marek Vasut, u-boot, John Crispin
Hi Christian,
On Wed, 2 Oct 2024 at 17:00, Christian Marangi <ansuelsmth@gmail.com> wrote:
>
> On Wed, Oct 02, 2024 at 04:55:42PM -0600, Simon Glass wrote:
> > On Tue, 1 Oct 2024 at 06:25, Christian Marangi <ansuelsmth@gmail.com> wrote:
> > >
> > > Implement LED boot API to signal correct boot of the system.
> > >
> > > led_boot_on/off/blink() are introduced to turn ON, OFF and BLINK the
> > > designated boot LED.
> > >
> > > New Kconfig is introduced, CONFIG_LED_BOOT to enable the feature.
> > > This makes use of the /options/u-boot property "boot-led" to the
> > > define the boot LED.
> > > It's also introduced a new /options/u-boot property "boot-led-period"
> > > to define the default period when the LED is set to blink mode.
> >
> > BTW could you please send a schema update for this so that Linux accepts it?
> >
>
> I open a PR there [1] or should I use other way?
>
> [1] https://github.com/devicetree-org/dt-schema/pull/144
Well I see others getting merged, so yes that seems to be fine. I have
only ever used the mailing list myself.
Regards,
SImon
>
> > >
> > > If "boot-led-period" is not defined, the value of 250 (ms) is
> > > used by default.
> > >
> > > If CONFIG_LED_BLINK or CONFIG_LED_SW_BLINK is not enabled,
> > > led_boot_blink call will fallback to simple LED ON.
> > >
> > > To cache the data we repurpose the now unused led_uc_priv for storage of
> > > global LED uclass info.
> > >
> > > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> > > ---
> > > drivers/led/Kconfig | 11 ++++++
> > > drivers/led/led-uclass.c | 85 ++++++++++++++++++++++++++++++++++++++++
> > > include/led.h | 55 +++++++++++++++++++++++++-
> > > 3 files changed, 149 insertions(+), 2 deletions(-)
> > >
> >
> > Reviewed-by: Simon Glass <sjg@chromium.org>
>
> --
> Ansuel
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 00/11] led: introduce LED boot and activity function
2024-10-01 12:24 [PATCH v5 00/11] led: introduce LED boot and activity function Christian Marangi
` (10 preceding siblings ...)
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 ` Tom Rini
11 siblings, 0 replies; 30+ messages in thread
From: Tom Rini @ 2024-10-11 17:35 UTC (permalink / raw)
To: Simon Glass, Joe Hershberger, Ramon Fried, AKASHI Takahiro,
Ilias Apalodimas, Etienne Carriere, Caleb Connolly,
Algapally Santosh Sagar, Sean Anderson, Eddie James,
Mattijs Korpershoek, Alexander Gendin, Yang Xiwen, Dario Binacchi,
Heinrich Schuchardt, Miquel Raynal, Arseniy Krasnov,
Heiko Schocher, Michael Trimarchi, Martin Kurbanov,
Alexey Romanov, Artur Rojek, Rasmus Villemoes, Leo Yu-Chi Liang,
Vasileios Amoiridis, Mikhail Kshevetskiy, Michael Polyntsov,
Doug Zobel, Marek Vasut, u-boot, John Crispin, Christian Marangi
On Tue, 01 Oct 2024 14:24:33 +0200, Christian Marangi wrote:
> This series is a reworked version of the previous seried:
> misc: introduce STATUS LED activity function
>
> This series port and expand the legacy concept of LED boot from
> the legacy Status LED API to new LED API.
>
> One thing that many device need is a way to communicate to the
> user that the device is actually doing something.
>
> [...]
Applied to u-boot/master, thanks!
--
Tom
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 03/11] led: implement LED boot API
2024-10-02 22:55 ` Simon Glass
2024-10-02 23:00 ` Christian Marangi
@ 2024-11-02 19:33 ` Simon Glass
2024-11-02 19:36 ` Christian Marangi
1 sibling, 1 reply; 30+ messages in thread
From: Simon Glass @ 2024-11-02 19:33 UTC (permalink / raw)
To: Christian Marangi
Cc: Tom Rini, Joe Hershberger, Ramon Fried, AKASHI Takahiro,
Ilias Apalodimas, Etienne Carriere, Caleb Connolly,
Algapally Santosh Sagar, Sean Anderson, Eddie James,
Mattijs Korpershoek, Alexander Gendin, Yang Xiwen, Dario Binacchi,
Heinrich Schuchardt, Miquel Raynal, Arseniy Krasnov,
Heiko Schocher, Michael Trimarchi, Martin Kurbanov,
Alexey Romanov, Artur Rojek, Rasmus Villemoes, Leo Yu-Chi Liang,
Vasileios Amoiridis, Mikhail Kshevetskiy, Michael Polyntsov,
Doug Zobel, Marek Vasut, u-boot, John Crispin
Hi Christian,
On Wed, 2 Oct 2024 at 16:55, Simon Glass <sjg@chromium.org> wrote:
>
> On Tue, 1 Oct 2024 at 06:25, Christian Marangi <ansuelsmth@gmail.com> wrote:
> >
> > Implement LED boot API to signal correct boot of the system.
> >
> > led_boot_on/off/blink() are introduced to turn ON, OFF and BLINK the
> > designated boot LED.
> >
> > New Kconfig is introduced, CONFIG_LED_BOOT to enable the feature.
> > This makes use of the /options/u-boot property "boot-led" to the
> > define the boot LED.
> > It's also introduced a new /options/u-boot property "boot-led-period"
> > to define the default period when the LED is set to blink mode.
>
> BTW could you please send a schema update for this so that Linux accepts it?
I'm just checking that you did this?
>
> >
> > If "boot-led-period" is not defined, the value of 250 (ms) is
> > used by default.
> >
> > If CONFIG_LED_BLINK or CONFIG_LED_SW_BLINK is not enabled,
> > led_boot_blink call will fallback to simple LED ON.
> >
> > To cache the data we repurpose the now unused led_uc_priv for storage of
> > global LED uclass info.
> >
> > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> > ---
> > drivers/led/Kconfig | 11 ++++++
> > drivers/led/led-uclass.c | 85 ++++++++++++++++++++++++++++++++++++++++
> > include/led.h | 55 +++++++++++++++++++++++++-
> > 3 files changed, 149 insertions(+), 2 deletions(-)
> >
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
Regards,
Simon
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 03/11] led: implement LED boot API
2024-11-02 19:33 ` Simon Glass
@ 2024-11-02 19:36 ` Christian Marangi
2024-11-02 19:50 ` Simon Glass
0 siblings, 1 reply; 30+ messages in thread
From: Christian Marangi @ 2024-11-02 19:36 UTC (permalink / raw)
To: Simon Glass
Cc: Tom Rini, Joe Hershberger, Ramon Fried, AKASHI Takahiro,
Ilias Apalodimas, Etienne Carriere, Caleb Connolly,
Algapally Santosh Sagar, Sean Anderson, Eddie James,
Mattijs Korpershoek, Alexander Gendin, Yang Xiwen, Dario Binacchi,
Heinrich Schuchardt, Miquel Raynal, Arseniy Krasnov,
Heiko Schocher, Michael Trimarchi, Martin Kurbanov,
Alexey Romanov, Artur Rojek, Rasmus Villemoes, Leo Yu-Chi Liang,
Vasileios Amoiridis, Mikhail Kshevetskiy, Michael Polyntsov,
Doug Zobel, Marek Vasut, u-boot, John Crispin
On Sat, Nov 02, 2024 at 01:33:10PM -0600, Simon Glass wrote:
> Hi Christian,
>
> On Wed, 2 Oct 2024 at 16:55, Simon Glass <sjg@chromium.org> wrote:
> >
> > On Tue, 1 Oct 2024 at 06:25, Christian Marangi <ansuelsmth@gmail.com> wrote:
> > >
> > > Implement LED boot API to signal correct boot of the system.
> > >
> > > led_boot_on/off/blink() are introduced to turn ON, OFF and BLINK the
> > > designated boot LED.
> > >
> > > New Kconfig is introduced, CONFIG_LED_BOOT to enable the feature.
> > > This makes use of the /options/u-boot property "boot-led" to the
> > > define the boot LED.
> > > It's also introduced a new /options/u-boot property "boot-led-period"
> > > to define the default period when the LED is set to blink mode.
> >
> > BTW could you please send a schema update for this so that Linux accepts it?
>
> I'm just checking that you did this?
>
Yep [0]. Also tagged Rob 2 hours ago. (eh the coincidence)
Tell me if I should send it with usual way with a dedicated mail. (any
hint on the mailing-list address?)
[0] https://github.com/devicetree-org/dt-schema/pull/144
> >
> > >
> > > If "boot-led-period" is not defined, the value of 250 (ms) is
> > > used by default.
> > >
> > > If CONFIG_LED_BLINK or CONFIG_LED_SW_BLINK is not enabled,
> > > led_boot_blink call will fallback to simple LED ON.
> > >
> > > To cache the data we repurpose the now unused led_uc_priv for storage of
> > > global LED uclass info.
> > >
> > > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> > > ---
> > > drivers/led/Kconfig | 11 ++++++
> > > drivers/led/led-uclass.c | 85 ++++++++++++++++++++++++++++++++++++++++
> > > include/led.h | 55 +++++++++++++++++++++++++-
> > > 3 files changed, 149 insertions(+), 2 deletions(-)
> > >
> >
> > Reviewed-by: Simon Glass <sjg@chromium.org>
>
> Regards,
> Simon
--
Ansuel
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 03/11] led: implement LED boot API
2024-11-02 19:36 ` Christian Marangi
@ 2024-11-02 19:50 ` Simon Glass
2024-11-02 19:52 ` Christian Marangi
0 siblings, 1 reply; 30+ messages in thread
From: Simon Glass @ 2024-11-02 19:50 UTC (permalink / raw)
To: Christian Marangi
Cc: Tom Rini, Joe Hershberger, Ramon Fried, AKASHI Takahiro,
Ilias Apalodimas, Etienne Carriere, Caleb Connolly,
Algapally Santosh Sagar, Sean Anderson, Eddie James,
Mattijs Korpershoek, Alexander Gendin, Yang Xiwen, Dario Binacchi,
Heinrich Schuchardt, Miquel Raynal, Arseniy Krasnov,
Heiko Schocher, Michael Trimarchi, Martin Kurbanov,
Alexey Romanov, Artur Rojek, Rasmus Villemoes, Leo Yu-Chi Liang,
Vasileios Amoiridis, Mikhail Kshevetskiy, Michael Polyntsov,
Doug Zobel, Marek Vasut, u-boot, John Crispin
Hi Christian,
On Sat, 2 Nov 2024 at 13:36, Christian Marangi <ansuelsmth@gmail.com> wrote:
>
> On Sat, Nov 02, 2024 at 01:33:10PM -0600, Simon Glass wrote:
> > Hi Christian,
> >
> > On Wed, 2 Oct 2024 at 16:55, Simon Glass <sjg@chromium.org> wrote:
> > >
> > > On Tue, 1 Oct 2024 at 06:25, Christian Marangi <ansuelsmth@gmail.com> wrote:
> > > >
> > > > Implement LED boot API to signal correct boot of the system.
> > > >
> > > > led_boot_on/off/blink() are introduced to turn ON, OFF and BLINK the
> > > > designated boot LED.
> > > >
> > > > New Kconfig is introduced, CONFIG_LED_BOOT to enable the feature.
> > > > This makes use of the /options/u-boot property "boot-led" to the
> > > > define the boot LED.
> > > > It's also introduced a new /options/u-boot property "boot-led-period"
> > > > to define the default period when the LED is set to blink mode.
> > >
> > > BTW could you please send a schema update for this so that Linux accepts it?
> >
> > I'm just checking that you did this?
> >
>
> Yep [0]. Also tagged Rob 2 hours ago. (eh the coincidence)
>
> Tell me if I should send it with usual way with a dedicated mail. (any
> hint on the mailing-list address?)
OK great! Yes, once it lands, please send a patch to bring it into U-Boot
Regards,
Simon
> [0] https://github.com/devicetree-org/dt-schema/pull/144
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 03/11] led: implement LED boot API
2024-11-02 19:50 ` Simon Glass
@ 2024-11-02 19:52 ` Christian Marangi
2024-11-03 14:46 ` Simon Glass
0 siblings, 1 reply; 30+ messages in thread
From: Christian Marangi @ 2024-11-02 19:52 UTC (permalink / raw)
To: Simon Glass
Cc: Tom Rini, Joe Hershberger, Ramon Fried, AKASHI Takahiro,
Ilias Apalodimas, Etienne Carriere, Caleb Connolly,
Algapally Santosh Sagar, Sean Anderson, Eddie James,
Mattijs Korpershoek, Alexander Gendin, Yang Xiwen, Dario Binacchi,
Heinrich Schuchardt, Miquel Raynal, Arseniy Krasnov,
Heiko Schocher, Michael Trimarchi, Martin Kurbanov,
Alexey Romanov, Artur Rojek, Rasmus Villemoes, Leo Yu-Chi Liang,
Vasileios Amoiridis, Mikhail Kshevetskiy, Michael Polyntsov,
Doug Zobel, Marek Vasut, u-boot, John Crispin
On Sat, Nov 02, 2024 at 01:50:13PM -0600, Simon Glass wrote:
> Hi Christian,
>
> On Sat, 2 Nov 2024 at 13:36, Christian Marangi <ansuelsmth@gmail.com> wrote:
> >
> > On Sat, Nov 02, 2024 at 01:33:10PM -0600, Simon Glass wrote:
> > > Hi Christian,
> > >
> > > On Wed, 2 Oct 2024 at 16:55, Simon Glass <sjg@chromium.org> wrote:
> > > >
> > > > On Tue, 1 Oct 2024 at 06:25, Christian Marangi <ansuelsmth@gmail.com> wrote:
> > > > >
> > > > > Implement LED boot API to signal correct boot of the system.
> > > > >
> > > > > led_boot_on/off/blink() are introduced to turn ON, OFF and BLINK the
> > > > > designated boot LED.
> > > > >
> > > > > New Kconfig is introduced, CONFIG_LED_BOOT to enable the feature.
> > > > > This makes use of the /options/u-boot property "boot-led" to the
> > > > > define the boot LED.
> > > > > It's also introduced a new /options/u-boot property "boot-led-period"
> > > > > to define the default period when the LED is set to blink mode.
> > > >
> > > > BTW could you please send a schema update for this so that Linux accepts it?
> > >
> > > I'm just checking that you did this?
> > >
> >
> > Yep [0]. Also tagged Rob 2 hours ago. (eh the coincidence)
> >
> > Tell me if I should send it with usual way with a dedicated mail. (any
> > hint on the mailing-list address?)
>
> OK great! Yes, once it lands, please send a patch to bring it into U-Boot
>
> Regards,
> Simon
>
> > [0] https://github.com/devicetree-org/dt-schema/pull/144
I'm confused what kind of patch I should send to U-Boot?
--
Ansuel
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 03/11] led: implement LED boot API
2024-11-02 19:52 ` Christian Marangi
@ 2024-11-03 14:46 ` Simon Glass
2024-11-04 23:13 ` Christian Marangi
0 siblings, 1 reply; 30+ messages in thread
From: Simon Glass @ 2024-11-03 14:46 UTC (permalink / raw)
To: Christian Marangi
Cc: Tom Rini, Joe Hershberger, Ramon Fried, AKASHI Takahiro,
Ilias Apalodimas, Etienne Carriere, Caleb Connolly,
Algapally Santosh Sagar, Sean Anderson, Eddie James,
Mattijs Korpershoek, Alexander Gendin, Yang Xiwen, Dario Binacchi,
Heinrich Schuchardt, Miquel Raynal, Arseniy Krasnov,
Heiko Schocher, Michael Trimarchi, Martin Kurbanov,
Alexey Romanov, Artur Rojek, Rasmus Villemoes, Leo Yu-Chi Liang,
Vasileios Amoiridis, Mikhail Kshevetskiy, Michael Polyntsov,
Doug Zobel, Marek Vasut, u-boot, John Crispin
Hi Christian,
On Sat, 2 Nov 2024 at 13:52, Christian Marangi <ansuelsmth@gmail.com> wrote:
>
> On Sat, Nov 02, 2024 at 01:50:13PM -0600, Simon Glass wrote:
> > Hi Christian,
> >
> > On Sat, 2 Nov 2024 at 13:36, Christian Marangi <ansuelsmth@gmail.com> wrote:
> > >
> > > On Sat, Nov 02, 2024 at 01:33:10PM -0600, Simon Glass wrote:
> > > > Hi Christian,
> > > >
> > > > On Wed, 2 Oct 2024 at 16:55, Simon Glass <sjg@chromium.org> wrote:
> > > > >
> > > > > On Tue, 1 Oct 2024 at 06:25, Christian Marangi <ansuelsmth@gmail.com> wrote:
> > > > > >
> > > > > > Implement LED boot API to signal correct boot of the system.
> > > > > >
> > > > > > led_boot_on/off/blink() are introduced to turn ON, OFF and BLINK the
> > > > > > designated boot LED.
> > > > > >
> > > > > > New Kconfig is introduced, CONFIG_LED_BOOT to enable the feature.
> > > > > > This makes use of the /options/u-boot property "boot-led" to the
> > > > > > define the boot LED.
> > > > > > It's also introduced a new /options/u-boot property "boot-led-period"
> > > > > > to define the default period when the LED is set to blink mode.
> > > > >
> > > > > BTW could you please send a schema update for this so that Linux accepts it?
> > > >
> > > > I'm just checking that you did this?
> > > >
> > >
> > > Yep [0]. Also tagged Rob 2 hours ago. (eh the coincidence)
> > >
> > > Tell me if I should send it with usual way with a dedicated mail. (any
> > > hint on the mailing-list address?)
> >
> > OK great! Yes, once it lands, please send a patch to bring it into U-Boot
> >
> > Regards,
> > Simon
> >
> > > [0] https://github.com/devicetree-org/dt-schema/pull/144
>
> I'm confused what kind of patch I should send to U-Boot?
Something to add the binding to U-Boot also. See my patch at [1]
Regards,
Simon
[1] https://patchwork.ozlabs.org/project/uboot/patch/20241103003322.626036-26-sjg@chromium.org/
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 03/11] led: implement LED boot API
2024-11-03 14:46 ` Simon Glass
@ 2024-11-04 23:13 ` Christian Marangi
2024-11-05 15:12 ` Simon Glass
0 siblings, 1 reply; 30+ messages in thread
From: Christian Marangi @ 2024-11-04 23:13 UTC (permalink / raw)
To: Simon Glass
Cc: Tom Rini, Joe Hershberger, Ramon Fried, AKASHI Takahiro,
Ilias Apalodimas, Etienne Carriere, Caleb Connolly,
Algapally Santosh Sagar, Sean Anderson, Eddie James,
Mattijs Korpershoek, Alexander Gendin, Yang Xiwen, Dario Binacchi,
Heinrich Schuchardt, Miquel Raynal, Arseniy Krasnov,
Heiko Schocher, Michael Trimarchi, Martin Kurbanov,
Alexey Romanov, Artur Rojek, Rasmus Villemoes, Leo Yu-Chi Liang,
Vasileios Amoiridis, Mikhail Kshevetskiy, Michael Polyntsov,
Doug Zobel, Marek Vasut, u-boot, John Crispin
On Sun, Nov 03, 2024 at 07:46:19AM -0700, Simon Glass wrote:
> Hi Christian,
>
> On Sat, 2 Nov 2024 at 13:52, Christian Marangi <ansuelsmth@gmail.com> wrote:
> >
> > On Sat, Nov 02, 2024 at 01:50:13PM -0600, Simon Glass wrote:
> > > Hi Christian,
> > >
> > > On Sat, 2 Nov 2024 at 13:36, Christian Marangi <ansuelsmth@gmail.com> wrote:
> > > >
> > > > On Sat, Nov 02, 2024 at 01:33:10PM -0600, Simon Glass wrote:
> > > > > Hi Christian,
> > > > >
> > > > > On Wed, 2 Oct 2024 at 16:55, Simon Glass <sjg@chromium.org> wrote:
> > > > > >
> > > > > > On Tue, 1 Oct 2024 at 06:25, Christian Marangi <ansuelsmth@gmail.com> wrote:
> > > > > > >
> > > > > > > Implement LED boot API to signal correct boot of the system.
> > > > > > >
> > > > > > > led_boot_on/off/blink() are introduced to turn ON, OFF and BLINK the
> > > > > > > designated boot LED.
> > > > > > >
> > > > > > > New Kconfig is introduced, CONFIG_LED_BOOT to enable the feature.
> > > > > > > This makes use of the /options/u-boot property "boot-led" to the
> > > > > > > define the boot LED.
> > > > > > > It's also introduced a new /options/u-boot property "boot-led-period"
> > > > > > > to define the default period when the LED is set to blink mode.
> > > > > >
> > > > > > BTW could you please send a schema update for this so that Linux accepts it?
> > > > >
> > > > > I'm just checking that you did this?
> > > > >
> > > >
> > > > Yep [0]. Also tagged Rob 2 hours ago. (eh the coincidence)
> > > >
> > > > Tell me if I should send it with usual way with a dedicated mail. (any
> > > > hint on the mailing-list address?)
> > >
> > > OK great! Yes, once it lands, please send a patch to bring it into U-Boot
> > >
> > > Regards,
> > > Simon
> > >
> > > > [0] https://github.com/devicetree-org/dt-schema/pull/144
> >
> > I'm confused what kind of patch I should send to U-Boot?
>
> Something to add the binding to U-Boot also. See my patch at [1]
>
> Regards,
> Simon
>
> [1] https://patchwork.ozlabs.org/project/uboot/patch/20241103003322.626036-26-sjg@chromium.org/
Ok thanks for the hint.
Anyway Rob checked the patch (good news) but he request some changes
(bad news)
I created this PR [1] waiting for CI to confirm everything is ok.
Would be good if you can check the changes while CI tests.
[1] https://github.com/u-boot/u-boot/pull/686
--
Ansuel
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 03/11] led: implement LED boot API
2024-11-04 23:13 ` Christian Marangi
@ 2024-11-05 15:12 ` Simon Glass
2024-11-05 15:15 ` Christian Marangi
0 siblings, 1 reply; 30+ messages in thread
From: Simon Glass @ 2024-11-05 15:12 UTC (permalink / raw)
To: Christian Marangi
Cc: Tom Rini, Joe Hershberger, Ramon Fried, AKASHI Takahiro,
Ilias Apalodimas, Etienne Carriere, Caleb Connolly,
Algapally Santosh Sagar, Sean Anderson, Eddie James,
Mattijs Korpershoek, Alexander Gendin, Yang Xiwen, Dario Binacchi,
Heinrich Schuchardt, Miquel Raynal, Arseniy Krasnov,
Heiko Schocher, Michael Trimarchi, Martin Kurbanov,
Alexey Romanov, Artur Rojek, Rasmus Villemoes, Leo Yu-Chi Liang,
Vasileios Amoiridis, Mikhail Kshevetskiy, Michael Polyntsov,
Doug Zobel, Marek Vasut, u-boot, John Crispin
Hi Christian,
On Mon, 4 Nov 2024 at 16:13, Christian Marangi <ansuelsmth@gmail.com> wrote:
>
> On Sun, Nov 03, 2024 at 07:46:19AM -0700, Simon Glass wrote:
> > Hi Christian,
> >
> > On Sat, 2 Nov 2024 at 13:52, Christian Marangi <ansuelsmth@gmail.com> wrote:
> > >
> > > On Sat, Nov 02, 2024 at 01:50:13PM -0600, Simon Glass wrote:
> > > > Hi Christian,
> > > >
> > > > On Sat, 2 Nov 2024 at 13:36, Christian Marangi <ansuelsmth@gmail.com> wrote:
> > > > >
> > > > > On Sat, Nov 02, 2024 at 01:33:10PM -0600, Simon Glass wrote:
> > > > > > Hi Christian,
> > > > > >
> > > > > > On Wed, 2 Oct 2024 at 16:55, Simon Glass <sjg@chromium.org> wrote:
> > > > > > >
> > > > > > > On Tue, 1 Oct 2024 at 06:25, Christian Marangi <ansuelsmth@gmail.com> wrote:
> > > > > > > >
> > > > > > > > Implement LED boot API to signal correct boot of the system.
> > > > > > > >
> > > > > > > > led_boot_on/off/blink() are introduced to turn ON, OFF and BLINK the
> > > > > > > > designated boot LED.
> > > > > > > >
> > > > > > > > New Kconfig is introduced, CONFIG_LED_BOOT to enable the feature.
> > > > > > > > This makes use of the /options/u-boot property "boot-led" to the
> > > > > > > > define the boot LED.
> > > > > > > > It's also introduced a new /options/u-boot property "boot-led-period"
> > > > > > > > to define the default period when the LED is set to blink mode.
> > > > > > >
> > > > > > > BTW could you please send a schema update for this so that Linux accepts it?
> > > > > >
> > > > > > I'm just checking that you did this?
> > > > > >
> > > > >
> > > > > Yep [0]. Also tagged Rob 2 hours ago. (eh the coincidence)
> > > > >
> > > > > Tell me if I should send it with usual way with a dedicated mail. (any
> > > > > hint on the mailing-list address?)
> > > >
> > > > OK great! Yes, once it lands, please send a patch to bring it into U-Boot
> > > >
> > > > Regards,
> > > > Simon
> > > >
> > > > > [0] https://github.com/devicetree-org/dt-schema/pull/144
> > >
> > > I'm confused what kind of patch I should send to U-Boot?
> >
> > Something to add the binding to U-Boot also. See my patch at [1]
> >
> > Regards,
> > Simon
> >
> > [1] https://patchwork.ozlabs.org/project/uboot/patch/20241103003322.626036-26-sjg@chromium.org/
>
> Ok thanks for the hint.
>
> Anyway Rob checked the patch (good news) but he request some changes
> (bad news)
>
> I created this PR [1] waiting for CI to confirm everything is ok.
>
> Would be good if you can check the changes while CI tests.
A few things:
- Better to return -ENOENT or -EINVAL if something is missing, since
we use -ENODEV in driver model to mean there is no device
- 'nodep' instead of 'node' for the parameter, so it is clear that it
is returned
Otherwise it looks good to me (with the proviso that's I'm just
looking at an emphemal github link!)
Regards,
Simon
>
> [1] https://github.com/u-boot/u-boot/pull/686
>
> --
> Ansuel
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 03/11] led: implement LED boot API
2024-11-05 15:12 ` Simon Glass
@ 2024-11-05 15:15 ` Christian Marangi
0 siblings, 0 replies; 30+ messages in thread
From: Christian Marangi @ 2024-11-05 15:15 UTC (permalink / raw)
To: Simon Glass
Cc: Tom Rini, Joe Hershberger, Ramon Fried, AKASHI Takahiro,
Ilias Apalodimas, Etienne Carriere, Caleb Connolly,
Algapally Santosh Sagar, Sean Anderson, Eddie James,
Mattijs Korpershoek, Alexander Gendin, Yang Xiwen, Dario Binacchi,
Heinrich Schuchardt, Miquel Raynal, Arseniy Krasnov,
Heiko Schocher, Michael Trimarchi, Martin Kurbanov,
Alexey Romanov, Artur Rojek, Rasmus Villemoes, Leo Yu-Chi Liang,
Vasileios Amoiridis, Mikhail Kshevetskiy, Michael Polyntsov,
Doug Zobel, Marek Vasut, u-boot, John Crispin
On Tue, Nov 05, 2024 at 08:12:47AM -0700, Simon Glass wrote:
> Hi Christian,
>
> On Mon, 4 Nov 2024 at 16:13, Christian Marangi <ansuelsmth@gmail.com> wrote:
> >
> > On Sun, Nov 03, 2024 at 07:46:19AM -0700, Simon Glass wrote:
> > > Hi Christian,
> > >
> > > On Sat, 2 Nov 2024 at 13:52, Christian Marangi <ansuelsmth@gmail.com> wrote:
> > > >
> > > > On Sat, Nov 02, 2024 at 01:50:13PM -0600, Simon Glass wrote:
> > > > > Hi Christian,
> > > > >
> > > > > On Sat, 2 Nov 2024 at 13:36, Christian Marangi <ansuelsmth@gmail.com> wrote:
> > > > > >
> > > > > > On Sat, Nov 02, 2024 at 01:33:10PM -0600, Simon Glass wrote:
> > > > > > > Hi Christian,
> > > > > > >
> > > > > > > On Wed, 2 Oct 2024 at 16:55, Simon Glass <sjg@chromium.org> wrote:
> > > > > > > >
> > > > > > > > On Tue, 1 Oct 2024 at 06:25, Christian Marangi <ansuelsmth@gmail.com> wrote:
> > > > > > > > >
> > > > > > > > > Implement LED boot API to signal correct boot of the system.
> > > > > > > > >
> > > > > > > > > led_boot_on/off/blink() are introduced to turn ON, OFF and BLINK the
> > > > > > > > > designated boot LED.
> > > > > > > > >
> > > > > > > > > New Kconfig is introduced, CONFIG_LED_BOOT to enable the feature.
> > > > > > > > > This makes use of the /options/u-boot property "boot-led" to the
> > > > > > > > > define the boot LED.
> > > > > > > > > It's also introduced a new /options/u-boot property "boot-led-period"
> > > > > > > > > to define the default period when the LED is set to blink mode.
> > > > > > > >
> > > > > > > > BTW could you please send a schema update for this so that Linux accepts it?
> > > > > > >
> > > > > > > I'm just checking that you did this?
> > > > > > >
> > > > > >
> > > > > > Yep [0]. Also tagged Rob 2 hours ago. (eh the coincidence)
> > > > > >
> > > > > > Tell me if I should send it with usual way with a dedicated mail. (any
> > > > > > hint on the mailing-list address?)
> > > > >
> > > > > OK great! Yes, once it lands, please send a patch to bring it into U-Boot
> > > > >
> > > > > Regards,
> > > > > Simon
> > > > >
> > > > > > [0] https://github.com/devicetree-org/dt-schema/pull/144
> > > >
> > > > I'm confused what kind of patch I should send to U-Boot?
> > >
> > > Something to add the binding to U-Boot also. See my patch at [1]
> > >
> > > Regards,
> > > Simon
> > >
> > > [1] https://patchwork.ozlabs.org/project/uboot/patch/20241103003322.626036-26-sjg@chromium.org/
> >
> > Ok thanks for the hint.
> >
> > Anyway Rob checked the patch (good news) but he request some changes
> > (bad news)
> >
> > I created this PR [1] waiting for CI to confirm everything is ok.
> >
> > Would be good if you can check the changes while CI tests.
>
> A few things:
> - Better to return -ENOENT or -EINVAL if something is missing, since
> we use -ENODEV in driver model to mean there is no device
> - 'nodep' instead of 'node' for the parameter, so it is clear that it
> is returned
>
> Otherwise it looks good to me (with the proviso that's I'm just
> looking at an emphemal github link!)
>
Thanks a lot. Fighting a bit with the tests but thanks for the feedback.
>
> >
> > [1] https://github.com/u-boot/u-boot/pull/686
> >
> > --
> > Ansuel
--
Ansuel
^ permalink raw reply [flat|nested] 30+ messages in thread
end of thread, other threads:[~2024-11-05 15:54 UTC | newest]
Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH v5 09/11] doc: introduce led.rst documentation Christian Marangi
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox