public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* suspend to RAM (embedded) ppc?
@ 2006-06-24 18:02 Guennadi Liakhovetski
  2006-06-25  1:20 ` Paul Mackerras
  0 siblings, 1 reply; 12+ messages in thread
From: Guennadi Liakhovetski @ 2006-06-24 18:02 UTC (permalink / raw)
  To: linux-pm

Hi

Sorry if this is not the right list to ask. I was surprised to not find 
any ppc platforms except powermac implementing suspend to RAM? Same for 
CPU_FREQ - only powermac. What could be the reason? Sure ppc supports CPU 
frequency switching / sleep states.

Thanks
Guennadi
---
Guennadi Liakhovetski

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: suspend to RAM (embedded) ppc?
  2006-06-24 18:02 suspend to RAM (embedded) ppc? Guennadi Liakhovetski
@ 2006-06-25  1:20 ` Paul Mackerras
  2006-06-25 10:06   ` Guennadi Liakhovetski
  2006-06-25 18:36   ` Guennadi Liakhovetski
  0 siblings, 2 replies; 12+ messages in thread
From: Paul Mackerras @ 2006-06-25  1:20 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: linux-pm

Guennadi Liakhovetski writes:

> Sorry if this is not the right list to ask. I was surprised to not find 
> any ppc platforms except powermac implementing suspend to RAM? Same for 
> CPU_FREQ - only powermac. What could be the reason?

Presumably no-one else has felt motivated to get them going on other
PPC platforms so far...  Both of these things tend to use very
platform-specific facilities.

Patches welcome.

Paul.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: suspend to RAM (embedded) ppc?
  2006-06-25  1:20 ` Paul Mackerras
@ 2006-06-25 10:06   ` Guennadi Liakhovetski
  2006-06-25 18:36   ` Guennadi Liakhovetski
  1 sibling, 0 replies; 12+ messages in thread
From: Guennadi Liakhovetski @ 2006-06-25 10:06 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linux-pm

On Sun, 25 Jun 2006, Paul Mackerras wrote:

> Guennadi Liakhovetski writes:
> 
> > Sorry if this is not the right list to ask. I was surprised to not find 
> > any ppc platforms except powermac implementing suspend to RAM? Same for 
> > CPU_FREQ - only powermac. What could be the reason?
> 
> Presumably no-one else has felt motivated to get them going on other
> PPC platforms so far...  Both of these things tend to use very
> platform-specific facilities.

Thanks! That's exactly what I wanted to hear - that it's not because it's 
impossible or not worth it, just not yet implemented.

I just cannot believe that no embedded devices on the market using ppc 
CPUs running under 2.6 kernel implement suspend to RAM...

Thanks
Guennadi
---
Guennadi Liakhovetski

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: suspend to RAM (embedded) ppc?
  2006-06-25  1:20 ` Paul Mackerras
  2006-06-25 10:06   ` Guennadi Liakhovetski
@ 2006-06-25 18:36   ` Guennadi Liakhovetski
  2006-06-26  6:13     ` Johannes Berg
  2006-06-26  6:26     ` Paul Mackerras
  1 sibling, 2 replies; 12+ messages in thread
From: Guennadi Liakhovetski @ 2006-06-25 18:36 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linux-pm

On Sun, 25 Jun 2006, Paul Mackerras wrote:

> Guennadi Liakhovetski writes:
> 
> > Sorry if this is not the right list to ask. I was surprised to not find 
> > any ppc platforms except powermac implementing suspend to RAM? Same for 
> > CPU_FREQ - only powermac. What could be the reason?
> 
> Presumably no-one else has felt motivated to get them going on other
> PPC platforms so far...  Both of these things tend to use very
> platform-specific facilities.

Oh, no... Looking in arch/powerpc/platforms/powermac/setup.c at their
struct pm_ops couldn't see any actual code to handle suspends, and then
noticed this:

