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

2005-06-01 Thread Stelian Pop
> Ok, the patch is now getting "good enough" for wider testing. It applies
> on current "git" tree (or 2.6.12-rc6 when/if that is ever released). It
> requires one other patch to be applied first:
> 
> http://gate.crashing.org/~benh/ppc32-remove-macserial.diff
> 
> The PM patch itself can be found at:
> 
> http://gate.crashing.org/~benh/ppc32-rework-pm.diff
> 
> This patch completely reworks both suspend-to-ram and suspend-to-disk
> support on PowerMac:

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.

  * looking at the console messages when resuming, I see those 'normal' 
messages:
Stopping tasks: 
=|
Freeing memory... done (42488 pages freed)
swsusp critical section done
After those messages and before the machine powers down, I see a few 
messages
related to resume, such as (hand copied so not necessarily exact):
Restoring Highmem
radeonfb resuming from state 2
eth0: resuming
PHY ID: 1410cc2, addr: 0
hda: Enabling Ultra DMA 5
hdc: Enabling MultiWord DMA 2
ehci_hcd 0001:10:1b.2: park 0
ehci_hcd 0001:10:1b.2: USB 2.0 restarted
I'm not sure those actions are supposed to happen. Or is this necessary for 
powering down the machine ?

  * 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.
 
Thanks Ben !

Stelian.
-- 
Stelian Pop <[EMAIL PROTECTED]>


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



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

