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
Hi Michael,
Have you checked the implementations of other Community users, like the following thread?
https://community.freescale.com/thread/343064
Hope this will be useful for you.
Best regards!
/Carlos
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thank you for your post, I have the u-boot part of my board working.
Right now I have the inputs working by exporting the pins and setting the direction to input in my rc.local file. Then by reading the value register I can get the current state of the pin. I am hoping to use the gpio-keys-polled but can't find out how to actually poll the value of the pin.
For outputs I use the gpio-leds and that works fine for me.