Merge patch series "led: remove unused legacy LED code"

Quentin Schulz <quentin.schulz@cherry.de> says:

Only the Siemens corvus board seems to be using these two status LEDs
from the legacy LED API.

Since we're trying to get rid of the last users of the legacy LED API,
let's migrate Corvus to the modern LED API instead, which uses DM. For
Corvus's case, it also uses DM_GPIO (already enabled in defconfig).

Since there was no use for the green status_led (not compiled in), it
simply is removed without migrating it to the modern API. If need be, we
can always add a new gpio-led in the FDT.

Note that I do not own a Siemens Corvus board so it's a bit of a shot in
the dark whether it'll work on the first try, only build tested.

The red LED should be on whenever reaching U-Boot proper CLI, if not we
have an issue.

The LED should be controllable with the led command from U-Boot proper
CLI.

Link: https://lore.kernel.org/r/20251119-corvus-led-red-green-v1-0-ce86b8d59dfc@cherry.de
This commit is contained in:
Tom Rini
2025-12-05 13:38:32 -06:00
10 changed files with 13 additions and 146 deletions
+11
View File
@@ -10,6 +10,7 @@
* 2011 Nicolas Ferre <nicolas.ferre@atmel.com>
*/
/dts-v1/;
#include <dt-bindings/leds/common.h>
#include "at91sam9g45.dtsi"
/ {
@@ -106,4 +107,14 @@
status = "okay";
};
};
leds {
compatible = "gpio-leds";
red_led: led-0 {
gpios = <&pioD 31 GPIO_ACTIVE_HIGH>;
color = <LED_COLOR_ID_RED>;
default-state = "on";
};
};
};
-3
View File
@@ -183,9 +183,6 @@ here:
movne r9, r0
# endif
#if ! defined(CONFIG_XPL_BUILD)
bl red_led_on
#endif
/* call board_init_r(gd_t *id, ulong dest_addr) */
mov r0, r9 /* gd_t */
ldr r1, [r9, #GD_RELOCADDR] /* dest_addr */
-22
View File
@@ -52,28 +52,6 @@ static void corvus_request_gpio(void)
gpio_request(AT91_PIN_PD3, "USB1");
gpio_request(AT91_PIN_PB18, "SPICS1");
gpio_request(AT91_PIN_PB3, "SPICS0");
gpio_request(AT91_PIN_PD31, "red led"); /* this is the user1 led */
gpio_request(AT91_PIN_PD0, "green led"); /* this is the user2 led */
}
void red_led_on(void)
{
gpio_set_value(AT91_PIN_PD31, 1);
}
void red_led_off(void)
{
gpio_set_value(AT91_PIN_PD31, 0);
}
void green_led_on(void)
{
gpio_set_value(AT91_PIN_PD0, 0);
}
void green_led_off(void)
{
gpio_set_value(AT91_PIN_PD0, 1);
}
static void corvus_nand_hw_init(void)
-12
View File
@@ -44,12 +44,6 @@ static const led_tbl_t led_commands[] = {
#ifdef CONFIG_LED_STATUS5
{ "5", CONFIG_LED_STATUS_BIT5, NULL, NULL, NULL },
#endif
#endif
#ifdef CONFIG_LED_STATUS_GREEN
{ "green", CONFIG_LED_STATUS_GREEN, green_led_off, green_led_on, NULL },
#endif
#ifdef CONFIG_LED_STATUS_RED
{ "red", CONFIG_LED_STATUS_RED, red_led_off, red_led_on, NULL },
#endif
{ NULL, 0, NULL, NULL, NULL }
};
@@ -161,12 +155,6 @@ U_BOOT_CMD(
#ifdef CONFIG_LED_STATUS5
"5|"
#endif
#endif
#ifdef CONFIG_LED_STATUS_GREEN
"green|"
#endif
#ifdef CONFIG_LED_STATUS_RED
"red|"
#endif
"all] [on|off|toggle|blink] [blink-freq in ms]",
"[led_name] [on|off|toggle|blink] sets or clears led(s)"
-16
View File
@@ -54,22 +54,6 @@
DECLARE_GLOBAL_DATA_PTR;
/*
* TODO(sjg@chromium.org): IMO this code should be
* refactored to a single function, something like:
*
* void led_set_state(enum led_colour_t colour, int on);
*/
/************************************************************************
* Coloured LED functionality
************************************************************************
* May be supplied by boards if desired
*/
__weak void red_led_on(void) {}
__weak void red_led_off(void) {}
__weak void green_led_on(void) {}
__weak void green_led_off(void) {}
/*
* Why is gd allocated a register? Prior to reloc it might be better to
* just pass it around to each function in this file?
+2
View File
@@ -75,6 +75,8 @@ CONFIG_CLK_AT91=y
CONFIG_DFU_NAND=y
CONFIG_SYS_DFU_DATA_BUF_SIZE=0x100000
CONFIG_AT91_GPIO=y
CONFIG_LED=y
CONFIG_LED_GPIO=y
# CONFIG_MMC is not set
CONFIG_MTD=y
CONFIG_SYS_NAND_DRIVER_ECC_LAYOUT=y
-19
View File
@@ -57,10 +57,6 @@ Some other LED macros
CONFIG_STATUS_LED_BOOT is the LED to light when the board is booting.
This must be a valid LED number (0-5).
CONFIG_STATUS_LED_RED is the red LED. It is used to signal errors. This must be
a valid LED number (0-5). Other similar color LED's macros are
CONFIG_STATUS_LED_GREEN.
General LED functions
~~~~~~~~~~~~~~~~~~~~~
The following functions should be defined:
@@ -72,21 +68,6 @@ __led_set is called to change the state of the LED.
__led_toggle is called to toggle the current state of the LED.
Colour LED
----------
Colour LED's are at present only used by ARM.
The functions names explain their purpose.
- red_LED_on
- red_LED_off
- green_LED_on
- green_LED_off
These are weakly defined in arch/arm/lib/board.c to noops. Where applicable, define
these functions in the board specific source.
TBD : Describe older board dependent macros similar to what is done for
TBD : Describe general support via asm/status_led.h
-28
View File
@@ -400,34 +400,6 @@ config LED_STATUS_BOOT
endif # LED_STATUS_BOOT_ENABLE
config LED_STATUS_RED_ENABLE
bool "Enable red LED"
help
Enable red status LED.
if LED_STATUS_RED_ENABLE
config LED_STATUS_RED
int "Red LED identification"
help
Valid enabled LED device number.
endif # LED_STATUS_RED_ENABLE
config LED_STATUS_GREEN_ENABLE
bool "Enable green LED"
help
Enable green status LED.
if LED_STATUS_GREEN_ENABLE
config LED_STATUS_GREEN
int "Green LED identification"
help
Valid enabled LED device number (0-5).
endif # LED_STATUS_GREEN_ENABLE
config LED_STATUS_CMD
bool "Enable status LED commands"
-30
View File
@@ -50,33 +50,3 @@ void __led_toggle(led_id_t mask)
{
gpio_set_value(mask, !gpio_get_value(mask));
}
#ifdef CONFIG_GPIO_LED_STUBS
/* 'generic' override of colored LED stubs, to use GPIO functions instead */
#ifdef CONFIG_LED_STATUS_RED
void red_led_on(void)
{
__led_set(CONFIG_LED_STATUS_RED, CONFIG_LED_STATUS_ON);
}
void red_led_off(void)
{
__led_set(CONFIG_LED_STATUS_RED, CONFIG_LED_STATUS_OFF);
}
#endif
#ifdef CONFIG_LED_STATUS_GREEN
void green_led_on(void)
{
__led_set(CONFIG_LED_STATUS_GREEN, CONFIG_LED_STATUS_ON);
}
void green_led_off(void)
{
__led_set(CONFIG_LED_STATUS_GREEN, CONFIG_LED_STATUS_OFF);
}
#endif
#endif /* CONFIG_GPIO_LED_STUBS */
-16
View File
@@ -65,20 +65,4 @@ static inline void status_led_set(int led, int state) { }
static inline void status_led_boot_blink(void) { }
#endif /* CONFIG_LED_STATUS */
/*
* Coloured LEDs API
*/
#ifndef __ASSEMBLY__
void red_led_on(void);
void red_led_off(void);
void green_led_on(void);
void green_led_off(void);
#else
.extern red_led_on
.extern red_led_off
.extern green_led_on
.extern green_led_off
#endif
#endif /* _STATUS_LED_H_ */