gpio-cdev icon indicating copy to clipboard operation
gpio-cdev copied to clipboard

GPIO electrical configuration

Open dbrgn opened this issue 5 years ago • 6 comments

Is there support for electrical configuration of GPIO pins (e.g. enabling pull-up resistors on the Raspberry Pi)?

If I look at https://www.kernel.org/doc/html/v5.3/driver-api/gpio/driver.html#gpio-electrical-configuration this should be possible, right? Or is that a different API? (I'm still figuring out the kernel GPIO APIs, so forgive me if I'm mixing up things :slightly_smiling_face:)

dbrgn avatar Nov 02 '20 12:11 dbrgn

@dbrgn Nope, this isn't part of the userspace API. Typically, this is done via devicetree as part of the board setup for custom hardware. For hobbyist boards which are less fixed there are DT Overlays. Configuration of these characteristics of GPIOs are often highly IP chunk dependent as the pin config usually requires muxing, etc.

https://www.raspberrypi.org/documentation/configuration/device-tree.md

posborne avatar Nov 02 '20 16:11 posborne

Ok, I might have spoken a bit too soon as some new stuff landed in kernel 5.5. I'll leave this open and get back to it once I do some more reading.

posborne avatar Nov 02 '20 16:11 posborne

https://microhobby.com.br/blog/2020/02/02/new-linux-kernel-5-5-new-interfaces-in-gpiolib/ has a nice summary (libgpiod focused). There's a new V2 ABI for GPIO which we'll need to update to support (while keeping some compatability with the V1 ABI for older kernels).

posborne avatar Nov 02 '20 16:11 posborne

Hi, I have a work project that depends on internal resistor setup. Was some work done on this or should I just fork.

sadilekivan avatar Aug 10 '22 18:08 sadilekivan

There have been some discussion over at #68, I am not sure if some progress has been made.

eldruin avatar Aug 11 '22 11:08 eldruin

Was some work done on this or should I just fork.

@sadilekivan Care to elaborate on what "just fork" means? I'm going to assume that you mean "just [click the] fork [button on GitHub and send a pull request]".

JonathonReinhart avatar Dec 18 '23 20:12 JonathonReinhart