# VERY Happy thinkpad user! (2.6.0-test6)

## tweakt

Just writing to say I've just acheived a state of Zen with with linux on my Thinkpad T23  :Very Happy: 

* Full ACPI working (battery status, thermal info, etc)

* Suspend to disk (CONFIG_PM_DISK)

* Speedstep. (CONFIG_X86_SPEEDSTEP_SMI)

The new suspend code in -test6 works great, takes ~30s to suspend from within X, and about 5s to restore. (depending on how much memory is in use).

All it takes is a:

  echo -n disk > /sys/power/state

So far, suspend to ram doesn't seem to wake up properly.

If folks are interested, I can post the .config and patchset I'm using. The patches are specific to newer thinkpads and fix the ACPI stuff.

Oh, also... I started working on some scripts for acpid to switch to low speed when the AC is unplugged, etc... but maybe something like this has already been written?

----------

## A-star

Can you post what you did?

trying that for ages too.

Maybe you can make a how-to?

I think a lot of thinkpad users will be greatfull

----------

## UberLord

 *tweakt wrote:*   

> 
> 
> Oh, also... I started working on some scripts for acpid to switch to low speed when the AC is unplugged, etc... but maybe something like this has already been written?

 

Now that would be very very useful  :Smile: 

Any idea if it would be possible to vary the CPU low speed without patching the kernel? I only ask as my laptops "powersave" setting via the kernel is really waaaaay too slow for any kinda use.

----------

## tweakt

 *Quote:*   

> Can you post what you did?
> 
> trying that for ages too.
> 
> Maybe you can make a how-to?
> ...

 

I'll see what I can do. First off keep in mind this is all mostly experimental software, all the support for this stuff has come about in 2.6.0, and seems to finally be working.

With 2.6 and thinkpads, the first hurtle to get paste is ACPI. Step 1, make sure you have the latest bios from IBM. Even 2.4 ACPI wouldn't work right before I upgraded the BIOS.

Next, emerge development-source, (currently 2.6.0-test6).

I can't really post my .config here, I think it would be too large, but the key options to enable are (for my T23 Mobile PIII):

(I use 'make gconfig')

Processor type and features:

MPENTIUMIII

PREEMPT

X86_UP_APIC

X86_UP_IOAPIC

X86_MCE

X86_MSR

X86_CPUID

MTRR

Power management:

PM

PM_DISK

PM_DISK_PARTITION='/dev/hda4' (set to your swap partition)

ACPI

ACPI_SLEEP

ACPI_AC

ACPI_BATTERY

ACPI_BUTTON

ACPI_FAN

ACPI_PROCESSOR

ACPI_THERMAL

CPU_FREQ

CPU_FREQ_GOV_PERFORMANCE

CPU_FREQ_GOV_POWERSAVE

CPU_FREQ_GOV_USERSPACE

CPU_FREQ_DEFAULT_GOV_USERSPACE

X86_SPEEDSTEP_SMI (_ICH also seems to work)

For my thinkpad and I'm sure other newerd T, A and X series (possibly more) have a problem with ACPI support in Linux correctly detecting the Embeddec Controller... the symptom here is a bunch of "AE_TIME" errors when booting (check 'dmesg').

Another patch fixes the battery status for 2.6, something changed since 2.4 worked ok, but this patch is needed to correctly access battery data under 2.6

You can get these two patches here:

http://erkki.tty0.org/thinkpad/thinkpad-acpi.html

Note the battery patch doesn't apply cleanly to 2.6.0-test6, but check the bottom of that page for a patch containing all those changes which works with -test3 (and also -test6 as I've tested).

Ok. I'll post more of this when I get more time.

----------

## alchemst

Hmm, I built with your basic config options, but after I suspend to disk, I crash on restart.  Even odder, it looks like its trying to suspend while its booting, but that may just be poor messages.  Any ideas?  This is a T30 running BIOS version: 2.03b (1IET64WW).  I did make a couple of substitutions for Pentium 4 instead of III and I'm using sppedstep-ich since I have a pentium-m based processor.

Here's what I'm seeing on boot:

Stopping tasks: ===================|

Freeing memory: ...................................|

drivers/usb/host/uhci-hcd.c: 1840: syspend_hc

|

hdc: start_power_step(step: 0)

hdc: completing PM request, suspend

hda: start_power_step(step, 0)

hda: start_power_step(step, 1)

hda: complete_power_step(step: 1, stat: 50, err: 0)

hda: completing PM request, suspend

uhci-hcd 0000:00:1d:2: suspend D4 --> D3

drivers/usb/host/uhci-hcd.c: 1840: suspnd_hc

uhci-hcd 0000:00:1d:1: suspend D4 --> D3

drivers/usb/host/uhci-hcd.c: 1820: suspnd_hc

uhci-hcd 0000:00:1d:0: suspend D4 --> D3

Debug: sleeping function called from invalid context at include/linux/rwsem.h:43

in_atomic():0, irqs_disabled():1own.

Call Trace: g saved image

 [<c011e16b>] do_page_fault+0x0/0x560

_

----------

## Skar

Sry, I don't find the T23 on the IBM Site.

is it a 14,1" Display?

And what a battery do u have?

I'm interested in your battery rundown time.

I've the T40 with an 47kWh battery and the rundown time is at 2:45 while watching divx and

CPU Speed at 600MHz. I thought it would stay at least one hour longer.

Is there any possibility to get the CPU Speed less than 600?

In WinXP the minimum is 275MHz, but I can't change the cpuinfo_min_freq setting under Linux.

----------

## tweakt

 *Quote:*   

> Sry, I don't find the T23 on the IBM Site.
> 
> is it a 14,1" Display?
> 
> And what a battery do u have?
> ...

 

I have an IBM T23 1.13Ghz Pentium-IIIm

```

localhost root # cat /proc/acpi/battery/BAT0/info

present:                 yes

design capacity:         38880 mWh

last full capacity:      28240 mWh

battery technology:      rechargeable

design voltage:          10800 mV

design capacity warning: 1944 mWh

design capacity low:     388 mWh

capacity granularity 1:  1 mWh

capacity granularity 2:  1 mWh

model number:            IBM-02K6627

serial number:            1901

battery type:            LION

OEM info:                SANYO

localhost root # cat /proc/acpi/battery/BAT0/state

present:                 yes

capacity state:          ok

charging state:          unknown

present rate:            0 mW

remaining capacity:      28180 mWh

present voltage:         12440 mV

(Unplug AC adaptor...)

mark@localhost mark $ cat /proc/acpi/battery/BAT0/state

present:                 yes

capacity state:          ok

charging state:          discharging

present rate:            15914 mW

remaining capacity:      26500 mWh

present voltage:         11930 mV

mark@localhost mark $ acpi -V

     Battery 1: discharging, 94%, 01:39:58 remaining

     Thermal 1: ok, 45.0 degrees C

  AC Adapter 1: off-line

```

As you can see it's getting time to replace the battery, I'm missing nearly 10,000mWh now. Without a processes running you won't notice a difference between cpu speeds. My system seems to draw about 16W most of the time. The HD spinning down makes a big difference too.  Check hdparm and edit /etc/conf.d/hdparm to adjust the power management stuff for it (spindown time, etc).

----------

## tweakt

 *Quote:*   

> Hmm, I built with your basic config options, but after I suspend to disk, I crash on restart. Even odder, it looks like its trying to suspend while its booting, but that may just be poor messages. Any ideas? This is a T30 running BIOS version: 2.03b (1IET64WW). I did make a couple of substitutions for Pentium 4 instead of III and I'm using sppedstep-ich since I have a pentium-m based processor.

 

Is that's a Pentium-m with centrino, you want to use X86_SPEEDSTEP_CENTRINO for the frequency scaling driver, if it's a Pentium-4, you want X86_P4_CLOCKMOD

Not sure if that has anything to do with your suspend hang. Obviously it's alpha quality code as it's marked EXPERIMENTAL. One thing you can try is unloading and hardware drivers that might not support powermanagement correctly. I know, for example my USB ports stop functioning after resume.

----------

## tweakt

 *Quote:*   

> Is there any possibility to get the CPU Speed less than 600?
> 
> In WinXP the minimum is 275MHz, but I can't change the cpuinfo_min_freq setting under Linux.

 

Wow, 275? That's awsome. Well, forgot to mention, make sure you use the CENTRINO option for CPU scaling driver, "X86_SPEEDSTEP_CENTRINO". I beleive that will give you more control over the speeds. 

Since I don't have that I can't tell you if it works like you expect, so I would search some kernel lists, etc for results with Centrino systems. I have heard however that the results so far have been quite good.

----------

## sepp

what happens if you guys close the lid of your laptop? If I do that (R40 centrino) my laptop goes to hibernate mode or something like that (even if I have disabled acpi in kernel) and I can't wake the damn thing up. anyone knows how to turn this off? 

doesn't suspend to disk also need the resume=/dev/hda2 kernel line in grub.conf?

----------

## pilla

I've been using APM with my T23 and even suspend to memory works (well, sometimes I have some problems in the wake-up, that seem to be related to ALSA drivers). 

Could you get ltmodem to work with the new 2.6.0 series?

----------

## ultraslacker

 *sepp wrote:*   

> what happens if you guys close the lid of your laptop? If I do that (R40 centrino) my laptop goes to hibernate mode or something like that (even if I have disabled acpi in kernel) and I can't wake the damn thing up. anyone knows how to turn this off?

 

You should be able to turn that off through the bios.

----------

## sepp

 *ultraslacker wrote:*   

>  *sepp wrote:*   what happens if you guys close the lid of your laptop? If I do that (R40 centrino) my laptop goes to hibernate mode or something like that (even if I have disabled acpi in kernel) and I can't wake the damn thing up. anyone knows how to turn this off? 
> 
> You should be able to turn that off through the bios.

 

I just installed latest bios and test7 kernel and it went away by itself.

something else. what kind of keyboard layout are you guys using in xfree?

I am using Option      "XkbModel" "pc101" but I don' think this is the best option to go with.

how do you control speedstep features? are you using any special commands? are you guys using acpid?

----------

## flokno

sepp: emerge -s cpudyn

that's what i use although i used it before it was in portage.

so i can't tell you anything about the ebuild-quality except that the self compiled version works quite fine.

----------

## TGL

 *flokno wrote:*   

> i can't tell you anything about the ebuild-quality

 

Being the author, I can't neither  :Wink: 

But the two things to know are:

 - configuration is done in /etc/conf.d/cpudyn (thanks debian for this one)

 - /etc/init.d/cpudyn start to test it, and rc-update add cpudyn default to start it on boot

Seems to work fine for me so far...

----------

## flokno

i'll took a look at it and will be testing it in the next time.

----------

## aitor11

Is an stupid question, but if i do this:  echo -n disk > /sys/power/state 

how can i restore the computer, if i press the power button my T21 do the same as if i just turn on ut normaly.

Aitor

----------

## tam

 *TGL wrote:*   

> 
> 
>  - /etc/init.d/cpudyn start to test it, and rc-update add cpudyn default to start it on boot
> 
> Seems to work fine for me so far...

 

Yep, works fine with 2.6-test9 and T23

----------

## b0fh

I was using apm on my T23 for up to now. I compiled acpi support into my kernel, but now klaptopdaemon refuses to show my any battery status. How can I tell it to use acpi?

I am also trying cpudyn at the moment. It changes frequencies fine between 733 and 1133 mhz, but how can I tell it to switch it down even more? I don't have a /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies as described on the cpudyn page...

----------

## TGL

 *b0fh wrote:*   

