Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.


  Search this Thread
Old 06-02-2019, 11:17 AM   #1
LQ Newbie
Registered: Jun 2019
Posts: 2

Rep: Reputation: Disabled
configure bias-pull-down for GPIO pin via device-tree overlay


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.


/ {
	compatible = "allwinner,sun8i-h3";

	fragment@0 {
		target-path = "/";
		__overlay__ {
			pinctrl@1c20800 {
				my_notify {
					pins = "PA6";
					function = "gpio";

	fragment@1 {
		target-path = "/";
		__overlay__ {
			my_device {
				pinctrl-0 = <&my_notify>;
				status = "okay";
This is how I verify changes:

# 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.

Last edited by temoto; 06-02-2019 at 02:04 PM. Reason: more precise console output
Old 06-03-2019, 09:46 PM   #2
Registered: Jan 2011
Posts: 108

Rep: Reputation: 11

Does it have something to do with this issue?


Old 06-04-2019, 03:20 AM   #3
LQ Newbie
Registered: Jun 2019
Posts: 2

Original Poster
Rep: Reputation: Disabled
Originally Posted by elucches View Post
Does it have something to do with this issue?
We face similar issue. We do not share any code. They want something fixed in a commonly used library. I only need to configure one particular board.

libgpiod author Bartosz quote from related thread:
Originally Posted by brgl@github
take a look at device tree bindings: there is no generic PULL_UP/DOWN property defined, only certain drivers using their own constants.
I'm looking for a way to enable pull-down with SoC specific properties in dt.

Last edited by temoto; 06-04-2019 at 03:23 AM. Reason: cut human protocol from quote


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom module to add device tree overlay - kernel 4.14-rc4 Carli-K Linux - Kernel 3 05-29-2018 09:40 PM
Live Image mount: union FS overlay vs dmsetup overlay kostya Linux - Software 2 02-16-2012 07:38 AM
GPIO access on a Fujitsu Mini-ITX Industrial Mainboard, PCI Driver for GPIO mechatrix Linux - Embedded & Single-board computer 3 11-20-2011 04:57 PM
Receive IRQ from a GPIO pin maus Linux - Embedded & Single-board computer 1 06-22-2009 11:02 AM
Using GPIO (from kernel GPIO support) in MY application DannyGilbert Linux - Kernel 2 03-16-2009 08:52 AM > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 08:05 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration