riscv: dts: starfive: jh7110-common: keep the status power LED on
Subsystems (3)
PATCH 1/1 riscv: dts: starfive: jh7110-common: keep the status power LED on
The firmware turns the status power LED on, but the node has no default-state, so the LED switches off when leds-gpio probes and the board looks powered down.
Default the LED to on.
Tested on a VisionFive 2 v1.3B.
--- arch/riscv/boot/dts/starfive/jh7110-common.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/riscv/boot/dts/starfive/jh7110-common.dtsi +1 -0
@@ -44,6 +44,7 @@ leds { led_status_power: led-0 { gpios = <&aongpio 3 GPIO_ACTIVE_HIGH>; + default-state = "on"; }; };
base-commit: ddfe51b0a0f5dc9e415cc2c8ad8db17532dd426b
Signature · 1 line
2.43.0
Hi Owen,
Quoted 27 lines · Owen O'Hehir
The firmware turns the status power LED on, but the node has no default-state, so the LED switches off when leds-gpio probes and the board looks powered down.
Default the LED to on.
Tested on a VisionFive 2 v1.3B.
Fixes 1ec99dfe9eb0 ("riscv: dts: starfive: jh7110-common: add status power led node")Signed-off-by Owen O'Hehir <[email protected]>--- arch/riscv/boot/dts/starfive/jh7110-common.dtsi | 1 + 1 file changed, 1 insertion(+)arch/riscv/boot/dts/starfive/jh7110-common.dtsi +1
-0@@ -44,6 +44,7 @@ leds { led_status_power: led-0 { gpios = <&aongpio 3 GPIO_ACTIVE_HIGH>; + default-state = "on"; }; };
Quoted 1 line
base-commit:
ddfe51b0a0f5dc9e415cc2c8ad8db17532dd426b
I think this change may disagree with fastboot select function on VisionFive2 Lite, where (if I understand this correctly) it is read as an input; see that schematic listed as the "VisionFive 2 Lit Schematic":
https://www.starfivetech.com/en/index.php?s=docs&c=search&keyword=schematic
You may reference also the ghidra archive
https://web.archive.org/web/20260718140236/https://freeshell.de/e/riscv64/hrv-jhre-JH-7110%20BootROM%20analysis_2026_02_22.gar
for decompilation of JH-7110 BootROM loader, and there (to the best of my understanding) it is not interacting with that register so it must be purely the SoC reset state.
-E
Hi E,
Thanks for checking. You're right about the commit message: I saw the LED lit before Linux probes and assumed the firmware set it, without checking where it comes from.
On the Lite, the schematic (sheet 21) shows RGPIO3 driving the system LED and also used for fastboot detection, through jumper J20 that pulls it to 1.8 V via R257 (1k). Detection happens at reset, before Linux, and R257 limits the current whichever level the pin is driven to afterwards, so I don't think driving it high conflicts there.
Owen
Hi Owen,
Quoted 9 lines · Owen O'Hehir
Hi E,
Thanks for checking. You're right about the commit message: I saw the LED lit before Linux probes and assumed the firmware set it, without checking where it comes from.
On the Lite, the schematic (sheet 21) shows RGPIO3 driving the system LED and also used for fastboot detection, through jumper J20 that pulls it to 1.8 V via R257 (1k). Detection happens at reset, before Linux,
No, the software is not any concern for a hardware description.
Quoted 4 lines
and R257 limits the current whichever level the pin is driven to afterwards, so I don't think driving it high conflicts there.
Owen
It may or may not conflict in software operation but that has nothing to do with if it should be applied to device tree that describes hardware. Conor since applied, which is trusting you researched this correctly before sending to the list. I'm saying that all things being good in intention this is obviously not well researched, and not allowing for discussion to verify the fix before applying.
Anyways it is a user light not a power LED. Pine64 Star64 has a power LED and this user LED. If a board does not have power LED then co-opting the user LED is something that should be done in inittab not treating upstream device tree as a preferences config file for userland.
-E
Hi E,
Ok, fair point.
Conor, could you please drop this patch? Apologies for the hassle.
Owen
Hi E,
Ok, fair point.
Conor, could you please drop this patch? Apologies for the hassle.
Owen
From: Conor Dooley <[email protected]>
Quoted 9 lines · Owen O'Hehir
The firmware turns the status power LED on, but the node has no default-state, so the LED switches off when leds-gpio probes and the board looks powered down.
Default the LED to on.
Tested on a VisionFive 2 v1.3B.
[...]
Applied to riscv-dt-fixes, thanks!
[1/1] riscv: dts: starfive: jh7110-common: keep the status power LED on
https://git.kernel.org/conor/c/68dbe2550bd4
Thanks,
Conor.
Hi Conor,
Quoted 13 lines · Conor Dooley
From: Conor Dooley <[email protected]>
Quoted 9 lines · Owen O'Hehir
The firmware turns the status power LED on, but the node has no default-state, so the LED switches off when leds-gpio probes and the board looks powered down.
Default the LED to on.
Tested on a VisionFive 2 v1.3B.
[...]
Quoted 7 lines
Applied to riscv-dt-fixes, thanks!
[1/1] riscv: dts: starfive: jh7110-common: keep the status power LED on
https://git.kernel.org/conor/c/68dbe2550bd4Thanks,
Conor.
I replied this a moment earlier:
https://lore.kernel.org/lkml/[email protected]/
This disagrees with VisionFive 2 Lite schematic; if when this node is consumed by a bootloader it will be evident we are not describing the hardware correctly, no?
If you want the light on and it wasn't on at reset or due to boot ROM, then that is userland stuff and not hardware description... but that is your decision to make as maintainer.
-E
Conor Dooley
maintainerQuoted 24 lines · E Shattow
Hi Conor,
Quoted 13 lines · Conor Dooley
From: Conor Dooley <[email protected]>
Quoted 9 lines · Owen O'Hehir
The firmware turns the status power LED on, but the node has no default-state, so the LED switches off when leds-gpio probes and the board looks powered down.
Default the LED to on.
Tested on a VisionFive 2 v1.3B.
[...]
Quoted 7 lines
Applied to riscv-dt-fixes, thanks!
[1/1] riscv: dts: starfive: jh7110-common: keep the status power LED on
https://git.kernel.org/conor/c/68dbe2550bd4Thanks,
Conor.
Quoted 6 lines
I replied this a moment earlier:
https://lore.kernel.org/lkml/[email protected]/This disagrees with VisionFive 2 Lite schematic; if when this node is consumed by a bootloader it will be evident we are not describing the hardware correctly, no?
I am not sure if that's actually relevant though? If the visionfive2lite needs this gpio then it shouldn't be listed in a leds node. Changing the default status of it doesn't affect the fact that it is wrong to begin with, wrong before the patch and wrong afterwards. If there are some boards that include this common.dtsi but don't have these leds, they're not common and should be moved to the relevant dts files. If you know what those are, please send a patch doing the move.
Quoted 3 lines
If you want the light on and it wasn't on at reset or due to boot ROM, then that is userland stuff and not hardware description... but that is your decision to make as maintainer.
It's a power status led, I think it's pretty reasonable for it to actually represent power status without intervention in userspace, the alternative I guess could be something like setting the function property to "power" - but I'm not sure if that does anything for gpio-leds.
Cheers,
Conor.
Hi Conor,
Quoted 32 lines · Conor Dooley
Quoted 24 lines · E Shattow
Hi Conor,
Quoted 13 lines · Conor Dooley
From: Conor Dooley <[email protected]>
Quoted 9 lines · Owen O'Hehir
The firmware turns the status power LED on, but the node has no default-state, so the LED switches off when leds-gpio probes and the board looks powered down.
Default the LED to on.
Tested on a VisionFive 2 v1.3B.
[...]
Quoted 7 lines
Applied to riscv-dt-fixes, thanks!
[1/1] riscv: dts: starfive: jh7110-common: keep the status power LED on
https://git.kernel.org/conor/c/68dbe2550bd4Thanks,
Conor.Quoted 6 lines
I replied this a moment earlier:
https://lore.kernel.org/lkml/[email protected]/This disagrees with VisionFive 2 Lite schematic; if when this node is consumed by a bootloader it will be evident we are not describing the hardware correctly, no?
Quoted 7 lines
I am not sure if that's actually relevant though? If the visionfive2lite needs this gpio then it shouldn't be listed in a leds node. Changing the default status of it doesn't affect the fact that it is wrong to begin with, wrong before the patch and wrong afterwards. If there are some boards that include this
common.dtsibut don't have these leds, they're not common and should be moved to the relevant dts files. If you know what those are, please send a patch doing the move.
All JH-7110 boards with published schematics have this configurable LED. Some board(s) have this same RGPIO also connected to an input jumper for fastboot selection. Some board(s) have an additional power LED that is not configurable and so not represented in device tree.
Quoted 10 lines
Quoted 4 lines
If you want the light on and it wasn't on at reset or due to boot ROM, then that is userland stuff and not hardware description... but that is your decision to make as maintainer.
It's a power status led, I think it's pretty reasonable for it to actually represent power status without intervention in userspace, the alternative I guess could be something like setting the function property to "power" - but I'm not sure if that does anything for gpio-leds.
Sure, if this is updated as a per-board user-LED function property by reference to published hardware description (silkscreen or published schematics) then that's at least verifiable; Vendor firmware that showcases as heartbeat or whatever less convincingly-so.
Debian users should be reminded that these LED functions are compiled as modules for Debian kernel config and so the setting of property to "power" or "heartbeat" e.g. is further dependent on whether the initrd was generated with including those modules. The LED function mode (or lack thereof) from passed fdt structure can be set with an override on the corresponding kernel command line argument.
Quoted 3 lines
Cheers,
Conor.
-E
Hi Conor,
You may have missed my email on Friday at 21:12.
I think E has a point. There is a separate red LED on the board that shows power. My confusion came from the net that drives this green LED, which is labelled STS_PWR. This green LED has no silkscreen label and the schematic is ambiguous on this particular LED.
It is probably better to drop this patch. Apologies again.
Owen
Conor Dooley
maintainerQuoted 10 lines · Owen O'Hehir
Hi Conor,
You may have missed my email on Friday at 21:12.
I think E has a point. There is a separate red LED on the board that shows power. My confusion came from the net that drives this green LED, which is labelled
STS_PWR. This green LED has no silkscreen label and the schematic is ambiguous on this particular LED.It is probably better to drop this patch. Apologies again.
Okay, no worries.