aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-04-22 09:27:04 -0400
committerLinus Walleij <linus.walleij@linaro.org>2019-04-23 17:30:07 -0400
commit7358a821f0b571e824fa531c4f764000eeee320a (patch)
tree7b36e6643848a26fac739381c44f43d131664138
parent4a4b119b176e992912941a1e9dfa9d138b1c2faa (diff)
docs: gpio: convert docs to ReST and rename to *.rst
The API described at sysfs.txt is deprecated. Still, as it is still part of the Kernel (and will likely be there for some time, as we don't simply remove APIs). So, it makes sense to keep it there. The conversion of this file is trivial: - add blank lines and identation in order to identify paragraphs; - mark a literal block as such. At its new index.rst, let's add a :orphan: while this is not linked to the main index.rst file, in order to avoid build warnings. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--Documentation/gpio/index.rst17
-rw-r--r--Documentation/gpio/sysfs.rst (renamed from Documentation/gpio/sysfs.txt)39
2 files changed, 42 insertions, 14 deletions
diff --git a/Documentation/gpio/index.rst b/Documentation/gpio/index.rst
new file mode 100644
index 000000000000..09a4a553f434
--- /dev/null
+++ b/Documentation/gpio/index.rst
@@ -0,0 +1,17 @@
1:orphan:
2
3====
4gpio
5====
6
7.. toctree::
8 :maxdepth: 1
9
10 sysfs
11
12.. only:: subproject and html
13
14 Indices
15 =======
16
17 * :ref:`genindex`
diff --git a/Documentation/gpio/sysfs.txt b/Documentation/gpio/sysfs.rst
index 58eeab81f349..ec09ffd983e7 100644
--- a/Documentation/gpio/sysfs.txt
+++ b/Documentation/gpio/sysfs.rst
@@ -1,10 +1,12 @@
1GPIO Sysfs Interface for Userspace 1GPIO Sysfs Interface for Userspace
2================================== 2==================================
3 3
4THIS ABI IS DEPRECATED, THE ABI DOCUMENTATION HAS BEEN MOVED TO 4.. warning::
5Documentation/ABI/obsolete/sysfs-gpio AND NEW USERSPACE CONSUMERS 5
6ARE SUPPOSED TO USE THE CHARACTER DEVICE ABI. THIS OLD SYSFS ABI WILL 6 THIS ABI IS DEPRECATED, THE ABI DOCUMENTATION HAS BEEN MOVED TO
7NOT BE DEVELOPED (NO NEW FEATURES), IT WILL JUST BE MAINTAINED. 7 Documentation/ABI/obsolete/sysfs-gpio AND NEW USERSPACE CONSUMERS
8 ARE SUPPOSED TO USE THE CHARACTER DEVICE ABI. THIS OLD SYSFS ABI WILL
9 NOT BE DEVELOPED (NO NEW FEATURES), IT WILL JUST BE MAINTAINED.
8 10
9Refer to the examples in tools/gpio/* for an introduction to the new 11Refer to the examples in tools/gpio/* for an introduction to the new
10character device ABI. Also see the userspace header in 12character device ABI. Also see the userspace header in
@@ -51,13 +53,15 @@ The control interfaces are write-only:
51 53
52 /sys/class/gpio/ 54 /sys/class/gpio/
53 55
54 "export" ... Userspace may ask the kernel to export control of 56 "export" ...
57 Userspace may ask the kernel to export control of
55 a GPIO to userspace by writing its number to this file. 58 a GPIO to userspace by writing its number to this file.
56 59
57 Example: "echo 19 > export" will create a "gpio19" node 60 Example: "echo 19 > export" will create a "gpio19" node
58 for GPIO #19, if that's not requested by kernel code. 61 for GPIO #19, if that's not requested by kernel code.
59 62
60 "unexport" ... Reverses the effect of exporting to userspace. 63 "unexport" ...
64 Reverses the effect of exporting to userspace.
61 65
62 Example: "echo 19 > unexport" will remove a "gpio19" 66 Example: "echo 19 > unexport" will remove a "gpio19"
63 node exported using the "export" file. 67 node exported using the "export" file.
@@ -67,7 +71,8 @@ and have the following read/write attributes:
67 71
68 /sys/class/gpio/gpioN/ 72 /sys/class/gpio/gpioN/
69 73
70 "direction" ... reads as either "in" or "out". This value may 74 "direction" ...
75 reads as either "in" or "out". This value may
71 normally be written. Writing as "out" defaults to 76 normally be written. Writing as "out" defaults to
72 initializing the value as low. To ensure glitch free 77 initializing the value as low. To ensure glitch free
73 operation, values "low" and "high" may be written to 78 operation, values "low" and "high" may be written to
@@ -78,7 +83,8 @@ and have the following read/write attributes:
78 it was exported by kernel code that didn't explicitly 83 it was exported by kernel code that didn't explicitly
79 allow userspace to reconfigure this GPIO's direction. 84 allow userspace to reconfigure this GPIO's direction.
80 85
81 "value" ... reads as either 0 (low) or 1 (high). If the GPIO 86 "value" ...
87 reads as either 0 (low) or 1 (high). If the GPIO
82 is configured as an output, this value may be written; 88 is configured as an output, this value may be written;
83 any nonzero value is treated as high. 89 any nonzero value is treated as high.
84 90
@@ -92,14 +98,16 @@ and have the following read/write attributes:
92 file and read the new value or close the file and re-open it 98 file and read the new value or close the file and re-open it
93 to read the value. 99 to read the value.
94 100
95 "edge" ... reads as either "none", "rising", "falling", or 101 "edge" ...
102 reads as either "none", "rising", "falling", or
96 "both". Write these strings to select the signal edge(s) 103 "both". Write these strings to select the signal edge(s)
97 that will make poll(2) on the "value" file return. 104 that will make poll(2) on the "value" file return.
98 105
99 This file exists only if the pin can be configured as an 106 This file exists only if the pin can be configured as an
100 interrupt generating input pin. 107 interrupt generating input pin.
101 108
102 "active_low" ... reads as either 0 (false) or 1 (true). Write 109 "active_low" ...
110 reads as either 0 (false) or 1 (true). Write
103 any nonzero value to invert the value attribute both 111 any nonzero value to invert the value attribute both
104 for reading and writing. Existing and subsequent 112 for reading and writing. Existing and subsequent
105 poll(2) support configuration via the edge attribute 113 poll(2) support configuration via the edge attribute
@@ -112,11 +120,14 @@ read-only attributes:
112 120
113 /sys/class/gpio/gpiochipN/ 121 /sys/class/gpio/gpiochipN/
114 122
115 "base" ... same as N, the first GPIO managed by this chip 123 "base" ...
124 same as N, the first GPIO managed by this chip
116 125
117 "label" ... provided for diagnostics (not always unique) 126 "label" ...
127 provided for diagnostics (not always unique)
118 128
119 "ngpio" ... how many GPIOs this manages (N to N + ngpio - 1) 129 "ngpio" ...
130 how many GPIOs this manages (N to N + ngpio - 1)
120 131
121Board documentation should in most cases cover what GPIOs are used for 132Board documentation should in most cases cover what GPIOs are used for
122what purposes. However, those numbers are not always stable; GPIOs on 133what purposes. However, those numbers are not always stable; GPIOs on
@@ -129,7 +140,7 @@ the correct GPIO number to use for a given signal.
129Exporting from Kernel code 140Exporting from Kernel code
130-------------------------- 141--------------------------
131Kernel code can explicitly manage exports of GPIOs which have already been 142Kernel code can explicitly manage exports of GPIOs which have already been
132requested using gpio_request(): 143requested using gpio_request()::
133 144
134 /* export the GPIO to userspace */ 145 /* export the GPIO to userspace */
135 int gpiod_export(struct gpio_desc *desc, bool direction_may_change); 146 int gpiod_export(struct gpio_desc *desc, bool direction_may_change);