Cannot set GPIO value

I am trying to set the value of GPIO1.14 (SODIMM 99) from userspace, on my custom carrier board. According to this mapping, it is pin number 14. I’ve used these commands:

echo 14 > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio14/direction
echo 0 > /sys/class/gpio/gpio14/value
echo 1 > /sys/class/gpio/gpio14/value

The problem is that the pin is always high.

I’ve also tried with gpioset. I confirm that the pin’s state changes correctly in the output of cat /sys/kernel/debug/gpio. E.g., the output after echo 0:

cat /sys/kernel/debug/gpio | grep 99
 gpio-14  (SODIMM_99           |sysfs               ) out lo 

I also confirm that there is no hardware problem (the pin is connected to a pulldown resistor and I have verified the connectivity from the SODIMM 99 pad to resistor’s pad).

I did not encounter this problem with other pins. My device tree is based on the Iris v2 device tree and I have attached my diff file.

Does anybody know what is the problem?

To work as a generic GPIO and be set through sysfs your pinctrl_modem node should be included in pinctrl-0 group of &iomux node. As it done for pinctrl_gpio1 … pinctrl_gpio7 here.

Please note that the long famous sysfs GPIO interface (/sys/class/gpio) has been deprecated, the GPIO Char Device API, also known as libgpiod has been adopted by the Linux kernel community as the replacement. The sysfs interface is still supported by Toradex BSPs but you are discouraged to use it.

Thank you for the suggestion. I will try it tomorrow and let you know the result.

I know about sysfs. I used it just for testing.

But why do the pins from my other custom pinctrls work, taking into account that I did not add none of my pinctrls to the pinctrl-0 group? Even SODIMM 135 works and it is part of the same pinctrl (pinctrl_modem).

I confirm that the solution works. Thank you.

Thank you for the update.