2005-06-02 Thread Stelian Pop
[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 ?

> >   * 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.

Stelian.
-- 
Stelian Pop <[EMAIL PROTECTED]>



Re: keyboard backlight working on PowerBook5,6?

2005-06-02 Thread Stelian Pop
Le jeudi 02 juin 2005 à 13:20 +0200, Johannes H. Jensen a écrit :

> I also have the same problem on my 15" PowerBook5,6. Runnning a
> 2.6.12-rc4 kernel with CONFIG_I2C_KEYWEST=y. Still, the keyboard
> illumination tabs in powerprefs are disabled and the backlight is not
> working with a configured pbbuttonsd.
> 

What about CONFIG_I2C_CHARDEV ?

> I would love if you got this working!

If works fine for me (on the same machine as yours) with the
attached .config

Stelian. 
-- 
Stelian Pop <[EMAIL PROTECTED]>
CONFIG_MMU=y
CONFIG_GENERIC_HARDIRQS=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_HAVE_DEC_LOCK=y
CONFIG_PPC=y
CONFIG_PPC32=y
CONFIG_GENERIC_NVRAM=y
CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
CONFIG_EXPERIMENTAL=y
CONFIG_CLEAN_COMPILE=y
CONFIG_BROKEN_ON_SMP=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_LOCALVERSION=""
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_SYSCTL=y
CONFIG_HOTPLUG=y
CONFIG_KOBJECT_UEVENT=y
CONFIG_KALLSYMS=y
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
CONFIG_EPOLL=y
CONFIG_SHMEM=y
CONFIG_CC_ALIGN_FUNCTIONS=0
CONFIG_CC_ALIGN_LABELS=0
CONFIG_CC_ALIGN_LOOPS=0
CONFIG_CC_ALIGN_JUMPS=0
CONFIG_BASE_SMALL=0
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_OBSOLETE_MODPARM=y
CONFIG_MODVERSIONS=y
CONFIG_MODULE_SRCVERSION_ALL=y
CONFIG_KMOD=y
CONFIG_6xx=y
CONFIG_PPC_FPU=y
CONFIG_ALTIVEC=y
CONFIG_TAU=y
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_TABLE=y
CONFIG_CPU_FREQ_STAT=y
CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
CONFIG_CPU_FREQ_PMAC=y
CONFIG_PM=y
CONFIG_PPC_STD_MMU=y
CONFIG_PPC_MULTIPLATFORM=y
CONFIG_PPC_CHRP=y
CONFIG_PPC_PMAC=y
CONFIG_PPC_PREP=y
CONFIG_PPC_OF=y
CONFIG_PPCBUG_NVRAM=y
CONFIG_HIGHMEM=y
CONFIG_BINFMT_ELF=y
CONFIG_PROC_DEVICETREE=y
CONFIG_PREP_RESIDUAL=y
CONFIG_PROC_PREPRESIDUAL=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="console=ttyS0,9600 console=tty0 root=/dev/sda2"
CONFIG_SOFTWARE_SUSPEND=y
CONFIG_PM_STD_PARTITION=""
CONFIG_ISA_DMA_API=y
CONFIG_GENERIC_ISA_DMA=y
CONFIG_PCI=y
CONFIG_PCI_DOMAINS=y
CONFIG_PCI_LEGACY_PROC=y
CONFIG_PCI_NAMES=y
CONFIG_PCCARD=y
CONFIG_PCMCIA=y
CONFIG_CARDBUS=y
CONFIG_YENTA=y
CONFIG_PCCARD_NONSTATIC=y
CONFIG_HIGHMEM_START=0xfe00
CONFIG_LOWMEM_SIZE=0x3000
CONFIG_KERNEL_START=0xc000
CONFIG_TASK_SIZE=0x8000
CONFIG_BOOT_LOAD=0x0080
CONFIG_STANDALONE=y
CONFIG_PREVENT_FIRMWARE_BUILD=y
CONFIG_FW_LOADER=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=8192
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_CDROM_PKTCDVD=m
CONFIG_CDROM_PKTCDVD_BUFFERS=8
CONFIG_IOSCHED_NOOP=y
CONFIG_IOSCHED_AS=y
CONFIG_IDE=y
CONFIG_BLK_DEV_IDE=y
CONFIG_BLK_DEV_IDEDISK=y
CONFIG_BLK_DEV_IDECD=y
CONFIG_BLK_DEV_IDEPCI=y
CONFIG_IDEPCI_SHARE_IRQ=y
CONFIG_BLK_DEV_GENERIC=y
CONFIG_BLK_DEV_IDEDMA_PCI=y
CONFIG_IDEDMA_PCI_AUTO=y
CONFIG_BLK_DEV_IDE_PMAC=y
CONFIG_BLK_DEV_IDE_PMAC_ATA100FIRST=y
CONFIG_BLK_DEV_IDEDMA_PMAC=y
CONFIG_BLK_DEV_IDEDMA=y
CONFIG_IDEDMA_AUTO=y
CONFIG_SCSI=y
CONFIG_SCSI_PROC_FS=y
CONFIG_BLK_DEV_SD=y
CONFIG_CHR_DEV_SG=y
CONFIG_SCSI_MULTI_LUN=y
CONFIG_SCSI_CONSTANTS=y
CONFIG_SCSI_QLA2XXX=y
CONFIG_IEEE1394=y
CONFIG_IEEE1394_OUI_DB=y
CONFIG_IEEE1394_EXTRA_CONFIG_ROMS=y
CONFIG_IEEE1394_CONFIG_ROM_IP1394=y
CONFIG_IEEE1394_OHCI1394=y
CONFIG_IEEE1394_VIDEO1394=m
CONFIG_IEEE1394_SBP2=y
CONFIG_IEEE1394_SBP2_PHYS_DMA=y
CONFIG_IEEE1394_DV1394=m
CONFIG_IEEE1394_RAWIO=m
CONFIG_IEEE1394_CMP=m
CONFIG_IEEE1394_AMDTP=m
CONFIG_ADB=y
CONFIG_ADB_PMU=y
CONFIG_PMAC_APM_EMU=y
CONFIG_PMAC_BACKLIGHT=y
CONFIG_INPUT_ADBHID=y
CONFIG_MAC_EMUMOUSEBTN=y
CONFIG_THERM_ADT746X=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_IP_MULTICAST=y
CONFIG_NETFILTER=y
CONFIG_IP_NF_CONNTRACK=y
CONFIG_IP_NF_FTP=y
CONFIG_IP_NF_IRC=y
CONFIG_IP_NF_IPTABLES=y
CONFIG_IP_NF_MATCH_LIMIT=y
CONFIG_IP_NF_MATCH_IPRANGE=y
CONFIG_IP_NF_MATCH_MAC=y
CONFIG_IP_NF_MATCH_PKTTYPE=y
CONFIG_IP_NF_MATCH_MARK=y
CONFIG_IP_NF_MATCH_MULTIPORT=y
CONFIG_IP_NF_MATCH_TOS=y
CONFIG_IP_NF_MATCH_RECENT=y
CONFIG_IP_NF_MATCH_ECN=y
CONFIG_IP_NF_MATCH_DSCP=y
CONFIG_IP_NF_MATCH_AH_ESP=y
CONFIG_IP_NF_MATCH_LENGTH=y
CONFIG_IP_NF_MATCH_TTL=y
CONFIG_IP_NF_MATCH_TCPMSS=y
CONFIG_IP_NF_MATCH_HELPER=y
CONFIG_IP_NF_MATCH_STATE=y
CONFIG_IP_NF_MATCH_OWNER=y
CONFIG_IP_NF_MATCH_ADDRTYPE=y
CONFIG_IP_NF_MATCH_REALM=y
CONFIG_IP_NF_MATCH_SCTP=y
CONFIG_IP_NF_MATCH_COMMENT=y
CONFIG_IP_NF_MATCH_HASHLIMIT=y
CONFIG_IP_NF_FILTER=y
CONFIG_IP_NF_TARGET_REJECT=y
CONFIG_IP_NF_TARGET_LOG=y
CONFIG_IP_NF_MANGLE=y
CONFIG_IP_NF_ARPTABLES=y
CONFIG_IP_NF_ARPFILTER=y
CONFIG_NET_CLS_ROUTE=y
CONFIG_NETPOLL=y
CONFIG_NETPOLL_RX=y
CONFIG_NETPOLL_TRAP=y
CONFIG_NET_POLL_CONTROLLER=y
CONFIG_BT=y
CONFIG_BT_L2CAP=y
CONFIG_BT_RFCOMM=y
CONFIG_BT_RFCOMM_TTY=y
CONFIG_BT_HIDP=m
CONFIG_BT_HCIUSB=y
CONFIG_NETDEVICES=y
CONFIG_NET_ETHERNET=y
CONFIG_MII=y

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

2005-06-02 Thread Stelian Pop
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.0 +0200
+++ linux-2.6-trunk.git/arch/ppc/platforms/pmac_pm.c2005-06-02
17:27:58.0 +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.c2005-06-02
10:23:17.0 +0200
+++ linux-2.6-trunk.git/kernel/power/main.c 2005-06-02
17:17:04.0 +0200
@@ -34,6 +34,7 @@
 {
down(&pm_sem);
pm_ops = ops;
+   pm_disk_mode = pm_ops->pm_disk_mode;
up(&pm_sem);
 }
 

-- 
Stelian Pop <[EMAIL PROTECTED]>



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

2005-06-03 Thread Stelian Pop
Le vendredi 03 juin 2005 à 08:17 +1000, Benjamin Herrenschmidt a écrit :

> On Thu, 2005-06-02 at 17:52 +0200, Stelian Pop wrote:
> 
> > 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).
> 
> Ah, good catch. That's more crap in the generic code where
> suspend-to-disk doesn't go through the "normal" process but instead
> bypasses everything and does it's own callback mecanism. Best is to fix
> the generic code here, broadcast_wake shouldn't be called while userland
> is still frozen.

