[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPDyKFqcv8+B=xL_NSzydNYOH_ZzdJuqmrX72jsy=-FNnEf=tw@mail.gmail.com>
Date: Tue, 2 Jan 2018 13:53:56 +0100
From: Ulf Hansson <ulf.hansson@...aro.org>
To: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: Geert Uytterhoeven <geert@...ux-m68k.org>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Linux PM <linux-pm@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Jason Cooper <jason@...edaemon.net>,
Marc Zyngier <marc.zyngier@....com>,
Linus Walleij <linus.walleij@...aro.org>,
Simon Horman <horms@...ge.net.au>,
Niklas Soderlund <niklas.soderlund+renesas@...natech.se>,
Linux-Renesas <linux-renesas-soc@...r.kernel.org>,
linux-gpio@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 3/3] gpio: rcar: Use WAKEUP_PATH driver PM flag
On 2 January 2018 at 11:48, Rafael J. Wysocki <rafael@...nel.org> wrote:
> On Tue, Jan 2, 2018 at 11:44 AM, Geert Uytterhoeven
> <geert@...ux-m68k.org> wrote:
>> Hi Rafael,
>>
>> On Tue, Jan 2, 2018 at 11:32 AM, Rafael J. Wysocki <rafael@...nel.org> wrote:
>>> On Fri, Dec 29, 2017 at 2:31 PM, Ulf Hansson <ulf.hansson@...aro.org> wrote:
>>>> From: Geert Uytterhoeven <geert+renesas@...der.be>
>>>>
>>>> Since commit ab82fa7da4dce5c7 ("gpio: rcar: Prevent module clock disable
>>>> when wake-up is enabled"), when a GPIO is used for wakeup, the GPIO block's
>>>> module clock (if exists) is manually kept running during system suspend, to
>>>> make sure the device stays active.
>>>>
>>>> However, this explicit clock handling is merely a workaround for a failure
>>>> to properly communicate wakeup information to the PM core. Instead, set the
>>>> WAKEUP_PATH driver PM flag to indicate that the device is part of the
>>>> wakeup path, which further also enables middle-layers and PM domains (like
>>>> genpd) to act on this.
>>>>
>>>> In case the device is attached to genpd and depending on if it has an
>>>> active wakeup configuration, genpd will keep the device active (the clock
>>>> running) during system suspend when needed. This enables us to remove all
>>>> explicit clock handling code from the driver, so let's do that as well.
>>>>
>>>> Signed-off-by: Geert Uytterhoeven <geert+renesas@...der.be>
>>>> [Ulf: Converted to use the WAKEUP_PATH driver PM flag]
>>
>> Ulf: + killing the DEV_PM_OPS define, increasing kernel size if PM_SUSPEND=n?
>>
>>>> Signed-off-by: Ulf Hansson <ulf.hansson@...aro.org>
>>
>>>> --- a/drivers/gpio/gpio-rcar.c
>>>> +++ b/drivers/gpio/gpio-rcar.c
>>
>>>> @@ -415,6 +402,18 @@ static int gpio_rcar_parse_dt(struct gpio_rcar_priv *p, unsigned int *npins)
>>>> return 0;
>>>> }
>>>>
>>>> +#ifdef CONFIG_PM_SLEEP
>>>> +static int gpio_rcar_suspend(struct device *dev)
>>>> +{
>>>> + struct gpio_rcar_priv *p = dev_get_drvdata(dev);
>>>> +
>>>> + dev_pm_set_driver_flags(dev, p->wakeup_path ? DPM_FLAG_WAKEUP_PATH : 0);
>>>
>>> Why don't you simply set dev->power.wakeup_path here?
>>
>> That's what my v1 did (https://patchwork.kernel.org/patch/10050995/).
>
> I very much prefer this one. :-)
Okay!
The reason why I suggested inventing a new driver PM flag, was because
I consider the ->dev.power.wakeup_path, being a status flag/bit, owned
by the PM core. In other words, consumers of the flag are allowed to
look at it, but not change it.
Anyway, I am perfectly fine to drop the DPM_FLAG_WAKEUP_PATH thingy.
However, perhaps we should still add a helper function
(device_set_wakeup_path() or similar), which users can call to set the
flag?
>
> What's wrong with it?
It works, although I would rather change the assignment of the flag to
respect if the current value is true, something like this:
dev->power.wakeup_path = dev->power.wakeup_path || p->wakeup_path;
Kind regards
Uffe
Powered by blists - more mailing lists