How to set GPIOs to pre-defined value

Andrew Jeffery andrew at aj.id.au
Wed May 8 11:53:50 AEST 2019



On Tue, 7 May 2019, at 18:23, Brad Chou wrote:
> Hi Samuel,
> Thanks for your reply, I am using AST2500.
> I tried add gpio-hog settings into my device tree, and yes, the GPIO 
> works as it defined.
> But all GPIOs defined by gpio-hog can not be modified in user space by 
> gpioset / gpioget utility.
> I need to set all GPIOs to pre-defined state and can change it at run 
> time.
> Set GPIOs in Device tree is trying to lock it by a fixed direction and 
> value.
> 

This problem is probably best taken up with upstream. Currently GPIO
nodes in the devicetree are ignored if they do not have the `gpio-hog`
property:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpio/gpiolib-of.c?h=v5.1#n454

Changing that might be a hard argument - it may impact existing
devicetrees that expect the current behaviour.

However, I'm interested in what you see wrong with doing this from
userspace? What requirements do you have that would need this to
be done in the kernel?

Cheers,

Andrew


More information about the openbmc mailing list