Power key press sends up+down events simultaneously

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Power key press sends up+down events simultaneously

跳至解决方案
1,069 次查看
gsteimle
Contributor II

Hello.

We have Android 7.1.2 (Nougat) running on a device with imx6. When we press the Power key on the device, we see the following getevent output that shows shows both DOWN and UP events being sent. When the Power key is released, no event is seen:

[     726.515409] /dev/input/event2: EV_KEY       KEY_POWER            DOWN
[     726.515409] /dev/input/event2: EV_SYN       SYN_REPORT           00000000
[     726.530056] /dev/input/event2: EV_KEY       KEY_POWER            UP
[     726.530056] /dev/input/event2: EV_SYN       SYN_REPORT           00000000

With the same hardware running Android JellyBean, we see the expected behavior, where the DOWN event is seen on the key press, and the UP event is seen on the key release. Can you help us to produce the expected behavior on Nougat?

Here is the related device tree entry:

    gpio_keys: gpio-keys {
        compatible = "gpio-keys";
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_gpio_keys>;
        
        volume-back {
            label = "Volume Back";
            interrupts-extended = <&gpio7 12 IRQ_TYPE_EDGE_FALLING>;
            wakeup-source;
            linux,code = <KEY_BACK>;
            debounce-interval = <5>;
        };

        power {
            label = "Power Button";
            interrupts-extended = <&gpio1 5 IRQ_TYPE_EDGE_FALLING>;
            wakeup-source;
            linux,code = <KEY_POWER>;
            debounce-interval = <5>;
        };
    };

Further details might be seen from the "getevent -li" output:

add device 1: /dev/input/event0
  bus:      0019
  vendor    0001
  product   0001
  version   0100
  name:     "gpio-keys-polled"
  location: "gpio-keys-polled/input0"
  id:       ""
  version:  1.0.1
  events:
    KEY (0001): KEY_WAKEUP
  input props:
    <none>
could not get driver version for /dev/input/mouse0, Not a typewriter
add device 2: /dev/input/event1
  bus:      0018
  vendor    0000
  product   0000
  version   0000
  name:     "EP0980M09"
  location: ""
  id:       ""
  version:  1.0.1
  events:
    KEY (0001): BTN_TOUCH
    ABS (0003): ABS_X                 : value 298, min 0, max 479, fuzz 0, flat 0, resolution 0
                ABS_Y                 : value 185, min 0, max 271, fuzz 0, flat 0, resolution 0
                ABS_MT_SLOT           : value 0, min 0, max 4, fuzz 0, flat 0, resolution 0
                ABS_MT_POSITION_X     : value 0, min 0, max 479, fuzz 0, flat 0, resolution 0
                ABS_MT_POSITION_Y     : value 0, min 0, max 271, fuzz 0, flat 0, resolution 0
                ABS_MT_TRACKING_ID    : value 0, min 0, max 65535, fuzz 0, flat 0, resolution 0
  input props:
    INPUT_PROP_DIRECT
add device 3: /dev/input/event2
  bus:      0019
  vendor    0001
  product   0001
  version   0100
  name:     "gpio-keys"
  location: "gpio-keys/input0"
  id:       ""
  version:  1.0.1
  events:
    KEY (0001): KEY_POWER             KEY_BACK
  input props:
    <none>
could not get driver version for /dev/input/mice, Not a typewriter

标记 (2)
0 项奖励
1 解答
926 次查看
gsteimle
Contributor II

Hi,

We were able to resolve this by replacing this line in the power button section of the device tree (.dtsi) file

interrupts-extended = <&gpio1 5 IRQ_TYPE_EDGE_FALLING>;

with this

gpios = <&gpio1 5 IRQ_TYPE_EDGE_RISING>;

Thanks,

Gary

在原帖中查看解决方案

2 回复数
926 次查看
diegoadrian
NXP Employee
NXP Employee

Hello,

Are you still having a problem with this?

Otherwise, can you please pass me the revision of your board?

Best regards,

Diego.

0 项奖励
927 次查看
gsteimle
Contributor II

Hi,

We were able to resolve this by replacing this line in the power button section of the device tree (.dtsi) file

interrupts-extended = <&gpio1 5 IRQ_TYPE_EDGE_FALLING>;

with this

gpios = <&gpio1 5 IRQ_TYPE_EDGE_RISING>;

Thanks,

Gary