All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Mark Brown <broonie@kernel.org>
Cc: Russell King <linux@arm.linux.org.uk>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	Alessandro Rubini <rubini@unipv.it>,
	Linus Walleij <linus.walleij@linaro.org>,
	Wolfram Sang <wsa@the-dreams.de>, Chris Ball <chris@printf.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
	"linux-spi@vger.kernel.org" <linux-spi@vger.kernel.org>,
	linux-mmc <linux-mmc@vger.kernel.org>
Subject: Re: [PATCH 07/17] spi: pl022: Don't ignore power domain and amba bus at system suspend
Date: Mon, 10 Feb 2014 13:33:50 +0100	[thread overview]
Message-ID: <CAPDyKFqNdw-6R12cUOre8UOTOnB-PpxHD5rPAMCwuS3i--Sesg@mail.gmail.com> (raw)
In-Reply-To: <20140204191609.GU22609@sirena.org.uk>

On 4 February 2014 20:16, Mark Brown <broonie@kernel.org> wrote:
> On Tue, Feb 04, 2014 at 04:58:48PM +0100, Ulf Hansson wrote:
>
>> @@ -2328,8 +2300,23 @@ static int pl022_suspend(struct device *dev)
>>               return ret;
>>       }
>>
>> -     pm_runtime_get_sync(dev);
>> -     pl022_suspend_resources(pl022, false);
>> +     pm_runtime_disable(dev);
>> +
>> +     if (!pm_runtime_status_suspended(dev)) {
>> +             if (dev->pm_domain && dev->pm_domain->ops.runtime_suspend)
>> +                     ret = dev->pm_domain->ops.runtime_suspend(dev);
>> +             else
>> +                     ret = dev->bus->pm->runtime_suspend(dev);
>> +
>> +             if (ret) {
>> +                     pm_runtime_enable(dev);
>> +                     return ret;
>> +             }
>> +
>> +             pm_runtime_set_suspended(dev);
>> +     }
>
> This seems like a fairly hideous thing to be having to open code in an
> individual driver, it all looks generic and like something that most if
> not all devices ought to be doing and it looks very vulnerable to being
> broken by changes in the core.  At the very least I would expect this to
> be done in a helper function, though it would be even nicer if the
> driver core were figuring this stuff out for us based on the device
> level callback so that drivers didn't need to worry about being in power
> domains or manually calling bus level callbacks.
>
> Putting it in a helper would at least mean that it's easier for the
> mechanics to be transferred to the core proper later on.

I agree, a helper function would be nice. I have earlier sent a patch
to the PM core, that is similar to the code above, though it was
rejected in it's current form. Let me follow up on this again.

At this point, would a way forward be to still go ahead with this
patch and then convert to, when/if, the helper function from the PM
core becomes available?

Kind regards
Ulf Hansson

WARNING: multiple messages have this Message-ID (diff)
From: ulf.hansson@linaro.org (Ulf Hansson)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 07/17] spi: pl022: Don't ignore power domain and amba bus at system suspend
Date: Mon, 10 Feb 2014 13:33:50 +0100	[thread overview]
Message-ID: <CAPDyKFqNdw-6R12cUOre8UOTOnB-PpxHD5rPAMCwuS3i--Sesg@mail.gmail.com> (raw)
In-Reply-To: <20140204191609.GU22609@sirena.org.uk>

On 4 February 2014 20:16, Mark Brown <broonie@kernel.org> wrote:
> On Tue, Feb 04, 2014 at 04:58:48PM +0100, Ulf Hansson wrote:
>
>> @@ -2328,8 +2300,23 @@ static int pl022_suspend(struct device *dev)
>>               return ret;
>>       }
>>
>> -     pm_runtime_get_sync(dev);
>> -     pl022_suspend_resources(pl022, false);
>> +     pm_runtime_disable(dev);
>> +
>> +     if (!pm_runtime_status_suspended(dev)) {
>> +             if (dev->pm_domain && dev->pm_domain->ops.runtime_suspend)
>> +                     ret = dev->pm_domain->ops.runtime_suspend(dev);
>> +             else
>> +                     ret = dev->bus->pm->runtime_suspend(dev);
>> +
>> +             if (ret) {
>> +                     pm_runtime_enable(dev);
>> +                     return ret;
>> +             }
>> +
>> +             pm_runtime_set_suspended(dev);
>> +     }
>
> This seems like a fairly hideous thing to be having to open code in an
> individual driver, it all looks generic and like something that most if
> not all devices ought to be doing and it looks very vulnerable to being
> broken by changes in the core.  At the very least I would expect this to
> be done in a helper function, though it would be even nicer if the
> driver core were figuring this stuff out for us based on the device
> level callback so that drivers didn't need to worry about being in power
> domains or manually calling bus level callbacks.
>
> Putting it in a helper would at least mean that it's easier for the
> mechanics to be transferred to the core proper later on.

I agree, a helper function would be nice. I have earlier sent a patch
to the PM core, that is similar to the code above, though it was
rejected in it's current form. Let me follow up on this again.

