LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
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.

Notices


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

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


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.

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

Rep: Reputation: 11
Hello,

Does it have something to do with this issue?

Regards,

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

Original Poster
Rep: Reputation: Disabled
Quote:
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:
Quote:
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 02:23 AM. Reason: cut human protocol from quote
 
  


Reply



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 08:40 PM
Live Image mount: union FS overlay vs dmsetup overlay kostya Linux - Software 2 02-16-2012 06: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 03:57 PM
Receive IRQ from a GPIO pin maus Linux - Embedded & Single-board computer 1 06-22-2009 10:02 AM
Using GPIO (from kernel GPIO support) in MY application DannyGilbert Linux - Kernel 2 03-16-2009 07:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 09:54 AM.

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