ARM: bcm2835: Add names for the Raspberry Pi GPIO lines
A message that is not in the archive (sent off-list or not yet received): CAPoCmYJC1TebBrspD_=mTETULSjg9or5a0Yda8p945y6ZWL99Q@mail.gmail.com
PATCH v2 1/1 ARM: bcm2835: Add names for the Raspberry Pi GPIO lines
Quoted 8 lines · Gottfried Haider
Hi Eric, Linus,
I'll hopefully find time to look at the more recent changes to the gpio subsystem (lsgpio?!), but since this patch is up for discussion now - what I was wondering: how does this change relate to /sys/class/gpio/gpio%d? Is this completely orthogonal - or would this change the sysfs interface as well?
Quoted 8 lines
Regarding the proposed format using the header pin numbers: From what I've seen in terms of existing educational materials, it seems the overwhelming majority ends up using GPIO numbers instead of physical pin header numbering. (e.g. [1] [2])
Would it be too confusing to try to pick GPIO 5 from an alphabetically sorted list like this "P11_GPIO17", "P12_GPIO18"? (I know, alphabetical sorting is an issue here already for a different reason. But applications might do it, I guess?)
I added the pin numbers because it was a consistent response to the
first version. I do think the GPIO numbers without pin numbers would be
the most clear.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20161018/cae67ff7/attachment.sig>
PATCH v2 1/1 ARM: bcm2835: Add names for the Raspberry Pi GPIO lines
In reply to a message not in the archiveQuoted 5 lines · On Tue, Oct 18, 2016 at 10:44 PM, Gottfried Haider <[email protected]…
I'll hopefully find time to look at the more recent changes to the gpio subsystem (lsgpio?!), but since this patch is up for discussion now - what I was wondering: how does this change relate to /sys/class/gpio/gpio%d? Is this completely orthogonal - or would this change the sysfs interface as well?
The old sysfs interface is not changing. However it is deprecated so once you have a v4.8+ kernel, consider migrating whatever userspace you have to use the chardev ABI instead.
See:
commit fe95046e960b4b76e73dc1486955d93f47276134 "gpio: ABI: mark the sysfs ABI as obsolete" commit 521a2ad6f862a28e2e43cb3e254a26bf0f9452e9 "gpio: add userspace ABI for GPIO line information" commit d7c51b47ac11e66f547b55640405c1c474642d72 "gpio: userspace ABI for reading/writing GPIO lines" commit 61f922db72216b00386581c851db9c9095961522 "gpio: userspace ABI for reading GPIO line events"
Quoted 4 lines
Regarding the proposed format using the header pin numbers: From what I've seen in terms of existing educational materials, it seems the overwhelming majority ends up using GPIO numbers instead of physical pin header numbering. (e.g. [1] [2])
What does that number mean? If you are referring to the global GPIO numberspace it is obsolete and just reflecting the fact that people up until now was referring to Linux-internal GPIO numbers.
Quoted 4 lines
Would it be too confusing to try to pick GPIO 5 from an alphabetically sorted list like this "
P11_GPIO17", "P12_GPIO18"? (I know, alphabetical sorting is an issue here already for a different reason. But applications might do it, I guess?)
Any attempt to preserve the global GPIO numberspace is futile. If it is the local offset number on the chip it is another thing, that is kind of OK if the arch maintainer likes it.
Global GPIO numbers are inherently inconsistent since the introduction of deferred probe, as GPIO drivers often pick a dynamic number base and thus end up with the same number even though that can depend on things like cosmic radiation or the temperature of their board when they boot. So global GPIO numbers are considered harmful and have therefore been obsoleted as userspace ABI.
Yours,
Linus Walleij
PATCH v2 1/1 ARM: bcm2835: Add names for the Raspberry Pi GPIO lines
Quoted 4 lines
The old sysfs interface is not changing. However it is deprecated so once you have a v4.8+ kernel, consider migrating whatever userspace you have to use the chardev ABI instead.
Quoted 9 lines
See:
commitfe95046e960b4b76e73dc1486955d93f47276134"gpio: ABI: mark the sysfs ABI as obsolete" commit521a2ad6f862a28e2e43cb3e254a26bf0f9452e9"gpio: add userspace ABI for GPIO line information" commitd7c51b47ac11e66f547b55640405c1c474642d72"gpio: userspace ABI for reading/writing GPIO lines" commit61f922db72216b00386581c851db9c9095961522"gpio: userspace ABI for reading GPIO line events"
Thanks for those pointers. Somewhat off topic: is it planned to add support for setting GENERIC_PINCONF style pull-up/pull-down resistors throigh the new ABI? (The bcm28xx drivers would still need to converted to this as well.)
Quoted 8 lines
Quoted 4 lines
Regarding the proposed format using the header pin numbers: From what I've seen in terms of existing educational materials, it seems the overwhelming majority ends up using GPIO numbers instead of physical pin header numbering. (e.g. [1] [2])
What does that number mean? If you are referring to the global GPIO numberspace it is obsolete and just reflecting the fact that people up until now was referring to Linux-internal GPIO numbers.
I am referring to the name of the various GPIO lines as per datasheet ("GPIO0", "GPIO1", ...). So far, I believe those matched the global GPIO numberspace.
Quoted 8 lines
Quoted 4 lines
Would it be too confusing to try to pick GPIO 5 from an alphabetically sorted list like this "
P11_GPIO17", "P12_GPIO18"? (I know, alphabetical sorting is an issue here already for a different reason. But applications might do it, I guess?)Any attempt to preserve the global GPIO numberspace is futile. If it is the local offset number on the chip it is another thing, that is kind of OK if the arch maintainer likes it.
I understand that Linux can't guarantee a certain global GPIO number - but I fear that the board manufacturers also might not think of the pin headers as something set in stone (that the can't rearrange in a future revision/product).
Would there be a reason against _naming_ the pin "GPIO0"? (even if it ends up with a different global, internal number)
Thanks & best
Gottfried
PATCH v2 1/1 ARM: bcm2835: Add names for the Raspberry Pi GPIO lines
Quoted 3 lines · Gottfried Haider
Somewhat off topic: is it planned to add
support for settingGENERIC_PINCONFstyle pull-up/pull-down resistors throigh the new ABI?
Not planned, as in "I will do the job" but anticipated.
I expect that someone will come up with that usecase (indeed even the Arduino is doing it) so that we will have to support it.
It's better than inventing a separate userspace ABI for pin control anyways.
Quoted 2 lines
(The bcm28xx drivers would still need to
converted to this as well.)
All drivers that want to support it need converting I suspect.
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Regarding the proposed format using the header pin numbers: From what I've seen in terms of existing educational materials, it seems the overwhelming majority ends up using GPIO numbers instead of physical pin header numbering. (e.g. [1] [2])
Quoted 7 lines
Quoted 3 lines
What does that number mean? If you are referring to the global GPIO numberspace it is obsolete and just reflecting the fact that people up until now was referring to Linux-internal GPIO numbers.
I am referring to the name of the various GPIO lines as per datasheet ("GPIO0", "GPIO1", ...). So far, I believe those matched the global GPIO numberspace.
Aha. Yeah that is matching somewhat by chance these days, because:
static struct gpio_chip bcm2835_gpio_chip = {
.label = MODULE_NAME,
(...)
.base = -1,
(...)
};
That means this number is dynamicallly assigned and depend on things like probe order or another GPIO chip failing etc.
Quoted 4 lines
I understand that Linux can't guarantee a certain global GPIO number - but I fear that the board manufacturers also might not think of the pin headers as something set in stone (that the can't rearrange in a future revision/product).
Depends on which manufacturer. For 96boards there exist a document specifying how they should be arranged and named:
https://github.com/96boards/documentation
Rpi would be wise to come up with something similar, but I have no high hopes. We do need standardization and interoperability, but it is not creating itself. :/
Quoted 2 lines
Would there be a reason against _naming_ the pin "GPIO0"? (even if it ends up with a different global, internal number)
No not if it makes electronic sense, like if the schematic or SoC uses that name, then use that if the board maintainer likes the idea.
Yours,
Linus Walleij
PATCH v2 1/1 ARM: bcm2835: Add names for the Raspberry Pi GPIO lines
In reply to Linus WalleijQuoted 11 lines · Linus Walleij
Quoted 4 lines · On Tue, Oct 18, 2016 at 10:44 PM, Gottfried Haider <[email protected]…
Regarding the proposed format using the header pin numbers: From what I've seen in terms of existing educational materials, it seems the overwhelming majority ends up using GPIO numbers instead of physical pin header numbering. (e.g. [1] [2])
What does that number mean? If you are referring to the global GPIO numberspace it is obsolete and just reflecting the fact that people up until now was referring to Linux-internal GPIO numbers.
The number within the SOC's GPIOs. Until the 8-line expander that's
been hung off the SOC GPIOs in the Pi3, they were the only GPIOs in the
system.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20161020/3bd2a4ea/attachment.sig>