Re: How to use an ACPI declared GPIO in a userspace ...

From: Andy Shevchenko
Date: Fri Oct 02 2020 - 08:48:40 EST


On Fri, Oct 2, 2020 at 1:02 PM Flavio Suligoi <f.suligoi@xxxxxxx> wrote:

> > > > My SSDT table is:
> > >
> > > ^^^^ See the difference? I can't help here.
>
> This is the DSDT table related to the GPIO controller of my board:
>
> Device (GPO1)
> {
> Name (_ADR, Zero) // _ADR: Address
> Name (_HID, "INT3452") // _HID: Hardware ID
> Name (_CID, "INT3452") // _CID: Compatible ID
> Name (_DDN, "General Purpose Input/Output (GPIO) Controller - Northwest") // _DDN: DOS Device Name
> Name (_UID, 0x02) // _UID: Unique ID
> Name (RBUF, ResourceTemplate ()
> {
> Memory32Fixed (ReadWrite,
> 0x00000000, // Address Base
> 0x00004000, // Address Length
> _Y08)
> Interrupt (ResourceConsumer, Level, ActiveLow, Shared, ,, )
> {
> 0x0000000E,
> }
> })
> Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings
> {
> CreateDWordField (RBUF, \_SB.GPO1._Y08._BAS, B0BA) // _BAS: Base Address
> CreateDWordField (RBUF, \_SB.GPO1._Y08._LEN, B0LN) // _LEN: Length
> B0BA = GP1A /* \GP1A */
> B0LN = GP1L /* \GP1L */
> Return (RBUF) /* \_SB_.GPO1.RBUF */
> }
>
> Method (_STA, 0, NotSerialized) // _STA: Status
> {
> If ((OSYS < 0x07DC))
> {
> Return (Zero)
> }
>
> Return (0x0F)
> }
> }

So, what about adding the following

DefinitionBlock ("linename.aml", "SSDT", 5, "", "LINENAME", 1)
{
External (_SB_.GPO1, DeviceObj)
Scope (\_SB.GPO1)
{
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () {
"gpio-line-names",
Package () {
"Line0",
"Line1",
"Line2",
...
}
},
}
})
}
}

?

(Replace '...' with meaningful line names or drop for now, but in any
case you need to provide as much names as lines of such GPIO
controller)

--
With Best Regards,
Andy Shevchenko