From patchwork Wed Dec 9 15:20:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 58150 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp737129lbb; Wed, 9 Dec 2015 07:20:59 -0800 (PST) X-Received: by 10.98.16.216 with SMTP id 85mr13849048pfq.64.1449674459652; Wed, 09 Dec 2015 07:20:59 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id va5si13241252pac.165.2015.12.09.07.20.59; Wed, 09 Dec 2015 07:20:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750994AbbLIPU7 (ORCPT + 4 others); Wed, 9 Dec 2015 10:20:59 -0500 Received: from foss.arm.com ([217.140.101.70]:50241 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750937AbbLIPU6 (ORCPT ); Wed, 9 Dec 2015 10:20:58 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D192849; Wed, 9 Dec 2015 07:20:35 -0800 (PST) Received: from [10.1.207.150] (e103737-lin.cambridge.arm.com [10.1.207.150]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 57A983F459; Wed, 9 Dec 2015 07:20:56 -0800 (PST) Subject: Re: [PATCH] gpio: pl061: add support for wakeup configuration To: Linus Walleij References: <1448644755-29183-1-git-send-email-sudeep.holla@arm.com> Cc: Aubrey Li , Dmitry Torokhov , "Rafael J. Wysocki" , Sudeep Holla , "linux-gpio@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Alexandre Courbot , Ulf Hansson From: Sudeep Holla Organization: ARM Message-ID: <566846D6.6010501@arm.com> Date: Wed, 9 Dec 2015 15:20:54 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org On 09/12/15 15:08, Linus Walleij wrote: > On Fri, Nov 27, 2015 at 6:19 PM, Sudeep Holla wrote: > >> The PL061 supports interrupts and those can be wakeup interrupts. We >> need to provide support for configuring those interrupts as wakeup >> sources. >> >> This patch adds irq_set_wake callback for PL061 so that GPIO interrupts >> can be configured as wakeup. >> >> Cc: Linus Walleij >> Cc: Alexandre Courbot >> Signed-off-by: Sudeep Holla >> --- >> drivers/gpio/gpio-pl061.c | 9 +++++++++ >> 1 file changed, 9 insertions(+) >> >> diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c >> index 4d4b37676702..8b1cbd5767f9 100644 >> --- a/drivers/gpio/gpio-pl061.c >> +++ b/drivers/gpio/gpio-pl061.c >> @@ -14,6 +14,7 @@ >> #include >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -269,12 +270,20 @@ static void pl061_irq_ack(struct irq_data *d) >> spin_unlock(&chip->lock); >> } >> >> +static int pl061_irq_set_wake(struct irq_data *d, unsigned int state) >> +{ >> + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); >> + >> + return irq_set_irq_wake(gc->irq_parent, state); >> +} >> + >> static struct irq_chip pl061_irqchip = { >> .name = "pl061", >> .irq_ack = pl061_irq_ack, >> .irq_mask = pl061_irq_mask, >> .irq_unmask = pl061_irq_unmask, >> .irq_set_type = pl061_irq_type, >> + .irq_set_wake = pl061_irq_set_wake, >> }; > > Is this really all that is needed? Don't you need to call > device_wakeup_enable(&adev->dev, 1); on the amba (primecell) > device providing this GPIO, lest it may be suspended itself > and render this exercise pointless. > Do you mean something like : -->8-- -->8-- If yes, I agree that's one possible solution. > And if not, why not? > The only reason I didn't go for the above solution is that some platforms may not have any gpio pins as wakeup source, so it may be unnecessary to do that. Also in order to that, we also implicitly force platforms to mark the GPIO controller as wakeup source rather than just the few GPIO pins that are wakeup capable. > How are GPIO chips providing IRQs actually going to do this, > provided that they need to be kept awake themselves? > Not gone through all the implementations. Just started with PL061 when I tested on Juno(Beware it doesn't work with std. firmware as there are some know issues still under investigation) -- Regards, Sudeep -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git i/drivers/gpio/gpio-pl061.c w/drivers/gpio/gpio-pl061.c index 4d4b37676702..467e0b278cf0 100644 --- i/drivers/gpio/gpio-pl061.c +++ w/drivers/gpio/gpio-pl061.c @@ -354,6 +354,7 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) } amba_set_drvdata(adev, chip); + dev_pm_set_wake_irq(&adev->dev, irq); dev_info(&adev->dev, "PL061 GPIO chip @%pa registered\n", &adev->res.start);