summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorQuentin Schulz <[email protected]>2026-01-28 17:01:25 +0100
committerAndre Przywara <[email protected]>2026-03-16 21:55:53 +0100
commit256557dd9aae376afcc3c3bc23cd739f427e9dc7 (patch)
treec3ecf641e241ded3ed95a0fc09d77f83e6a7caf1 /board
parenta27980786cfb3c430aa1c05da8e79180c584d221 (diff)
sunxi: remove usage of legacy LED API
We are trying to get rid of the legacy LED API and PinePhone is one of the last ones requiring it. Unlike all other users of the legacy LED API, PinePhone is controlling the GPIO LED in SPL. Unfortunately, Sunxi doesn't enable DM support in SPL because of tight space constraints, so we cannot make use of the modern LED framework as that is based on DM_GPIO. Since PinePhone is the last user of this API, I'm moving the logic to Sunxi SPL code and will let this community decide how to handle this hot potato. The logic is extremely simplified as only one GPIO LED is currently controlled in SPL by PinePhone. No need for handling multiple LEDs or inverted polarity, let's keep it simple. This however allows us to use the modern LED framework once in U-Boot proper since this logic won't collide with the new framework. Since the only misc drivers that were compiled in SPL were guarded by CONFIG_LED_STATUS and CONFIG_LED_STATUS_GPIO, we can also disable CONFIG_SPL_DRIVERS_MISC (which does nothing anymore). This also saves some space for PinePhone in SPL and proper. Tested-by: Andre Przywara <[email protected]> Signed-off-by: Quentin Schulz <[email protected]> Reviewed-by: Simon Glass <[email protected]>
Diffstat (limited to 'board')
-rw-r--r--board/sunxi/board.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 954a8715075..d7722d1858a 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -50,7 +50,6 @@
#include <spl.h>
#include <sy8106a.h>
#include <asm/setup.h>
-#include <status_led.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -561,14 +560,23 @@ static void sunxi_spl_store_dram_size(phys_addr_t dram_size)
spl->dram_size = dram_size >> 20;
}
+static void status_led_init(void)
+{
+#if CONFIG_IS_ENABLED(SUNXI_LED_STATUS)
+ unsigned int state = CONFIG_SPL_SUNXI_LED_STATUS_STATE;
+ unsigned int gpio = CONFIG_SPL_SUNXI_LED_STATUS_BIT;
+
+ gpio_request(gpio, "gpio_led");
+ gpio_direction_output(gpio, state);
+#endif
+}
+
void sunxi_board_init(void)
{
int power_failed = 0;
-#ifdef CONFIG_LED_STATUS
- if (IS_ENABLED(CONFIG_SPL_DRIVERS_MISC))
+ if (CONFIG_IS_ENABLED(SUNXI_LED_STATUS))
status_led_init();
-#endif
#ifdef CONFIG_SY8106A_POWER
power_failed = sy8106a_set_vout1(CONFIG_SY8106A_VOUT1_VOLT);