/etc/power/pwrctl-local for an iBook 2.2 (cpufreq adjustement)

2003-04-25 Thread David MENTRE
Hello,

For those that would find it useful, here is the /etc/power/pwrctl-local
script (don't forget to make it executable, chmod 755) I'm using on my
debian iBook 2.2:

 - use powersave mode (reduced cpu frequency) on battery, performance
   mode on ac

 - set fblevel off and do filesystem sync when going into sleep

For more info on cpufreq adjustement, look at Documentation/cpufreq in
kernel source tree.

I hope it will help others,
Best regards,
d.

#!/bin/bash
# -
# $Id: pwrctl-local,v 1.1.1.1 2001/12/07 11:31:48 sleemburg Exp $
#
# This script is invoked by pwrctl to configure the system for a
# given power level. The desired level is indicated by the first
# argument, which can have the following values:
#
# minimum = minimum power
# medium  = medium power 
# maximum = full power  
# sleep   = prepare for sleep
# wakeup  = system woke up after a sleep
# warning = low battery condition detected, issue a warning to users
#
# the second argument gives the current power source, and can take the
# following values:
#
# ac
# battery
#
#
# This script can be invoked by pwrctl when it is named /etc/power/pwrctl-local 
# and is executable. Pwrctl is called by pmud on a power event. If this 
# script returns the value 1, then pwrctl will skip it's main body
#
# Example usage: use ifdown -a on sleep (and ifup -a on wakeup) to
# automagically renew DHCP leases. Similar use of iwconfig down/up might be
# required for Wavelan users with older versions of the kernel.
#
# -
# $Log: pwrctl-local,v $
# Revision 1.1.1.1  2001/12/07 11:31:48  sleemburg
# Initial CVS import of the unreleased pmud-0.8 to apmud (new project name
# because of a name clash at sourceforge.net).
#
# Revision 1.2  2000/03/25 21:26:37  stephan
# pmud-0.5 changes
#
# Revision 1.1  2000/03/09 13:02:18  stephan
# Initial revision
#
# -
logger=/usr/bin/logger

# -
# main
# -
case $1 in
minimum)
$logger -p daemon.info -t pwrctl-local minimum power $2
case $2 in
ac)
echo -n 0%50%100%performance  /proc/cpufreq
;;
*)
echo -n 0%50%100%powersave  /proc/cpufreq
;;
esac
;;
medium)
$logger -p daemon.info -t pwrctl-local medium power $2
case $2 in
ac)
echo -n 0%50%100%performance  /proc/cpufreq
;;
*)
echo -n 0%50%100%powersave  /proc/cpufreq
;;
esac
;;
maximum)
$logger -p daemon.info -t pwrctl-local maximum power $2
case $2 in
ac)
echo -n 0%50%100%performance  /proc/cpufreq
;;
*)
echo -n 0%50%100%powersave  /proc/cpufreq
;;
esac
$logger -p daemon.info -t pwrctl-local skipping pwrctl-main
exit 1
;;
warning)
/usr/bin/wall Low battery, system going down any minute now
;;
lid-closed)
$logger -p daemon.info -t pwrctl-local lid-closed $2
;;
lid-opened)
$logger -p daemon.info -t pwrctl-local lid-opened $2
;;
sleep)
$logger -p daemon.info -t pwrctl-local sleep $2
sync;sync;sync
fblevel off
;;
wakeup)
$logger -p daemon.info -t pwrctl-local sleep $2
case $2 in
ac)
echo -n 0%50%100%performance  /proc/cpufreq
;;
*)
echo -n 0%50%100%powersave  /proc/cpufreq
;;
esac
fblevel on
;;
*)
$logger -p daemon.error -t pwrctl-local invalid arg $1 $2
exit 2
;;
esac

exit 0

-- 
 [EMAIL PROTECTED]



Re: New sleep code for ATI M6, M7 and M9

