i.MX8M/8X GPIO probe failed

Showing results for 
Search instead for 
Did you mean: 

i.MX8M/8X GPIO probe failed

100% helpful (2/2)

i.MX8M/8X GPIO probe failed



When configure a gpio pin for a driver in the dts/dtsi file like below example,




a-switch {

           compatible = "a-switch-driver";

           pinctrl-names = "default";

           pinctrl-0 = <&pinctrl_switch>;

           gpios = <&lsio_gpio1 1 GPIO_ACTIVE_HIGH>;

           status = "okay";



pinctrl_switch: switch_gpio {
    fsl,pins = < IMX8QXP_SPI2_SDO_LSIO_GPIO1_IO01    0x21 >;


then you may get the error when request the gpio in the driver during the kernel boot up.


Error message like this:

a-switch: failed to request gpio

a-switch: probe of a-switch failed with error -22


Linux version: L5.4.x




Because the gpio_mxc_init function run before the function imx_scu_driver_init. The pm_domains for gpio is not ready before running mxc_gpio_probe, so gpio request will be failed.





There are two ways to resolve this issue
1. Build the driver as a module. i.e. select the driver in kernel’s menuconfig as “M”. Then , run “insmod” to load the driver after the kernel boot up.




2. Apply below patch, let gpio driver init after scu driver.

diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index 1dfe513f8fcf..52b5799040b3 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -892,7 +892,7 @@ static int __init gpio_mxc_init(void)
return platform_driver_register(&mxc_gpio_driver);


Version history
Revision #:
2 of 2
Last update:
‎10-27-2021 02:40 AM
Updated by: