linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4] Documentation: ACPI: explain how to use gpio-line-names
@ 2020-11-12 13:15 Flavio Suligoi
  2020-11-12 13:40 ` Andy Shevchenko
  2020-11-16 18:37 ` Rafael J. Wysocki
  0 siblings, 2 replies; 4+ messages in thread
From: Flavio Suligoi @ 2020-11-12 13:15 UTC (permalink / raw)
  To: Mika Westerberg, Andy Shevchenko, Rafael J . Wysocki, Len Brown
  Cc: linux-gpio, linux-acpi, linux-kernel, Flavio Suligoi

The "gpio-line-names" declaration is not fully
documented, so can be useful to add some important
information and one more example.

This commit also fixes a trivial spelling mistake.

Signed-off-by: Flavio Suligoi <f.suligoi@asem.it>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---

v2: - fix commit spelling mistakes
    - add double back quotes to gpio-line-names
    - adjust documentation lines layout
    - add comma at the end of Package list names in the first example

v3: - add: Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

v4: - add: Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>

 .../firmware-guide/acpi/gpio-properties.rst   | 58 ++++++++++++++++++-
 1 file changed, 56 insertions(+), 2 deletions(-)

diff --git a/Documentation/firmware-guide/acpi/gpio-properties.rst b/Documentation/firmware-guide/acpi/gpio-properties.rst
index bb6d74f23ee0..ae5396a1f092 100644
--- a/Documentation/firmware-guide/acpi/gpio-properties.rst
+++ b/Documentation/firmware-guide/acpi/gpio-properties.rst
@@ -107,7 +107,61 @@ Example::
 
 - gpio-line-names
 
-Example::
+The ``gpio-line-names`` declaration is a list of strings ("names"), which
+describes each line/pin of a GPIO controller/expander. This list, contained in
+a package, must be inserted inside the GPIO controller declaration of an ACPI
+table (typically inside the DSDT). The ``gpio-line-names`` list must respect the
+following rules (see also the examples):
+
+  - the first name in the list corresponds with the first line/pin of the GPIO
+    controller/expander
+  - the names inside the list must be consecutive (no "holes" are permitted)
+  - the list can be incomplete and can end before the last GPIO line: in
+    other words, it is not mandatory to fill all the GPIO lines
+  - empty names are allowed (two quotation marks ``""`` correspond to an empty
+    name)
+
+Example of a GPIO controller of 16 lines, with an incomplete list with two
+empty names::
+
+  Package () {
+      "gpio-line-names",
+      Package () {
+          "pin_0",
+          "pin_1",
+          "",
+          "",
+          "pin_3",
+          "pin_4_push_button",
+      }
+  }
+
+At runtime, the above declaration produces the following result (using the
+"libgpiod" tools)::
+
+  root@debian:~# gpioinfo gpiochip4
+  gpiochip4 - 16 lines:
+          line   0:      "pin_0"       unused   input  active-high
+          line   1:      "pin_1"       unused   input  active-high
+          line   2:      unnamed       unused   input  active-high
+          line   3:      unnamed       unused   input  active-high
+          line   4:      "pin_3"       unused   input  active-high
+          line   5: "pin_4_push_button" unused input active-high
+          line   6:      unnamed       unused   input  active-high
+          line   7       unnamed       unused   input  active-high
+          line   8:      unnamed       unused   input  active-high
+          line   9:      unnamed       unused   input  active-high
+          line  10:      unnamed       unused   input  active-high
+          line  11:      unnamed       unused   input  active-high
+          line  12:      unnamed       unused   input  active-high
+          line  13:      unnamed       unused   input  active-high
+          line  14:      unnamed       unused   input  active-high
+          line  15:      unnamed       unused   input  active-high
+  root@debian:~# gpiofind pin_4_push_button
+  gpiochip4 5
+  root@debian:~#
+
+Another example::
 
   Package () {
       "gpio-line-names",
@@ -191,7 +245,7 @@ The driver might expect to get the right GPIO when it does::
 but since there is no way to know the mapping between "reset" and
 the GpioIo() in _CRS desc will hold ERR_PTR(-ENOENT).
 
-The driver author can solve this by passing the mapping explictly
+The driver author can solve this by passing the mapping explicitly
 (the recommended way and documented in the above chapter).
 
 The ACPI GPIO mapping tables should not contaminate drivers that are not
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v4] Documentation: ACPI: explain how to use gpio-line-names
  2020-11-12 13:15 [PATCH v4] Documentation: ACPI: explain how to use gpio-line-names Flavio Suligoi
