* [PATCH 02/04] Driver Core: Add idle and wakeup functions
@ 2009-05-27 10:06 Magnus Damm
2009-05-28 21:29 ` Rafael J. Wysocki
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: Magnus Damm @ 2009-05-27 10:06 UTC (permalink / raw)
To: linux-sh
From: Magnus Damm <damm@igel.co.jp>
Add platform_device_idle() and platform_device_wakeup()
and allow architectures to implement their own versions
of these if CONFIG_HAVE_PLATFORM_IDLE_WAKEUP is set.
Signed-off-by: Magnus Damm <damm@igel.co.jp>
---
Yes, this needs documentation. See [00/04] for now.
arch/Kconfig | 3 +++
include/linux/platform_device.h | 8 ++++++++
2 files changed, 11 insertions(+)
--- 0002/arch/Kconfig
+++ work/arch/Kconfig 2009-05-26 12:31:06.000000000 +0900
@@ -115,3 +115,6 @@ config HAVE_DEFAULT_NO_SPIN_MUTEXES
config HAVE_PLATFORM_DEVICE_ARCHDATA
bool
+
+config HAVE_PLATFORM_DEVICE_IDLE_WAKEUP
+ bool
--- 0002/include/linux/platform_device.h
+++ work/include/linux/platform_device.h 2009-05-26 12:32:40.000000000 +0900
@@ -57,6 +57,14 @@ extern int platform_device_add(struct pl
extern void platform_device_del(struct platform_device *pdev);
extern void platform_device_put(struct platform_device *pdev);
+#ifdef CONFIG_HAVE_PLATFORM_DEVICE_IDLE_WAKEUP
+void platform_device_idle(struct platform_device *pdev);
+void platform_device_wakeup(struct platform_device *pdev);
+#else
+static inline void platform_device_idle(struct platform_device *pdev) {}
+static inline void platform_device_wakeup(struct platform_device *pdev) {}
+#endif
+
struct platform_driver {
int (*probe)(struct platform_device *);
int (*remove)(struct platform_device *);
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 02/04] Driver Core: Add idle and wakeup functions
2009-05-27 10:06 [PATCH 02/04] Driver Core: Add idle and wakeup functions Magnus Damm
@ 2009-05-28 21:29 ` Rafael J. Wysocki
2009-05-29 5:10 ` Magnus Damm
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Rafael J. Wysocki @ 2009-05-28 21:29 UTC (permalink / raw)
To: linux-sh
On Wednesday 27 May 2009, Magnus Damm wrote:
> From: Magnus Damm <damm@igel.co.jp>
>
> Add platform_device_idle() and platform_device_wakeup()
> and allow architectures to implement their own versions
> of these if CONFIG_HAVE_PLATFORM_IDLE_WAKEUP is set.
>
> Signed-off-by: Magnus Damm <damm@igel.co.jp>
> ---
>
> Yes, this needs documentation. See [00/04] for now.
>
> arch/Kconfig | 3 +++
> include/linux/platform_device.h | 8 ++++++++
> 2 files changed, 11 insertions(+)
>
> --- 0002/arch/Kconfig
> +++ work/arch/Kconfig 2009-05-26 12:31:06.000000000 +0900
> @@ -115,3 +115,6 @@ config HAVE_DEFAULT_NO_SPIN_MUTEXES
>
> config HAVE_PLATFORM_DEVICE_ARCHDATA
> bool
> +
> +config HAVE_PLATFORM_DEVICE_IDLE_WAKEUP
Again, I'm not sure if the new CONFIG_ option is really necessary.
> + bool
> --- 0002/include/linux/platform_device.h
> +++ work/include/linux/platform_device.h 2009-05-26 12:32:40.000000000 +0900
> @@ -57,6 +57,14 @@ extern int platform_device_add(struct pl
> extern void platform_device_del(struct platform_device *pdev);
> extern void platform_device_put(struct platform_device *pdev);
>
> +#ifdef CONFIG_HAVE_PLATFORM_DEVICE_IDLE_WAKEUP
> +void platform_device_idle(struct platform_device *pdev);
> +void platform_device_wakeup(struct platform_device *pdev);
> +#else
> +static inline void platform_device_idle(struct platform_device *pdev) {}
> +static inline void platform_device_wakeup(struct platform_device *pdev) {}
> +#endif
> +
> struct platform_driver {
> int (*probe)(struct platform_device *);
> int (*remove)(struct platform_device *);
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 02/04] Driver Core: Add idle and wakeup functions
2009-05-27 10:06 [PATCH 02/04] Driver Core: Add idle and wakeup functions Magnus Damm
2009-05-28 21:29 ` Rafael J. Wysocki
@ 2009-05-29 5:10 ` Magnus Damm
2009-06-03 9:05 ` Rafael J. Wysocki
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Magnus Damm @ 2009-05-29 5:10 UTC (permalink / raw)
To: linux-sh
2009/5/29 Rafael J. Wysocki <rjw@sisk.pl>:
> On Wednesday 27 May 2009, Magnus Damm wrote:
>> From: Magnus Damm <damm@igel.co.jp>
>>
>> Add platform_device_idle() and platform_device_wakeup()
>> and allow architectures to implement their own versions
>> of these if CONFIG_HAVE_PLATFORM_IDLE_WAKEUP is set.
>>
>> Signed-off-by: Magnus Damm <damm@igel.co.jp>
>> ---
>>
>> Yes, this needs documentation. See [00/04] for now.
>>
>> arch/Kconfig | 3 +++
>> include/linux/platform_device.h | 8 ++++++++
>> 2 files changed, 11 insertions(+)
>>
>> --- 0002/arch/Kconfig
>> +++ work/arch/Kconfig 2009-05-26 12:31:06.000000000 +0900
>> @@ -115,3 +115,6 @@ config HAVE_DEFAULT_NO_SPIN_MUTEXES
>>
>> config HAVE_PLATFORM_DEVICE_ARCHDATA
>> bool
>> +
>> +config HAVE_PLATFORM_DEVICE_IDLE_WAKEUP
>
> Again, I'm not sure if the new CONFIG_ option is really necessary.
At least it could be combined into a single option for platform device
runtime pm. So no need to have separate kconfig options for [02/04]
and [03/04].
We could also drop the #ifdef stuff and go for weak symbols that can
be overriden by architecture code.
I'm open to suggestions. =)
/ magnus
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 02/04] Driver Core: Add idle and wakeup functions
2009-05-27 10:06 [PATCH 02/04] Driver Core: Add idle and wakeup functions Magnus Damm
2009-05-28 21:29 ` Rafael J. Wysocki
2009-05-29 5:10 ` Magnus Damm
@ 2009-06-03 9:05 ` Rafael J. Wysocki
2009-06-05 3:26 ` Magnus Damm
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Rafael J. Wysocki @ 2009-06-03 9:05 UTC (permalink / raw)
To: linux-sh
On Friday 29 May 2009, Magnus Damm wrote:
> 2009/5/29 Rafael J. Wysocki <rjw@sisk.pl>:
> > On Wednesday 27 May 2009, Magnus Damm wrote:
> >> From: Magnus Damm <damm@igel.co.jp>
> >>
> >> Add platform_device_idle() and platform_device_wakeup()
> >> and allow architectures to implement their own versions
> >> of these if CONFIG_HAVE_PLATFORM_IDLE_WAKEUP is set.
> >>
> >> Signed-off-by: Magnus Damm <damm@igel.co.jp>
> >> ---
> >>
> >> Yes, this needs documentation. See [00/04] for now.
> >>
> >> arch/Kconfig | 3 +++
> >> include/linux/platform_device.h | 8 ++++++++
> >> 2 files changed, 11 insertions(+)
> >>
> >> --- 0002/arch/Kconfig
> >> +++ work/arch/Kconfig 2009-05-26 12:31:06.000000000 +0900
> >> @@ -115,3 +115,6 @@ config HAVE_DEFAULT_NO_SPIN_MUTEXES
> >>
> >> config HAVE_PLATFORM_DEVICE_ARCHDATA
> >> bool
> >> +
> >> +config HAVE_PLATFORM_DEVICE_IDLE_WAKEUP
> >
> > Again, I'm not sure if the new CONFIG_ option is really necessary.
>
> At least it could be combined into a single option for platform device
> runtime pm. So no need to have separate kconfig options for [02/04]
> and [03/04].
>
> We could also drop the #ifdef stuff and go for weak symbols that can
> be overriden by architecture code.
The weak symbols don't work really AFAICS. People have been replacing them
with alternative things recently.
> I'm open to suggestions. =)
Well, that depends on what exactly you want to achieve. :-)
Best,
Rafael
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 02/04] Driver Core: Add idle and wakeup functions
2009-05-27 10:06 [PATCH 02/04] Driver Core: Add idle and wakeup functions Magnus Damm
` (2 preceding siblings ...)
2009-06-03 9:05 ` Rafael J. Wysocki
@ 2009-06-05 3:26 ` Magnus Damm
2009-06-05 20:42 ` Rafael J. Wysocki
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Magnus Damm @ 2009-06-05 3:26 UTC (permalink / raw)
To: linux-sh
On Wed, Jun 3, 2009 at 6:05 PM, Rafael J. Wysocki<rjw@sisk.pl> wrote:
> On Friday 29 May 2009, Magnus Damm wrote:
>> 2009/5/29 Rafael J. Wysocki <rjw@sisk.pl>:
>> > On Wednesday 27 May 2009, Magnus Damm wrote:
>> >> From: Magnus Damm <damm@igel.co.jp>
>> >>
>> >> Add platform_device_idle() and platform_device_wakeup()
>> >> and allow architectures to implement their own versions
>> >> of these if CONFIG_HAVE_PLATFORM_IDLE_WAKEUP is set.
>> >>
>> >> Signed-off-by: Magnus Damm <damm@igel.co.jp>
>> >> ---
>> >>
>> >> Yes, this needs documentation. See [00/04] for now.
>> >>
>> >> arch/Kconfig | 3 +++
>> >> include/linux/platform_device.h | 8 ++++++++
>> >> 2 files changed, 11 insertions(+)
>> >>
>> >> --- 0002/arch/Kconfig
>> >> +++ work/arch/Kconfig 2009-05-26 12:31:06.000000000 +0900
>> >> @@ -115,3 +115,6 @@ config HAVE_DEFAULT_NO_SPIN_MUTEXES
>> >>
>> >> config HAVE_PLATFORM_DEVICE_ARCHDATA
>> >> bool
>> >> +
>> >> +config HAVE_PLATFORM_DEVICE_IDLE_WAKEUP
>> >
>> > Again, I'm not sure if the new CONFIG_ option is really necessary.
>>
>> At least it could be combined into a single option for platform device
>> runtime pm. So no need to have separate kconfig options for [02/04]
>> and [03/04].
>>
>> We could also drop the #ifdef stuff and go for weak symbols that can
>> be overriden by architecture code.
>
> The weak symbols don't work really AFAICS. People have been replacing them
> with alternative things recently.
>
>> I'm open to suggestions. =)
>
> Well, that depends on what exactly you want to achieve. :-)
=)
I'd like an architecture independent interface upstream that makes it
possible for device drivers to notify the architecture code that they
are idle() and that need wakeup().
In the long term I hope we can share a great deal of runtime PM code
between architectures, but for now we just need some architecture
specific hooks to get started.
The wakeup()/idle() code in this patch is one way to solve it on a
platform device level. Another more generic way would be to add
->enable() and ->disable() callbacks to struct bus_type and introduce
device_enable() and device_disable() that takes struct device and
invokes the bus callbacks if set.
Any thoughts? Does it make sense?
/ magnus
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 02/04] Driver Core: Add idle and wakeup functions
2009-05-27 10:06 [PATCH 02/04] Driver Core: Add idle and wakeup functions Magnus Damm
` (3 preceding siblings ...)
2009-06-05 3:26 ` Magnus Damm
@ 2009-06-05 20:42 ` Rafael J. Wysocki
2009-06-09 4:22 ` Magnus Damm
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Rafael J. Wysocki @ 2009-06-05 20:42 UTC (permalink / raw)
To: linux-sh
On Friday 05 June 2009, Magnus Damm wrote:
> On Wed, Jun 3, 2009 at 6:05 PM, Rafael J. Wysocki<rjw@sisk.pl> wrote:
> > On Friday 29 May 2009, Magnus Damm wrote:
> >> 2009/5/29 Rafael J. Wysocki <rjw@sisk.pl>:
> >> > On Wednesday 27 May 2009, Magnus Damm wrote:
> >> >> From: Magnus Damm <damm@igel.co.jp>
> >> >>
> >> >> Add platform_device_idle() and platform_device_wakeup()
> >> >> and allow architectures to implement their own versions
> >> >> of these if CONFIG_HAVE_PLATFORM_IDLE_WAKEUP is set.
> >> >>
> >> >> Signed-off-by: Magnus Damm <damm@igel.co.jp>
> >> >> ---
> >> >>
> >> >> Yes, this needs documentation. See [00/04] for now.
> >> >>
> >> >> arch/Kconfig | 3 +++
> >> >> include/linux/platform_device.h | 8 ++++++++
> >> >> 2 files changed, 11 insertions(+)
> >> >>
> >> >> --- 0002/arch/Kconfig
> >> >> +++ work/arch/Kconfig 2009-05-26 12:31:06.000000000 +0900
> >> >> @@ -115,3 +115,6 @@ config HAVE_DEFAULT_NO_SPIN_MUTEXES
> >> >>
> >> >> config HAVE_PLATFORM_DEVICE_ARCHDATA
> >> >> bool
> >> >> +
> >> >> +config HAVE_PLATFORM_DEVICE_IDLE_WAKEUP
> >> >
> >> > Again, I'm not sure if the new CONFIG_ option is really necessary.
> >>
> >> At least it could be combined into a single option for platform device
> >> runtime pm. So no need to have separate kconfig options for [02/04]
> >> and [03/04].
> >>
> >> We could also drop the #ifdef stuff and go for weak symbols that can
> >> be overriden by architecture code.
> >
> > The weak symbols don't work really AFAICS. People have been replacing them
> > with alternative things recently.
> >
> >> I'm open to suggestions. =)
> >
> > Well, that depends on what exactly you want to achieve. :-)
>
> =)
>
> I'd like an architecture independent interface upstream that makes it
> possible for device drivers to notify the architecture code that they
> are idle() and that need wakeup().
>
> In the long term I hope we can share a great deal of runtime PM code
> between architectures, but for now we just need some architecture
> specific hooks to get started.
>
> The wakeup()/idle() code in this patch is one way to solve it on a
> platform device level. Another more generic way would be to add
> ->enable() and ->disable() callbacks to struct bus_type and introduce
> device_enable() and device_disable() that takes struct device and
> invokes the bus callbacks if set.
So, you need a generic mechanism that drivers can use to notify the bus type
code that a device is idle and therefore it should schedule an autosuspend
request for the device. Also, you want a mechanism by which drivers can notify
the platform code that there is a need to wake-up an autosuspended device.
Is that correct?
Rafael
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 02/04] Driver Core: Add idle and wakeup functions
2009-05-27 10:06 [PATCH 02/04] Driver Core: Add idle and wakeup functions Magnus Damm
` (4 preceding siblings ...)
2009-06-05 20:42 ` Rafael J. Wysocki
@ 2009-06-09 4:22 ` Magnus Damm
2009-06-09 23:41 ` Rafael J. Wysocki
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Magnus Damm @ 2009-06-09 4:22 UTC (permalink / raw)
To: linux-sh
On Sat, Jun 6, 2009 at 5:42 AM, Rafael J. Wysocki<rjw@sisk.pl> wrote:
> On Friday 05 June 2009, Magnus Damm wrote:
>> On Wed, Jun 3, 2009 at 6:05 PM, Rafael J. Wysocki<rjw@sisk.pl> wrote:
>> > On Friday 29 May 2009, Magnus Damm wrote:
>> >> 2009/5/29 Rafael J. Wysocki <rjw@sisk.pl>:
>> >> > On Wednesday 27 May 2009, Magnus Damm wrote:
>> >> >> From: Magnus Damm <damm@igel.co.jp>
>> >> >>
>> >> >> Add platform_device_idle() and platform_device_wakeup()
>> >> >> and allow architectures to implement their own versions
>> >> >> of these if CONFIG_HAVE_PLATFORM_IDLE_WAKEUP is set.
>> >> >>
>> >> >> Signed-off-by: Magnus Damm <damm@igel.co.jp>
>> >> >> ---
>> The wakeup()/idle() code in this patch is one way to solve it on a
>> platform device level. Another more generic way would be to add
>> ->enable() and ->disable() callbacks to struct bus_type and introduce
>> device_enable() and device_disable() that takes struct device and
>> invokes the bus callbacks if set.
>
> So, you need a generic mechanism that drivers can use to notify the bus type
> code that a device is idle and therefore it should schedule an autosuspend
> request for the device. Also, you want a mechanism by which drivers can notify
> the platform code that there is a need to wake-up an autosuspended device.
> Is that correct?
Yes, you are 100% correct that I want drivers to have some way to
notify the bus type that a certain device is idle or needs to be woken
up.
Exactly what should happen when the device is marked as idle is a
different question. I guess this is bus specific. Connecting the idle
notification directly to autosuspend is not a very good idea IMO since
the power management comes with latency restrictions.
If we zoom out a bit then I think that we should have something
similar to cpuidle but for devices. Maybe the driver should give a
list of suspend modes, their latencies and power savings. This per
driver (or per device) latency information is important, but even more
important IMO is latency information for the bus itself.
So for our on-chip SuperH SoC platform devices I'd like to keep track
of which devices that are idle, and if all devices within one power
domain are idle then i'd like to execute autosuspend() for those and
after that power off the bus/domain. But only if this doesn't break
any latency requirements.
Cheers,
/ magnus
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 02/04] Driver Core: Add idle and wakeup functions
2009-05-27 10:06 [PATCH 02/04] Driver Core: Add idle and wakeup functions Magnus Damm
` (5 preceding siblings ...)
2009-06-09 4:22 ` Magnus Damm
@ 2009-06-09 23:41 ` Rafael J. Wysocki
2009-06-10 6:03 ` Magnus Damm
2009-06-10 8:19 ` Rafael J. Wysocki
8 siblings, 0 replies; 10+ messages in thread
From: Rafael J. Wysocki @ 2009-06-09 23:41 UTC (permalink / raw)
To: linux-sh
On Tuesday 09 June 2009, Magnus Damm wrote:
> On Sat, Jun 6, 2009 at 5:42 AM, Rafael J. Wysocki<rjw@sisk.pl> wrote:
> > On Friday 05 June 2009, Magnus Damm wrote:
> >> On Wed, Jun 3, 2009 at 6:05 PM, Rafael J. Wysocki<rjw@sisk.pl> wrote:
> >> > On Friday 29 May 2009, Magnus Damm wrote:
> >> >> 2009/5/29 Rafael J. Wysocki <rjw@sisk.pl>:
> >> >> > On Wednesday 27 May 2009, Magnus Damm wrote:
> >> >> >> From: Magnus Damm <damm@igel.co.jp>
> >> >> >>
> >> >> >> Add platform_device_idle() and platform_device_wakeup()
> >> >> >> and allow architectures to implement their own versions
> >> >> >> of these if CONFIG_HAVE_PLATFORM_IDLE_WAKEUP is set.
> >> >> >>
> >> >> >> Signed-off-by: Magnus Damm <damm@igel.co.jp>
> >> >> >> ---
>
> >> The wakeup()/idle() code in this patch is one way to solve it on a
> >> platform device level. Another more generic way would be to add
> >> ->enable() and ->disable() callbacks to struct bus_type and introduce
> >> device_enable() and device_disable() that takes struct device and
> >> invokes the bus callbacks if set.
> >
> > So, you need a generic mechanism that drivers can use to notify the bus type
> > code that a device is idle and therefore it should schedule an autosuspend
> > request for the device. Also, you want a mechanism by which drivers can notify
> > the platform code that there is a need to wake-up an autosuspended device.
> > Is that correct?
>
> Yes, you are 100% correct that I want drivers to have some way to
> notify the bus type that a certain device is idle or needs to be woken
> up.
>
> Exactly what should happen when the device is marked as idle is a
> different question. I guess this is bus specific. Connecting the idle
> notification directly to autosuspend is not a very good idea IMO since
> the power management comes with latency restrictions.
>
> If we zoom out a bit then I think that we should have something
> similar to cpuidle but for devices. Maybe the driver should give a
> list of suspend modes, their latencies and power savings. This per
> driver (or per device) latency information is important, but even more
> important IMO is latency information for the bus itself.
>
> So for our on-chip SuperH SoC platform devices I'd like to keep track
> of which devices that are idle, and if all devices within one power
> domain are idle then i'd like to execute autosuspend() for those and
> after that power off the bus/domain. But only if this doesn't break
> any latency requirements.
OK, I think we can add ->idle() and ->wakeup() callbacks to struct bus_type
for this purpose.
BTW, I'm waiting for a new version of your patch adding the arch data to
struct platform_device with a better changelog.
Best,
Rafael
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 02/04] Driver Core: Add idle and wakeup functions
2009-05-27 10:06 [PATCH 02/04] Driver Core: Add idle and wakeup functions Magnus Damm
` (6 preceding siblings ...)
2009-06-09 23:41 ` Rafael J. Wysocki
@ 2009-06-10 6:03 ` Magnus Damm
2009-06-10 8:19 ` Rafael J. Wysocki
8 siblings, 0 replies; 10+ messages in thread
From: Magnus Damm @ 2009-06-10 6:03 UTC (permalink / raw)
To: linux-sh
On Wed, Jun 10, 2009 at 8:41 AM, Rafael J. Wysocki<rjw@sisk.pl> wrote:
> On Tuesday 09 June 2009, Magnus Damm wrote:
>> On Sat, Jun 6, 2009 at 5:42 AM, Rafael J. Wysocki<rjw@sisk.pl> wrote:
>> > On Friday 05 June 2009, Magnus Damm wrote:
>> >> On Wed, Jun 3, 2009 at 6:05 PM, Rafael J. Wysocki<rjw@sisk.pl> wrote:
>> >> > On Friday 29 May 2009, Magnus Damm wrote:
>> >> >> 2009/5/29 Rafael J. Wysocki <rjw@sisk.pl>:
>> >> >> > On Wednesday 27 May 2009, Magnus Damm wrote:
>> >> >> >> From: Magnus Damm <damm@igel.co.jp>
>> >> >> >>
>> >> >> >> Add platform_device_idle() and platform_device_wakeup()
>> >> >> >> and allow architectures to implement their own versions
>> >> >> >> of these if CONFIG_HAVE_PLATFORM_IDLE_WAKEUP is set.
>> >> >> >>
>> >> >> >> Signed-off-by: Magnus Damm <damm@igel.co.jp>
>> >> >> >> ---
>>
>> >> The wakeup()/idle() code in this patch is one way to solve it on a
>> >> platform device level. Another more generic way would be to add
>> >> ->enable() and ->disable() callbacks to struct bus_type and introduce
>> >> device_enable() and device_disable() that takes struct device and
>> >> invokes the bus callbacks if set.
>> >
>> > So, you need a generic mechanism that drivers can use to notify the bus type
>> > code that a device is idle and therefore it should schedule an autosuspend
>> > request for the device. Also, you want a mechanism by which drivers can notify
>> > the platform code that there is a need to wake-up an autosuspended device.
>> > Is that correct?
>>
>> Yes, you are 100% correct that I want drivers to have some way to
>> notify the bus type that a certain device is idle or needs to be woken
>> up.
>>
>> Exactly what should happen when the device is marked as idle is a
>> different question. I guess this is bus specific. Connecting the idle
>> notification directly to autosuspend is not a very good idea IMO since
>> the power management comes with latency restrictions.
>>
>> If we zoom out a bit then I think that we should have something
>> similar to cpuidle but for devices. Maybe the driver should give a
>> list of suspend modes, their latencies and power savings. This per
>> driver (or per device) latency information is important, but even more
>> important IMO is latency information for the bus itself.
>>
>> So for our on-chip SuperH SoC platform devices I'd like to keep track
>> of which devices that are idle, and if all devices within one power
>> domain are idle then i'd like to execute autosuspend() for those and
>> after that power off the bus/domain. But only if this doesn't break
>> any latency requirements.
>
> OK, I think we can add ->idle() and ->wakeup() callbacks to struct bus_type
> for this purpose.
Sounds very good! So unless there are any objections I'll just post a
"Driver Core: Add idle and wakeup functions V2" which adds ->idle()
and ->wakeup() callbacks to struct bus_type together with inline asm
functions device_idle() and device_wakeup().
> BTW, I'm waiting for a new version of your patch adding the arch data to
> struct platform_device with a better changelog.
Yeah, sorry about the delay. I will post an updated version!
/ magnus
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 02/04] Driver Core: Add idle and wakeup functions
2009-05-27 10:06 [PATCH 02/04] Driver Core: Add idle and wakeup functions Magnus Damm
` (7 preceding siblings ...)
2009-06-10 6:03 ` Magnus Damm
@ 2009-06-10 8:19 ` Rafael J. Wysocki
8 siblings, 0 replies; 10+ messages in thread
From: Rafael J. Wysocki @ 2009-06-10 8:19 UTC (permalink / raw)
To: linux-sh
On Wednesday 10 June 2009, Magnus Damm wrote:
> On Wed, Jun 10, 2009 at 8:41 AM, Rafael J. Wysocki<rjw@sisk.pl> wrote:
> > On Tuesday 09 June 2009, Magnus Damm wrote:
> >> On Sat, Jun 6, 2009 at 5:42 AM, Rafael J. Wysocki<rjw@sisk.pl> wrote:
> >> > On Friday 05 June 2009, Magnus Damm wrote:
> >> >> On Wed, Jun 3, 2009 at 6:05 PM, Rafael J. Wysocki<rjw@sisk.pl> wrote:
> >> >> > On Friday 29 May 2009, Magnus Damm wrote:
> >> >> >> 2009/5/29 Rafael J. Wysocki <rjw@sisk.pl>:
> >> >> >> > On Wednesday 27 May 2009, Magnus Damm wrote:
> >> >> >> >> From: Magnus Damm <damm@igel.co.jp>
> >> >> >> >>
> >> >> >> >> Add platform_device_idle() and platform_device_wakeup()
> >> >> >> >> and allow architectures to implement their own versions
> >> >> >> >> of these if CONFIG_HAVE_PLATFORM_IDLE_WAKEUP is set.
> >> >> >> >>
> >> >> >> >> Signed-off-by: Magnus Damm <damm@igel.co.jp>
> >> >> >> >> ---
> >>
> >> >> The wakeup()/idle() code in this patch is one way to solve it on a
> >> >> platform device level. Another more generic way would be to add
> >> >> ->enable() and ->disable() callbacks to struct bus_type and introduce
> >> >> device_enable() and device_disable() that takes struct device and
> >> >> invokes the bus callbacks if set.
> >> >
> >> > So, you need a generic mechanism that drivers can use to notify the bus type
> >> > code that a device is idle and therefore it should schedule an autosuspend
> >> > request for the device. Also, you want a mechanism by which drivers can notify
> >> > the platform code that there is a need to wake-up an autosuspended device.
> >> > Is that correct?
> >>
> >> Yes, you are 100% correct that I want drivers to have some way to
> >> notify the bus type that a certain device is idle or needs to be woken
> >> up.
> >>
> >> Exactly what should happen when the device is marked as idle is a
> >> different question. I guess this is bus specific. Connecting the idle
> >> notification directly to autosuspend is not a very good idea IMO since
> >> the power management comes with latency restrictions.
> >>
> >> If we zoom out a bit then I think that we should have something
> >> similar to cpuidle but for devices. Maybe the driver should give a
> >> list of suspend modes, their latencies and power savings. This per
> >> driver (or per device) latency information is important, but even more
> >> important IMO is latency information for the bus itself.
> >>
> >> So for our on-chip SuperH SoC platform devices I'd like to keep track
> >> of which devices that are idle, and if all devices within one power
> >> domain are idle then i'd like to execute autosuspend() for those and
> >> after that power off the bus/domain. But only if this doesn't break
> >> any latency requirements.
> >
> > OK, I think we can add ->idle() and ->wakeup() callbacks to struct bus_type
> > for this purpose.
>
> Sounds very good! So unless there are any objections I'll just post a
> "Driver Core: Add idle and wakeup functions V2" which adds ->idle()
> and ->wakeup() callbacks to struct bus_type together with inline asm
> functions device_idle() and device_wakeup().
Well, I'd prefer to do that along with my run-time PM patch that is currently
being discussed with Alan and Oliver (I've sent a Cc of the first message
in that thread to you).
> > BTW, I'm waiting for a new version of your patch adding the arch data to
> > struct platform_device with a better changelog.
>
> Yeah, sorry about the delay. I will post an updated version!
Great, thanks!
Best,
Rafael
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2009-06-10 8:19 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-27 10:06 [PATCH 02/04] Driver Core: Add idle and wakeup functions Magnus Damm
2009-05-28 21:29 ` Rafael J. Wysocki
2009-05-29 5:10 ` Magnus Damm
2009-06-03 9:05 ` Rafael J. Wysocki
2009-06-05 3:26 ` Magnus Damm
2009-06-05 20:42 ` Rafael J. Wysocki
2009-06-09 4:22 ` Magnus Damm
2009-06-09 23:41 ` Rafael J. Wysocki
2009-06-10 6:03 ` Magnus Damm
2009-06-10 8:19 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox