imx8 linux gpio-keys using gpio interrupt example

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

imx8 linux gpio-keys using gpio interrupt example

Jump to solution
1,546 Views
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".

0 Kudos
1 Solution
1,469 Views
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.

View solution in original post

0 Kudos
4 Replies
940 Views
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 Kudos
1,518 Views
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 Kudos
1,470 Views
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 Kudos
948 Views
Savo
Contributor II

Hello, the same, I can see

gpio_keys

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

0 Kudos