but at the end, when I’m checking the pin setting via cat /sys/kernel/debug/40048000.iomuxc/pinconf-pins | grep PTB21, I get 0x22ed, which is the setting of pinctrl_can_int that is not used by any node …
However if I also delete the pinctrl_can_int group, I get the expected pin setting (0x22cd).
This is a behavior which is particular to the Vybrid GPIO driver. In Vybrid, the GPIO and pinctrl drivers have some direct dependencies: The direction of the pin is controlled through pinctrl registers. But there is no explicit link between a GPIO and a particular pinctrl setting of a pad where a GPIO is available on… Now when the GPIO driver requests the pinctrl driver to enable the pin the pinctrl driver searches through all pinctrl settings to find the pinctrl register matching the GPIO number (offset). The first pinctrl setting which comes up will be used (see pinctrl-imx.c)…
This is arguable somewhat hacky. However, it emulates the behavior of other SoC, where it is not necessary to explicitly mux a pin before they can be used as GPIO.
In your case, it seems that the mux of pinctrl_can_int appears earlier in the list then your new pinctrl_gpio_keys pinmux. To work around this, just remove (or use delete-node) the can_int pinmux.
Deleting the can_int node solve the issue, but now I’m facing a similar issue with DCU pins that I want to use with gpioleds driver.
From my dtb, I set it with:
But at the end, with cat /sys/kernel/debug/40048000.iomuxc/pinctrl/pinconf-pins | grep PTE21, I get:
pin 126 (VF610_PAD_PTE21):0x101902
and no other pingroups are using this pin.