summaryrefslogtreecommitdiffstats
path: root/Documentation/acpi
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-07-07 15:40:27 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-07-07 15:40:27 -0400
commitc7d28eca1d58d335ff8de6f33559b221bdd029f9 (patch)
tree3522cae5809d6912ccc307a4b0a7dea3ffeb8225 /Documentation/acpi
parentdddd564dbb5934c9a0c401491cafb98ab1c82fc6 (diff)
parent413058df4331ce29f9934a5870d582c7e71fe15f (diff)
Merge tag 'gpio-v4.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull GPIO updates from Linus Walleij: "This is the bulk of GPIO changes for the v4.13 series. Some administrativa: I have a slew of 8250 serial patches and the new IOT2040 serial+GPIO driver coming in through this tree, along with a whole bunch of Exar 8250 fixes. These are ACKed by Greg and also hit drivers/platform/* where they are ACKed by Andy Shevchenko. Speaking about drivers/platform/* there is also a bunch of ACPI stuff coming through that route, again ACKed by Andy. The MCP23S08 changes are coming in here as well. You already have the commits in your tree, so this is just a result of sharing an immutable branch between pin control and GPIO. Core: - Export add/remove for lookup tables so that modules can export GPIO descriptor tables. - Handle GPIO sleep states: it is now possible to flag that a GPIO line may loose its state during suspend/resume of the system to save power. This is used in the Wolfson Micro Arizona driver. - ACPI-based GPIO was tightened up a lot around the edges. - Use bitmap_fill() to speed up a loop. New drivers: - Exar XRA1403 SPI-based GPIO. - MVEBU driver now supports Armada 7K and 8K. - LP87565 PMIC GPIO. - Renesas R-CAR R8A7743 (RZ/G1M). - The new IOT2040 8250 serial/GPIO also comes in through this changeset. Substantial driver changes: - Seriously fix the Exar 8250 GPIO portions to work. - The MCP23S08 was moved out to a pin control driver. - Convert MEVEBU to use regmap for register access. - Drop Vulcan support from the Broadcom driver. - Serious cleanup and improvement of the mockup driver, giving us a better test coverage. Misc: - Lots of janitorial clean up. - A bunch of documentation fixes" * tag 'gpio-v4.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (70 commits) serial: exar: Add support for IOT2040 device gpio-exar/8250-exar: Make set of exported GPIOs configurable platform: Accept const properties serial: exar: Factor out platform hooks gpio-exar/8250-exar: Rearrange gpiochip parenthood gpio: exar: Fix iomap request gpio-exar/8250-exar: Do not even instantiate a GPIO device for Commtech cards serial: uapi: Add support for bus termination gpio: rcar: Add R8A7743 (RZ/G1M) support gpio: gpio-wcove: Fix GPIO control register offset calculation gpio: lp87565: Add support for GPIO gpio: dwapb: fix missing first irq for edgeboth irq type MAINTAINERS: Take maintainership for GPIO ACPI support gpio: exar: Fix reading of directions and values gpio: exar: Allocate resources on behalf of the platform device gpio-exar/8250-exar: Fix passing in of parent PCI device gpio: mockup: use devm_kcalloc() where applicable gpio: mockup: add myself as author gpio: mockup: improve the error message gpio: mockup: don't return magic numbers from probe() ...
Diffstat (limited to 'Documentation/acpi')
-rw-r--r--Documentation/acpi/gpio-properties.txt65
1 files changed, 65 insertions, 0 deletions
diff --git a/Documentation/acpi/gpio-properties.txt b/Documentation/acpi/gpio-properties.txt
index 2aff0349facd..88c65cb5bf0a 100644
--- a/Documentation/acpi/gpio-properties.txt
+++ b/Documentation/acpi/gpio-properties.txt
@@ -156,3 +156,68 @@ pointed to by its first argument. That should be done in the driver's .probe()
156routine. On removal, the driver should unregister its GPIO mapping table by 156routine. On removal, the driver should unregister its GPIO mapping table by
157calling acpi_dev_remove_driver_gpios() on the ACPI device object where that 157calling acpi_dev_remove_driver_gpios() on the ACPI device object where that
158table was previously registered. 158table was previously registered.
159
160Using the _CRS fallback
161-----------------------
162
163If a device does not have _DSD or the driver does not create ACPI GPIO
164mapping, the Linux GPIO framework refuses to return any GPIOs. This is
165because the driver does not know what it actually gets. For example if we
166have a device like below:
167
168 Device (BTH)
169 {
170 Name (_HID, ...)
171
172 Name (_CRS, ResourceTemplate () {
173 GpioIo (Exclusive, PullNone, 0, 0, IoRestrictionNone,
174 "\\_SB.GPO0", 0, ResourceConsumer) {15}
175 GpioIo (Exclusive, PullNone, 0, 0, IoRestrictionNone,
176 "\\_SB.GPO0", 0, ResourceConsumer) {27}
177 })
178 }
179
180The driver might expect to get the right GPIO when it does:
181
182 desc = gpiod_get(dev, "reset", GPIOD_OUT_LOW);
183
184but since there is no way to know the mapping between "reset" and
185the GpioIo() in _CRS desc will hold ERR_PTR(-ENOENT).
186
187The driver author can solve this by passing the mapping explictly
188(the recommended way and documented in the above chapter).
189
190The ACPI GPIO mapping tables should not contaminate drivers that are not
191knowing about which exact device they are servicing on. It implies that
192the ACPI GPIO mapping tables are hardly linked to ACPI ID and certain
193objects, as listed in the above chapter, of the device in question.
194
195Getting GPIO descriptor
196-----------------------
197
198There are two main approaches to get GPIO resource from ACPI:
199 desc = gpiod_get(dev, connection_id, flags);
200 desc = gpiod_get_index(dev, connection_id, index, flags);
201
202We may consider two different cases here, i.e. when connection ID is
203provided and otherwise.
204
205Case 1:
206 desc = gpiod_get(dev, "non-null-connection-id", flags);
207 desc = gpiod_get_index(dev, "non-null-connection-id", index, flags);
208
209Case 2:
210 desc = gpiod_get(dev, NULL, flags);
211 desc = gpiod_get_index(dev, NULL, index, flags);
212
213Case 1 assumes that corresponding ACPI device description must have
214defined device properties and will prevent to getting any GPIO resources
215otherwise.
216
217Case 2 explicitly tells GPIO core to look for resources in _CRS.
218
219Be aware that gpiod_get_index() in cases 1 and 2, assuming that there
220are two versions of ACPI device description provided and no mapping is
221present in the driver, will return different resources. That's why a
222certain driver has to handle them carefully as explained in previous
223chapter.