Device Tree for GPIO Push Button

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

Device Tree for GPIO Push Button

7,488 Views
danielbujak
Contributor III

Hi all, I'm working on a board based on the iMX6ul evk, and am trying to register push button presses in user space. Based on the research I've done, the best way to do this is via gpio-keys in the device tree. So far I've gotten the below code. The device tree compiles but there is no documentation on how to handle this in the user space. So I have 2 questions:

  1. Is GPIO-KEYS the correct binding to use if I want to trigger a script to run based on a GPIO toggle for example?
  2. Is there documentation on how to handle this and other bindings in user space?

  /* Input button configuration */
  gpio_keys {
      compatible = "gpio-keys";
      pinctrl-names = "default";
      pinctrl-0 = <&pinctrl_gpiokeys>;      
      #address-cells = <1>;
      #size-cells = <0>;
      autorepeat;

      test-btn {
        label = "Test-Input";
        linux,code = <28>;
        gpios = <&gpio1 31 GPIO_ACTIVE_LOW>;
      };
  };

    pinctrl_gpiokeys: gpiokeygrp {
      fsl,pins = <
        MX6UL_PAD_UART5_RX_DATA__GPIO1_IO31    0x000010B0  /* USER Push Button */
      >;
    };

Labels (1)
Tags (1)
0 Kudos
2 Replies

2,654 Views
igorpadykov
NXP Employee
NXP Employee

Hi danielbujak

one can check examples on

https://community.freescale.com/thread/381277 

Definitive GPIO guide - Studio Kousagi Wiki 

for documentation one can look at common linux documentation

https://www.kernel.org/doc/Documentation/gpio/sysfs.txt 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

2,654 Views
danielbujak
Contributor III

Thanks, this looks like it will be helpful for some background understanding. I have the gpio-keys somewhat working but I'm having no luck with the gpio-reset. Is there some more documentation on that than what's in the Documentation/devicetree/bindings/reset?

0 Kudos