Skip to content

Commit 1bd3387

Browse files
andy-shevrafaeljw
authored andcommitted
Documentation: firmware-guide: gpio-properties: Fix factual mistakes
Fix factual mistakes and style issues in GPIO properties document. This converts IoRestriction from InputOnly to OutputOnly as pins in the example are used as outputs. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent f8394f2 commit 1bd3387

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

Documentation/firmware-guide/acpi/gpio-properties.rst

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ index, like the ASL example below shows::
2020

2121
Name (_CRS, ResourceTemplate ()
2222
{
23-
GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionInputOnly,
23+
GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionOutputOnly,
2424
"\\_SB.GPO0", 0, ResourceConsumer) {15}
25-
GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionInputOnly,
25+
GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionOutputOnly,
2626
"\\_SB.GPO0", 0, ResourceConsumer) {27, 31}
2727
})
2828

@@ -49,7 +49,7 @@ index
4949
pin
5050
Pin in the GpioIo()/GpioInt() resource. Typically this is zero.
5151
active_low
52-
If 1 the GPIO is marked as active_low.
52+
If 1, the GPIO is marked as active_low.
5353

5454
Since ACPI GpioIo() resource does not have a field saying whether it is
5555
active low or high, the "active_low" argument can be used here. Setting
@@ -112,8 +112,8 @@ Example::
112112
Package () {
113113
"gpio-line-names",
114114
Package () {
115-
"SPI0_CS_N", "EXP2_INT", "MUX6_IO", "UART0_RXD", "MUX7_IO",
116-
"LVL_C_A1", "MUX0_IO", "SPI1_MISO"
115+
"SPI0_CS_N", "EXP2_INT", "MUX6_IO", "UART0_RXD",
116+
"MUX7_IO", "LVL_C_A1", "MUX0_IO", "SPI1_MISO",
117117
}
118118
}
119119

@@ -137,7 +137,7 @@ to the GPIO lines it is going to use and provide the GPIO subsystem with a
137137
mapping between those names and the ACPI GPIO resources corresponding to them.
138138

139139
To do that, the driver needs to define a mapping table as a NULL-terminated
140-
array of struct acpi_gpio_mapping objects that each contain a name, a pointer
140+
array of struct acpi_gpio_mapping objects that each contains a name, a pointer
141141
to an array of line data (struct acpi_gpio_params) objects and the size of that
142142
array. Each struct acpi_gpio_params object consists of three fields,
143143
crs_entry_index, line_index, active_low, representing the index of the target
@@ -154,13 +154,14 @@ question would look like this::
154154
static const struct acpi_gpio_mapping bluetooth_acpi_gpios[] = {
155155
{ "reset-gpios", &reset_gpio, 1 },
156156
{ "shutdown-gpios", &shutdown_gpio, 1 },
157-
{ },
157+
{ }
158158
};
159159

160160
Next, the mapping table needs to be passed as the second argument to
161-
acpi_dev_add_driver_gpios() that will register it with the ACPI device object
162-
pointed to by its first argument. That should be done in the driver's .probe()
163-
routine. On removal, the driver should unregister its GPIO mapping table by
161+
acpi_dev_add_driver_gpios() or its managed analogue that will
162+
register it with the ACPI device object pointed to by its first
163+
argument. That should be done in the driver's .probe() routine.
164+
On removal, the driver should unregister its GPIO mapping table by
164165
calling acpi_dev_remove_driver_gpios() on the ACPI device object where that
165166
table was previously registered.
166167

@@ -191,12 +192,12 @@ The driver might expect to get the right GPIO when it does::
191192
but since there is no way to know the mapping between "reset" and
192193
the GpioIo() in _CRS desc will hold ERR_PTR(-ENOENT).
193194

194-
The driver author can solve this by passing the mapping explictly
195-
(the recommended way and documented in the above chapter).
195+
The driver author can solve this by passing the mapping explicitly
196+
(this is the recommended way and it's documented in the above chapter).
196197

197198
The ACPI GPIO mapping tables should not contaminate drivers that are not
198199
knowing about which exact device they are servicing on. It implies that
199-
the ACPI GPIO mapping tables are hardly linked to ACPI ID and certain
200+
the ACPI GPIO mapping tables are hardly linked to an ACPI ID and certain
200201
objects, as listed in the above chapter, of the device in question.
201202

202203
Getting GPIO descriptor
@@ -229,5 +230,5 @@ Case 2 explicitly tells GPIO core to look for resources in _CRS.
229230
Be aware that gpiod_get_index() in cases 1 and 2, assuming that there
230231
are two versions of ACPI device description provided and no mapping is
231232
present in the driver, will return different resources. That's why a
232-
certain driver has to handle them carefully as explained in previous
233+
certain driver has to handle them carefully as explained in the previous
233234
chapter.

0 commit comments

Comments
 (0)