/* TODO: Merge the suspend-to-ram with the common code !!!
 * currently, this is a stub implementation for suspend-to-disk
 * only
 */

So, there's not a single STR implementation for ppc in the kernel?...

Thanks
Guennadi
---
Guennadi Liakhovetski

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: suspend to RAM (embedded) ppc?
  2006-06-25 18:36   ` Guennadi Liakhovetski
@ 2006-06-26  6:13     ` Johannes Berg
  2006-06-26  6:26     ` Paul Mackerras
  1 sibling, 0 replies; 12+ messages in thread
From: Johannes Berg @ 2006-06-26  6:13 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: linux-pm


[-- Attachment #1.1: Type: text/plain, Size: 271 bytes --]

On Sun, 2006-06-25 at 20:36 +0200, Guennadi Liakhovetski wrote:

> So, there's not a single STR implementation for ppc in the kernel?...

powerbooks and ibooks can suspend but all the code for that goes through
the via-pmu ioctl, not the generic stuff.

johannes

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 793 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: suspend to RAM (embedded) ppc?
  2006-06-25 18:36   ` Guennadi Liakhovetski
  2006-06-26  6:13     ` Johannes Berg
@ 2006-06-26  6:26     ` Paul Mackerras
  2006-06-26 18:44       ` Guennadi Liakhovetski
  1 sibling, 1 reply; 12+ messages in thread
From: Paul Mackerras @ 2006-06-26  6:26 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: linux-pm

Guennadi Liakhovetski writes:

> So, there's not a single STR implementation for ppc in the kernel?...

The STR implementation for powerbooks predates the generic STR support
(by quite a long way, it was originally done in 1998).  These days it
uses some parts of the generic STR support but the top-level control
is still using the old code, because the generic STR code doesn't
provide all the hooks we need yet.

For historical reasons, the top-level powerbook STR code is in
drivers/macintosh/via-pmu.c, and is invoked via an ioctl on /dev/pmu.

Paul.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: suspend to RAM (embedded) ppc?
  2006-06-26  6:26     ` Paul Mackerras
@ 2006-06-26 18:44       ` Guennadi Liakhovetski
  2006-06-27 18:07         ` Johannes Berg
  0 siblings, 1 reply; 12+ messages in thread
From: Guennadi Liakhovetski @ 2006-06-26 18:44 UTC (permalink / raw)
  To: Johannes Berg, Paul Mackerras; +Cc: linux-pm

On Mon, 26 Jun 2006, Johannes Berg wrote:

> powerbooks and ibooks can suspend but all the code for that goes through
> the via-pmu ioctl, not the generic stuff.

On Mon, 26 Jun 2006, Paul Mackerras wrote:

> The STR implementation for powerbooks predates the generic STR support
> (by quite a long way, it was originally done in 1998).  These days it
> uses some parts of the generic STR support but the top-level control
> is still using the old code, because the generic STR code doesn't
> provide all the hooks we need yet.
> 
> For historical reasons, the top-level powerbook STR code is in
> drivers/macintosh/via-pmu.c, and is invoked via an ioctl on /dev/pmu.

Thanks Johannes and Paul! would never find myself... Looking further. 
Expect more questions:-)

Thanks
Guennadi
---
Guennadi Liakhovetski

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: suspend to RAM (embedded) ppc?
  2006-06-26 18:44       ` Guennadi Liakhovetski
@ 2006-06-27 18:07         ` Johannes Berg
  2006-06-27 19:31           ` Guennadi Liakhovetski
  2006-06-28 22:37           ` Guennadi Liakhovetski
  0 siblings, 2 replies; 12+ messages in thread
From: Johannes Berg @ 2006-06-27 18:07 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: linux-pm


[-- Attachment #1.1: Type: text/plain, Size: 434 bytes --]

On Mon, 2006-06-26 at 20:44 +0200, Guennadi Liakhovetski wrote:

> Thanks Johannes and Paul! would never find myself... Looking further. 
> Expect more questions:-)

