Thread (9 messages) 9 messages, 4 authors, 2018-02-07

[PATCH] pinctrl: msm: allow the gpio base to be configurable

From: Bartosz Golaszewski <hidden>
Date: 2018-01-26 22:13:53
Also in: linux-arm-msm, linux-gpio

2018-01-26 14:16 GMT+01:00 Timur Tabi [off-list ref]:
On 1/26/18 7:01 AM, Linus Walleij wrote:
quoted
This is a feature not a bug. It encourages people not to
depend on the global GPIO numberspace.

Just set it to -1.

If I change it to -1, then I think I'm going to break every existing MSM
platform that depends on the base address being 0, because then every MSM
driver will have a non-zero base, and none of the existing drivers register
more than one GPIO device.

So how about this:

        static int base = 0;

        chip->base = base;
        base = -1;

This way, existing code works as before.  If any driver registers two GPIO
devices, the first one will get a base of 0, and the second one will get
some other base.
quoted
quoted
gpiochip_find_base: found new base at 437
(...)
quoted
gpiochip_find_base: found new base at 362
These are awesome bases, just beautiful. Use this.

If you don't like seeing GPIO base numbers like this: use things
like the chardev and the tools in tools/gpio or libgpiod when
developing, and you will never see them. They should not make
a difference anyway.

Can you tell me more about the chardev?  I've always been using "echo X >
/sys/class/gpio/export", so I guess that's not the right way to do things.
Hi Timur,

take a look at the in-project documentation[1] and read the article[2]
about libgpiod. That should get you started.

Let me know if anything's not clear.

Thanks,
Bartosz

[1] https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/
[2] https://www.cnx-software.com/2017/11/03/learn-more-about-linuxs-new-gpio-user-space-subsystem-libgpiod/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help