2003-03-17 Thread David MENTRE
Michel Dänzer [EMAIL PROTECTED] writes:

  But I did not have any /dev/apm_bios, so I made a nod with
  
  mknod /dev/apm_bios c 10 134
  chmod 770 /dev/apm_bios
 
 Or better:
 
 cd /dev; MAKEDEV apm

Isn't it a bug in the xfree related packages that /dev/apm_bios is not
created (at least on PowerPC arch)? 

Best regards,
d.
-- 
 [EMAIL PROTECTED]



Re: New sleep code for ATI M6, M7 and M9

2003-03-15 Thread David MENTRE
Hello ben,

Benjamin Herrenschmidt [EMAIL PROTECTED] writes:

 I posted a patch at http://penguinppc.org/~benh/new_sleep.diff
 
 Sleep should now work properly on all these ATI Mobility chips,
 and power consumption might even be slightly improved in
 normal use.

I've just tested your patch on a ben8 kernel and it does not work. :(
The machine goes to sleep correctly but after reboot, the screen is not
restored (two vertical red lines over a black screen) and the machine
seems frozen. However, there is a progress as during a short moment the
screen seems to make a restoration tentative.

 Please let me know how this works for you (mention your machine
 model and video chip type, that is the output of /proc/cpuinfo
 and lspci) along with your reports so I know what's up.

Here are the info:

/proc/cpuinfo:

cpu : 750FX
temperature : 59 C (uncalibrated)
clock   : 800MHz
revision: 2.2 (pvr 7000 0202)
bogomips: 1589.24
machine : PowerBook4,3
motherboard : PowerBook4,3 MacRISC2 MacRISC Power Macintosh
detected as : 257 (iBook 2 rev. 2)
pmac flags  : 000b
L2 cache: 512K unified
memory  : 384MB
pmac-generation : NewWorld

lspci -v (in fact, the graphic card is a M6 lW):
00:0b.0 Host bridge: Apple Computer Inc.: Unknown device 0027
Flags: bus master, 66Mhz, medium devsel, latency 16
Capabilities: available only to root

00:10.0 VGA compatible controller: ATI Technologies Inc Radeon Mobility M6 LW 
(prog-if 00 [VGA])
Subsystem: ATI Technologies Inc Radeon Mobility M6 LW
Flags: bus master, stepping, 66Mhz, medium devsel, latency 255, IRQ 48
Memory at 9800 (32-bit, prefetchable) [size=128M]
I/O ports at 802400 [size=256]
Memory at 9000 (32-bit, non-prefetchable) [size=64K]
Expansion ROM at 9002 [disabled] [size=128K]
Capabilities: available only to root

10:0b.0 Host bridge: Apple Computer Inc.: Unknown device 0028
Flags: bus master, 66Mhz, medium devsel, latency 16

10:17.0 Class ff00: Apple Computer Inc.: Unknown device 0025
Flags: bus master, medium devsel, latency 16
Memory at 8000 (32-bit, non-prefetchable) [size=512K]

10:18.0 USB Controller: Apple Computer Inc.: Unknown device 0026 (prog-if 10 
[OHCI])
Flags: bus master, medium devsel, latency 16, IRQ 27
Memory at 80081000 (32-bit, non-prefetchable) [size=4K]
Capabilities: available only to root

10:19.0 USB Controller: Apple Computer Inc.: Unknown device 0026 (prog-if 10 
[OHCI])
Flags: bus master, medium devsel, latency 16, IRQ 28
Memory at 8008 (32-bit, non-prefetchable) [size=4K]
Capabilities: available only to root

20:0b.0 Host bridge: Apple Computer Inc.: Unknown device 0029
Flags: bus master, 66Mhz, medium devsel, latency 16

20:0e.0 Class : Apple Computer Inc.: Unknown device 0030 (rev ff) (prog-if 
ff)
!!! Unknown header type 7f

20:0f.0 Class : Apple Computer Inc.: Unknown device 0024 (rev ff) (prog-if 
ff)
!!! Unknown header type 7f

I include my .config as attachement.

Best regards,
david
-- 
 [EMAIL PROTECTED]