You may want to hold off working on this a bit and first ask BenH for
his old patches that converted the pmu stuff to the generic thing but
needed invasive generic stuff first.

On the other hand, you can also just implement it for your board :)

johannes

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 793 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: suspend to RAM (embedded) ppc?
  2006-06-27 18:07         ` Johannes Berg
@ 2006-06-27 19:31           ` Guennadi Liakhovetski
  2006-06-28 22:37           ` Guennadi Liakhovetski
  1 sibling, 0 replies; 12+ messages in thread
From: Guennadi Liakhovetski @ 2006-06-27 19:31 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-pm

On Tue, 27 Jun 2006, Johannes Berg wrote:

> On Mon, 2006-06-26 at 20:44 +0200, Guennadi Liakhovetski wrote:
> 
> > Thanks Johannes and Paul! would never find myself... Looking further. 
> > Expect more questions:-)
> 
> You may want to hold off working on this a bit and first ask BenH for
> his old patches that converted the pmu stuff to the generic thing but
> needed invasive generic stuff first.

Oh, I'd love to "hold off" and would be greatful to see any patches... I 
am quite new to power and to power management, so, rather than starting on 
an "empty" place...

> On the other hand, you can also just implement it for your board :)

Yeah, "just implement" is good:-) I'll try to look through datasheets for 
now, to understand what's involved, etc.

Thanks
Guennadi
---
Guennadi Liakhovetski

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: suspend to RAM (embedded) ppc?
  2006-06-27 18:07         ` Johannes Berg
  2006-06-27 19:31           ` Guennadi Liakhovetski
@ 2006-06-28 22:37           ` Guennadi Liakhovetski
  2006-06-28 23:59             ` Benjamin Herrenschmidt
  2006-06-30 18:00             ` Pavel Machek
  1 sibling, 2 replies; 12+ messages in thread
From: Guennadi Liakhovetski @ 2006-06-28 22:37 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-pm

On Tue, 27 Jun 2006, Johannes Berg wrote:

> You may want to hold off working on this a bit and first ask BenH for
> his old patches that converted the pmu stuff to the generic thing but
> needed invasive generic stuff first.

Well, I started thinking about possible solutions for mpc824x by looking 
at the only available sleep implementation for ppc in the kernel - 
powermac. As was suggested I looked under drivers/macintosh. As an example 
I took powerbook_sleep_grackle() (I think, grackle is also installed in 
"blue and white" G3's, right?). There I see various calls to pmu_request() 
with macros as parameters and some comments, so, most things can be 
understood and mapped to another hardware (if still relevant under the new 
power-management interface). But then come some things that I don't 
understand:

		/* Ask the PMU to put us to sleep */
		pmu_request(&req, NULL, 5, PMU_SLEEP, 'M', 'A', 'T', 'T');

So, what exactly does this command do?

Next I'll dig the real low-level stuff

		low_sleep_handler();

I am already excited about getting my hands dirty with ppc assembly:-)