At this point, would a way forward be to still go ahead with this
patch and then convert to, when/if, the helper function from the PM
core becomes available?

Kind regards
Ulf Hansson

  reply	other threads:[~2014-02-10 12:33 UTC|newest]

Thread overview: 147+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-04 15:58 [PATCH 00/17] amba: PM fixups for amba bus and some amba drivers Ulf Hansson
2014-02-04 15:58 ` Ulf Hansson
2014-02-04 15:58 ` Ulf Hansson
2014-02-04 15:58 ` [PATCH 01/17] amba: Let runtime PM callbacks be available for CONFIG_PM Ulf Hansson
2014-02-04 15:58   ` Ulf Hansson
2014-02-04 15:58   ` Ulf Hansson
2014-02-19  9:40   ` Russell King - ARM Linux
2014-02-19  9:40     ` Russell King - ARM Linux
2014-02-19  9:40     ` Russell King - ARM Linux
2014-02-19 11:40     ` Ulf Hansson
2014-02-19 11:40       ` Ulf Hansson
2014-02-19 11:40       ` Ulf Hansson
2014-02-04 15:58 ` [PATCH 02/17] amba: Add late and early PM callbacks Ulf Hansson
2014-02-04 15:58   ` Ulf Hansson
2014-02-04 15:58 ` [PATCH 03/17] mmc: mmci: Mask IRQs for all variants during runtime suspend Ulf Hansson
2014-02-04 15:58   ` Ulf Hansson
2014-02-04 15:58   ` Ulf Hansson
2014-02-18 16:05   ` Russell King - ARM Linux
2014-02-18 16:05     ` Russell King - ARM Linux
2014-02-18 16:05     ` Russell King - ARM Linux
2014-02-18 16:36     ` Ulf Hansson
2014-02-18 16:36       ` Ulf Hansson
2014-02-18 16:36       ` Ulf Hansson
2014-02-18 16:46       ` Russell King - ARM Linux
2014-02-18 16:46         ` Russell King - ARM Linux
2014-02-18 16:46         ` Russell King - ARM Linux
2014-02-18 17:02         ` Ulf Hansson
2014-02-18 17:02           ` Ulf Hansson
2014-02-18 17:02           ` Ulf Hansson
2014-02-24 14:54       ` Linus Walleij
2014-02-24 14:54         ` Linus Walleij
2014-02-24 14:54         ` Linus Walleij
2014-02-04 15:58 ` [PATCH 04/17] mmc: mmci: Let runtime PM callbacks be available for CONFIG_PM Ulf Hansson
2014-02-04 15:58   ` Ulf Hansson
2014-02-04 15:58 ` [PATCH 05/17] mmc: mmci: Put the device into low power state at system suspend Ulf Hansson
2014-02-04 15:58   ` Ulf Hansson
2014-02-04 19:22   ` Kevin Hilman
2014-02-04 19:22     ` Kevin Hilman
2014-02-04 19:22     ` Kevin Hilman
2014-02-05 12:49     ` Linus Walleij
2014-02-05 12:49       ` Linus Walleij
2014-02-05 12:49       ` Linus Walleij
2014-02-05 14:13       ` Mark Brown
2014-02-05 14:13         ` Mark Brown
2014-02-05 14:13         ` Mark Brown
2014-02-05 20:08       ` Kevin Hilman
2014-02-05 20:08         ` Kevin Hilman
2014-02-05 20:08         ` Kevin Hilman
2014-02-05 20:08         ` Kevin Hilman
2014-02-10 11:11     ` Ulf Hansson
2014-02-10 11:11       ` Ulf Hansson
2014-02-10 11:11       ` Ulf Hansson
2014-02-10 18:03       ` Kevin Hilman
2014-02-10 18:03         ` Kevin Hilman
2014-02-10 18:03         ` Kevin Hilman
2014-02-10 18:03         ` Kevin Hilman
2014-02-04 15:58 ` [PATCH 06/17] spi: pl022: Let runtime PM callbacks be available for CONFIG_PM Ulf Hansson
2014-02-04 15:58   ` Ulf Hansson
2014-02-19 14:20   ` Ulf Hansson
2014-02-19 14:20     ` Ulf Hansson
2014-02-19 14:20     ` Ulf Hansson
2014-02-19 15:10     ` Mark Brown
2014-02-19 15:10       ` Mark Brown
2014-02-19 15:10       ` Mark Brown
2014-02-19 18:02       ` Ulf Hansson
2014-02-19 18:02         ` Ulf Hansson
2014-02-19 18:02         ` Ulf Hansson
2014-02-04 15:58 ` [PATCH 07/17] spi: pl022: Don't ignore power domain and amba bus at system suspend Ulf Hansson
2014-02-04 15:58   ` Ulf Hansson
2014-02-04 19:16   ` Mark Brown
2014-02-04 19:16     ` Mark Brown
2014-02-10 12:33     ` Ulf Hansson [this message]
2014-02-10 12:33       ` Ulf Hansson
2014-02-10 12:33       ` Ulf Hansson
2014-02-10 12:51       ` Mark Brown
2014-02-10 12:51         ` Mark Brown
2014-02-10 12:51         ` Mark Brown
2014-02-19 14:15         ` Ulf Hansson
2014-02-19 14:15           ` Ulf Hansson
2014-02-19 14:15           ` Ulf Hansson
2014-02-04 15:58 ` [PATCH 08/17] spi: pl022: Fully gate clocks at request inactivity Ulf Hansson
2014-02-04 15:58   ` Ulf Hansson
2014-02-04 17:07   ` Mark Brown
2014-02-04 17:07     ` Mark Brown
2014-02-04 17:07     ` Mark Brown
2014-02-10 10:36     ` Ulf Hansson
2014-02-10 10:36       ` Ulf Hansson
2014-02-10 10:36       ` Ulf Hansson
2014-02-04 15:58 ` [PATCH 09/17] spi: pl022: Simplify clock handling Ulf Hansson
2014-02-04 15:58   ` Ulf Hansson
2014-02-04 15:58   ` Ulf Hansson
2014-02-04 19:19   ` Mark Brown
2014-02-04 19:19     ` Mark Brown
2014-02-10 10:42     ` Ulf Hansson
2014-02-10 10:42       ` Ulf Hansson
2014-02-10 10:42       ` Ulf Hansson
2014-02-04 15:58 ` [PATCH 10/17] spi: pl022: Remove redundant pinctrl to default state in probe Ulf Hansson
2014-02-04 15:58   ` Ulf Hansson
2014-02-04 15:58   ` Ulf Hansson
2014-02-04 19:20   ` Mark Brown
2014-02-04 19:20     ` Mark Brown
2014-02-04 19:20     ` Mark Brown
2014-02-05 12:53   ` Linus Walleij
2014-02-05 12:53     ` Linus Walleij
2014-02-05 12:53     ` Linus Walleij
2014-02-04 15:58 ` [PATCH 11/17] i2c: nomadik: Convert to devm functions Ulf Hansson
2014-02-04 15:58   ` Ulf Hansson
2014-02-04 15:58   ` Ulf Hansson
2014-02-05 14:32   ` Linus Walleij
2014-02-05 14:32     ` Linus Walleij
2014-02-05 14:32     ` Linus Walleij
2014-02-04 15:58 ` [PATCH 12/17] i2c: nomadik: Remove redundant call to pm_runtime_disable Ulf Hansson
2014-02-04 15:58   ` Ulf Hansson
2014-02-04 15:58 ` [PATCH 13/17] i2c: nomadik: Leave probe with the device in active state Ulf Hansson
2014-02-04 15:58   ` Ulf Hansson
2014-02-04 15:58 ` [PATCH 14/17] i2c: nomadik: Fixup deployment of runtime PM Ulf Hansson
2014-02-04 15:58   ` Ulf Hansson
2014-02-05 14:34   ` Linus Walleij
2014-02-05 14:34     ` Linus Walleij
2014-02-05 14:34     ` Linus Walleij
2014-02-10 10:14     ` Ulf Hansson
2014-02-10 10:14       ` Ulf Hansson
2014-02-10 10:14       ` Ulf Hansson
2014-02-13 14:12       ` Ulf Hansson
2014-02-13 14:12         ` Ulf Hansson
2014-02-13 14:12         ` Ulf Hansson
2014-02-05 14:45   ` Fabio Estevam
2014-02-05 14:45     ` Fabio Estevam
2014-02-05 14:45     ` Fabio Estevam
2014-02-10 10:16     ` Ulf Hansson
2014-02-10 10:16       ` Ulf Hansson
2014-02-10 10:16       ` Ulf Hansson
2014-02-04 15:58 ` [PATCH 15/17] i2c: nomadik: Convert to late and early system PM callbacks Ulf Hansson
2014-02-04 15:58   ` Ulf Hansson
2014-02-04 15:58   ` Ulf Hansson
2014-02-04 15:58 ` [PATCH 16/17] i2c: nomadik: Remove busy check for transfers at suspend late Ulf Hansson
2014-02-04 15:58   ` Ulf Hansson
2014-02-04 15:58   ` Ulf Hansson
2014-02-04 15:58 ` [PATCH 17/17] i2c: nomadik: Fixup system suspend Ulf Hansson
2014-02-04 15:58   ` Ulf Hansson
2014-02-04 15:58   ` Ulf Hansson
2014-02-04 18:49 ` [PATCH 00/17] amba: PM fixups for amba bus and some amba drivers Mark Brown
2014-02-04 18:49   ` Mark Brown
2014-02-04 18:49   ` Mark Brown
2014-02-10 10:25   ` Ulf Hansson
2014-02-10 10:25     ` Ulf Hansson
2014-02-10 10:25     ` Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPDyKFqNdw-6R12cUOre8UOTOnB-PpxHD5rPAMCwuS3i--Sesg@mail.gmail.com \
    --to=ulf.hansson@linaro.org \
    --cc=broonie@kernel.org \
    --cc=chris@printf.net \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=rubini@unipv.it \
    --cc=wsa@the-dreams.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.