> I am also trying cpudyn at the moment. It changes frequencies fine between 733 and 1133 mhz, but how can I tell it to switch it down even more? I don't have a /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies as described on the cpudyn page...

 

I don't know T23, but I guess it is a Pentium M, right? In that case, it is true that the "Speedstep" cpufreq driver only allows you to switch between two frequencies, defined by the BIOS (by default, something like 50% or 100% when booted on AC, and 10% or 50% when booted on DC I think). In this mode, you don't have access to any other user-defined frequency, and you have no scaling_available_frequencies file. I don't really know if it's a bug or a feature. 

On my T40, despite it is also a Pentium-M, I often use the "Pentium-4" driver instead of this "Speedstep" driver, because this one allows you to define your own min/max frequencies (just echo one of those listed in .../scaling_available_frequencies to .../scaling_max_freq or .../scaling_min_freq). And it works... 

Note that you can have both drivers compiled as module, and switch them on the fly.

----------

## flokno

i also experimented with cpudyn and speedfreq on my pentium m 1500.

with the pentium4 driver it goes down as low as 186mhz and up to 1500mhz compared to the other driver (600 and 1500). kernel 2.6.0-test used.

it changes the speed but doesn't change battery runtime much and the cpu cooler still is on from time to time even with the lowest speed possible. this doesn't happen with winxp!

now i don't know what to do to improve battery life and cooler usage (which really annoys me!)...

any hints?

thanks, flo

----------

## TGL

 *flokno wrote:*   

> it changes the speed but doesn't change battery runtime much and the cpu cooler still is on from time to time even with the lowest speed possible.

 

Doh! I was assuming power consumption was lower at 160MHz, but I've not really verified it with a clock in the hands. And it's true that the fan never really stop, so maybe this tip is in fact completly useless...

----------

## flokno

i haven't checked it with a clock either but i assume a running fan indicates a warm cpu which still uses too much power.

----------

## TGL

 *flokno wrote:*   

> i haven't checked it with a clock either but i assume a running fan indicates a warm cpu which still uses too much power.

 

Makes sense  :Smile: 

----------

## tam

 *b0fh wrote:*   

> 
> 
> I am also trying cpudyn at the moment. It changes frequencies fine between 733 and 1133 mhz, but how can I tell it to switch it down even more?

 

I don't think that's possible,

----------

## marshall_j

Any chance someone with a working 2.6 thinkpad post their .config to me?

marshall at pwnstar dot net if you could  :Smile: 

Damn ACPI just doesn't seem to want to work for me :/ In the meantime I think I'll flash the BIOS 'cause I'm getting some weird ACPI messages on boot...

edit:

error message i'm getting is:

```

ACPI: Subsystem revision 20021122

     ACPI-0370: *** Error: GPE0 block (GPE 0 to 15) overlaps the GPE1 block (GPE 0 to 15)

ACPI: Unable to start the ACPI Interpreter

```

----------

## marshall_j

Thought I'd bring this thread back from the dead....

My ACPI problem went away by itself when I moved from 2.6.0-test4 to 2.6.0-test9.

Here is a working .config for a IBM R40.

What it has:

ACPI

Networking

