md.jamal
md.jamal

Reputation: 4567

Setting GPIO using sysfs fails in i.MX6

I have a custom i.MX6 board, and I want to turn on a particular GPIO.

From the schematic, the GPIO pin is connected to KEY_COL2 pad, and the KEY_COL2 has the following options.

enter image description here

So, I have to export the following GPIO as per the calculation:

linux gpio number = (gpio_bank - 1) * 32 + gpio_bit

gpio number = ( 4 - 1 ) *32 +10 = 106

When I run the following command, i get the error:

# echo 106 > /sys/class/gpio/export
sh: write error: Device or resource busy

What can be the issue, am i missing anything...

Upvotes: 1

Views: 1047

Answers (1)

md.jamal
md.jamal

Reputation: 4567

After looking at the device tree, this particular GPIO was used by some other device, hence the error.

You can find the GPIO's in use with the following commands:

 mount -t debugfs none /sys/kernel/debug

 cat /sys/kernel/debug/gpio

Upvotes: 1

Related Questions