Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3298158pxb; Mon, 16 Nov 2020 10:40:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJw95prTtu9SoKgmoCiQc+mM1+w/GI+qEvN3neL6eLrjdu8QLv8qWSkRCVfFJGsclsvXj55P X-Received: by 2002:a50:99d6:: with SMTP id n22mr17408700edb.261.1605552033561; Mon, 16 Nov 2020 10:40:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605552033; cv=none; d=google.com; s=arc-20160816; b=ZXfn/36QHoqWPh9s0980cC6fwAvp7heboySmQhE5PEZjx6zhQ20eI982cndbGwgIpK tYrmDtZcfbWjhsNV7tTtC2DajN+QwtTF/+kOT+zdUneqfnNxj6NO8AstFAW3OR9vZbI4 q7q8TI88JUO46HuRbYD31FoQDxgSXZTANeSYyJK4obB6M7Y5tGaHk761nJYkoM7WUSvA 99Kzko8iS+TIrhw/vP2bIpQnYlspMxNGL9e1aMw6zgxVXqxUYFBKx/QSp44M0207bp2D Ri0ThlSEKHoXv7bwH3kn0IGn3iJ06BYT/oxLRGVUzsMJbbt8dw65pXG2Bbde44btdtuj KaaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=7txsWknCiewn8OFUjAkOemwMtstyUm6JbL05uCaZO30=; b=C1zTlyCkgfuiOlN52xDYi8fnu18jmf0fxM227VWRVZwMAmAHiK2iBwTx7uNqwfOFNn Unnd1S7Hlhh4uR9rM8gcHAiiafih0mLaNzU7sqDzA7jX+TaWfPnZlu2YwPkRz2yBtMuH E8naXS6X5uzzmIdwsLTSTMwDS8vmtYrs2UT71gsJCBJDThqF2/vCVeMli2Ql0UHNPf/0 Ao7gtH6Pm0ELCLTnpvyImCwiWRTpWZ93pM1/Dvht2/kHdEALcyDvPWSLNVwHJbXJ2g7D J+Bla4vGQ2i/Rnz9lELm/6NW2Y+k+ypg4pN8vdes4weWrdU2lVExp7yvSve7ILmJ5w/e B7bA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x3si13341338eds.522.2020.11.16.10.40.10; Mon, 16 Nov 2020 10:40:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727017AbgKPSiF (ORCPT + 99 others); Mon, 16 Nov 2020 13:38:05 -0500 Received: from mail-ot1-f67.google.com ([209.85.210.67]:41646 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726272AbgKPSiF (ORCPT ); Mon, 16 Nov 2020 13:38:05 -0500 Received: by mail-ot1-f67.google.com with SMTP id o3so6447861ota.8; Mon, 16 Nov 2020 10:38:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7txsWknCiewn8OFUjAkOemwMtstyUm6JbL05uCaZO30=; b=mwPwJfTytkIvoqE8WdgYnuYoBzNUSF9UCB6Yg4JovJsflfL4yUyyFdqSH5WDN6UdKB 1WhbKQgi/vzgvS9wwpjqlKzHYrrvb1ccbDB11lRThWLL3OllDZC1rSPa7RoYSX6oJApx ob8vtaVkdPEn/BR8ThMiOMROC5za8PwjplIGVvzTMg269zskfNqGEZOZAc0LOF4pMaEi 43orJCs3aJm+WkafGE4l9v1BVwWAr3y0Mb88+lNxktUf9fbcFUzY15doNHY9rYfpGuHU mOwSlHcY3NE1JtvzJsj0NFVbC/Wl2X8qMd0nC4Fqx328pYdujcATRhe8wgHhu2j2J2B1 e4vg== X-Gm-Message-State: AOAM532BzjsxbXwpZkUY3AwuiDRKndw549iszBky5mT6/hjpB0z5kmXd qRGkhwvS4lrHRHR/UjMuMnMrIDimkHL+HtfKX0U= X-Received: by 2002:a9d:171a:: with SMTP id i26mr488714ota.260.1605551884287; Mon, 16 Nov 2020 10:38:04 -0800 (PST) MIME-Version: 1.0 References: <20201112131545.62628-1-f.suligoi@asem.it> In-Reply-To: <20201112131545.62628-1-f.suligoi@asem.it> From: "Rafael J. Wysocki" Date: Mon, 16 Nov 2020 19:37:53 +0100 Message-ID: Subject: Re: [PATCH v4] Documentation: ACPI: explain how to use gpio-line-names To: Flavio Suligoi Cc: Mika Westerberg , Andy Shevchenko , "Rafael J . Wysocki" , Len Brown , linux-gpio@vger.kernel.org, ACPI Devel Maling List , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 12, 2020 at 2:15 PM 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. 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 > Reviewed-by: Andy Shevchenko > Reviewed-by: Mika Westerberg > --- > > 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 > > v4: - add: Reviewed-by: Mika Westerberg > > .../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 >