@ 2020-11-12 13:40 ` Andy Shevchenko
  2020-11-12 13:50   ` Flavio Suligoi
  2020-11-16 18:37 ` Rafael J. Wysocki
  1 sibling, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2020-11-12 13:40 UTC (permalink / raw)
  To: Flavio Suligoi
  Cc: Mika Westerberg, Rafael J . Wysocki, Len Brown, linux-gpio,
	linux-acpi, linux-kernel

On Thu, Nov 12, 2020 at 02:15:45PM +0100, Flavio Suligoi wrote:
> The "gpio-line-names" declaration is not fully
> documented, so can be useful to add some important
> information and one more example.
> 
> This commit also fixes a trivial spelling mistake.

For the future contributions:

No need to resend each time you got a tag. Maintainers usually take them all at
once when applying (esp. taking into account plenty of scripts which help to do
this automatically).

Also, no need to resend so often. Give a chance to others to review (minimum
resend time is 24h)

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH v4] Documentation: ACPI: explain how to use gpio-line-names
  2020-11-12 13:40 ` Andy Shevchenko
@ 2020-11-12 13:50   ` Flavio Suligoi
  0 siblings, 0 replies; 4+ messages in thread
From: Flavio Suligoi @ 2020-11-12 13:50 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Mika Westerberg, Rafael J . Wysocki, Len Brown, linux-gpio,
	linux-acpi, linux-kernel

HI Andy,

> On Thu, Nov 12, 2020 at 02:15:45PM +0100, Flavio Suligoi wrote:
> > The "gpio-line-names" declaration is not fully
> > documented, so can be useful to add some important
> > information and one more example.
> >
> > This commit also fixes a trivial spelling mistake.
> 
> For the future contributions:
> 
> No need to resend each time you got a tag. Maintainers usually take them
> all at
> once when applying (esp. taking into account plenty of scripts which help
> to do
> this automatically).

ok

> 
> Also, no need to resend so often. Give a chance to others to review
> (minimum
> resend time is 24h)

ok, right!

> 
> --
> With Best Regards,
> Andy Shevchenko
> 

Regards,
Flavio

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v4] Documentation: ACPI: explain how to use gpio-line-names
  2020-11-12 13:15 [PATCH v4] Documentation: ACPI: explain how to use gpio-line-names Flavio Suligoi
  2020-11-12 13:40 ` Andy Shevchenko
