How to find out which Linux driver is hogging my GPIO

I have a pad multiplxed as GPIO on my board. When I try to export it via /sys/class/gpio/export, I get

-sh: echo: write error: Device or resource busy

My guess is some other driver is requesting this pad before I get that chance. How can I find out what is reserving it?


  • On the Boundary Devices kernel, and maybe others, you can use cat /sys/kernel/debug/gpio to get a list of the mapped gpios, their states, and name given when it was allocated. You can grep the kernel source for the name and find out what module grabbed it.

    root@nitrogen6x:/opt# cat /sys/kernel/debug/gpio 
    GPIOs 0-31, platform/209c000.gpio, 209c000.gpio:
     gpio-2   (flexcan-trx-stby    ) out lo    
     gpio-17  (DISP_SCL            ) out lo    
    GPIOs 32-63, platform/20a0000.gpio, 20a0000.gpio:
     gpio-33  (sysfs               ) out lo    
     gpio-35  (sysfs               ) in  hi    
     gpio-36  (sysfs               ) in  hi    
     gpio-37  (DISP_SDI            ) out lo    
     gpio-38  (219c000.usdhc cd    ) in  hi    
    GPIOs 64-95, platform/20a4000.gpio, 20a4000.gpio:
     gpio-83  (spi_imx             ) out lo    
     gpio-86  (usb_otg_vbus        ) out lo    
    GPIOs 96-127, platform/20a8000.gpio, 20a8000.gpio:
     gpio-101 (sysfs               ) in  hi    
     gpio-116 (rst-gpios           ) out lo    
    GPIOs 128-159, platform/20ac000.gpio, 20ac000.gpio:
    GPIOs 160-191, platform/20b0000.gpio, 20b0000.gpio:
     gpio-175 (wlan-en             ) out lo    
     gpio-176 (bt_rfkill_reset     ) out lo    
    GPIOs 192-223, platform/20b4000.gpio, 20b4000.gpio:
     gpio-192 (2198000.usdhc cd    ) in  lo    
     gpio-204 (ehci_reset_gpio     ) out lo    
     gpio-205 (sysfs               ) in  lo