- device tree에 gpio-key 추가
- / {
gpio-keys {
compatible = "gpio-keys";
autorepeat;
pinctrl-names = "default";
pinctrl-0 = <&push_button_pins_default>;
sw5 {
label = "GPIO Key USER1";
linux,code = <BTN_0>;
//BTN_0=0x100gpios = <&wkup_gpio0 24 GPIO_ACTIVE_LOW>;
//<0x07 0x18 0x01>;
};
sw6 {
label = "GPIO Key USER2";
linux,code = <BTN_1>;
//BTN_1=0x101gpios = <&wkup_gpio0 27 GPIO_ACTIVE_LOW>
; //<0x07 0x1b 0x01>;
};
};
- };
- &wkup_pmx0 {
wkup_i2c0_pins_default: wkup-i2c0-pins-default {
pinctrl-single,pins = <
AM65X_WKUP_IOPAD(0x00e0, PIN_INPUT, 0) /* (AC7) WKUP_I2C0_SCL */
AM65X_WKUP_IOPAD(0x00e4, PIN_INPUT, 0) /* (AD6) WKUP_I2C0_SDA */
>;
};
push_button_pins_default: push-button-pins-default {
pinctrl-single,pins = <
AM65X_WKUP_IOPAD(0x0030, PIN_INPUT, 7) /* (R5) WKUP_GPIO0_24 */
AM65X_WKUP_IOPAD(0x003c, PIN_INPUT, 7) /* (P2) WKUP_GPIO0_27 */
>;
};
- };
- / {
- 확인 방법
- $ cat /proc/bus/input/devices
- 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/input0
- U: Uniq=
- H: Handlers=event0
- B: PROP=0
- B: EV=100003
- B: KEY=3 0 0 0 0
- $cat /sys/class/input/event0/uevent
- MAJOR=13
- MINOR=64
- DEVNAME=input/event0
- $mknod /dev/gpio-keys c 13 64
- $hexdump /dev/gpio-keys
- 0000000 bf9e 67f0 0000 0000 4d50 000b 0000 0000
- 0000010 0001 0100 0001 0000 bf9e 67f0 0000 0000
- 0000020 4d50 000b 0000 0000 0000 0000 0000 0000
- 0000030 bf9e 67f0 0000 0000 33e7 000d 0000 0000
- 0000040 0001 0100 0000 0000 bf9e 67f0 0000 0000
- 0000050 33e7 000d 0000 0000 0000 0000 0000 0000
리눅스에서 GPIO-KEY사용방법(AM65XX)