AnsweredAssumed Answered

GPIO input read, device tree imx6 kernel

Question asked by michaeldiamond on Feb 25, 2015
Latest reply on Feb 27, 2015 by michaeldiamond

I am trying to read the value of an input. I am using kernel 3.10.17_1.0.2_ga. The only way I have found is to manually export the gpio and then read the value.

 

I have tried using the gpio-keys.

keys {
  compatible = "gpio-keys-polled";
  #address-cells = <1>;
  #size-cells = <0>;
  poll-interval = <20>;
  //autorepeat;
  gpio-pwr{
  label = "gpio-powerbutton";
  gpios = <&gpio2 1 1>;
  linux,code = <84>; /* KEY_RESERVED  */
  };
  gpio-charge{
  label = "gpio-charge";
  gpios = <&gpio2 2 0>;
  linux,code = <85>; /* KEY_RESERVED  */
  };
  gpio-test{
  label = "gpio-test";
  gpios = <&gpio3 14 0>;
  linux,code = <86>; /* KEY_RESERVED  */
  };
  };

I can see the the events occur in /dev/input/event0.

 

The problem is I need to read the value and not trigger off of an interrupt.  I have read about gpio-keys-polled (Xilinx Wiki - Linux GPIO Driver) but can't find anything on how to get the value in code.  We had the kernel export the gpio in the old kernel but have not found a way to do that using the device tree.  I found some things for open wrt for having the dts file export the gpio but it looks like our kernel does not have this.

 

Any help here would be great

 

Michael

Outcomes