Ok, I saw on linux-pm that you're working on it.

While you're rewriting the code, you may also be interested in fixing
this oops (it happens when trying to suspend to disk and
freeze_processes() fails. Then the code tries to resume the soundcard
which wasn't yet suspended, just notified (only PBOOK_SLEEP_REQUEST was
send and not PBOOK_SLEEP_NOW):

Stopping tasks:
==
 stopping tasks failed (1 tasks remaining)
Restarting tasks...<6> Strange, pbbuttonsd not stopped
 done
adb: starting probe task...
adb: finished probe task...
Badness in enable_irq at kernel/irq/manage.c:108
Call trace:
 [c0007af0] dump_stack+0x18/0x28
 [c0005914] check_bug_trap+0x84/0xac
 [c0005a9c] ProgramCheckException+0x160/0x1a0
 [c0004d7c] ret_from_except_full+0x0/0x4c
 [c003d024] enable_irq+0xa0/0xa8
 [c021f598] tumbler_resume+0xf0/0x184
 [c021c040] snd_pmac_resume+0xd0/0xd4
 [c021c090] snd_pmac_sleep_notify+0x4c/0x5c
 [c040bc4c] broadcast_wake+0x3c/0x60
 [c003c788] unprepare_processes+0x5c/0x60
 [c003c850] pm_suspend_disk+0x34/0xc8
 [c00398dc] enter_state+0xb0/0xb8
 [c0039a2c] state_store+0xa0/0xbc
 [c009e254] subsys_attr_store+0x44/0x4c
 [c009e62c] flush_write_buffer+0x3c/0x4c
