From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Flavio Suligoi <f.suligoi@asem.it>
Cc: Bartosz Golaszewski <brgl@bgdev.pl>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: How to use an ACPI declared GPIO in a userspace ...
Date: Fri, 2 Oct 2020 15:40:13 +0300 [thread overview]
Message-ID: <CAHp75Vfh7u+va0CVCQxSe7unk8qGiWnNrpKHXVH3fKBYzqEUVA@mail.gmail.com> (raw)
In-Reply-To: <8b6adbc45d134da7b0fd1f9044a37cf6@asem.it>
On Fri, Oct 2, 2020 at 1:26 PM Flavio Suligoi <f.suligoi@asem.it> wrote:
> Hi Andy,
>
> with my custom SSDT table:
>
> DefinitionBlock ("gpio_button.aml", "SSDT", 5, "ASEMsp", "GPIO_BTN", 1)
> {
> External (_SB_.GPO1, DeviceObj)
> Scope (\_SB.GPO1)
> {
> Device (BTNS)
> {
> Name (_HID, "ASEM0005") // _HID: Hardware ID PRP0001
> Name (_UID, Zero) // _UID: Unique ID
> Name (_DDN, "DDN - SW Readable Button") // _DDN: DOS Device Name
> Name (_STR, Unicode ("STR - SW Readable Button")) // _STR: Description String
>
> Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
> {
> GpioIo (
> Shared, // Not shared
> PullNone, // No need for pulls
> 0, // Debounce timeout
> 0, // Drive strength
> IoRestrictionInputOnly, // Only used as input
> "\\_SB.GPO1", // GPIO controller
> 0, ResourceConsumer, , ) // Must be 0
> {
> 25, // GPIO number 25
> }
> })
> }
> }
> }
>
> I'm able to see the GPIO in:
>
> /sys/bus/platform/devices/ASEM0005:00/firmware_node:
>
> -r--r--r-- 1 root root 4096 Oct 2 12:10 description
> -r--r--r-- 1 root root 4096 Oct 2 12:10 hid
> -r--r--r-- 1 root root 4096 Oct 2 12:10 modalias
> -r--r--r-- 1 root root 4096 Oct 2 12:10 path
> lrwxrwxrwx 1 root root 0 Oct 2 12:10 physical_node -> ../../../../platform/INT3452:01/ASEM0005:00
> drwxr-xr-x 2 root root 0 Oct 2 12:10 power
> lrwxrwxrwx 1 root root 0 Oct 2 12:10 subsystem -> ../../../../../bus/acpi
> -rw-r--r-- 1 root root 4096 Oct 2 12:10 uevent
> -r--r--r-- 1 root root 4096 Oct 2 12:10 uid
>
> and so I can see some useful info:
>
> # cat description
> STR - SW Readable Button
> # cat hid
> ASEM0005
> # cat modalias
> acpi:ASEM0005:
> bmxxxx-x86-64:/sys/bus/platform/devices/ASEM0005:00/firmware_node# cat path
> \_SB_.GPO1.BTNS
>
> So, from userspace, I can discover the GPIO controller /dev/gpiochip1,
> but I don't know how to discover the GPIO number (25 in this case).
> Do you have any suggestion about how to discover this GPIO number?
You don't need this SSDT at all.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2020-10-02 12:40 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-29 15:37 How to use an ACPI declared GPIO in a userspace Flavio Suligoi
2020-09-29 15:47 ` Bartosz Golaszewski
2020-09-29 16:10 ` Andy Shevchenko
2020-09-29 16:21 ` Flavio Suligoi
2020-09-29 16:27 ` Andy Shevchenko
2020-09-30 12:04 ` Flavio Suligoi
2020-09-30 13:01 ` Andy Shevchenko
2020-09-30 15:39 ` Flavio Suligoi
2020-09-30 15:54 ` Andy Shevchenko
2020-09-30 16:10 ` Andy Shevchenko
2020-10-02 10:02 ` Flavio Suligoi
2020-10-02 12:48 ` Andy Shevchenko
2020-10-02 13:23 ` Andy Shevchenko
2020-10-02 13:29 ` Flavio Suligoi
2020-10-02 10:26 ` Flavio Suligoi
2020-10-02 12:40 ` Andy Shevchenko [this message]
2020-09-29 16:10 ` Flavio Suligoi
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=CAHp75Vfh7u+va0CVCQxSe7unk8qGiWnNrpKHXVH3fKBYzqEUVA@mail.gmail.com \
--to=andy.shevchenko@gmail.com \
--cc=brgl@bgdev.pl \
--cc=f.suligoi@asem.it \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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).