Skip to content

Commit 830751d

Browse files
andy-shevrafaeljw
authored andcommitted
ACPI: docs: gpio-properties: Unify ASL style for GPIO examples
GPIO examples of ASL in the board.rst, enumeration.rst and gpio-properties.rst are not unified. Unify them for better reader experience. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 01399a9 commit 830751d

3 files changed

Lines changed: 28 additions & 41 deletions

File tree

Documentation/driver-api/gpio/board.rst

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ with the help of _DSD (Device Specific Data), introduced in ACPI 5.1::
7171

7272
Device (FOO) {
7373
Name (_CRS, ResourceTemplate () {
74-
GpioIo (Exclusive, ..., IoRestrictionOutputOnly,
75-
"\\_SB.GPI0") {15} // red
76-
GpioIo (Exclusive, ..., IoRestrictionOutputOnly,
77-
"\\_SB.GPI0") {16} // green
78-
GpioIo (Exclusive, ..., IoRestrictionOutputOnly,
79-
"\\_SB.GPI0") {17} // blue
80-
GpioIo (Exclusive, ..., IoRestrictionOutputOnly,
81-
"\\_SB.GPI0") {1} // power
74+
GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionOutputOnly,
75+
"\\_SB.GPI0", 0, ResourceConsumer) { 15 } // red
76+
GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionOutputOnly,
77+
"\\_SB.GPI0", 0, ResourceConsumer) { 16 } // green
78+
GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionOutputOnly,
79+
"\\_SB.GPI0", 0, ResourceConsumer) { 17 } // blue
80+
GpioIo (Exclusive, PullNone, 0, 0, IoRestrictionOutputOnly,
81+
"\\_SB.GPI0", 0, ResourceConsumer) { 1 } // power
8282
})
8383

8484
Name (_DSD, Package () {
@@ -92,10 +92,7 @@ with the help of _DSD (Device Specific Data), introduced in ACPI 5.1::
9292
^FOO, 2, 0, 1,
9393
}
9494
},
95-
Package () {
96-
"power-gpios",
97-
Package () {^FOO, 3, 0, 0},
98-
},
95+
Package () { "power-gpios", Package () { ^FOO, 3, 0, 0 } },
9996
}
10097
})
10198
}

Documentation/firmware-guide/acpi/enumeration.rst

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -295,26 +295,13 @@ For example::
295295
{
296296
Name (SBUF, ResourceTemplate()
297297
{
298-
...
299298
// Used to power on/off the device
300-
GpioIo (Exclusive, PullDefault, 0x0000, 0x0000,
301-
IoRestrictionOutputOnly, "\\_SB.PCI0.GPI0",
302-
0x00, ResourceConsumer,,)
303-
{
304-
// Pin List
305-
0x0055
306-
}
299+
GpioIo (Exclusive, PullNone, 0, 0, IoRestrictionOutputOnly,
300+
"\\_SB.PCI0.GPI0", 0, ResourceConsumer) { 85 }
307301

308302
// Interrupt for the device
309-
GpioInt (Edge, ActiveHigh, ExclusiveAndWake, PullNone,
310-
0x0000, "\\_SB.PCI0.GPI0", 0x00, ResourceConsumer,,)
311-
{
312-
// Pin list
313-
0x0058
314-
}
315-
316-
...
317-
303+
GpioInt (Edge, ActiveHigh, ExclusiveAndWake, PullNone, 0,
304+
"\\_SB.PCI0.GPI0", 0, ResourceConsumer) { 88 }
318305
}
319306

320307
Return (SBUF)
@@ -331,6 +318,7 @@ For example::
331318
}
332319
})
333320
...
321+
}
334322

335323
These GPIO numbers are controller relative and path "\\_SB.PCI0.GPI0"
336324
specifies the path to the controller. In order to use these GPIOs in Linux

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

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ index, like the ASL example below shows::
2121
Name (_CRS, ResourceTemplate ()
2222
{
2323
GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionOutputOnly,
24-
"\\_SB.GPO0", 0, ResourceConsumer) {15}
24+
"\\_SB.GPO0", 0, ResourceConsumer) { 15 }
2525
GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionOutputOnly,
26-
"\\_SB.GPO0", 0, ResourceConsumer) {27, 31}
26+
"\\_SB.GPO0", 0, ResourceConsumer) { 27, 31 }
2727
})
2828

2929
Name (_DSD, Package ()
3030
{
3131
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
3232
Package ()
33-
{
34-
Package () {"reset-gpios", Package() {^BTH, 1, 1, 0 }},
35-
Package () {"shutdown-gpios", Package() {^BTH, 0, 0, 0 }},
33+
{
34+
Package () { "reset-gpios", Package () { ^BTH, 1, 1, 0 } },
35+
Package () { "shutdown-gpios", Package () { ^BTH, 0, 0, 0 } },
3636
}
3737
})
3838
}
@@ -123,17 +123,17 @@ Example::
123123
// _DSD Hierarchical Properties Extension UUID
124124
ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
125125
Package () {
126-
Package () {"hog-gpio8", "G8PU"}
126+
Package () { "hog-gpio8", "G8PU" }
127127
}
128128
})
129129

130130
Name (G8PU, Package () {
131131
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
132132
Package () {
133-
Package () {"gpio-hog", 1},
134-
Package () {"gpios", Package () {8, 0}},
135-
Package () {"output-high", 1},
136-
Package () {"line-name", "gpio8-pullup"},
133+
Package () { "gpio-hog", 1 },
134+
Package () { "gpios", Package () { 8, 0 } },
135+
Package () { "output-high", 1 },
136+
Package () { "line-name", "gpio8-pullup" },
137137
}
138138
})
139139

@@ -266,15 +266,17 @@ have a device like below::
266266

267267
Name (_CRS, ResourceTemplate () {
268268
GpioIo (Exclusive, PullNone, 0, 0, IoRestrictionNone,
269-
"\\_SB.GPO0", 0, ResourceConsumer) {15}
269+
"\\_SB.GPO0", 0, ResourceConsumer) { 15 }
270270
GpioIo (Exclusive, PullNone, 0, 0, IoRestrictionNone,
271-
"\\_SB.GPO0", 0, ResourceConsumer) {27}
271+
"\\_SB.GPO0", 0, ResourceConsumer) { 27 }
272272
})
273273
}
274274

275275
The driver might expect to get the right GPIO when it does::
276276

277277
desc = gpiod_get(dev, "reset", GPIOD_OUT_LOW);
278+
if (IS_ERR(desc))
279+
...error handling...
278280

279281
but since there is no way to know the mapping between "reset" and
280282
the GpioIo() in _CRS desc will hold ERR_PTR(-ENOENT).

0 commit comments

Comments
 (0)