On Sat, 2020-03-07 at 13:14 +0100, Hans de Goede wrote: > On most Cherry Trail (x86, UEFI + ACPI) devices the ACPI tables do > not have > a _DSD with a "daffd814-6eba-4d8c-8a91-bc9bbf4aa301" UUID, adding > "irq-gpios" and "reset-gpios" mappings, so we cannot get the GPIOS by > name > without first manually adding mappings ourselves. > > These devices contain 1 GpioInt and 1 GpioIo resource in their _CRS > table: > > Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings > { > Name (RBUF, ResourceTemplate () > { > I2cSerialBusV2 (0x0014, ControllerInitiated, 0x00061A80, > AddressingMode7Bit, "\\_SB.PCI0.I2C2", > 0x00, ResourceConsumer, , Exclusive, > ) > GpioInt (Edge, ActiveLow, Shared, PullDefault, 0x0000, > "\\_SB.GPO1", 0x00, ResourceConsumer, , > ) > { // Pin list > 0x0013 > } > GpioIo (Shared, PullDefault, 0x0000, 0x0000, > IoRestrictionOutputOnly, > "\\_SB.GPO1", 0x00, ResourceConsumer, , > ) > { // Pin list > 0x0019 > } > }) > Return (RBUF) /* \_SB_.PCI0.I2C2.TCS1._CRS.RBUF */ > } > > There is no fixed order for these 2. This commit adds code to check > that > there is 1 of each as expected and then registers a mapping matching > their > order using devm_acpi_dev_add_driver_gpios(). > > This gives us access to both GPIOs allowing us to properly suspend > the > controller during suspend, and making it possible to reset the > controller > if necessary. > > BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1786317 > BugLink: https://github.com/nexus511/gpd-ubuntu-packages/issues/10 > BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=199207 > Cc: Dmitry Mastykin <mastichi@xxxxxxxxx> > Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx> Reviewed-by: Bastien Nocera <hadess@xxxxxxxxxx>