jamie.lentin.co.uk

IBM Thinkpad G40 and Debian (sid)

The 'G' range is a strange annex of the thinkpad line, and doesn't have most of the normal features (e.g. Ultrabays, Thinklights), nor does it use the standard thinkpad power supply. It is also huge since it has a desktop P4 and a lot of copper. Despite this it's a reasonably quiet laptop which can last a few hours away from power.

There's nothing particularly unusual you have to do to get debian up and running---the install process should guide you through to at least a command prompt. Debian stock kernels work just fine.

BIOS setup

Update to the latest BIOS, of course. Then press some buttons. I dunno.

Like other IBM's, there's the recovery area to disable (IMO it's not that useful, if you don't trust yourself enough that you get the BIOS to hide a backup windows installation then you probably shouldn't be using Linux).

Graphics configuration

Warning: It seems the VGA connector on the laptop is prone to breaking off, this inhibits use of dualheading somewhat. Whilst nosing on ebay for spares, it seems I'm not the only one to suffer this. It doesn't appear to be easily repairable, either.

Xorg

Current versions of the "intel" driver (2:2.3.2-2+lenny6) work pretty much flawlessly, can rotate screens, shut the lid (which hasn't been possible for some time). Config looks like:-

  Section "Device"
        Identifier      "Internal Video"
        Driver          "intel"
        BusID           "PCI:0:2:0"
        Screen          0
  EndSection

  Section "Monitor"
        Identifier      "Laptop LCD"
        Option          "DPMS"
        DisplaySize     270 203
  EndSection

  Section "Monitor"
        Identifier      "Sun GDM-20E20"
        Option          "DPMS"
        HorizSync       30-85
        VertRefresh     48-160
        DisplaySize     337 270
  EndSection

  Section "Screen"
        Identifier      "Default Screen"
        Device          "Internal Video"
        Monitor         "Laptop LCD"
        Option          "monitor-VGA" "Sun GDM-20E20"
        DefaultDepth    24
        SubSection "Display"
                Depth 16
                Virtual 2304 1024
        EndSubSection
        SubSection "Display"
                Depth 24
                Virtual 1280 1024
        EndSubSection
  EndSection

DRI

This seems to just-work™ & glxgears gives me ~400fps, which isn't great but I'm not that fussed. Select the following Character Devices in your kernel setup:-

If you compiled them as a module, insert "i915" into /etc/modules to get it to load on bootup.

Framebuffer

The intelfb fb driver will coexist with the intel X11 driver, however it gets confused when X11 takes over and disables accelleration.

To use intelfb, enable "Intel 830M/845G/852GM/855GM/865G/915G/945G support" under Graphics support in your kernel (compiled in, not a module). Add the following to your kernel command line:-

vga=0x318 video=intelfb

Powersaving/ACPI configuration

ACPI works fairly well out of the tin. Make sure you have compiled "IBM ThinkPad Laptop Extras" and add the following to /etc/modprobe.d/g40hardware

options thinkpad-acpi experimental=1

The laptop exposes:-

A lot of thinkpad-acpi won't do much, e.g. the volume control will flip bits, but this has no affect on the sound (presumably they didn't bother wiring the sound chip into whatever the volume controls set), the video options also don't do anything. Maybe I play with these at some point.

Sleep States

The laptop supports S3 (suspend-to-ram) reasonably well. Add the following to your kernel command line:-

acpi_sleep=s3_bios

This tells ACPI to run the video BIOS after a resume. It will work fine without, but you need to switch VT's and back again before you can see your mouse cursor.

DSDT Hacks: Extra keys

The DSDT I have modified to include ACPI hotkey support for more keys. This is a similar process for any thinkpad.

  1. Install the iasl compiler, copy /proc/acpi/dsdt and decompile it.
  2. Look at the source code. Search for "_Q"
  3. You should see a whole load of Method (_Q03, 0, NotSerialized). Each one of these is triggered when the Embedded controller receives an event. Through trial and error, I found these events were triggered by some keys:-
Method (_Q03, 0, NotSerialized) /* Fn-F9 */
Method (_Q04, 0, NotSerialized) /* Fn-Space */
Method (_Q0A, 0, NotSerialized) /* Fn-Home */
Method (_Q0B, 0, NotSerialized) /* Fn-End */
Method (_Q0C, 0, NotSerialized) /* Fn-F3 */
Method (_Q0D, 0, NotSerialized) /* Fn-F4 */
Method (_Q0E, 0, NotSerialized) /* Fn-F5 */
Method (_Q0F, 0, NotSerialized) /* Access IBM */
Method (_Q10, 0, NotSerialized) /* Fn-F7 */
Method (_Q11, 0, NotSerialized) /* Fn-F8 */
Method (_Q12, 0, NotSerialized) /* Vol Down */
Method (_Q13, 0, NotSerialized) /* Vol Up */
Method (_Q14, 0, NotSerialized) /* Mute */
Method (_Q15, 0, NotSerialized) /* Fn-F12 */

Adding a call to MHKQ in each of these blocks means that thinkpad_acpi will get told about them. My patch is here.

Recompile the DSDT using iasl -tc into a hex file, and configure the kernel to compile this into it's source code. You could also use the initrd patch, but the new initramfs stuff is a bit cumbersome if that's the only thing you use it for.

CPUFreq

Even if it's predominantly a desktop, this is a good-thing™ to keep heat (and therefore noise) down. I wanted to just use one of the kernel governors and not play around that much. Compile in support for "Intel Pentium 4 clock modulation", and whatever governors you want. Although you can't select ondemand or conservative for the default govenor, you can install sysfs-tools and add to /etc/sysfs.conf:-

devices/system/cpu/cpu0/cpufreq/scaling_governor = ondemand

Audio Configuration

Pretty easy to setup using alsa. Make sure you compile the "Intel/SiS/nVidia/AMD/ALi AC97 Controller" ALSA module (snd_intel8x0), and udev should load it for you.

The mixer channels:-

You can also set the driver to disable the chip when nothing is being played. Put the following in /etc/sysfs.conf

module/snd_ac97_codec/parameters/power_save = Y

Link-o-rama