]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
sunxi: spl: fix SPL_SUNXI_LED active low configuration
authorAndre Przywara <andre.przywara@arm.com>
Tue, 7 Apr 2026 22:34:45 +0000 (00:34 +0200)
committerAndre Przywara <andre.przywara@arm.com>
Thu, 30 Apr 2026 21:31:02 +0000 (23:31 +0200)
The newly introduced Allwinner SPL LED "framework" defined a
SPL_SUNXI_LED_STATUS_STATE Kconfig symbol, that was supposed to denote
the active-low vs. active-high polarity of the LED. However this is
a bool symbol, so it will simply vanish if not defined, and we cannot use
it directly inside a C statement.

Filter the symbol through the IS_ENABLED() macro, which will return 0 if
the symbol is not defined, which is the intended value here.

Since the STATUS_STATE name is a bit confusing, rename it to ACTIVE_HIGH
on the way, because that is its real meaning. Also the LED_STATUS_BIT
name for the GPIO number is similarly a remnant of the old status LED
code, so rename it to LED_STATUS_GPIO as well.

This fixes configuring LEDs with active-low polarity.

Fixes: 256557dd9aae ("sunxi: remove usage of legacy LED API")
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Paul Kocialkowski <paulk@sys-base.io>
Closes: https://lore.kernel.org/u-boot/adfMQBPdntWy1KIq@shepard/
Acked-by: Quentin Schulz <quentin.schulz@cherry.de>
arch/arm/mach-sunxi/Kconfig
board/sunxi/board.c
configs/pinephone_defconfig

index 89f0e77bcdb775f7f76acd16fe8b6859014f600a..07d7ea2b7ad120242de0876f45308f480eee9875 100644 (file)
@@ -1245,15 +1245,17 @@ config SPL_SUNXI_LED_STATUS
 
 if SPL_SUNXI_LED_STATUS
 
-config SPL_SUNXI_LED_STATUS_BIT
+config SPL_SUNXI_LED_STATUS_GPIO
        int "GPIO number for GPIO status LED"
        help
          GPIO number for the GPIO controlling the GPIO status LED in SPL.
 
-config SPL_SUNXI_LED_STATUS_STATE
-       bool "GPIO status LED initial state is on"
+config SPL_SUNXI_LED_STATUS_ACTIVE_HIGH
+       bool "GPIO status LED is active high"
+       default y
        help
-         Whether the initial state of the status LED in SPL must be on or off.
+         Whether the GPIO of the status LED must be set high or low to turn
+         the LED on.
 
 endif # SPL_SUNXI_LED_STATUS
 
index d7722d1858aa2fce905d236308849a6b5e5a04a9..3d1afec7c669807082027a3ddede6a9c6c0fe817 100644 (file)
@@ -563,8 +563,8 @@ static void sunxi_spl_store_dram_size(phys_addr_t dram_size)
 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;
+       unsigned int state = IS_ENABLED(CONFIG_SPL_SUNXI_LED_STATUS_ACTIVE_HIGH);
+       unsigned int gpio = CONFIG_SPL_SUNXI_LED_STATUS_GPIO;
 
        gpio_request(gpio, "gpio_led");
        gpio_direction_output(gpio, state);
index ed7dbc1852b4b4a6af4f7cb1a3b75ff4bacd0cd7..3a4f4ec51cf8404a77e2f67c2d9f0b9ab2395ff3 100644 (file)
@@ -9,8 +9,7 @@ CONFIG_DRAM_ZQ=3881949
 CONFIG_MMC_SUNXI_SLOT_EXTRA=2
 CONFIG_PINEPHONE_DT_SELECTION=y
 CONFIG_SPL_SUNXI_LED_STATUS=y
-CONFIG_SPL_SUNXI_LED_STATUS_BIT=114
-CONFIG_SPL_SUNXI_LED_STATUS_STATE=y
+CONFIG_SPL_SUNXI_LED_STATUS_GPIO=114
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_CMD_PSTORE=y
 CONFIG_CMD_PSTORE_MEM_ADDR=0x61000000