以button为例,硬件PD11浮空,用这个GPIO做按键,配置这个GPIO上拉:
gpio_keys_test {
compatible = "gpio-keys";
status = "okay";
autorepeat;
pinctrl-names = "default";
pinctrl-0 = <&PD11_gpio>;
botton0 {
label = "Key Down";
linux,code = <KEY_DOWN>;
gpios = <&gpion 2 GPIO_ACTIVE_LOW>;
wakeup-source;
};
button1{
label ="Key Up";
linux,code = <KEY_UP>;
gpios = <&gpion 3 GPIO_ACTIVE_LOW>;
wakeup-source;
};
botton2 {
label = "Key Left";
linux,code = <KEY_LEFT>;
gpios = <&gpion 12 GPIO_ACTIVE_LOW>;
wakeup-source;
};
button3 {
label ="Key Right";
linux,code = <KEY_RIGHT>;
gpios = <&gpiod 11 GPIO_ACTIVE_LOW>;
wakeup-source;
};
};
gpio_keys_test{
PD11_gpio: pd11grp{
nuvoton,pins =
<SYS_GPD_MFPH_PD11MFP_GPIO &pcfg_keypad>;
};
};
|