From: Changbin Du <changbin.du@gmail.com>
To: rjw@rjwysocki.net, Jonathan Corbet <corbet@lwn.net>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
fenghua.yu@intel.com, linuxppc-dev@lists.ozlabs.org,
linux-acpi@vger.kernel.org, linux-gpio@vger.kernel.org,
mchehab+samsung@kernel.org, Changbin Du <changbin.du@gmail.com>
Subject: [PATCH v5 07/23] Documentation: ACPI: move gpio-properties.txt to firmware-guide/acpi and convert to reST
Date: Thu, 25 Apr 2019 01:52:50 +0800 [thread overview]
Message-ID: <20190424175306.25880-8-changbin.du@gmail.com> (raw)
In-Reply-To: <20190424175306.25880-1-changbin.du@gmail.com>
This converts the plain text documentation to reStructuredText format and
add it to Sphinx TOC tree. No essential content change.
Signed-off-by: Changbin Du <changbin.du@gmail.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
---
.../acpi/gpio-properties.rst} | 78 +++++++++++--------
Documentation/firmware-guide/acpi/index.rst | 1 +
MAINTAINERS | 2 +-
3 files changed, 46 insertions(+), 35 deletions(-)
rename Documentation/{acpi/gpio-properties.txt => firmware-guide/acpi/gpio-properties.rst} (81%)
diff --git a/Documentation/acpi/gpio-properties.txt b/Documentation/firmware-guide/acpi/gpio-properties.rst
similarity index 81%
rename from Documentation/acpi/gpio-properties.txt
rename to Documentation/firmware-guide/acpi/gpio-properties.rst
index 88c65cb5bf0a..bb6d74f23ee0 100644
--- a/Documentation/acpi/gpio-properties.txt
+++ b/Documentation/firmware-guide/acpi/gpio-properties.rst
@@ -1,5 +1,8 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+======================================
_DSD Device Properties Related to GPIO
---------------------------------------
+======================================
With the release of ACPI 5.1, the _DSD configuration object finally
allows names to be given to GPIOs (and other things as well) returned
@@ -8,7 +11,7 @@ the corresponding GPIO, which is pretty error prone (it depends on
the _CRS output ordering, for example).
With _DSD we can now query GPIOs using a name instead of an integer
-index, like the ASL example below shows:
+index, like the ASL example below shows::
// Bluetooth device with reset and shutdown GPIOs
Device (BTH)
@@ -34,15 +37,19 @@ index, like the ASL example below shows:
})
}
-The format of the supported GPIO property is:
+The format of the supported GPIO property is::
Package () { "name", Package () { ref, index, pin, active_low }}
- ref - The device that has _CRS containing GpioIo()/GpioInt() resources,
- typically this is the device itself (BTH in our case).
- index - Index of the GpioIo()/GpioInt() resource in _CRS starting from zero.
- pin - Pin in the GpioIo()/GpioInt() resource. Typically this is zero.
- active_low - If 1 the GPIO is marked as active_low.
+ref
+ The device that has _CRS containing GpioIo()/GpioInt() resources,
+ typically this is the device itself (BTH in our case).
+index
+ Index of the GpioIo()/GpioInt() resource in _CRS starting from zero.
+pin
+ Pin in the GpioIo()/GpioInt() resource. Typically this is zero.
+active_low
+ If 1 the GPIO is marked as active_low.
Since ACPI GpioIo() resource does not have a field saying whether it is
active low or high, the "active_low" argument can be used here. Setting
@@ -55,7 +62,7 @@ It is possible to leave holes in the array of GPIOs. This is useful in
cases like with SPI host controllers where some chip selects may be
implemented as GPIOs and some as native signals. For example a SPI host
controller can have chip selects 0 and 2 implemented as GPIOs and 1 as
-native:
+native::
Package () {
"cs-gpios",
@@ -67,7 +74,7 @@ native:
}
Other supported properties
---------------------------
+==========================
Following Device Tree compatible device properties are also supported by
_DSD device properties for GPIO controllers:
@@ -78,7 +85,7 @@ _DSD device properties for GPIO controllers:
- input
- line-name
-Example:
+Example::
Name (_DSD, Package () {
// _DSD Hierarchical Properties Extension UUID
@@ -100,7 +107,7 @@ Example:
- gpio-line-names
-Example:
+Example::
Package () {
"gpio-line-names",
@@ -114,7 +121,7 @@ See Documentation/devicetree/bindings/gpio/gpio.txt for more information
about these properties.
ACPI GPIO Mappings Provided by Drivers
---------------------------------------
+======================================
There are systems in which the ACPI tables do not contain _DSD but provide _CRS
with GpioIo()/GpioInt() resources and device drivers still need to work with
@@ -139,16 +146,16 @@ line in that resource starting from zero, and the active-low flag for that line,
respectively, in analogy with the _DSD GPIO property format specified above.
For the example Bluetooth device discussed previously the data structures in
-question would look like this:
+question would look like this::
-static const struct acpi_gpio_params reset_gpio = { 1, 1, false };
-static const struct acpi_gpio_params shutdown_gpio = { 0, 0, false };
+ static const struct acpi_gpio_params reset_gpio = { 1, 1, false };
+ static const struct acpi_gpio_params shutdown_gpio = { 0, 0, false };
-static const struct acpi_gpio_mapping bluetooth_acpi_gpios[] = {
- { "reset-gpios", &reset_gpio, 1 },
- { "shutdown-gpios", &shutdown_gpio, 1 },
- { },
-};
+ static const struct acpi_gpio_mapping bluetooth_acpi_gpios[] = {
+ { "reset-gpios", &reset_gpio, 1 },
+ { "shutdown-gpios", &shutdown_gpio, 1 },
+ { },
+ };
Next, the mapping table needs to be passed as the second argument to
acpi_dev_add_driver_gpios() that will register it with the ACPI device object
@@ -158,12 +165,12 @@ calling acpi_dev_remove_driver_gpios() on the ACPI device object where that
table was previously registered.
Using the _CRS fallback
------------------------
+=======================
If a device does not have _DSD or the driver does not create ACPI GPIO
mapping, the Linux GPIO framework refuses to return any GPIOs. This is
because the driver does not know what it actually gets. For example if we
-have a device like below:
+have a device like below::
Device (BTH)
{
@@ -177,7 +184,7 @@ have a device like below:
})
}
-The driver might expect to get the right GPIO when it does:
+The driver might expect to get the right GPIO when it does::
desc = gpiod_get(dev, "reset", GPIOD_OUT_LOW);
@@ -193,22 +200,25 @@ the ACPI GPIO mapping tables are hardly linked to ACPI ID and certain
objects, as listed in the above chapter, of the device in question.
Getting GPIO descriptor
------------------------
+=======================
+
+There are two main approaches to get GPIO resource from ACPI::
-There are two main approaches to get GPIO resource from ACPI:
- desc = gpiod_get(dev, connection_id, flags);
- desc = gpiod_get_index(dev, connection_id, index, flags);
+ desc = gpiod_get(dev, connection_id, flags);
+ desc = gpiod_get_index(dev, connection_id, index, flags);
We may consider two different cases here, i.e. when connection ID is
provided and otherwise.
-Case 1:
- desc = gpiod_get(dev, "non-null-connection-id", flags);
- desc = gpiod_get_index(dev, "non-null-connection-id", index, flags);
+Case 1::
+
+ desc = gpiod_get(dev, "non-null-connection-id", flags);
+ desc = gpiod_get_index(dev, "non-null-connection-id", index, flags);
+
+Case 2::
-Case 2:
- desc = gpiod_get(dev, NULL, flags);
- desc = gpiod_get_index(dev, NULL, index, flags);
+ desc = gpiod_get(dev, NULL, flags);
+ desc = gpiod_get_index(dev, NULL, index, flags);
Case 1 assumes that corresponding ACPI device description must have
defined device properties and will prevent to getting any GPIO resources
diff --git a/Documentation/firmware-guide/acpi/index.rst b/Documentation/firmware-guide/acpi/index.rst
index 0e05b843521c..61d67763851b 100644
--- a/Documentation/firmware-guide/acpi/index.rst
+++ b/Documentation/firmware-guide/acpi/index.rst
@@ -11,3 +11,4 @@ ACPI Support
enumeration
osi
DSD-properties-rules
+ gpio-properties
diff --git a/MAINTAINERS b/MAINTAINERS
index 09f43f1bdd15..87f930bf32ad 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6593,7 +6593,7 @@ M: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
L: linux-gpio@vger.kernel.org
L: linux-acpi@vger.kernel.org
S: Maintained
-F: Documentation/acpi/gpio-properties.txt
+F: Documentation/firmware-guide/acpi/gpio-properties.rst
F: drivers/gpio/gpiolib-acpi.c
GPIO IR Transmitter
--
2.20.1
next prev parent reply other threads:[~2019-04-24 17:52 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-24 17:52 [PATCH v5 00/23] Include linux ACPI docs into Sphinx TOC tree Changbin Du
2019-04-24 17:52 ` [PATCH v5 01/23] Documentation: ACPI: move namespace.txt to firmware-guide/acpi and convert to reST Changbin Du
2019-04-24 17:52 ` [PATCH v5 02/23] Documentation: ACPI: move enumeration.txt " Changbin Du
2019-04-24 17:52 ` [PATCH v5 03/23] Documentation: ACPI: move osi.txt " Changbin Du
2019-04-24 17:52 ` [PATCH v5 04/23] Documentation: ACPI: move linuxized-acpica.txt to driver-api/acpi " Changbin Du
2019-04-24 17:52 ` [PATCH v5 05/23] Documentation: ACPI: move scan_handlers.txt " Changbin Du
2019-04-24 17:52 ` [PATCH v5 06/23] Documentation: ACPI: move DSD-properties-rules.txt to firmware-guide/acpi and covert " Changbin Du
2019-04-24 17:52 ` Changbin Du [this message]
2019-04-24 17:52 ` [PATCH v5 08/23] Documentation: ACPI: move method-customizing.txt to firmware-guide/acpi and convert " Changbin Du
2019-04-24 18:08 ` Mauro Carvalho Chehab
2019-04-24 17:52 ` [PATCH v5 09/23] Documentation: ACPI: move initrd_table_override.txt to admin-guide/acpi " Changbin Du
2019-04-24 17:52 ` [PATCH v5 10/23] Documentation: ACPI: move dsdt-override.txt " Changbin Du
2019-04-24 17:52 ` [PATCH v5 11/23] Documentation: ACPI: move i2c-muxes.txt to firmware-guide/acpi " Changbin Du
2019-04-24 17:52 ` [PATCH v5 12/23] Documentation: ACPI: move acpi-lid.txt " Changbin Du
2019-04-24 17:52 ` [PATCH v5 13/23] Documentation: ACPI: move dsd/graph.txt " Changbin Du
2019-04-24 17:52 ` [PATCH v5 14/23] Documentation: ACPI: move dsd/data-node-references.txt " Changbin Du
2019-04-24 18:10 ` Mauro Carvalho Chehab
2019-04-24 17:52 ` [PATCH v5 15/23] Documentation: ACPI: move debug.txt " Changbin Du
2019-04-24 17:52 ` [PATCH v5 16/23] Documentation: ACPI: move method-tracing.txt to firmware-guide/acpi and convert to rsST Changbin Du
2019-04-24 17:53 ` [PATCH v5 17/23] Documentation: ACPI: move aml-debugger.txt to firmware-guide/acpi and convert to reST Changbin Du
2019-04-24 17:53 ` [PATCH v5 18/23] Documentation: ACPI: move apei/output_format.txt " Changbin Du
2019-04-24 17:53 ` [PATCH v5 19/23] Documentation: ACPI: move apei/einj.txt " Changbin Du
2019-04-24 17:53 ` [PATCH v5 20/23] Documentation: ACPI: move cppc_sysfs.txt to admin-guide/acpi " Changbin Du
2019-04-24 18:12 ` Mauro Carvalho Chehab
2019-04-25 0:44 ` Changbin Du
2019-04-24 17:53 ` [PATCH v5 21/23] Documentation: ACPI: move lpit.txt to firmware-guide/acpi " Changbin Du
2019-04-24 17:53 ` [PATCH v5 22/23] Documentation: ACPI: move ssdt-overlays.txt to admin-guide/acpi " Changbin Du
2019-04-24 17:53 ` [PATCH v5 23/23] Documentation: ACPI: move video_extension.txt to firmware-guide/acpi " Changbin Du
2019-04-24 18:26 ` Mauro Carvalho Chehab
2019-04-25 8:44 ` [PATCH v5 00/23] Include linux ACPI docs into Sphinx TOC tree Rafael J. Wysocki
2019-04-25 15:20 ` Changbin Du
2019-05-01 10:15 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190424175306.25880-8-changbin.du@gmail.com \
--to=changbin.du@gmail.com \
--cc=bhelgaas@google.com \
--cc=corbet@lwn.net \
--cc=fenghua.yu@intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mchehab+samsung@kernel.org \
--cc=rjw@rjwysocki.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).