Verdin IMX8MP + Ivy board LEDs

@ToradexAI

I changed the file according to your recommendation. I still get the same error:

=> Adding device-tree overlay 'verdin-imx8mp_backlight_overlay.dts'
Error: verdin-imx8mp_backlight_overlay.dts:7.13-14 syntax error
FATAL ERROR: Unable to parse input tree
error: cannot apply verdin-imx8mp_backlight_overlay.dts.

Hello @mvo,

Sorry about the delay in getting back to you here. It took some time for me to figure this out.
In case it is helpful for anyone else browsing around here, the first thing important is to set the device tree to that for ivy board (# setenv fdtfile imx8mp-verdin-wifi-ivy.dtb) if it is not correctly set - by default, the Torizon OS and BSP images use the device tree file for verdin dev board.

The LEDs should be available and can be controlled through the /sys/class/leds/ interface. You can toggle all LEDs (D9, D5, D8, D7) using this. (By default, D9.Green is always ON and cannot be controlled, D5 is always ON and is Green - you will see why in the schematics of Ivy - section LEDs). This will leave you with the options to toggle the following LEDs:
D9: Red, Blue
D8: Red, Blue, Green
D7: Red, Blue, Green

This is what you will have by default in /sys/class/leds/:

root@verdin-imx8mp-15035975:~# ls /sys/class/leds/
blue:status-1  blue:status-2  blue:status-3  green:status-1  green:status-2  red:status-1  red:status-2  red:status-3

where,
status-1 → D7
status-2 → D8
status-3 → D9

You can toggle any of these available LEDs by writing 1 to the brightness as in:
root@verdin-imx8mp-15035975:/sys/class/leds/blue:status-3# echo 1 > brightness

Testing all these LEDs will give you an indication that these LEDs are configured correctly in the device tree. However, toggling them via GPIO does not work for all of them yet. This is because the pin control for leds is not added into pinctrl-0 for iomuxc yet. So I modified the file imx8mp-verdin-ivy.dtsi to add it. Also, the GPIOs for certain pins (SODIMM 30, 32, 34, 54) were left unnamed in this device tree. I gave it a name and rebuilt the device tree. Here is my diff:

diff --git a/arch/arm64/boot/dts/freescale/imx8mp-verdin-ivy.dtsi b/arch/arm64/boot/dts/freescale/imx8mp-verdin-ivy.dtsi
index db1b4ee7728c..cdbf77f2f049 100644
--- a/arch/arm64/boot/dts/freescale/imx8mp-verdin-ivy.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mp-verdin-ivy.dtsi
@@ -328,7 +328,7 @@ &gpio1 {
 &gpio3 {
        gpio-line-names =
                "", /* 0 */
-               "",
+               "LED_D8_GREEN", /* SODIMM 54 */
                "",
                "",
                "",
@@ -346,13 +346,13 @@ &gpio3 {
                "REL3", /* SODIMM 64 */
                "",
                "",
-               "",
+               "LED_D7_RED", /* SODIMM 34 */ 
                "", /* 20 */
                "",
+               "LED_D7_GREEN", /* SODIMM 32 */
                "",
                "",
-               "",
-               "",
+               "LED_D7_BLUE", /* SODIMM 30 */
                "",
                "",
                "",
@@ -482,7 +482,7 @@ &iomuxc {
 
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_gpio2>, <&pinctrl_gpio3>,
-                   <&pinctrl_ivy_dig_inputs>, <&pinctrl_ivy_relays>;
+                   <&pinctrl_ivy_dig_inputs>, <&pinctrl_ivy_relays>, <&pinctrl_ivy_leds>;
 
        pinctrl_ivy_dig_inputs: ivydiginputsgrp {
                fsl,pins =

Once this device tree is built and applied, you will see all these GPIO pins named and available in gpioinfo. (The truth is, these pins were available earlier but were unnamed, and could also be toggled with the right gpiochip and line numbers, after you add pinctrl_ivy_leds into pinctrl-0). With the above change in the devie tree, you should see those GPIO pins with the new names:

root@verdin-imx8mp-15035975:~# gpioinfo
gpiochip0 - 32 lines:
        line   0:       unnamed                 output active-low consumer=spi1 CS1
        line   1:       "GPIO2"                 input
        line   2:       unnamed                 input
        line   3:       unnamed                 input
        line   4:       unnamed                 input
        line   5:       "GPIO3"                 input
        line   6:       unnamed                 output active-low consumer=spi1 CS2
        line   7:       unnamed                 output consumer=mux
        line   8:       unnamed                 output consumer=mux
        line   9:       unnamed                 output
        line  10:       unnamed                 input
        line  11:       unnamed                 input
        line  12:       unnamed                 output consumer=regulator-usb1-vbus
        line  13:       unnamed                 input
        line  14:       unnamed                 output consumer=regulator-usb2-vbus
        line  15:       unnamed                 input
        line  16:       unnamed                 input
        line  17:       unnamed                 input
        line  18:       unnamed                 input
        line  19:       unnamed                 input
        line  20:       unnamed                 input
        line  21:       unnamed                 input
        line  22:       unnamed                 input
        line  23:       unnamed                 input
        line  24:       unnamed                 input
        line  25:       unnamed                 input
        line  26:       unnamed                 input
        line  27:       unnamed                 input
        line  28:       unnamed                 input
        line  29:       unnamed                 input
        line  30:       unnamed                 input
        line  31:       unnamed                 input
gpiochip1 - 32 lines:
        line   0:       unnamed                 input
        line   1:       unnamed                 input
        line   2:       unnamed                 input
        line   3:       unnamed                 input
        line   4:       unnamed                 input
        line   5:       unnamed                 input
        line   6:       "SODIMM_143"            input
        line   7:       "SODIMM_141"            input
        line   8:       unnamed                 input
        line   9:       unnamed                 input
        line  10:       "SODIMM_161"            input consumer="id"
        line  11:       unnamed                 output consumer=regulator-wifi-en
        line  12:       "SODIMM_84"             input active-low consumer="cd"
        line  13:       "SODIMM_78"             input
        line  14:       "SODIMM_74"             input
        line  15:       "SODIMM_80"             input
        line  16:       "SODIMM_82"             input
        line  17:       "SODIMM_70"             input
        line  18:       "SODIMM_72"             input
        line  19:       unnamed                 input
        line  20:       unnamed                 output consumer=regulator-module-eth1phy
        line  21:       unnamed                 input
        line  22:       unnamed                 input
        line  23:       unnamed                 input
        line  24:       unnamed                 input
        line  25:       unnamed                 input
        line  26:       unnamed                 input
        line  27:       unnamed                 input
        line  28:       unnamed                 input
        line  29:       unnamed                 input
        line  30:       unnamed                 input
        line  31:       unnamed                 input
gpiochip2 - 32 lines:
        line   0:       unnamed                 input
        line   1:       "LED_D8_GREEN"          input
        line   2:       unnamed                 input
        line   3:       unnamed                 input
        line   4:       unnamed                 input
        line   5:       unnamed                 input
        line   6:       "DIG_1"                 input
        line   7:       "DIG_2"                 input
        line   8:       "REL1"                  input
        line   9:       "REL2"                  input
        line  10:       unnamed                 input
        line  11:       unnamed                 input
        line  12:       unnamed                 input
        line  13:       unnamed                 input
        line  14:       "REL4"                  input
        line  15:       unnamed                 input
        line  16:       "REL3"                  input
        line  17:       unnamed                 input
        line  18:       unnamed                 input
        line  19:       "LED_D7_RED"            input
        line  20:       unnamed                 input
        line  21:       unnamed                 input
        line  22:       "LED_D7_GREEN"          input
        line  23:       unnamed                 input
        line  24:       unnamed                 input
        line  25:       "LED_D7_BLUE"           input
        line  26:       unnamed                 input
        line  27:       unnamed                 input
        line  28:       unnamed                 input
        line  29:       unnamed                 input
        line  30:       unnamed                 input
        line  31:       unnamed                 input
gpiochip3 - 32 lines:
        line   0:       "SODIMM_252"            input active-low consumer="Wake-Up"
        line   1:       "SODIMM_222"            input
        line   2:       "SODIMM_36"             input
        line   3:       "SODIMM_220"            input
        line   4:       "SODIMM_193"            input
        line   5:       "SODIMM_191"            input
        line   6:       "SODIMM_201"            input
        line   7:       "SODIMM_203"            input
        line   8:       "SODIMM_205"            input
        line   9:       "SODIMM_207"            input
        line  10:       "SODIMM_199"            input
        line  11:       "SODIMM_197"            input
        line  12:       "SODIMM_221"            input
        line  13:       "SODIMM_219"            input
        line  14:       "SODIMM_217"            input
        line  15:       "SODIMM_215"            input
        line  16:       "SODIMM_211"            input
        line  17:       "SODIMM_213"            input
        line  18:       "SODIMM_189"            input
        line  19:       "SODIMM_244"            output consumer="PCIe reset"
        line  20:       "SODIMM_38"             input
        line  21:       unnamed                 input
        line  22:       "SODIMM_76"             output consumer="regulator-usdhc2"
        line  23:       "SODIMM_135"            input
        line  24:       "SODIMM_133"            input
        line  25:       "SODIMM_17"             input
        line  26:       "SODIMM_24"             input
        line  27:       "SODIMM_26"             input
        line  28:       "SODIMM_21"             input
        line  29:       "SODIMM_256"            output consumer="regulator-force-sleep-moci"
        line  30:       "SODIMM_48"             input
        line  31:       "SODIMM_44"             input
gpiochip4 - 32 lines:
        line   0:       "SODIMM_42"             input
        line   1:       "SODIMM_46"             input
        line   2:       "SODIMM_187"            input
        line   3:       "SODIMM_20"             input
        line   4:       "SODIMM_22"             input
        line   5:       "SODIMM_15"             input
        line   6:       "SODIMM_196"            input
        line   7:       "SODIMM_200"            input
        line   8:       "SODIMM_198"            input
        line   9:       "SODIMM_202"            output active-low consumer="spi1 CS0"
        line  10:       unnamed                 input
        line  11:       unnamed                 input
        line  12:       unnamed                 input
        line  13:       unnamed                 input
        line  14:       unnamed                 output drive=open-drain consumer=scl
        line  15:       unnamed                 input drive=open-drain consumer=sda
        line  16:       "SODIMM_55"             input
        line  17:       "SODIMM_53"             input
        line  18:       "SODIMM_95"             output drive=open-drain consumer="scl"
        line  19:       "SODIMM_93"             input drive=open-drain consumer="sda"
        line  20:       "SODIMM_14"             output drive=open-drain consumer="scl"
        line  21:       "SODIMM_12"             input drive=open-drain consumer="sda"
        line  22:       "SODIMM_129"            input
        line  23:       "SODIMM_131"            input
        line  24:       "SODIMM_137"            input
        line  25:       "SODIMM_139"            input
        line  26:       "SODIMM_147"            input
        line  27:       "SODIMM_149"            input
        line  28:       "SODIMM_151"            input
        line  29:       "SODIMM_153"            input
        line  30:       unnamed                 input
        line  31:       unnamed                 input

With this, you can toggle those LEDs with GPIO using the gpioset commands.