Thanks
Guennadi
---
Guennadi Liakhovetski

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: suspend to RAM (embedded) ppc?
  2006-06-28 22:37           ` Guennadi Liakhovetski
@ 2006-06-28 23:59             ` Benjamin Herrenschmidt
  2006-06-30 18:00             ` Pavel Machek
  1 sibling, 0 replies; 12+ messages in thread
From: Benjamin Herrenschmidt @ 2006-06-28 23:59 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: linux-pm, Johannes Berg

On Thu, 2006-06-29 at 00:37 +0200, Guennadi Liakhovetski wrote:
> On Tue, 27 Jun 2006, Johannes Berg wrote:
> 
> > You may want to hold off working on this a bit and first ask BenH for
> > his old patches that converted the pmu stuff to the generic thing but
> > needed invasive generic stuff first.
> 
> Well, I started thinking about possible solutions for mpc824x by looking 
> at the only available sleep implementation for ppc in the kernel - 
> powermac. As was suggested I looked under drivers/macintosh. As an example 
> I took powerbook_sleep_grackle() (I think, grackle is also installed in 
> "blue and white" G3's, right?). There I see various calls to pmu_request() 
> with macros as parameters and some comments, so, most things can be 
> understood and mapped to another hardware (if still relevant under the new 
> power-management interface). But then come some things that I don't 
> understand:
> 
> 		/* Ask the PMU to put us to sleep */
> 		pmu_request(&req, NULL, 5, PMU_SLEEP, 'M', 'A', 'T', 'T');
> 
> So, what exactly does this command do?

It sends a command to the PMU microcontroller to go to sleep. The result
depends on the machine model (I'd suggest you look at the core99 version
rather than the grackle version, it's more sane, and the B&W G3 doesn't
have a PMU anyway). On anything recent, the PMU will then wait for a
signal from the northbridge indicating that the processor entered an
idle state (NAP or SLEEP), and when that haappens, will shut down
various bits of the motherboard, including the CPU, stop some clocks
etc... so basically put the machine to sleep (and do the thing with the
LED). It will also control the wakeup signals from the USB or the button
(or the ADB keyboard) and reboot the CPU when that hapens.

> Next I'll dig the real low-level stuff
> 
> 		low_sleep_handler();
> 
> I am already excited about getting my hands dirty with ppc assembly:-)

The above flushes all processor caches (since the CPU is going to be
powered down) and saves as much as necessary of the CPU state, then put
the CPU into a SLEEP loop waiting for the shutdown by the PMU. It also
sets up some magic vectors where the ROM code will jump to on resume and
restores everything it saved.

> Thanks
> Guennadi
> ---
> Guennadi Liakhovetski

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: suspend to RAM (embedded) ppc?
  2006-06-28 22:37           ` Guennadi Liakhovetski
  2006-06-28 23:59             ` Benjamin Herrenschmidt
@ 2006-06-30 18:00             ` Pavel Machek
  1 sibling, 0 replies; 12+ messages in thread
From: Pavel Machek @ 2006-06-30 18:00 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: Johannes Berg, linux-pm

On Thu 2006-06-29 00:37:47, Guennadi Liakhovetski wrote:
> On Tue, 27 Jun 2006, Johannes Berg wrote:
> 
> > You may want to hold off working on this a bit and first ask BenH for
> > his old patches that converted the pmu stuff to the generic thing but
> > needed invasive generic stuff first.
> 
> Well, I started thinking about possible solutions for mpc824x by looking 
> at the only available sleep implementation for ppc in the kernel - 
> powermac. As was suggested I looked under drivers/macintosh. As an example 
> I took powerbook_sleep_grackle() (I think, grackle is also installed in 
> "blue and white" G3's, right?). There I see various calls to pmu_request() 
> with macros as parameters and some comments, so, most things can be 
> understood and mapped to another hardware (if still relevant under the new 
> power-management interface). But then come some things that I don't 
> understand:
> 
> 		/* Ask the PMU to put us to sleep */
> 		pmu_request(&req, NULL, 5, PMU_SLEEP, 'M', 'A', 'T', 'T');
                                                      ~~~~~~~~~~~~~~~~~~
					What kind of inside joke is that?

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2006-06-30 18:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-24 18:02 suspend to RAM (embedded) ppc? Guennadi Liakhovetski
2006-06-25  1:20 ` Paul Mackerras
2006-06-25 10:06   ` Guennadi Liakhovetski
2006-06-25 18:36   ` Guennadi Liakhovetski
2006-06-26  6:13     ` Johannes Berg
2006-06-26  6:26     ` Paul Mackerras
2006-06-26 18:44       ` Guennadi Liakhovetski
2006-06-27 18:07         ` Johannes Berg
2006-06-27 19:31           ` Guennadi Liakhovetski
2006-06-28 22:37           ` Guennadi Liakhovetski
2006-06-28 23:59             ` Benjamin Herrenschmidt
2006-06-30 18:00             ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox