[lkml]   [2022]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH v1 2/3] Documentation: gpio: Add a section on what to return in ->get() callback
The ->get() callback depending on other settings and hardware support
may return different values, while the line outside the chip is kept
in the same state. Let's discuss that in the documentation.

Signed-off-by: Andy Shevchenko <>
Documentation/driver-api/gpio/driver.rst | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)

diff --git a/Documentation/driver-api/gpio/driver.rst b/Documentation/driver-api/gpio/driver.rst
index bf6319cc531b..3d2f36001a7a 100644
--- a/Documentation/driver-api/gpio/driver.rst
+++ b/Documentation/driver-api/gpio/driver.rst
@@ -251,6 +251,30 @@ supports more versatile control over electrical properties and can handle
different pull-up or pull-down resistance values.

+Considerations of the ->get() returned value
+Due to different possible electrical configurations and software applications
+the value that ->get() callback returns may vary depending on the other settings.
+This will allow to use pins in the I2C emulation mode or other not so standard
+The below table gathered the most used cases.
+========== ========== =============== =======================
+ Input Output State What value to return?
+========== ========== =============== =======================
+ Disabled Disabled Hi-Z input buffer
+ Disabled OS/OD/etc Single ended [cached] output buffer
+ x Push-Pull Out [cached] output buffer
+ Enabled Disabled In input buffer
+ Enabled OS/OD/etc Bidirectional input buffer
+========== ========== =============== =======================
+The [cached] here is used in a broader sense: either pure software cache, or
+read back value from the GPIO output buffer (not all hardware support that).
GPIO drivers providing IRQs

 \ /
  Last update: 2022-11-30 16:56    [W:0.300 / U:0.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site