imx6sx gpio irq allocated failed

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx6sx gpio irq allocated failed

1,805 Views
pisces
Contributor II

Hi NXP's engineers,

Based on imx6sx platform, we created a wiegand port device, and  when we try open this device, it occationally report the gpio irq allocated error like this :

root@falcon-4866:/dev# cat wiegand_port3
[ 1197.666490] gpio gpiochip5: (20b0000.gpio): gpiochip_lock_as_irq: tried to flag a GPIO set as output for IRQ
[ 1197.676488] gpio-mxc 20b0000.gpio: unable to lock HW IRQ 8 for IRQ
[ 1197.688323] genirq: Failed to request resources for wiegand-gpio (irq 236) on irqchip gpio-mxc
[ 1197.697075] wiegand-gpio wiegand_port3: D0 IRQ 236 not allocated
cat: wiegand_port3: Input/output error
root@falcon-4866:/dev#

 

the related code is here:

/* Attach the interrupt handlers */
if (0 > request_irq(port->irq_number_d0,
(irq_handler_t)irq_handler_d0,
TRIGGER_EDGE,
DRIVER_NAME,
port))
{
dev_err (port->parent, "D0 IRQ %d not allocated\n", port->irq_number_d0);
spin_lock (&port->port_open_lock);
port->port_open = false;
spin_unlock (&port->port_open_lock);
return -EIO;
}

 

when the wiegand device call the open function, and try to allocate gpio irq, it sometimes report the irq allocation error.

Have you ever met this kind of issuss ?

thanks.

0 Kudos
3 Replies

1,791 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hi, Weigang,

 

According to your description, it looks like the reason why the interrupt was not released in time after it was used up.

(看上去像是,在request IRQ,使用完之后,没有及时地release;当再次request的时候,会提示IRQ占用)

 

Have a nice day!

B.R,

Weidong

0 Kudos

1,787 Views
pisces
Contributor II

Hi,

经过调查发现,原始是在open设备时,request gpio中断时,内核判断该gpio是 output属性,导致request gpio irq 失败。

但是很奇怪,不知道是哪里将该gpio设置成了output属性了。我们在probe函数里是明确初始化成input属性的。dts里也没有设置。

我们想了个规避方案,就是在open函数后,request irq之前,再次设置成一次input属性。目前这样修改后,这个问题不再复现了。

0 Kudos

615 Views
kaixa-lee
Contributor I

Hi,

我也出现了跟你一样的问题,经过排查确实是设备树里其他设备引用了这个引脚导致配置冲突内核无法申请中断,可以尝试cat /sys/kernel/debug/gpio 查看需要申请的引脚是否已经被其他设备使用。

0 Kudos