Imx7: should GPIOs keep their states during system shutdown

Hello everyone!
I am working on a product that uses Colibri iMX7 SoM with a custom carrier board. As for software, we are using Yocto with Toradex BSP and custom meta-layer.
Some time ago, we have updated Yocto and BSP to 5.x.y version (previously we were using LTS 3). Of course we had to adjust our custom recipes but the board work correctly now although I have noticed one misbehavior and I am not sure if it’s intended.

So, we have a LED on the board and by default, pre-boot, when GPIOs are uninitialized, it is turned on, because of a pullup resistor. During the boot process, we initialize one of iMX7’s GPIOs and short the line to ground so the LED is turned off. So far so good.

The potential misbehavior is occurring when executing shutdown -h now command.

  • On the “old” system (LTS 3), 10-20s after executing the command, the LED was being “released” so it was going back to its default state - on.
  • On the “new” system (5.x.y), it looks like the GPIO that controls the LED is being kept in 0 state, so the LED is off.

At first I was thinking, that maybe the shutdown process doesn’t end correctly and hangs somewhere, causing the GPIO to not get “freed” properly but after some investigation, everything seems to be okay.
Following the advice from here, I have created a script file that should be executed as one of the last things during shutdown:

root@colibri-imx7-emmc:~# cat /lib/systemd/system-shutdown/                                                                                                           
mount -o remount,rw /
dmesg > /shutdown-log.txt
echo "asd" > /asd.txt
mount -o remount,ro /

So, the script gets executed, so it porbably indicates that the shutdown process ends correctly. According to that webpage, If normal reboot or poweroff never finish even after waiting a few minutes, the above method to create the shutdown log will not help and the log must be obtained using other methods
As for the logs, they look mostly the same between the two versions and they end in the same spot. I am not sure if I can post the whole dmesg so I can show you the endings for now:

shutdown_logs.txt (7.0 KB)

So, my question is - is it possible that the updated system behaves differently and somehow keeps the GPIOs state even after successful shutdown?

The thing is that after executing that shutdown command, we are cutting off iMX7’s power supply, so we would like to make sure that the shutdown is clean, to not get any file corruption etc.