#
# Automatically generated make config: don't edit
#
# CONFIG_UID16 is not set
# CONFIG_RWSEM_GENERIC_SPINLOCK is not set
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_HAVE_DEC_LOCK=y

#
# Code maturity level options
#
CONFIG_EXPERIMENTAL=y

#
# Loadable module support
#
CONFIG_MODULES=y
CONFIG_MODVERSIONS=y
CONFIG_KMOD=y

#
# Platform support
#
CONFIG_PPC=y
CONFIG_PPC32=y
CONFIG_6xx=y
# CONFIG_4xx is not set
# CONFIG_POWER3 is not set
# CONFIG_POWER4 is not set
# CONFIG_8xx is not set
# CONFIG_8260 is not set
CONFIG_PPC_STD_MMU=y
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_24_API=y
CONFIG_CPU_FREQ_PMAC=y
CONFIG_ALL_PPC=y
# CONFIG_APUS is not set
# CONFIG_SPRUCE is not set
# CONFIG_PAL4 is not set
# CONFIG_GEMINI is not set
# CONFIG_SMP is not set
CONFIG_ALTIVEC=y
CONFIG_TAU=y
# CONFIG_TAU_INT is not set
CONFIG_TAU_AVERAGE=y
CONFIG_PPC_ISATIMER=y

#
# General setup
#
# CONFIG_HIGHMEM is not set
# CONFIG_ISA is not set
# CONFIG_EISA is not set
# CONFIG_SBUS is not set
# CONFIG_MCA is not set
CONFIG_PCI=y
CONFIG_NET=y
CONFIG_SYSCTL=y
CONFIG_SYSVIPC=y
# CONFIG_BSD_PROCESS_ACCT is not set
CONFIG_KCORE_ELF=y
CONFIG_BINFMT_ELF=y
CONFIG_KERNEL_ELF=y
CONFIG_BINFMT_MISC=m
CONFIG_PCI_NAMES=y
CONFIG_HOTPLUG=y

#
# PCMCIA/CardBus support
#
# CONFIG_PCMCIA is not set

#
# Parallel port support
#
# CONFIG_PARPORT is not set
CONFIG_PPC_RTC=y
CONFIG_PPC601_SYNC_FIX=y
CONFIG_PROC_DEVICETREE=y
# CONFIG_PPC_RTAS is not set
CONFIG_BOOTX_TEXT=y
# CONFIG_PREP_RESIDUAL is not set
# CONFIG_PROC_PREPRESIDUAL is not set
# CONFIG_CMDLINE_BOOL is not set

#
# Memory Technology Devices (MTD)
#
# CONFIG_MTD is not set

#
# Plug and Play configuration
#
# CONFIG_PNP is not set
# CONFIG_ISAPNP is not set

#
# Block devices
#
# CONFIG_BLK_DEV_FD is not set
# CONFIG_BLK_DEV_XD is not set
# CONFIG_PARIDE is not set

Re: New sleep code for ATI M6, M7 and M9

2003-03-15 Thread David MENTRE
David MENTRE [EMAIL PROTECTED] writes:

  I posted a patch at http://penguinppc.org/~benh/new_sleep.diff
  
  Sleep should now work properly on all these ATI Mobility chips,
  and power consumption might even be slightly improved in
  normal use.
 
 I've just tested your patch on a ben8 kernel and it does not work. :(
 The machine goes to sleep correctly but after reboot, the screen is not
 restored (two vertical red lines over a black screen) and the machine
 seems frozen. However, there is a progress as during a short moment the
 screen seems to make a restoration tentative.

I works!! In fact, the /dev/apm_bios character device was missing.

Doing a 'mknod /dev/apm_bios c 10 134;chmod 770 /dev/apm_bios' as root
make it works.

Great work benjamin!

Many, many, many thanks!
Best regards,
d.
-- 
 [EMAIL PROTECTED]



Re: ibooks battery life

