Hello.
TL;DR: what do I need to write into custom.dts to configure particular GPIO pin with bias-pull-down. It will be used from userspace via /dev/gpiochip.
Background: developing open source vending machine controller software. Question (Linux) relevant hardware: OrangePI Lite (sunxi-h3). Userspace application uses SPI and GPIO "response is ready notification" pin to communicate with physical device. Device puts pin to high when it's ready for next SPI communication. gpiochip related code works, thanks to Linus and others involved, it's much better than sysfs edge issues.
OS: Armbian with Linux 4.19.38 so dtb is loaded only on boot (or I don't know raspberry analog to load dt overlay at runtime).
Trying to learn device-tree semantic without much success yet. Link to detailed dts guide would be greatly appreciated.
Following code got me as far as removing /dev/spidev, so at least I have reliable way to influence device-tree, which is a good start.
Tried many random variations on following dts, without any changes in /sys/kernel/debug/pinctrl. Please forgive me for random poking, I'd like to properly understand dts but not there yet.
Code:
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun8i-h3";
fragment@0 {
target-path = "/";
__overlay__ {
pinctrl@1c20800 {
my_notify {
pins = "PA6";
function = "gpio";
bias-pull-down;
input-enable;
};
};
};
};
fragment@1 {
target-path = "/";
__overlay__ {
my_device {
pinctrl-0 = <&my_notify>;
status = "okay";
};
};
};
};
This is how I verify changes:
Code:
# fgrep PA6 /sys/kernel/debug/pinctrl/1c20800.pinctrl/pinconf-groups
6 (PA6): input bias disabled, output drive strength (20 mA)
# gpioinfo |fgrep ' 6:'
line 6: unnamed unused input active-high # from gpiochip0, trying to modify
line 6: unnamed unused input active-high # from gpiochip1, please ignore
Thanks for any comments.