CD Burning (to a point, I've got SCSI emulation fine and DMA enabled on the drive but I still seem to be getting buffer underruns. Not sure why...)

What it hasn't:

A decent power management script.

Wireless LAN (Centrino)

PCMCIA / IR / Firewire (I don't have any devices which use these to test it with)

Anyway, any tips on getting the stuff that isn't working is welcome. I'll post back here when I get something else going....

My take on Windows being able to get the proc speed down to 275 mHz:

The Centrino seems to support two speeds (mine being a 1.5gig) 1.5 gig when plugged in to the mains and 600mHz when running on batteries.

However if you issue (x being 1-7 depending on how slow you want to run. You can cat the contents of the file to see the speed decrease.):

```

echo -n "x" > /proc/acpi/processor/CPU/throttling

```

You can throttle the processor. This doesn't slow it down any further in mHz but issues interrupts to make it run slower (thereby saving on cooling I guess). So to get 275mHz it would be running about 1/2 of 600Mhz. You can go down to 87% of the processor speed but then things start to get pretty laggy just running a WM.

----------

## flokno

does anybody know a govenour that is capable of setting these acpi states marshall_j mentioned?

----------

## captnjameskirk

```
ACCEPT_KEYWORDS="~x86" emerge cpudyn
```

and then man cpudynd. It will spin down your hard disc for you, too. /me likes.   :Very Happy: 

----------

## flokno

harddisk spindown: even when i use hdparm -Y /dev/hda the hdd is on again within 20 seconds due to reiserfs even when i use noatime in fstab. this is when using kernel 2.4, maybe its better with 2.6.

----------

## sepp

does anyone know what could stop this error from reoccuring?

```

hda: dma_timer_expiry: dma status == 0x21

hda: DMA timeout error

hda: dma timeout error: status=0xd0 { Busy }

 

hda: DMA disabled

ide0: reset: success
```

----------

## b0fh

sepp: Do you have support for the right chipset (Intel PII someting) in your kernel and dma-options active?

----------

## sepp

 *b0fh wrote:*   

> sepp: Do you have support for the right chipset (Intel PII someting) in your kernel and dma-options active?

 

I have configured "Intel PIIXn chipsets" in my kernel config.I also have "Generic PCI bus-master DMA support" enabled aswell as "Use PCI DMA by default when available"

this is what dmesg gives me from the kernel boot:

```

Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2

ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx

ICH4: IDE controller at PCI slot 0000:00:1f.1

PCI: Enabling device 0000:00:1f.1 (0005 -> 0007)

ICH4: chipset revision 1

ICH4: not 100% native mode: will probe irqs later

    ide0: BM-DMA at 0x1860-0x1867, BIOS settings: hda:DMA, hdb:pio

    ide1: BM-DMA at 0x1868-0x186f, BIOS settings: hdc:DMA, hdd:pio

hda: IC25N040ATMR04-0, ATA DISK drive

Using anticipatory io scheduler

ide0 at 0x1f0-0x1f7,0x3f6 on irq 14

hdc: HL-DT-STCD-RW/DVD DRIVE GCC-4240N, ATAPI CD/DVD-ROM drive

ide1 at 0x170-0x177,0x376 on irq 15

hda: max request size: 128KiB

hda: 78140160 sectors (40007 MB) w/1740KiB Cache, CHS=65535/16/63, UDMA(100)

 /dev/ide/host0/bus0/target0/lun0: p1 p2 p3 p4 < p5 p6 p7 >

hdc: ATAPI 24X DVD-ROM CD-R/RW drive, 2048kB Cache, UDMA(33)

Uniform CD-ROM driver Revision: 3.12
```

so do i have to maybe change something?

----------

## marshall_j

If you got a sexy hi res 15" screen with the 1400x1050 res then append vga=834 to the kernel line in your grub.conf to get the correct resolution.

Before that i was using 795 which cause half the lines to be all fuzzy

----------

## tuxlover

 *flokno wrote:*   

> i also experimented with cpudyn and speedfreq on my pentium m 1500.
> 
> with the pentium4 driver it goes down as low as 186mhz and up to 1500mhz compared to the other driver (600 and 1500). kernel 2.6.0-test used.

 

I personally think that the lowest pentium m freq is 600 MHz. I kind of "prove" this here, read on if you like. Read the linked post and the next 3.

Please tell me if you find anything out that proves the contrary (which would, of course, be nice  :Smile:  )

----------

## flokno

i haven't got it lower than 600 too but combined with acpi throttling states (0-7) i had 600mhz and state7 (18%) i had a very slow cpu.

speedfreq used it with p4 scaling (?) here. now i just don't compile p4 scaling into my kernel, only enhanced speedstep.

but all this doesn't increase batterytime much or decreases fan usage...

i think i still have to wait.

-- 

 flo

----------

