Skip to content

Commit 08d94c7

Browse files
warthog618Bartosz Golaszewski
authored andcommitted
Documentation: gpio: Clarify effect of active low flag on line edges
The documentation does not make sufficiently clear that edge polarity is based on changes to the logical line values, and that the physical polarity of edges is dependent on the active low flag. Clarify the relationship between the active low flag and edge polarity for the functions that read edge events. Suggested-by: David C. Rankin <[email protected]> Signed-off-by: Kent Gibson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 5ca84d4 commit 08d94c7

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Documentation/userspace-api/gpio/gpio-lineevent-data-read.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ Edge detection must be enabled for the input line using either
4444
both. Edge events are then generated whenever edge interrupts are detected on
4545
the input line.
4646

47+
Edges are defined in terms of changes to the logical line value, so an inactive
48+
to active transition is a rising edge. If ``GPIOHANDLE_REQUEST_ACTIVE_LOW`` is
49+
set then logical polarity is the opposite of physical polarity, and
50+
``GPIOEVENT_REQUEST_RISING_EDGE`` then corresponds to a falling physical edge.
51+
4752
The kernel captures and timestamps edge events as close as possible to their
4853
occurrence and stores them in a buffer from where they can be read by
4954
userspace at its convenience using `read()`.

Documentation/userspace-api/gpio/gpio-v2-line-event-read.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ Edge detection must be enabled for the input line using either
4040
both. Edge events are then generated whenever edge interrupts are detected on
4141
the input line.
4242

43+
Edges are defined in terms of changes to the logical line value, so an inactive
44+
to active transition is a rising edge. If ``GPIO_V2_LINE_FLAG_ACTIVE_LOW`` is
45+
set then logical polarity is the opposite of physical polarity, and
46+
``GPIO_V2_LINE_FLAG_EDGE_RISING`` then corresponds to a falling physical edge.
47+
4348
The kernel captures and timestamps edge events as close as possible to their
4449
occurrence and stores them in a buffer from where they can be read by
4550
userspace at its convenience using `read()`.

0 commit comments

Comments
 (0)