Rpi conf for this hat add pull-ups for buttons and joystick pins.
Trying to create an overlay :
dts
/dts-v1/;
/plugin/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/rockchip.h>
/ {
compatible = "radxa,zero3";
fragment@0 {
target = <&{/}>;
__overlay__ {
buttons_joystick {
compatible = "gpio-keys";
pinctrl-names = "default";
pinctrl-0 = <&buttons_joystick_pins>;
key1 {
label = "KEY1";
gpios = <&gpio3 RK_PA5 GPIO_ACTIVE_LOW>;
linux,code = <KEY_1>;
};
key2 {
label = "KEY2";
gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_LOW>;
linux,code = <KEY_2>;
};
key3 {
label = "KEY3";
gpios = <&gpio3 RK_PA7 GPIO_ACTIVE_LOW>;
linux,code = <KEY_3>;
};
joy_up {
label = "JOY_UP";
gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>;
linux,code = <KEY_UP>;
};
joy_down {
label = "JOY_DOWN";
gpios = <&gpio3 RK_PA4 GPIO_ACTIVE_LOW>;
linux,code = <KEY_DOWN>;
};
joy_left {
label = "JOY_LEFT";
gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>;
linux,code = <KEY_LEFT>;
};
joy_right {
label = "JOY_RIGHT";
gpios = <&gpio1 RK_PA4 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RIGHT>;
};
joy_press {
label = "JOY_PRESS";
gpios = <&gpio3 RK_PC3 GPIO_ACTIVE_LOW>;
linux,code = <KEY_ENTER>;
};
};
};
};
fragment@1 {
target = <&pinctrl>;
__overlay__ {
buttons_joystick_pins: buttons-joystick-pins {
rockchip,pins =
<3 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>,
<3 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>,
<3 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>,
<3 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>,
<3 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>,
<3 RK_PB3 RK_FUNC_GPIO &pcfg_pull_up>,
<1 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>,
<3 RK_PC3 RK_FUNC_GPIO &pcfg_pull_up>;
};
};
};
};
Will it work ?