Documentation: gpio: consumer: describe active low property
Subsystems (2)
PATCH 1/1 Documentation: gpio: consumer: describe active low property
I've been searching for any documentation of 'the active-low property of a GPIO' already mentioned in this documenation. But couldn't find any. Add it.
--- Documentation/gpio/consumer.txt | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
Documentation/gpio/consumer.txt +26 -0
@@ -236,6 +236,32 @@ The active-low state of a GPIO can also be queried using the following call: Note that these functions should only be used with great moderation ; a driver should not have to care about the physical line level. +The active-low property +----------------------- + +As a driver should not have to care about the physical line level, all of the +gpiod_set_xxx_value_xxx() functions do take the active-low property into account. +This does mean that they check whether the GPIO is configured to be active-low. And +if so, they manipulate the passed value before the physical line level is driven. + +With this, all the gpiod_set_xxx_value_xxx() functions interpret the parameter +"value" as "active" ("1") or "inactive" ("0"). The physical line level will be +driven accordingly. + +As an example, if the active-low poperty for a dedicated GPIO is set, and the +gpiod_set_xxx_value_xxx() passes "active" ("1"), the physical line level will be +driven low. + +To summarize: + +Function (example) active-low proporty physical line +gpiod_set_raw_value(desc, 0); don't care low +gpiod_set_raw_value(desc, 1); don't care high +gpiod_set_value(desc, 0); n/a low +gpiod_set_value(desc, 1); n/a high +gpiod_set_value(desc, 0); active-low high +gpiod_set_value(desc, 1); active-low low + Set multiple GPIO outputs with a single function call -----------------------------------------------------
Signature · 1 line
2.4.5
Quoted 13 lines · Dirk Behme
I've been searching for any documentation of 'the active-low property of a GPIO' already mentioned in this documenation. But couldn't find any. Add it.
Sigend-off-by Dirk Behme <[email protected]>--- Documentation/gpio/consumer.txt | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)Documentation/gpio/consumer.txt +0
-0
Documentation/gpio/consumer.txt The active-low state of a GPIO can also be queried using the following call: · line 245
Quoted 10 lines
Documentation/gpio/consumer.txt +7
-0@@ -236,6 +236,32 @@ The active-low state of a GPIO can also be queried using the following call: Note that these functions should only be used with great moderation ; a driver should not have to care about the physical line level. +The active-low property +----------------------- + +As a driver should not have to care about the physical line level, all of the +gpiod_set_xxx_value_xxx() functions do take the active-low property into account. +This does mean that they check whether the GPIO is configured to be active-low. And +if so, they manipulate the passed value before the physical line level is driven.
This would be "all of the gpiod_set_value_xxx() functions, since gpiod_set_raw_value_xxx() ignores the active-low setting.
I think it would also be worth to explain that the set_raw/get_raw functions should be avoided as much as possible, especially by drivers which should not care about the actual physical line level and worry about the logical value instead.
Quoted 6 lines
Documentation/gpio/consumer.txt +6
-0+ +With this, all the gpiod_set_xxx_value_xxx() functions interpret the parameter +"value" as "active" ("1") or "inactive" ("0"). The physical line level will be +driven accordingly. + +As an example, if the active-low poperty for a dedicated GPIO is set, and the
Documentation/gpio/consumer.txt The active-low state of a GPIO can also be queried using the following call: · line 261
Quoted 10 lines
Documentation/gpio/consumer.txt +10
-0+gpiod_set_xxx_value_xxx() passes "active" ("1"), the physical line level will be +driven low. + +To summarize: + +Function (example) active-low proporty physical line +gpiod_set_raw_value(desc, 0); don't care low +gpiod_set_raw_value(desc, 1); don't care high +gpiod_set_value(desc, 0); n/a low +gpiod_set_value(desc, 1); n/a high
What is n/a here? Shouldn't it be "active high (default)"?
Once clarified,