Rock5B GPIO Pull-up/Pull-down

Using my Rock 5B I’ve noticed an issue trying to set pull-up or pull-down on any of the GPIO’s. I’ve been using Python3 with gpiod, however reverted to command-line to rule out any Python or library issues. Here is how I’ve been testing:

-> verify that I can set the pin high and low
gpioset <chip> <line>=0
gpioset <chip> <line>=1

-> test the pull-up/pull-down
gpiomon -B pull-up <chip> <line>
gpiomon -B pull-down <chip> <line>
gpiomon -B disable <chip> <line>

Setting the bias to pull-up or pull-down doesn’t produce an error, it just doesn’t change the level of the line. I ran the same tests on other SBC’s that I had immmediate access to:

Orange Pi 5 (RK3588S) - Same issue, pull-up/down doesn’t work
Raspberry Pi 4B - Works as expected
Starfive Visionfive 2 (RISC-V) - Works as expected
Bigtreetech CB1 (Allwinner H616) - Works as expected

The only reference to internal pull-up/down resistors I’ve found is in a Rockchip RK3588 datasheet (https://www.cnx-software.com/pdf/Rockchip RK3588 Datasheet V0.1-20210727.pdf). I haven’t found any other reference to it on the Radxa pages or Orange Pi pages. Does anyone know if the internal pull-up/down resistors are supported? I’m not sure if this just isn’t implemented on the Rock 5B or if this is a bug that needs to get fixed.

Thanks!

Hey any chance you found a solution? I seem to be having the same issue.
I’ve also tried coming up with a devicetree overlay that would set the bias, but that also doesn’t change anything…

I finally managed to get past this issue by changing the pin settings through a custom devicetree overlay, as I don’t need to change them dynamically

Can you share your overlay config? I tried setting some flags but was never successful.

sure!
this overlay sets up two pins with disabled bias resistors, and registers a keyboard with the kernel that registers the pin state changes as keypresses.

/dts-v1/;
/plugin/;

#include <dt-bindings/pinctrl/rockchip.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/linux-event-codes.h>

&pinctrl {
        custom_gpios{
                custom_pins: custom-pins {
                        rockchip,pins=
                                <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none_smt>,
                                <3 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none_smt>;
                };
        };
};
&{/} {
        twobuttonkeyboard {
                compatible = "gpio-keys";
                label = "End Switches";
                pinctrl-names = "default";
                pinctrl-0 = <&custom_pins>;
                left {
                        label = "GPIO EndSwitch Home Position";
                        linux,code = <KEY_HOME>;
                        gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_HIGH>;
                };
                right {
                        label = "GPIO EndSwitch End Position";
                        linux,code = <KEY_END>;
                        gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_HIGH>;
                };
        };
};