Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
Commit b01b109b authored by Robert Nelson's avatar Robert Nelson
Browse files

gpio-of-helper.c: espect the status property of individual gpios

#<Daulity> is there a kernel option to not reset gpio state at linux boot ?
#<zmatt> Daulity: the kernel does not reset any gpio unless explicitly requested to by a driver
#<zmatt> though by default if cape-universal is enabled then a gpio-of-helper device gets set up which configures all gpios as input... though that is normally the state they are in anyway after reset
#<zmatt> Daulity: why? are you setting gpios in u-boot?
#<Daulity> yes u-boot sets a few gpio's before it boots the kernel they get reset to a certain state not certain if u-boot or linux kernel
#<Daulity> was just wondering
#<zmatt> the annoying bit is that this isn't really fixable by applying an overlay on top of cape-universal due the the limitations of overlays and the fact that status="disabled"; doesn't work on individual gpios of a gpio-of-helper device node
#<zmatt> so your options are to modify the cape-universal overlay or disable cape-universal entirely and use an overlay to declare/export gpios (with initialization of your choice)
#<Daulity> i see
#<zmatt> (or fix the gpio-of-helper drivers to respect the status property of individual gpios... which is probably a 2-line patch)
#<zmatt> *driver
#<zmatt> interesting, if CONFIG_OF_KOBJ=n then nodes with non-okay status property don't even get deserialized, however in practice CONFIG_OF_KOBJ is always y (specifically, it is only n in kernels that lack sysfs support)
#<zmatt> yeah it's definitely a 2-line fix
#<zmatt> https://pastebin.com/f8V8pz1V


#<Daulity> thanks :)
#<zmatt> rcn-ee: can you include that patch?  that way overlays can disable cape-universal's gpio export for individual gpios used by the overlay
#<zmatt> e.g. &ocp { cape-universal { P9_14 { status = "disabled"; }; }; };
#<zmatt> Daulity: you can use that in an overlay and then if you still want the gpio exported you can just declare your own gpio-of-helper ... unfortunately it doesn't support exporting a gpio without initializing it, but at least you can choose *how* to initialize it (input, output-low, output-high) and whether or not linux userspace is allowed to change the direction of the gpio

Signed-off-by: default avatarRobert Nelson <robertcnelson@gmail.com>
parent 0df0afc0
Branches
Tags
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment