lkml.org 
[lkml]   [2020]   [Oct]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: How to use an ACPI declared GPIO in a userspace ...
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

\
 
 \ /
  Last update: 2020-10-02 14:41    [W:0.074 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site