AnsweredAssumed Answered

Device Tree for GPIO Push Button

Question asked by danielbujak on Jul 17, 2017
Latest reply on Jul 18, 2017 by danielbujak

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 */
      >;
    };

Outcomes