imx8mq - how to use gpio-key input driver for android btn key

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx8mq - how to use gpio-key input driver for android btn key

2,679 Views
ksw1
Contributor I

hello.

Now, I'm using android O8.1.0_1.3.0 (nxp released) and customized board (added btn).

I want to use gpio-keys driver for android btn key

(home, back, volume_up, volume_down, prop - GPIO3_IO10  ~14)

so, added dts below for gpio-keys driver.

but, when I pushed btn key, i can't show any key event (power-key event work ok! -cat /dev/input/event0)

(#cat /dev/input/event1)

please my dts file and notice me.

how can i modify dts file ?

evk_8mq:/ $ cat /proc/bus/input/devices
I: Bus=0019 Vendor=0000 Product=0000 Version=0000
N: Name="30370000.snvs:snvs-powerkey"
P: Phys=snvs-pwrkey/input0
S: Sysfs=/devices/platform/30370000.snvs/30370000.snvs:snvs-powerkey/input/input0
U: Uniq=
H: Handlers=kbd event0 keychord
B: PROP=0
B: EV=3
B: KEY=10000000000000 0

I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name="gpio-keys"
P: Phys=gpio-keys/input0
S: Sysfs=/devices/platform/gpio-keys/input/input1
U: Uniq=
H: Handlers=kbd event1 keychord
B: PROP=0
B: EV=3
B: KEY=4 c004000000000 4000

 

/ {
 gpio-keys {
  status = "okay";
  compatible = "gpio-keys"; 
  pinctrl-names = "default"; 
  pinctrl-0 = <&pinctrl_gpio_keys>;
  interrupt-parent = <&gpio3>;
  interrupts = <10 11 12 13 14>;

  back {
    label = "BTN 1";
    gpios = <&gpio3 10 1>;
    //irq-gpios = <&gpio3 10 IRQ_TYPE_LEVEL_LOW>;
    gpio-key;
    linux,code = <KEY_BACKSPACE>;
  };  

  prop {
    label = "BTN 2";
    gpios = <&gpio3 11 1>;
    //irq-gpios = <&gpio3 11 IRQ_TYPE_LEVEL_LOW>;
    gpio-key,wakeup;
    linux,code = <KEY_PROPS>;
  };

  volume-up {
    label = "BTN 3";
    gpios = <&gpio3 12 1>;
    //irq-gpios = <&gpio3 12 IRQ_TYPE_LEVEL_LOW>;
    gpio-key;
    linux,code = <KEY_VOLUMEUP>;
  };

  volume-down {
    label = "BTN 4";
    gpios = <&gpio3 13 1>;
    //irq-gpios = <&gpio3 13 IRQ_TYPE_LEVEL_LOW>;
    gpio-key;
    linux,code = <KEY_VOLUMEDOWN>;
  };

  home {
    label = "BTN 5";
    gpios = <&gpio3 14 1>;
    //irq-gpios = <&gpio3 14 IRQ_TYPE_LEVEL_LOW>;
    gpio-key;
    linux,code = <KEY_HOME>;
  };  
 };
};

&iomuxc {
 imx8mq-evk {

  pinctrl_gpio_keys: gpiokeys {
   fsl,pins = <
    MX8MQ_IOMUXC_NAND_DATA04_GPIO3_IO10  0x16
    MX8MQ_IOMUXC_NAND_DATA05_GPIO3_IO11  0x16    
    MX8MQ_IOMUXC_NAND_DATA06_GPIO3_IO12  0x16
    MX8MQ_IOMUXC_NAND_DATA07_GPIO3_IO13  0x16
    MX8MQ_IOMUXC_NAND_DQS_GPIO3_IO14  0x16    
   >;  
  };  
 };
};

0 Kudos
1 Reply

2,117 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Dear sangwook,

     you can refer to dts file for other boards, enter path  arch/arm/boot/dts via command line, run :

# grep -r -n 'gpio-keys' ./

then you will find many dts file supporting gpio-keys, for example, see below, please!

...

pinctrl_gpio_keys: gpio_keysgrp {

fsl,pins = <

MX6SX_PAD_CSI_DATA04__GPIO1_IO_18 0x17059

MX6SX_PAD_CSI_DATA05__GPIO1_IO_19 0x17059

>;

...

};

gpio-keys {

compatible = "gpio-keys";

pinctrl-names = "default";

pinctrl-0 = <&pinctrl_gpio_keys>;

 

volume-up {

label = "Volume Up";

gpios = <&gpio1 18 GPIO_ACTIVE_LOW>;

linux,code = <KEY_VOLUMEUP>;

};

 

volume-down {

label = "Volume Down";

gpios = <&gpio1 19 GPIO_ACTIVE_LOW>;

linux,code = <KEY_VOLUMEDOWN>;

};

};

 

So refer to above usage and firstly debug volume down and up, please!

Have a nice day!

BR,

Weidong

0 Kudos