[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [PATCH] ppc32: Rework power management take #3



Le jeudi 02 juin 2005 à 20:28 +1000, Benjamin Herrenschmidt a écrit :
> On Thu, 2005-06-02 at 09:59 +0200, Stelian Pop wrote:
> > [re-adding debian-powerpc in CC:, hope you don't mind, it was supposed
> > to be there in the first place but I wrongly put it into BCC: in the
> > original mail...]
> > 
> > Le jeudi 02 juin 2005 à 07:47 +1000, Benjamin Herrenschmidt a écrit :
> > > > This patch works almost perfectly on my PowerBook5,6 15" (ATI). Suspending to RAM
> > > > and DISK work beautifully, even in X, even with a USB mouse connected, even with
> > > > some music being played.
> > > > 
> > > > I have a few minor glitches with suspend-to-disk only:
> > > > 
> > > >   * after resuming the sound won't work until you 'touch' the master volume and/or
> > > >     the DRC level in alsamixer.
> > > 
> > > Ok.
> > 
> > Is there something I can hack here ?
> 
> Well, look at what's up in the Alsa driver ? :)
> 
> > > >   * time doesn't get restored correctly, I have to do a
> > > > 	/etc/init.d/hwclock.sh start
> > > >     after resuming. I'm not sure this is normal or should be done automagically
> > > >     on resume.
> > > 
> > > That should have worked. This is with suspend to disk or ram ?
> > 
> > To disk. When suspending to ram the clock gets updated correctly.
> 
> Ok, I'll have a look.

Well, both issues seem to come from the same cause: post_freeze
(pmac_pm_post_freeze in arch/ppc/pmac_pm.c) is not called when resuming
from disk, only from mem. This has the effect that broadcast_wake() is
never called when resuming from disk, and this affects at least the
timer and the sound (and possibly other hardware, like serial etc).

The attached patch fixes this for me by moving the wakeup in the
finish() callback. Maybe making post_freeze to be called in the first
place would be a more correct fix...

The attached patch also fixes the kernel/power core to use PLATFORM
instead of SHUTDOWN as the sleep mode... 

Stelian.
Index: linux-2.6-trunk.git/arch/ppc/platforms/pmac_pm.c
===================================================================
--- linux-2.6-trunk.git.orig/arch/ppc/platforms/pmac_pm.c	2005-06-02
10:23:17.000000000 +0200
+++ linux-2.6-trunk.git/arch/ppc/platforms/pmac_pm.c	2005-06-02
17:27:58.000000000 +0200
@@ -710,7 +710,7 @@
 		
 	} else if (state == PM_SUSPEND_DISK) {
 		device_shutdown();
-		machine_restart(NULL);
+		machine_power_off();
 	} else
 		rc = -EINVAL;
 	return rc;
@@ -747,6 +747,9 @@
 {
 	DBG("%s(%d)\n", __FUNCTION__, state);
 
+	/* Broadcase old style wakeup */
+	broadcast_wake();
+
 	/* Free PCI save block */
 	pbook_free_pci_save();
 
@@ -755,9 +758,6 @@
 static void __pmac pmac_pm_post_freeze(suspend_state_t state)
 {
 	DBG("%s(%d)\n", __FUNCTION__, state);
-
-	/* Broadcase old style wakeup */
-	broadcast_wake();
 }
 
 static struct pm_ops pmac_pm_ops  __pmacdata = {
Index: linux-2.6-trunk.git/kernel/power/main.c
===================================================================
--- linux-2.6-trunk.git.orig/kernel/power/main.c	2005-06-02
10:23:17.000000000 +0200
+++ linux-2.6-trunk.git/kernel/power/main.c	2005-06-02
17:17:04.000000000 +0200
@@ -34,6 +34,7 @@
 {
 	down(&pm_sem);
 	pm_ops = ops;
+	pm_disk_mode = pm_ops->pm_disk_mode;
 	up(&pm_sem);
 }
 

-- 
Stelian Pop <stelian@popies.net>



Reply to: