Linux on Thinkpad R40e

Thinkpad I am running Gentoo Linux on my Thinkpad R40e. If you have any comments or suggestions then please email me. My email id can be found on my Contact page.

Specifications

Does not have touchpad (IBM calls it UltraNav)
Does not have floppy drive

Note: ACPI works only partly. Battery and AC adapter status can be read but processor and thermal modules hang the system. I was able to get them working by making a small change to the kernel acpi code. See below for details. For the present you can forget about suspend/hibernation. ACPI is messing with the special buttons for volume and brightness control which become ineffective if I use an ACPI kernel (They work if I boot with acpi=off but then I wont have any ACPI). The BIOS does not support APM.

The keyboard is full-sized which is a good thing but some keys like Escape and Control are not in their usual position which is VERY ANNOYING for a linux user. The Esc key is placed further away that usual and I end up pressing F1 instead of Esc many times since F1 is placed just below Esc key. The Ctrl and Alt keys are right beside one another since IBM does not put a windows key. They have a Fn key which they could have put in between Ctrl and Alt.

CPU temperature is generally quite high. Even when idle and in an air-conditioned room it is between 46-50C. At 100% CPU it reaches 72C. As a result the fan is on most of the time and your battery will drain fast. The region on the lower left where you rest your left palm becomes hot and is a bit uncomfortable to work.

No recovery CD is provided since there is a separate recovery partition. But this gobbles up 3GB of valuable space. You can of course delete this space especially if you dont want to retain Windows. Purchasing a recovery CD costs about Rs. 1000 + local taxes according to their helpcenter.

If you already own an R40e then read on.

Some useful information

Partitioning

This model comes with a host protected area which contains the windows software (no installation CD is provided). When you boot for the first time windows is installed and the file system is converted from FAT32 to NTFS. IT is not possible to efficiently resize an NTFS partition. Windows defrags the harddisk badly and there are unmovable chunks which cannot be moved with ntfsresize. If you have already booted your laptop and the file system conversion has taken place and then you can do what I did: If you are booting for the first time: then hit the "Access IBM" button and do the partition with parted. Then reboot and allow windows to install.

Installing Gentoo

I installed using a Gentoo livecd. Since the Broadcom ethernet driver is not available in Linux I did a basic Stage 3 installation first and then installed the latest packages that I required once I got the network up. No problems with Gentoo installation; just follow the installation docs on the Gentoo site.

Display

Nothing special required here. The resolution is 1024x768. XFree will detect most things. In order to be able to switch off the backlight I had to upgrade to xfree86 4.4. You can switch it off by
    xset -display :0.0 dpms force off
To switch it back on just press any key. Thanks to Matt for this tip.
Update: You can also use radeontool to switch-off the backlight.

ACPI

ACPI mostly works but it also interferes with the hotkeys. I can get the battery percentage, ac adapter status and cpu temperature. There is no fan device in the DSDT table, so its probably controlled by the BIOS. To get cpu temperature you need to load the thermal module which requires the processor module. Unfortunately on R40e, the processor module causes the system to hang. After some experimentation with the kernel acpi code I found out that cpu power management was broken. In drivers/acpi/processor.c go to the following piece of code.
/*
 * Install the idle handler if processor power management is supported.
 * Note that the default idle handler (default_idle) will be used on 
 * platforms that only support C1.
 */
 if ((pr->id == 0) && (pr->flags.power)) {
      pm_idle_save = pm_idle;
      pm_idle = acpi_processor_idle;
    }
You will have to disable power management by adding an extra line as follows:
/*
 * Install the idle handler if processor power management is supported.
 * Note that the default idle handler (default_idle) will be used on 
 * platforms that only support C1.
 */
 pr->flags.power = 0; //Disable cpu power management for r40e
 if ((pr->id == 0) && (pr->flags.power)) {
      pm_idle_save = pm_idle;
      pm_idle = acpi_processor_idle;
    }
Recompile your kernel, install it and reboot. If you compiled processor as a module then try modprobe processor. With this small change the processor module loads without any problem and then you can load the thermal module.

The above modification turns-off power management:

karman root # cat /proc/acpi/processor/CPU/*
processor id:            0
acpi id:                 1
bus mastering control:   yes
power management:        no
throttling control:      yes
limit interface:         yes
active limit:            P0:T0
user limit:              P0:T0
thermal limit:           P0:T0
active state:            C1
default state:           C1
bus master activity:     00000000
states:
   *C1:                  promotion[C2] demotion[--] latency[000] usage[00000000]
    C2:                  promotion[C3] demotion[C1] latency[003] usage[00000000]
    C3:                  promotion[--] demotion[C2] latency[250] usage[00000000]
state count:             8
active state:            T0
states:
   *T0:                  00%
    T1:                  12%
    T2:                  25%
    T3:                  37%
    T4:                  50%
    T5:                  62%
    T6:                  75%
    T7:                  87%
This has the result that acpi will not put the system in C2 or C3 which are low power states and the processor is always in C1. Power savings due to acpi cannot be obtained and the system runs somewhat hotter even when idle.

Update on ACPI: Kernel 2.6.10 has a fix to automatically disable some power management feature in the processor module which would otherwise cause R40e to hang. The piece of code where this is disabled is listed below (The file should be either drivers/acpi/processor.c or drivers/acpi/processor_idle.c):

static struct dmi_system_id __initdata processor_power_dmi_table[] = {
      { no_c2c3, "IBM ThinkPad R40e", {
        DMI_MATCH(DMI_BIOS_VENDOR,"IBM"),
        DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW") }},
      { no_c2c3, "Medion 41700", {
        DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"),
        DMI_MATCH(DMI_BIOS_VERSION,"R01-A1J") }},
      {},
};

Set the BIOS version in this function to what you have on your laptop. With this fix you do not need to apply the previous fix listed above.

Trackpoint

Works without any problem. See my XF86Config file. I can use the middle button together with trackpoint for scrolling. Button 1+3 can be used for pasting from clipboard.

Ethernet

You have to download the Broadcom driver from their website and compile it yourself. The module will be called bcm5700. See the link below.
Update: The Tigon driver under 1000Mb section in the kernel also works. The module is called tg3.

USB

Not tested.

PCMCIA

Not tested.

Modem

The modem is M5457 AC-Link Modem for which you can get the drivers from SmartLink. I have not tested it though.

Miscellaneous

Some useful links

Thinkpad R40e software and device drivers
Matt's docs on his R40e
The Linux IBM Thinkpad R40e saga
Another linux-on-r40e page
Tuxmobil
Broadcom ethernet driver page
NotebookReview.com

Before buying a laptop

Buying a laptop in India

Laptops are still costly in India, the cheapest being in the range of Rs. 50000 ($1000). Since the duty cuts announced in December 2003 the prices of some models have come down. Thinkpads are still very costly with R40e being the only one that is reasonably priced (Rs. 50000). I recommend checking out the following: Many thanks to Sridar for help with this installation.
gentoo TuxMobil - Linux on Laptops, PDAs and mobile Phones