Normal gpio works, but LED4, LED5 in ixora board do not work

Hardware: apalis-imx6 SoM, ixora carrier board
Software: latest multimedia upstream image

Not work:
led4_red:at first, the light is on,
pin number is 178, use gpioinfo got bank is 0, line is 12, so gpioset 0 12=0, but the light is still on.

Works:
gpio1: at first, the voltage is 0,
use gpioinfo got bank is 1, line is 4, so use gpioset 1 4=1, test the voltage, result is 3.3 V

I found in the schematics that these 2 LEDs are used by SDIO and SDCard repectively.
So the question changed to: how to modify device tree source to release these 2 LEDs?

Hi @Thauzei , what is the OS installed on Apalis iMX6? Check it by cat /etc/os-release and uname -a.

root@apalis-imx6-05197972:~#
root@apalis-imx6-05197972:~# uname -a
Linux apalis-imx6-05197972 6.1.37-6.3.0+git.0f4ac6b4c5f0 #1 SMP Sat Jul  1 11:16:27 UTC 2023 armv7l armv7l armv7l GNU/Linux
root@apalis-imx6-05197972:~# cat /etc/os-release
ID=tdx-xwayland-upstream
NAME="TDX Wayland with XWayland Upstream"
VERSION="6.3.0+build.7 (kirkstone)"
VERSION_ID=6.3.0-build.7
PRETTY_NAME="TDX Wayland with XWayland Upstream 6.3.0+build.7 (kirkstone)"
DISTRO_CODENAME="kirkstone"
root@apalis-imx6-05197972:~#

There is a device tree binaries for two versions of Ixora. They are imx6q-apalis-ixora-v1.2.dtb and imx6q-apalis-ixora-v1.1.dtb. If you have Ixora V1.2, set the following in u-boot command line mode.

setenv fdtfile imx6q-apalis-ixora-v1.2.dtb
setenv fdt_board ixora-v1.2
saveenv

After a reboot, LED nodes exist at /sys/class/leds.

root@apalis-imx6-10767660:/sys/class/leds# ls
LED_4_GREEN  LED_4_RED  LED_5_GREEN  LED_5_RED  mmc0::  mmc2::

Turn on and off the LEDs .

root@apalis-imx6-10767660:/sys/class/leds# echo 1 > LED_4_RED/brightness
root@apalis-imx6-10767660:/sys/class/leds# echo 0 > LED_4_RED/brightness

If you would like to set these pins to GPIO, you have to modify the device tree according to this guide.

Thank you, I tried and it works.
I still have 3 questions:

  1. The default value of uboot env “fdtfile” is “imx6q-apalis-ixora.dtb”, what is the version of this dtb, is it v1.0?
  2. What is the differnce among ixora-v1.2, v1.1 and perhaps v1.0 if it exist?
  3. There is a label in my board says it’s “Ixora V1.1A 10592821”, why it’s OK to use v1.2 DTB?

By the way, the easiest way to modify the dtb file, is to use a device-tree-compiler (also a de-compiler), I have used it before. In ubuntu (20.04) sudo apt install device-tree-compiler can install it.

fdtfile is not defined in default U-Boot env. During boot, preboot will set it. The default fdt_board is eval referring to Apalis Evaluation Board. Ixora V1.2, V1.1 and Apalis Evaluation Board share a lot in common features. Either device tree can bring up the Linux system. However, some features may be missing. For example, the above LED_4_GREEN, LED_4_RED, LED_5_GREEN and LED_5_RED are not defined in imx6q-apalis-eval.dtb.

Apalis iMX6 # env default -fa
## Resetting to default environment
Apalis iMX6 # print fdtfile
## Error: "fdtfile" not defined
Apalis iMX6 # print preboot
preboot=test -n ${fdtfile} || setenv fdtfile imx6q-apalis-${fdt_board}.dtb
Apalis iMX6 # print fdt_board
fdt_board=eval

Here you will find the difference between Ixora V1.2 and V1.1.

Yes, the default fdtfile value is imx6q-apalis-eval.dtb, I mixed them up.