Badness in enable_irq at kernel/irq/manage.c:108
Call trace:
 [c0007af0] dump_stack+0x18/0x28
 [c0005914] check_bug_trap+0x84/0xac
 [c0005a9c] ProgramCheckException+0x160/0x1a0
 [c0004d7c] ret_from_except_full+0x0/0x4c
 [c003d024] enable_irq+0xa0/0xa8
 [c021bfe8] snd_pmac_resume+0x78/0xd4
 [c021c090] snd_pmac_sleep_notify+0x4c/0x5c
 [c040bc4c] broadcast_wake+0x3c/0x60
 [c003c788] unprepare_processes+0x5c/0x60
 [c003c850] pm_suspend_disk+0x34/0xc8
 [c00398dc] enter_state+0xb0/0xb8
 [c0039a2c] state_store+0xa0/0xbc
 [c009e254] subsys_attr_store+0x44/0x4c
 [c009e62c] flush_write_buffer+0x3c/0x4c
 [c009e6ac] sysfs_write_file+0x70/0xe0
Badness in enable_irq at kernel/irq/manage.c:108
Call trace:
 [c0007af0] dump_stack+0x18/0x28
 [c0005914] check_bug_trap+0x84/0xac
 [c0005a9c] ProgramCheckException+0x160/0x1a0
 [c0004d7c] ret_from_except_full+0x0/0x4c
 [c003d024] enable_irq+0xa0/0xa8
 [c021bff8] snd_pmac_resume+0x88/0xd4
 [c021c090] snd_pmac_sleep_notify+0x4c/0x5c
 [c040bc4c] broadcast_wake+0x3c/0x60
 [c003c788] unprepare_processes+0x5c/0x60
 [c003c850] pm_suspend_disk+0x34/0xc8
 [c00398dc] enter_state+0xb0/0xb8
 [c0039a2c] state_store+0xa0/0xbc
 [c009e254] subsys_attr_store+0x44/0x4c
     [c009e62c] flush_write_buffer+0x3c/0x4c
 [c009e6ac] sysfs_write_file+0x70/0xe0


-- 
Stelian Pop <[EMAIL PROTECTED]>



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

2005-06-03 Thread Stelian Pop

> > 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...
> 
> Yes.
> 
> > The attached patch also fixes the kernel/power core to use PLATFORM
> > instead of SHUTDOWN as the sleep mode... 
> 
> Ok, good, I'll have a look, thanks.

I also have issues with the integrated USB bluetooth controller.

When suspending to ram all works ok.

When resuming from suspend to disk, this USB device doesn't answer
anymore. It doesn't matter if I remove the modules (hci_usb) before
sleeping and reload them after, it just doesn't work anymore.

The only log I have is:
hci_usb_intr_rx_submit: hci0 intr rx submit failed urb de5791f4 err -90

I don't really understand how suspend/resume is supposed to work for USB
devices.

When resuming, I see disconnect/reconnect messages from ehci_hcd
corresponding to my external usb mouse:
ehci_hcd 0001:10:1b.2: park 0
ehci_hcd 0001:10:1b.2: USB 2.0 restarted, EHCI 1.00, driver 10 Dec 2004
usb 4-1: USB disconnect, address 3
usb 4-1: new low speed USB device using ohci_hcd and address 4
input: USB HID v1.10 Mouse [Logitech USB Mouse] on usb-0001:10:1b.1-1

But no other USB messages. However, this Powerbook has a USB keyboard,
which works ok after the resume. Even stranger, the USB keyboard and the
bluetooth controller are on the same USB bus:

Bus 004 Device 005: ID 046d:c00c Logitech, Inc. Optical Wheel Mouse
Bus 004 Device 001: ID :
Bus 003 Device 001: ID :
Bus 002 Device 007: ID 05ac:8205 Apple Computer, Inc.
   ^ this one is the bluetooth controller
Bus 002 Device 006: ID 05ac:020f Apple Computer, Inc.
   ^ this is the keyboard
Bus 002 Device 001: ID :
Bus 001 Device 001: ID :

I have no idea if this is Powerbook specific, so I start by posting this
here, but linux-usb may be more appropriate...

Stelian.
-- 
Stelian Pop <[EMAIL PROTECTED]>


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]