Using GPIO in Android L


I’m trying to connect some push buttons to DB410c’s GPIOs to be used as function buttons. The following post and this post suggest some changes to the boot script and then access the GPIOs using File I/O. However, as I’ll create my own image anyway, I’ve edited the device tree file (kernel/arch/arm/boot/dts/apq8016-sbc.dtsi) to include my new button

gpio_keys {
	// ...

	function1 {
		label = "function1";
		gpios = <&msm_gpio 36 0x1>; // GPIO-A
		linux,input-type = <1>;
		linux,code = <59>;
		debounce-interval = <15>;

Then, the button can be listened using normal KeyEvent send to my Android’s activity.

public class MainActivity extends AppCompatActivity {
    // ...

    public boolean onKeyDown(int keyCode, KeyEvent event) {
        Log.d("Key Press =", String.valueOf(event.getScanCode()));
        return super.onKeyDown(keyCode, event);

The following code work well. However, my problem is that the board doesn’t wake up from suspend when the button is pressed even gpio-key,wakeup is specified in the device tree and GPIO-A should have interrupt capability according to the GPIO Pin Assignment Spreadsheet (LM80-P0436-6).

Also, is there a way to implement a wakeup button that could wake the board from suspend and keep the board wake up when it is pushed again? As, using the power button will suspend the board if it is push when the board is already waked up.

Thank you,