From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mika Westerberg Subject: Re: [PATCH 6/6] gpio / ACPI: Add support for ACPI GPIO operation regions Date: Wed, 26 Feb 2014 11:11:53 +0200 Message-ID: <20140226091153.GY5018@intel.com> References: <1393257611-18031-1-git-send-email-mika.westerberg@linux.intel.com> <1393257611-18031-7-git-send-email-mika.westerberg@linux.intel.com> <2863081.yf9Ke2teV0@vostro.rjw.lan> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mga02.intel.com ([134.134.136.20]:9873 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752245AbaBZJFd (ORCPT ); Wed, 26 Feb 2014 04:05:33 -0500 Content-Disposition: inline In-Reply-To: <2863081.yf9Ke2teV0@vostro.rjw.lan> Sender: linux-acpi-owner@vger.kernel.org List-Id: linux-acpi@vger.kernel.org To: "Rafael J. Wysocki" Cc: Linus Walleij , Alexandre Courbot , Lan Tianyu , Lv Zheng , Alan Cox , Mathias Nyman , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org On Tue, Feb 25, 2014 at 03:55:02PM +0100, Rafael J. Wysocki wrote: > On Monday, February 24, 2014 06:00:11 PM Mika Westerberg wrote: > > GPIO operation regions is a new feature introduced in ACPI 5.0 > > specification. This feature adds a way for platform ASL code to call back > > to OS GPIO driver and toggle GPIO pins. > > > > An example ASL code from Lenovo Miix 2 tablet with only relevant part > > listed: > > > > Device (\_SB.GPO0) > > { > > Name (AVBL, Zero) > > Method (_REG, 2, NotSerialized) > > { > > If (LEqual (Arg0, 0x08)) > > { > > // Marks the region available > > Store (Arg1, AVBL) > > } > > } > > > > OperationRegion (GPOP, GeneralPurposeIo, Zero, 0x0C) > > Field (GPOP, ByteAcc, NoLock, Preserve) > > { > > Connection ( > > GpioIo (Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly, > > "\\_SB.GPO0", 0x00, ResourceConsumer,,) > > { > > 0x003B > > } > > ), > > SHD3, 1, > > } > > } > > > > Device (SHUB) > > { > > Method (_PS0, 0, Serialized) > > { > > If (LEqual (\_SB.GPO0.AVBL, One)) > > { > > Store (One, \_SB.GPO0.SHD3) > > Sleep (0x32) > > } > > } > > Method (_PS3, 0, Serialized) > > { > > If (LEqual (\_SB.GPO0.AVBL, One)) > > { > > Store (Zero, \_SB.GPO0.SHD3) > > } > > } > > } > > > > The sensor hub (SHUB) device uses GPIO connection SHD3 to power the device > > whenever the GPIO operation region is available. > > I would add more explanation of the ASL above here. Basically, how it is > supposed to work and what's the handler's role in it. OK, I will do that in the next revision. > > Implement the support by registering GPIO operation region handlers for all > > GPIO devices that have an ACPI handle. First time the GPIO is used by the > > ASL code we make sure that the GPIO stays requested until the GPIO chip > > driver itself is unloaded. If we find out that the GPIO is already > > requested we just toggle it according to the value got from ASL code. > > The patch itself looks good to me. Thanks for reviewing this :)