2003-03-11 Thread David MENTRE
Clemens Mangler [EMAIL PROTECTED] writes:

 i tried to tweak my powersetting to make ibooks battery last
 longer. how can i check weather the disk spins down or not?

See this article : http://bulmalug.net/body.phtml?nIdNoticia=1511

Best regards,
d.
-- 
 [EMAIL PROTECTED]



Management of backlight

2003-03-08 Thread David MENTRE
Hello,

On an iBook under MacOS X, I've noticed that MacOS X reduces backlight
when the user is inactive and restores backlight as soon as a user press
a key. Is it possible to have similar behavior under Debian 3.0 ?

Best regards,
d.
-- 
 [EMAIL PROTECTED]



How to desactivate the click on the touchpad?

2003-03-05 Thread David MENTRE
Hello,

On my iBook running Debian under Xfree, is there a way to desactivate
clicks made by pressing the touchpad (in other words, I want to click
only using the button)?

Best regards,
david
-- 
 [EMAIL PROTECTED]



Re: TiBook M7 sleep works!

2003-03-03 Thread David MENTRE
Clemens Mangler [EMAIL PROTECTED] writes:

 i have an iBook 2.2 (nov 02) with a M7 and a  DRI xserver and resume
 works!
 when opening the lid the screen looks messed up for a second, but then
 everything is ok!

Yes, for a friend of mine, it works like that on its 14 iBook (with M7
LW).

On my 12 iBook (also with M7 LW), the iBook is dead (black screen-
reboot) after sleep.

Question for the astute reader: what are the differences between a 12
and a 14 iBook? :)

Best regards,
d.
-- 
 [EMAIL PROTECTED]



Sleep mode not working on an iBook 2.2

2003-02-27 Thread David MENTRE
Hello,

I've installed a debian woody 3.0 on my new iBook (bought February
2003). Everything is working correctly (X, 3D acceleration, network,
sound) except the sleep mode.

When I close the screen, the laptop goes correclty into sleep mode (the
white led is flashing regurlarly). However, when I open the screen, the
iBook does not wake up : the screen is black and after a reboot the time
is reseted to 1st of Jan., 1904.

From the archive of this list, it appears that the correct working of
Linux of this iBook depends heavily on the right combination of
kernel/Xserver/radeon.o.

I've seen some patches floating around about radeonfb.c. Should I apply
them?

I'm using :
 - kernel 2.4.20-ben6 (from rsync.penguinppc.org)
 - Xfree 4.1.0
 - dri-trunk 2002.12.05-04 for radeon.o

I join to this email the logs of dmesg, /proc/cpuinfo, XF86Config-4,
XFree86.log, kernel .config.

Many thanks in advance for any help,
Best regards,
d.
-- 
 [EMAIL PROTECTED]

Memory BAT mapping: BAT2=256Mb, BAT3=128Mb, residual: 0Mb
Total memory = 384MB; using 1024kB for hash table (at c030)
Linux version 2.4.20-ben6 ([EMAIL PROTECTED]) (gcc version 2.95.4 20011002 
(Debian prerelease)) #1 Tue Feb 25 18:56:34 CET 2003
Found Uninorth memory controller  host bridge, revision: 192
Mapped at 0xfdf3c000
Found a Pangea mac-io controller, rev: 0, mapped at 0xfdebc000
Processor NAP mode on idle enabled.
PowerMac motherboard: iBook 2 rev. 2
CPU HID1 : 0x8044
Found UniNorth PCI host bridge at 0xf000. Firmware bus number: 0-0
hose pci, pci_mem_offset: , start0: f100
  io_base_virt: fd6b9000, io_base_phys: f000, isa_mem_base: 
Found UniNorth PCI host bridge at 0xf200. Firmware bus number: 0-0
hose pci, pci_mem_offset: , start0: f300
  io_base_virt: fceb7000, io_base_phys: f200, isa_mem_base: 
Found UniNorth PCI host bridge at 0xf400. Firmware bus number: 0-0
hose pci, pci_mem_offset: , start0: f500
  io_base_virt: fc6b5000, io_base_phys: f400, isa_mem_base: 
