[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vfh7u+va0CVCQxSe7unk8qGiWnNrpKHXVH3fKBYzqEUVA@mail.gmail.com>
Date: Fri, 2 Oct 2020 15:40:13 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Flavio Suligoi <f.suligoi@...m.it>
Cc: Bartosz Golaszewski <brgl@...ev.pl>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
"linux-acpi@...r.kernel.org" <linux-acpi@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: How to use an ACPI declared GPIO in a userspace ...
On Fri, Oct 2, 2020 at 1:26 PM Flavio Suligoi <f.suligoi@...m.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
Powered by blists - more mailing lists