From: Tom Rini Date: Wed, 18 Mar 2026 19:13:57 +0000 (-0600) Subject: Merge patch series "led: remove legacy API" X-Git-Tag: v2026.07-rc1~53^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=28608c808774a39ec47d31353b141db547136e58;p=thirdparty%2Fu-boot.git Merge patch series "led: remove legacy API" Quentin Schulz says: This migrates the last user of the legacy LED API, IMX233-OLinuXino and net/bootp.c, to the modern LED framework. I do have concern about being able to use BOOTP in SPL? In which case, I should probably add an additional check on CONFIG_IS_ENABLED(LED) in addition to IS_ENABLED(CONFIG_LED_BOOT)? I haven't tested this as I do not own an IMX233-OLinuXino, so please give this a try if you own this device. Then, since there's no user left of this legacy API, it is entirely removed. Link: https://lore.kernel.org/r/20251120-legacy-led-removal-v1-0-369d44338358@cherry.de --- 28608c808774a39ec47d31353b141db547136e58 diff --cc doc/api/led.rst index 9ae3f5fe252,e52e350d1bb..fe1904aea0d --- a/doc/api/led.rst +++ b/doc/api/led.rst @@@ -7,67 -7,4 +7,4 @@@ LE :doc: Overview .. kernel-doc:: include/led.h - :internal: + :internal: - - Legacy LED - ========== - - Please use the new LED API as defined above. This section is only for reference - for currently supported devices and to aid for migration to the new API. - - Status LED - ---------- - - This README describes the status LED API. - - The API is defined by the include file include/status_led.h - - The first step is to enable CONFIG_LED_STATUS in menuconfig:: - - > Device Drivers > LED Support. - - If the LED support is only for specific board, enable - CONFIG_LED_STATUS_BOARD_SPECIFIC in the menuconfig. - - Status LEDS 0 to 5 are enabled by the following configurations at menuconfig: - CONFIG_STATUS_LED0, CONFIG_STATUS_LED1, ... CONFIG_STATUS_LED5 - - The following should be configured for each of the enabled LEDs: - - - CONFIG_STATUS_LED_BIT - - CONFIG_STATUS_LED_STATE - - CONFIG_STATUS_LED_FREQ - - Where is an integer 1 through 5 (empty for 0). - - CONFIG_STATUS_LED_BIT is passed into the __led_* functions to identify which LED - is being acted on. As such, the value choose must be unique with respect to - the other CONFIG_STATUS_LED_BIT's. Mapping the value to a physical LED is the - reponsiblity of the __led_* function. - - CONFIG_STATUS_LED_STATE is the initial state of the LED. It should be set to one - of these values: CONFIG_LED_STATUS_OFF or CONFIG_LED_STATUS_ON. - - CONFIG_STATUS_LED_FREQ determines the LED blink frequency. - Values range from 2 to 10. - - 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). - - General LED functions - ~~~~~~~~~~~~~~~~~~~~~ - The following functions should be defined: - - __led_init is called once to initialize the LED to CONFIG_STATUS_LED_STATE. - One time start up code should be placed here. - - __led_set is called to change the state of the LED. - - __led_toggle is called to toggle the current state of the LED. - - TBD : Describe older board dependent macros similar to what is done for - - TBD : Describe general support via asm/status_led.h diff --cc drivers/misc/gpio_led.c index 1e2f83cca93,69b2e2f76bd..00000000000 deleted file mode 100644,100644 --- a/drivers/misc/gpio_led.c +++ /dev/null @@@ -1,52 -1,54 +1,0 @@@ - /* - * Status LED driver based on GPIO access conventions of Linux - * - * Copyright (C) 2010 Thomas Chou - * Licensed under the GPL-2 or later. - */ - - #include - #include -- - #ifndef CFG_GPIO_LED_INVERTED_TABLE - #define CFG_GPIO_LED_INVERTED_TABLE {} - #endif -#ifdef CONFIG_GPIO_LED_STUBS -- - static led_id_t gpio_led_inv[] = CFG_GPIO_LED_INVERTED_TABLE; -/* 'generic' override of colored LED stubs, to use GPIO functions instead */ -- - static int gpio_led_gpio_value(led_id_t mask, int state) -#ifdef CONFIG_LED_STATUS_RED -void red_led_on(void) --{ - int i, gpio_value = (state == CONFIG_LED_STATUS_ON); - - for (i = 0; i < ARRAY_SIZE(gpio_led_inv); i++) { - if (gpio_led_inv[i] == mask) - gpio_value = !gpio_value; - } - __led_set(CONFIG_LED_STATUS_RED, CONFIG_LED_STATUS_ON); -} -- - return gpio_value; -void red_led_off(void) -{ - __led_set(CONFIG_LED_STATUS_RED, CONFIG_LED_STATUS_OFF); --} -#endif -- - void __led_init(led_id_t mask, int state) -#ifdef CONFIG_LED_STATUS_GREEN -void green_led_on(void) --{ - int gpio_value; - __led_set(CONFIG_LED_STATUS_GREEN, CONFIG_LED_STATUS_ON); -} -- - if (gpio_request(mask, "gpio_led") != 0) { - printf("%s: failed requesting GPIO%lu!\n", __func__, mask); - return; - } -void green_led_off(void) -{ - __led_set(CONFIG_LED_STATUS_GREEN, CONFIG_LED_STATUS_OFF); -} -#endif -- - gpio_value = gpio_led_gpio_value(mask, state); - gpio_direction_output(mask, gpio_value); -#ifdef CONFIG_LED_STATUS_YELLOW -void yellow_led_on(void) -{ - __led_set(CONFIG_LED_STATUS_YELLOW, CONFIG_LED_STATUS_ON); --} -- - void __led_set(led_id_t mask, int state) -void yellow_led_off(void) --{ - int gpio_value = gpio_led_gpio_value(mask, state); - __led_set(CONFIG_LED_STATUS_YELLOW, CONFIG_LED_STATUS_OFF); -} -#endif -- - gpio_set_value(mask, gpio_value); -#ifdef CONFIG_LED_STATUS_BLUE -void blue_led_on(void) -{ - __led_set(CONFIG_LED_STATUS_BLUE, CONFIG_LED_STATUS_ON); --} -- - void __led_toggle(led_id_t mask) -void blue_led_off(void) --{ - gpio_set_value(mask, !gpio_get_value(mask)); - __led_set(CONFIG_LED_STATUS_BLUE, CONFIG_LED_STATUS_OFF); --} -#endif - -#endif /* CONFIG_GPIO_LED_STUBS */