PMU driver 2 initialized for Core99, firmware: 0c
On node 0 totalpages: 98304
zone(0): 98304 pages.
zone(1): 0 pages.
zone(2): 0 pages.
Kernel command line: root=/dev/hda11 ro 
PowerMac using OpenPIC irq controller
OpenPIC Version 1.2 (4 CPUs and 64 IRQ sources) at fc66e000
OpenPIC timer frequency is 4.16 MHz
GMT Delta read from XPRAM: 0 minutes, DST: off
time_init: decrementer frequency = 24.835277 MHz
Console: colour dummy device 80x25
Calibrating delay loop... 1589.24 BogoMIPS
Memory: 385088k available (1436k kernel code, 860k data, 124k init, 0k highmem)
AGP special page: 0xd7fff000
Dentry cache hash table entries: 65536 (order: 7, 524288 bytes)
Inode cache hash table entries: 32768 (order: 6, 262144 bytes)
Mount-cache hash table entries: 8192 (order: 4, 65536 bytes)
Buffer-cache hash table entries: 32768 (order: 5, 131072 bytes)
Page-cache hash table entries: 131072 (order: 7, 524288 bytes)
POSIX conformance testing by UNIFIX
PCI: Probing PCI hardware
Scanning bus 00
Found 00:58 [106b/0027] 000600 00
Found 00:80 [1002/4c57] 000300 00
Fixup res 1 (101) of dev 00:10.0: 400 - 802400
Fixups for bus 00
Bus scan for 00 returning with max=00
Scanning bus 10
Found 10:58 [106b/0028] 000600 00
Found 10:b8 [106b/0025] 00ff00 00
Found 10:c0 [106b/0026] 000c03 00
Found 10:c8 [106b/0026] 000c03 00
Fixups for bus 10
Bus scan for 10 returning with max=10
Scanning bus 20
Found 20:58 [106b/0029] 000600 00
Found 20:70 [106b/0030] 000c00 00
Found 20:78 [106b/0024] 000200 00
Fixups for bus 20
Bus scan for 20 returning with max=20
PCI-OF bus map:
0 - 0
16 - 0
32 - 0
PCI:00:10.0: Resource 0: 9800-9fff (f=1208), vd: 1002, dev: 4c57
PCI:00:10.0: Resource 2: 9000-9000 (f=200), vd: 1002, dev: 4c57
PCI:10:17.0: Resource 0: 8000-8007 (f=200), vd: 106b, dev: 0025
PCI:20:0f.0: Resource 0: f520-f53f (f=200), vd: 106b, dev: 0024
PCI:00:10.0: Resource 1: 00802400-008024ff (f=101), vd: 1002, dev: 4c57
PCI:10:18.0: Resource 0: 80081000-80081fff (f=200), vd: 106b, dev: 0026
PCI:10:19.0: Resource 0: 8008-80080fff (f=200), vd: 106b, dev: 0026
PCI:20:0e.0: Resource 0: f500-f5000fff (f=200), vd: 106b, dev: 0030
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Initializing RT netlink socket
Thermal assist unit using timers, shrink_timer: 200 jiffies
Starting kswapd
Journalled Block Device driver loaded
Installing knfsd (copyright (C) 1996 [EMAIL PROTECTED]).
PCI: Enabling device 00:10.0 (0086 - 0087)
radeonfb: ref_clk=2700, ref_div=12, xclk=36000 from OF
radeonfb: detected DFP panel size from EDID: 1024x768
Console: switching to colour frame buffer device 128x48
Registered ati backlight controller, level: 15/15
radeonfb: ATI Radeon M7 LW DDR SGRAM 32 MB
radeonfb: DVI port LCD monitor connected
radeonfb: CRT port no monitor connected
input0: Macintosh mouse button emulation
pty: 256 Unix98 ptys configured
Uniform Multi-Platform E-IDE driver Revision: 6.31
ide: