基于Volumio的Nanopi Neo Air内核LED驱动异常排查求助
/sys/class/leds on Nanopi Neo Air Volumio Custom Kernel Let's break down why your green power LED isn't working and /sys/class/leds is empty, even with seemingly correct kernel configs and DTS entries. Here are the key areas to investigate step by step:
Verify the Device Tree LED Node Was Properly Loaded
Your DTS defines the LED nodes, but we need to confirm the running kernel actually picked them up. Extract the active device tree with this command:dtc -I fs /proc/device-tree > active_dts.dtsOpen
active_dts.dtsand check for theledsnode:- Ensure the
pwr(green LED) node exists with the correct GPIO pin (<&r_pio 0 10 GPIO_ACTIVE_HIGH>) - Confirm the
pinctrl-0references (&leds_npi,&leds_r_npi) are present and configured to set those pins as GPIO outputs (not alternate functions like UART or SPI)
If the node is missing or misconfigured, your DTS wasn't properly included in the kernel's device tree blob (dtb) during compilation.
- Ensure the
Check GPIO Controller Drivers Are Enabled
LED functionality depends entirely on the underlying GPIO controller working. For the Nanopi Neo Air'sr_pio(right-side GPIO bank), confirm these kernel configs are built-in (not modules):CONFIG_PINCTRL_SUNXI=y CONFIG_PINCTRL_SUN8I_R=yVerify they're present in your built-in modules list:
grep -i sun8i /lib/modules/$(uname -r)/modules.builtinIf the GPIO controller driver isn't active, the LED subsystem can't access the pins, so no
/sys/class/ledsentries will be created.Inspect Kernel Boot Logs for LED/GPIO Errors
Kernel logs often reveal initialization failures. Run these commands to find relevant messages:dmesg | grep -i led dmesg | grep -i gpio dmesg | grep -i pinctrlLook for red flags like:
- "GPIO pin X is already in use by another device" (pin conflict)
- "Failed to parse LED node" (DTS syntax issue)
- "pinctrl: could not request pin X" (incorrect pin mux configuration)
These will point directly to why the LED subsystem isn't initializing.
Test GPIO Functionality Manually
To rule out hardware issues, try controlling the green LED via GPIO sysfs directly:- Calculate the correct GPIO number for
r_pio 0 10(on Sunxi platforms,r_piostarts at GPIO 128, so this would be128 + 10 = 138). - Export the GPIO:
echo 138 > /sys/class/gpio/export - Set it to output and turn it on:
echo out > /sys/class/gpio/gpio138/direction echo 1 > /sys/class/gpio/gpio138/value
If the LED lights up, the hardware is working, and the issue is definitely in the kernel's device tree or GPIO controller configuration. If it doesn't, double-check the pin mapping or physical hardware connections.
- Calculate the correct GPIO number for
Confirm LED Subsystem Dependencies
Even though you have trigger configs enabled, ensure core LED subsystem components are fully initialized. Double-check thatCONFIG_GPIO_SUNXI=y(main GPIO driver) is enabled alongside your existing LED configs—this is a critical dependency forleds-gpioto work.
内容的提问来源于stack exchange,提问作者Julien Julien