@ 2020-11-16 18:37 ` Rafael J. Wysocki
  1 sibling, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2020-11-16 18:37 UTC (permalink / raw)
  To: Flavio Suligoi
  Cc: Mika Westerberg, Andy Shevchenko, Rafael J . Wysocki, Len Brown,
	linux-gpio, ACPI Devel Maling List, Linux Kernel Mailing List

On Thu, Nov 12, 2020 at 2:15 PM Flavio Suligoi <f.suligoi@asem.it> wrote:
>
> The "gpio-line-names" declaration is not fully
> documented, so can be useful to add some important
> information and one more example.
>
> This commit also fixes a trivial spelling mistake.

The spelling mistake has been fixed already, so I dropped this part of
the patch and applied the rest as 5.11 material.

Thanks!

> Signed-off-by: Flavio Suligoi <f.suligoi@asem.it>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> ---
>
> v2: - fix commit spelling mistakes
>     - add double back quotes to gpio-line-names
>     - adjust documentation lines layout
>     - add comma at the end of Package list names in the first example
>
> v3: - add: Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> v4: - add: Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
>
>  .../firmware-guide/acpi/gpio-properties.rst   | 58 ++++++++++++++++++-
>  1 file changed, 56 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/firmware-guide/acpi/gpio-properties.rst b/Documentation/firmware-guide/acpi/gpio-properties.rst
> index bb6d74f23ee0..ae5396a1f092 100644
> --- a/Documentation/firmware-guide/acpi/gpio-properties.rst
> +++ b/Documentation/firmware-guide/acpi/gpio-properties.rst
> @@ -107,7 +107,61 @@ Example::
>
>  - gpio-line-names
>
> -Example::
> +The ``gpio-line-names`` declaration is a list of strings ("names"), which
> +describes each line/pin of a GPIO controller/expander. This list, contained in
> +a package, must be inserted inside the GPIO controller declaration of an ACPI
> +table (typically inside the DSDT). The ``gpio-line-names`` list must respect the
> +following rules (see also the examples):
> +
> +  - the first name in the list corresponds with the first line/pin of the GPIO
> +    controller/expander
> +  - the names inside the list must be consecutive (no "holes" are permitted)
> +  - the list can be incomplete and can end before the last GPIO line: in
> +    other words, it is not mandatory to fill all the GPIO lines
> +  - empty names are allowed (two quotation marks ``""`` correspond to an empty
> +    name)
> +
> +Example of a GPIO controller of 16 lines, with an incomplete list with two
> +empty names::
> +
> +  Package () {
> +      "gpio-line-names",
> +      Package () {
> +          "pin_0",
> +          "pin_1",
> +          "",
> +          "",
> +          "pin_3",
> +          "pin_4_push_button",
> +      }
> +  }
> +
> +At runtime, the above declaration produces the following result (using the
> +"libgpiod" tools)::
> +
> +  root@debian:~# gpioinfo gpiochip4
> +  gpiochip4 - 16 lines:
> +          line   0:      "pin_0"       unused   input  active-high
> +          line   1:      "pin_1"       unused   input  active-high
> +          line   2:      unnamed       unused   input  active-high
> +          line   3:      unnamed       unused   input  active-high
> +          line   4:      "pin_3"       unused   input  active-high
> +          line   5: "pin_4_push_button" unused input active-high
> +          line   6:      unnamed       unused   input  active-high
> +          line   7       unnamed       unused   input  active-high
> +          line   8:      unnamed       unused   input  active-high
> +          line   9:      unnamed       unused   input  active-high
> +          line  10:      unnamed       unused   input  active-high
> +          line  11:      unnamed       unused   input  active-high
> +          line  12:      unnamed       unused   input  active-high
> +          line  13:      unnamed       unused   input  active-high
> +          line  14:      unnamed       unused   input  active-high
> +          line  15:      unnamed       unused   input  active-high
> +  root@debian:~# gpiofind pin_4_push_button
> +  gpiochip4 5
> +  root@debian:~#
> +
> +Another example::
>
>    Package () {
>        "gpio-line-names",
> @@ -191,7 +245,7 @@ The driver might expect to get the right GPIO when it does::
>  but since there is no way to know the mapping between "reset" and
>  the GpioIo() in _CRS desc will hold ERR_PTR(-ENOENT).
>
> -The driver author can solve this by passing the mapping explictly
> +The driver author can solve this by passing the mapping explicitly
>  (the recommended way and documented in the above chapter).
>
>  The ACPI GPIO mapping tables should not contaminate drivers that are not
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-11-16 18:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-12 13:15 [PATCH v4] Documentation: ACPI: explain how to use gpio-line-names Flavio Suligoi
2020-11-12 13:40 ` Andy Shevchenko
2020-11-12 13:50   ` Flavio Suligoi
2020-11-16 18:37 ` Rafael J. Wysocki

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).