imx8 linux gpio-keys using gpio interrupt example

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

imx8 linux gpio-keys using gpio interrupt example

跳至解决方案
3,653 次查看
flobro
Contributor III

I would like to use a GPIO on the IMX8M plus as an input for the Linux gpio-keys driver. I have not been able to find any examples of the device tree entries required to enable the interrupts  for a GPIO input bit to act as a "keypress".

标记 (4)
0 项奖励
回复
1 解答
3,576 次查看
flobro
Contributor III

Thanks for the response. I found out that there is GPIO support (gpio-mxc.c) that appears to handle the GPIO setup for interrupts properly, so I get a event from the "gpio-keys" config I set up in the device tree.

The only issue (not) is that there is more than just one or more bytes that get sent as an event. Good thing all I care about is that there is an event after the gpio changes state (vary rarely) which allow a blocking read to monitor it.

在原帖中查看解决方案

0 项奖励
回复
4 回复数
3,047 次查看
flobro
Contributor III

There are a few web pages that talk about setting up the device tree for gpio-keys:


https://www.kernel.org/doc/Documentation/devicetree/bindings/input/gpio-keys.txt

https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842398/Linux+GPIO+Driver?view=blog#LinuxGPIO...

 

You have to modify the GPIO pin information to match your board design. This allows your GPIO to send a "key code" to an input driver (/dev/input/event0) that works kind of like an interrupt if a program does a blocking read on the input.

0 项奖励
回复
3,625 次查看
Chavira
NXP TechSupport
NXP TechSupport

Hi @flobro!

Thank you for contacting NXP Support!

 

For our boards, we don´t have examples, but you can see the documentation of the kernel following the link:

 

https://github.com/nxp-imx/linux-imx/blob/lf-6.1.y/Documentation/devicetree/bindings/gpio/gpio.txt

 

https://github.com/nxp-imx/linux-imx/blob/lf-6.1.y/Documentation/devicetree/bindings/gpio/fsl-imx-gp...

 

Best Regards!

 

Chavira

0 项奖励
回复
3,577 次查看
flobro
Contributor III

Thanks for the response. I found out that there is GPIO support (gpio-mxc.c) that appears to handle the GPIO setup for interrupts properly, so I get a event from the "gpio-keys" config I set up in the device tree.

The only issue (not) is that there is more than just one or more bytes that get sent as an event. Good thing all I care about is that there is an event after the gpio changes state (vary rarely) which allow a blocking read to monitor it.

0 项奖励
回复
3,055 次查看
Marco_Savo
Contributor II

Hello, the same, I can see

gpio_keys

Don't work on the board imx8, can you share your configuration?

0 项奖励
回复