HW: i.MX8QM MEK
SW: LF-v5.10.9_1.0.0
USDHC1_DATA7 -- > LSIO_GPIO5_IO22


imx8qm-mek-gpio-poweroff.dts
#include "imx8qm-mek.dts"
/{
gpio-keys {
compatible = "gpio-keys";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_gpio_keys>;
power {
label = "GPIO Key Power";
linux,code = <KEY_POWER>;
gpios = <&lsio_gpio5 22 GPIO_ACTIVE_LOW>;
debounce-interval = <50>;
};
};
};
&iomuxc {
/delete-node/ pinctrl_usdhc2;
/delete-node/ pinctrl_usdhc2_gpio;
pinctrl_gpio_keys: gpio_keys_grp {
fsl,pins = <
IMX8QM_USDHC1_DATA7_LSIO_GPIO5_IO22 0x00000021
>;
};
};
&usdhc2 {
status = "disabled";
};
event check:
plugin sdcard to tigger the pin(sdcard CD, now it is LSIO_GPIO5_IO22 )

check the power off:
1. modify the /etc/systemd/logind.conf and restart systemd or reboot the board
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
HandlePowerKey=poweroff
# i.MX-specific
#HandlePowerKey=ignore
#HandleSuspendKey=suspe
2. plugin sdcard to tigger the pin(sdcard CD, now it is LSIO_GPIO5_IO22 )
