Skip to contentSkip to conversation

PinePhone: enable LED on boot for improved

PATCH In review Arnaud Ferraris 2 participants 5 messages Sep 8, 2021 – Sep 9, 2021 Arm/Allwinner sunXi SoC support

lore
Share & tools
lore
#0 lore raw

v2 cover PinePhone: enable LED on boot for improved

Hi,

As the PinePhone doesn't provide any visual feedback when booting, these patches take advantage of the built-in RGB LED to indicate the device is indeed powered on.

I've been carrying those downstream in Mobian for some time now, allowing users to see their phone is booting (otherwise it can be several seconds before the kernel is loaded and able to show a sign of life).

Best regards,
Arnaud

--
Changes in v2:
- limit the amount of #ifdef's in board.c
- add a Reviewed-by record

Arnaud Ferraris (2):
board: sunxi: enable status LED early
pinephone_defconfig: add support for early-boot status LED

 board/sunxi/board.c         | 6 ++++++
 configs/pinephone_defconfig | 6 ++++++
 2 files changed, 12 insertions(+)
#1 lore raw

PATCH v2 1/2 board: sunxi: enable status LED early

For some systems, such as the PinePhone, there is no way for the end user to make sure the system is indeed booting before the boot script is executed, which takes several seconds. Therefore, it can be useful to provide early visual feedback as soon as possible.

In order achieve this goal, this patch initializes the status LED (if configured) in the SPL.

---
Changes in v2:
- limit the amount of #ifdef's in board.c

 board/sunxi/board.c | 6 ++++++
 1 file changed, 6 insertions(+)
board/sunxi/board.c +6 -0
index 1a46100e40..2249374fba 100644
@@ -46,6 +46,7 @@
 #include <spl.h>
 #include <sy8106a.h>
 #include <asm/setup.h>
+#include <status_led.h>
 
 #if defined CONFIG_VIDEO_LCD_PANEL_I2C && !(defined CONFIG_SPL_BUILD)
 /* So that we can use pin names in Kconfig and sunxi_name_to_gpio() */
@@ -672,6 +673,11 @@ void sunxi_board_init(void)
 {
 	int power_failed = 0;
 
+#ifdef CONFIG_LED_STATUS
+	if (IS_ENABLED(CONFIG_SPL_DRIVERS_MISC))
+		status_led_init();
+#endif
+
 #ifdef CONFIG_SY8106A_POWER
 	power_failed = sy8106a_set_vout1(CONFIG_SY8106A_VOUT1_VOLT);
 #endif
Signature · 1 line
2.33.0
maintainer Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] board: sunxi: enable status LED early

Quoted 9 lines · Arnaud Ferraris

For some systems, such as the PinePhone, there is no way for the end user to make sure the system is indeed booting before the boot script is executed, which takes several seconds. Therefore, it can be useful to provide early visual feedback as soon as possible.

In order achieve this goal, this patch initializes the status LED (if configured) in the SPL.

#3 lore raw

PATCH v2 2/2 pinephone_defconfig: add support for early-boot status LED

In reply to Arnaud Ferraris

This commit enables the green status LED (PD18/GPIO 114) on boot in the SPL, in order to provide visual feedback that the PinePhone is booting.

---
Changes in v2:
- add a Reviewed-by record

 configs/pinephone_defconfig | 6 ++++++
 1 file changed, 6 insertions(+)
configs/pinephone_defconfig +6 -0
index 64e13d3132..9d39204a43 100644
@@ -1,6 +1,7 @@
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
 CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-pinephone-1.2"
+CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_SPL=y
 CONFIG_MACH_SUN50I=y
 CONFIG_SUNXI_DRAM_LPDDR3_STOCK=y
@@ -10,3 +11,8 @@ CONFIG_MMC_SUNXI_SLOT_EXTRA=2
 CONFIG_PINEPHONE_DT_SELECTION=y
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_OF_LIST="sun50i-a64-pinephone-1.1 sun50i-a64-pinephone-1.2"
+CONFIG_LED_STATUS=y
+CONFIG_LED_STATUS_GPIO=y
+CONFIG_LED_STATUS0=y
+CONFIG_LED_STATUS_BIT=114
+CONFIG_LED_STATUS_STATE=2
Signature · 1 line
2.33.0
maintainer Reviewed-by Tested-by on v2 2/2
#4 lore raw

Re: [PATCH v2 2/2] pinephone_defconfig: add support for early-boot status LED

Quoted 5 lines · Arnaud Ferraris

This commit enables the green status LED (PD18/GPIO 114) on boot in the SPL, in order to provide visual feedback that the PinePhone is booting.

Thanks for the patch!
Samuel