Ubuntu GNU/Linux on the HP Compaq nw8240

I recently got a HP Compaq nw8240 (PG818EA), and this page is intended to document my efforts to get the GNU/Linux distribution Ubuntu 5.04 (Hoary Hedgehog) running on it. It is not a walkthrough for installing, nor a HOWTO for setting it up, but more of a collection of random notes on how I did various things while installing and how well it works.

If you have any suggestions, questions, solutions to things I haven't got working or otherwise feel an urge to communicate with me, send an e-mail to rickard@holmberg.info.

Status overview

Using linux-2.6.12, mainline plus alsa-1.0.9b, swsusp2 2.9.5, ATI fglrx, ipw2200-1.0.6 and my centrino-voltages patch.

This overview only describes what I have seen. "Does not work" only means that I am not competent enough to get it to work, just as "Works" only means that it happens to work on my particular setup.

Device Status Comments
CPU:
Intel Pentium M 770
Works
Graphics:
ATI Mobility FireGL V5000
Works, partially Works with the proprietary ATI fglrx drivers. May have issues with ACPI sleep and also with external monitors. Identifies as Mobility Radeon X700. ATI fglrx 3D acceleration incompatible with hibernation.
IDE Controller:
Intel ICH6 PIIX
Works
DVD+/-RW Works Works fine with dvdrecord.
Audio:
Intel ICH6 AC'97
Works ALSA, snd-intel8x0
Modem:
Intel AC'97 Modem Controller
Works Needs intel8x0m driver from ALSA 1.0.9b or later and reputedly slmodem before 2.9.10. I only tested with the debian-patched slmodem-2.9.9d, which works right away, V.92 and all.
USB Controller:
Intel 82801
Works
IEEE1394:
TI PCI7621
Does not work Gives errors. Haven't investigated.
Bluetooth controller Works hci_usb. A little bit flaky - but most likely it's my phone.
IrDA module Works IRQ detected wrongly, see IrDA section below.
Keyboard Works Sends scancodes for all keys except the power button, the fn-key, "switch to external monitor" and contrast up/down.
Trackpad and trackpoint:
Synaptics
Works Scrolling at the side of the pad works. Can't distinguish between 1, 2 and 3 finger taps, though.
WLAN (IEEE802.11g):
ipw2200bg
Works Driver from ipw2200.sf.net
Ethernet controller:
BCM tg3 Gigabit Ethernet
Works Only tried 100Mbit/s.
Battery Works Getting slightly more than 3 hours of work, on medium-dim display and slow (800MHz), undervolted CPU.
Fan Works Only rudimentary monitoring support over ACPI. May need resetting after resume from hibernation.
Sleep/suspend Works to disk, but not with fglrx Suspend-to-disk works, using the suspend2 kernel patch. The fglrx kernel module must not be loaded. ACPI S3 suspend-to-RAM does not work (hangs on resume).
SD flash reader:
TI PCI7621
Does not work No driver, probably not even being worked on.
Smartcard reader: TI PCI7621 Does not work Same as the SD flash reader.
PC-card slot:
TI PCI7621
Does not work Isn't recognised by any of the drivers I've tried. Haven't spent too much time on it, though. Same chip as SD, SC and IEEE1394.
Trusted Computing Platform:
Infineon?
Untested Haven't tried it yet. Could it be useful as a crypto-accelerator?

Specs

This is what I find in my box. Since everything is not really specified from HP, the specific parts used may probably vary.

Processor type: Intel Pentium M 770 (Dothan) Processor, at 2.133 GHz, 2 MB L2 cache, 533 MHz FSB
Memory: 2 GB DDR2-533 (1x1 GB module was installed, I added another)
Graphics controller: ATI Mobility FireGL V5000 (or, perhaps, a ATI Mobility Radeon X700) with 128 MB VRAM. PCI Express.
Display: 15.4" 1920x1200 WUXGA TFT
Hard drive: Toshiba MK8026GAX, 80 GB, 5200 rpm
DVD: Matsushita UJ-822Da, 2x DVD+/-RW

Devices

CPU: Intel Pentium M 770

I am greatly impressed by the Pentium M Dothan CPU. At the computational problems I run at work (Monte Carlo physics simulations), it is about 15% faster at 2.13 GHz than a Pentium 4 at 3.4 GHz. Not per clock, but actually faster. That is 86% more work per clock cycle. Nice.

However, the CPU emits quite a lot of heat by default (though obviously not when compared to the Pentium 4), which makes the fan run quite loudly, all the time (nearly, more than 95% when indoors anyway). On That Other Operating System, there is a utility called RMClock that (among other things) enables adjusting the CPU core voltages. I couldn't find such a utility for Linux, so I made this kernel patch: centrino-voltages.diff. IT IS DANGEROUS! Use at your own risk. I have only tested it on my computers, and it may very well fry your CPU, permanently destroying it. I give no guarantees as to whether it will work for you.

It applies cleanly to Linux 2.6.12, and probably to most other recent versions as well. If you trust my kernel hacking skillz with the life of your precious nw8240, apply the patch using

$ cd /usr/src/linux-2.6.12
$ patch -p1 < ~/downloads/centrino-voltages.diff
It updates the speedstep-centrino kernel module to allow changing voltages. Prerequisites include the speedstep-centrino module and cpufreq. After a recompile, reboot and modprobe, there should be a file /sys/devices/system/cpu/cpu0/cpufreq/scaling_voltages that on my system contains the following:
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_voltages
# frequency voltage
2133000 1356
1867000 1292
1600000 1212
1333000 1148
1067000 1068
800000 988
Frequencies in kHz, voltages in mV. Adjusting the voltages is then done by e.g.
$ sudo sh -c "(echo 800000 700; echo 1067000 988) > \
        /sys/devices/system/cpu/cpu0/cpufreq/scaling_voltages"
to make the CPU get 700 mV when working at 800 MHz, 988 mV when working at 1.067 GHz, and leave the other voltages at their current values. Voltage values are rounded down to the nearest settable value. Voltages cannot be raised above the original values, to try to protect against accidental CPU-frying. Don't rely on this, though, but stay careful. Changes to the table will be effective immediately. To do this automatically on boot, I use a tiny script /etc/init.d/sysfsctl that should be soft-linked to from an appropriate /etc/rc?.d directory. It uses a configuration file /etc/defaults/sysfsctl (it also turns on the dyn-tick stuff, and the conservative cpufreq-governor). Those are the voltages that work for my CPU. YMMV.

Using 700 mV @ 800 MHz lowers my CPU idle temperature to under 40 degrees Celsius, with the fan running. Since the default trip-point for turning fan off is 40 degrees, that makes the fan go on and off all the time. If you want to fix that, try patching your DSDT (see ACPI section below). I have decreased the fan speed so that it is barely louder than the hard drive, which to me is an acceptable noise level.

I tried replacing the thermal goop between the CPU and the cooling device with Arctic Silver 5. So far it seems it didn't make much of a difference, though that might be because I applied it incorrectly. Will try reapplying later.

On Linux 2.6, with the new, higher value of HZ, something emits a high-pitched noise when the CPU idles. The dyn_tick kernel patch by Tony Lindgren and Tuukka Tikkanen makes the CPU skip ticks when idle, thus reducing the high-pitched noise to a faint, low-pitched (~20 Hz) ticking, which is much less unpleasant. The patch was originally intended to save power, not remove noise, so it might reduce the power consumption as a bonus.

Graphics controller and display: ATI Mobility FireGL V5000

The graphics controller identifies itself as a ATI Radeon Mobility X700 with PCI ID 0x5653, instead of the expected Mobility FireGL V5000 with PCI ID 0x564A or 0x564B. I have no idea why that is, though it seems that the differences between the V5000 and the X700 are minimal, as far as the features I use are concerned. I could not make it work with the standard X.org ATI drivers, neither in X.org 6.8.2 nor the latest CVS version as of August 3. The screen shows something resembling the graphics supposed to be there but with a lot of flicker, almost as if the screen didn't sync properly. Once, when I killed the X server a bit early, the flicker carried over to the VESA text console. Hmm... I have tried setting the DisplayPriority option to "HIGH" and using the framebuffer, but the flicker remained.

The proprietary fglrx ATI drivers version 8.14.13 from http://www2.ati.com/drivers/linux/ati-driver-installer-8.14.13.run seems to work okay though. See the notes under ACPI sleep about the fglrx kernel module however. Adding the lines

ChipID 0x564A
Option "MonitorLayout" "NONE, LVDS"
to the Device section in xorg.conf overrides the detection of the card as a X700, forcing X to treat it as a Mobility FireGL V5000, and tells it that it should only use the laptop display. That seems to give some extra options for monitor selection. Try changing NONE and LVDS to various combinations of them, AUTO and TVOUT. I think that it is possible to use the fireglcontrolpanel program to control this, but I haven't tried that yet.

To make the XVideo (xv) output module work in video players such as xine, vlc and mplayer, add the following two lines to the Device section of your xorg.conf:

Option "OpenGLOverlay" "off"
Option "VideoOverlay"  "on"
I don't know how that affects OpenGL performance.

For 3D acceleration, more than 128 MB vmalloc space is needed. I appended vmalloc=256M to the kernel parameters in /boot/grub/menu.lst.

My xorg.conf can, as it stands, be downloaded from here.

IDE Controller

This is also from the chipset, a standard ICH6 that seems to use the PIIX driver, and worked straight away.

DVD burner: Matsushita UJ-822Da, 2x DVD+/-RW

Seems to work fine. To burn DVD and CD iso images, I use dvdrecord from the Ubuntu package dvdrtools. Turning on DMA gives a huge speed and stability boost, as expected. Since I don't want to mess up more discs than necessary, I use the following little script to keep track of the options needed:
#!/bin/sh
if [ ! -f "$1" -o $# -gt 1 ] ; then
  echo "Syntax:" > /dev/stderr
  echo "  $(basename $0) <iso-image>" > /dev/stderr
  exit 1
fi
if [ "$USER" != "root" ] ; then
  echo "Must be root!" > /dev/stderr
  exit 2
fi
modprobe ide_scsi
modprobe sg
modprobe sd_mod
echo 'using_dma:1' > /proc/ide/hdb/settings
dvdrecord driveropts=burnfree -v -dao dev=ATAPI:0,1,0 "$1"
So far, I haven't botched any discs using those parameters. Burning DVDs seems quite slow though - a whole DVD takes about 36 minutes to fill...

Audio: Intel ICH6 AC'97

Works, with the ALSA driver snd_intel8x0. Since the modem controller requires at least alsa-1.0.9b, I use that version for the sound module as well. To get the mute-LED and the headphone detection stuff working, I made this patch against alsa-1.0.9b: alsa-1.0.9b-nw8240.diff. Apply using patch -p1 < alsa-1.0.9b-nw8240.diff. This only gives the low-level driver support. To make the button actually do something, see the keyboard section.

Modem: Intel AC'97 Modem Controller

This is a soft modem that works with the snd-intel8x0m driver from ALSA 1.0.9b together with the proprietary slmodemd-2.9.9d from Smart Link. Someone indicated that slmodemd-2.10.0 didn't work. The snd-intel8x0m driver in Linux 2.6.12 has a known issue with this driver, so if it hasn't been fixed in the version you use, you need to get the new driver from the ALSA project. Check out the Linux on an HP/Compaq nc6120 Laptop page for more info. The extra initialisation string (AT+MS=34, lock to V.34) given there is not necessary, so all modem standards, even V.92, seems to work. When testing, I got a connection to my university's modem pool at 50667 baud, which is completely adequate.

USB Controller

The USB controllers are those on the Intel 82801 chipset. There seem to be four of them (3 for the external ports, and one for the internal Bluetooth module?), and they work out-of-the-box, using the uhci_hcd driver.

IEEE1394 (FireWire/i.LINK): OHCI-compliant device on the TI PCI7621

Tried with my iPod, but keep getting errors such as
ieee1394: The root node is not cycle master capable; selecting a new root node and resetting...
ieee1394: Node changed: 0-00:1023 -> 0-01:1023
ieee1394: Node changed: 0-01:1023 -> 0-00:1023
ieee1394: Error parsing configrom for node 0-00:1023
ieee1394: Error parsing configrom for node 0-01:1023
Also tried giving the sbp2 module the parameter serialize_io=1, to no avail. Anyone who has any tips? It looks like the IEEE1394 interface of the TI PCI7621 is almost standard, so it might work with a little more effort.

Bluetooth controller

Just works, with the hci_usb driver and the bluez Bluetooth stack, available in the bluez-utils debian package.

Sometimes when I've used a GPRS connection with my Sony-Ericsson T630, the phone isn't detected anymore. A reboot of the phone fixes it. I guess this is due to buggy firmware in the T630, but it might be the bluetooth driver that doesn't disconnect properly.

IrDA module

This works great with the steps outlined at the Linux on HP Compaq nx8220 notebook page. Requires the modules irtty_sir and ircomm. To make it permanent on Ubuntu, I installed the packages irda-utils and setserial, modified /var/lib/setserial/autoserial.conf to use irq 3 for /dev/ttyS2, and adjusted the DEVICE and ENABLE values in /etc/default/irda-utils. Add ircomm_tty and irtty_sir to /etc/modules, and the /dev/ircomm* devices will be created by udev on reboot.

You should have a working IrDA interface at /dev/ircomm0. If there is no such device, you can try to make udev create one for you. For syncing with my Palm Zire, I use gnome-pilot with /dev/ircomm0 as the port, and port type IrDA. It works quite nicely, actually.

Keyboard

All keys except for the power button, the fn-key, "switch to external monitor" (fn-f4) and contrast up/down (fn-f10, fn-f9) report scancodes. The power button reports an ACPI event, though. Left and right ctrl, left and right alt, and left and right super all send different scan codes.

To map the exotic keys (volume up/down, presentation button etc.) to something useful, you can use the metacity keyboard shortcuts, together with some lower-level support.

The lower-level support consists of giving the keys that don't have a keycode one, using setkeycode. A script for that is /etc/init.d/setkeycodes. It also needs a configuration file, /etc/defaults/setkeycodes:

e008 0x76 # Meeting
e009 0x78 # Battery
e033 0x79 # BrightnessAdjust
e078 0x75 # Wireless
e059 0x74 # Info
The rest of the keys were mapped already on my distribution. Furthermore, the keycodes must be mapped to XKB keys. To do that, I have a file .Xmodmap in my homedir:
! Presentation button:
keycode 123 = XF86Meeting
! Battery button: (is there a better name than XF86Q for it?)
keycode 139 = XF86Q
! Brightness adjust:
keycode 134 = XF86BrightnessAdjust
! Wireless on/off: (bad name)
keycode 157 = XF86iTouch
! Info button (ibid)
keycode 222 = XF86Tools
! fn-f3 sleep:
keycode 223 = XF86Sleep
! Volume buttons:
keycode 160 = XF86AudioMute
keycode 174 = XF86AudioLowerVolume
keycode 176 = XF86AudioRaiseVolume
Those values are not ideal (should be fixed, any day now) but they work and don't collide with anything else on the keyboard...

With that, the keys should be seen in X, e.g. by xev. To make them do something useful, the default gnome window manager metacity has a few configuration options (that took me quite a while to find). To make the volume keys do what would normally be expected, you can do as follows:

Try your new config out after a reboot. If metacity doesn't get the hang of it the first time, try logging out and in again, or sending a SIGHUP to it.

There probably is a much, much easier and more modern way to accomplish this, but that's how I did it.

Trackpad and trackpoint

A Synaptics, with three buttons each for the trackpad and trackpoint. Worked without additional configuration. Can't get it to distinguish between one, two and three finger taps, though, so I added the following three lines to the InputDevice section of xorg.conf, to make all taps be with the left button:
Option "TapButton1" "1"
Option "TapButton2" "1"
Option "TapButton3" "1"
Jim Gettys has a patch for the finger detection at his Ubuntu on HP Compaq nc8230 page. Haven't tried that. Supposedly it is scheduled to be included in the next Synaptics driver release.

Both horizontal (at the bottom edge) and vertical scrolling (left edge) works.

WLAN (IEEE802.11g): Intel PRO/Wireless 2200BG

At first, I could not get this to work at all, since the Intel-supplied ipw2200 driver always indicated that the rf_kill switch was on, disabling any 802.11 communication. However, it started working, quite magically, around the time that I recompiled my ACPI DSDT. It may or may not have been the patched DSDT that fixed this issue. I currently use version 1.0.6 of the ipw2200 drivers.

Ethernet controller: Broadcom Tigon3 Gigabit Ethernet

This is handled by the tg3 driver, present in Linux 2.6.12, and seems to work fine out of the box. I've only tested it with 100 Mbit/s yet, though.

ACPI features

DSDT

Since the DSDT seems to be a common source of problems on ACPI-enabled laptops, I tried recompiling the one supplied to see if any non-working devices would come to life. I haven't really investigated what works and not, but at least it seems not to have made anything worse. Useful things to have around when messing with the DSDT is the ACPI specification and the iasl compiler/decompiler from Intels ACPI Downloads page. I don't want to give away the version of the dsdt I use, since the DSDT seems to differ between different motherboards - even of the same model and BIOS version.

Battery

I haven't had any problems with this. The ACPI output from the standard battery is as follows:
$ cat /proc/acpi/battery/C171/info
present:                 yes
design capacity:         4479 mAh
last full capacity:      4479 mAh
battery technology:      rechargeable
design voltage:          14400 mV
design capacity warning: 224 mAh
design capacity low:     45 mAh
capacity granularity 1:  100 mAh
capacity granularity 2:  100 mAh
model number:            Primary
serial number:           17170 2005/06/20
battery type:            LIon
OEM info:                Hewlett-Packard
$ cat /proc/acpi/battery/C171/state
present:                 yes
capacity state:          ok
charging state:          charged
present rate:            0 mA
remaining capacity:      4479 mAh
present voltage:         16721 mV
The external travel battery has its own entries at /proc/acpi/battery/C170.

Fan

There is only one fan, which can be set to four different speeds, plus being turned off. Controlling the fan is done by echoing a "0" (for on) or a "3" (for off) to the /proc/acpi/fans/C261/state (slowest), /proc/acpi/fans/C260/state, /proc/acpi/fans/C25F/state, and /proc/acpi/fans/C25E/state (fastest) files. Haven't really gotten the hang of this yet.

If the fan starts going on and off all the time, you can try decreasing the slowest speed by patching your DSDT. There are three places that must be updated - the _OFF method of the power resource C25C and the _STA and _ON methods in the power resource C25D. The value (0xCA by default in the DSDT I had) should be increased to lower the fan speed. 0xFE is the slowest possible speed, which makes the fan about as loud as the hard drive, yet keeping my CPU at a reasonable 45 degrees Celsius when going at 800 MHz and 700 mV.

The thermal trip points in /proc/acpi/thermal/TZ*/trip_points seems to be ignored.

Sleep

Suspend-to-RAM (S3) sleeping hangs the computer on resume. The suspend2/swsusp2 kernel patch works for suspend-to-disk, but only if the fglrx kernel module is not loaded. The fglrx X.org driver works without the kernel module, though, but without 3D acceleration. That means that you can choose only one of 3D acceleration and hibernation support. Resuming is quite fast, about 25 seconds, so I think that using suspend-to-disk is a workable solution. It also saves more battery than suspend-to-RAM.

The ipw2200 may have issues after resume, but they are resolved by removing and reinstalling the module. The fans also are turned off, but that can be fixed by turning them off and then on again. I made a short script, that I put in /usr/share/sbin/togglefans that contains the following:

#!/bin/sh
for i in /proc/acpi/fan/*/state ; do
        echo 3 > $i     # Turn fan off
        echo 0 > $i     # Turn fan on again
done
(yes, 3 is off and 0 is on) Then, after making the script above executable with chmod 755 /usr/local/sbin/togglefans, I added the following line in /etc/hibernate/hibernate.conf
OnResume 30 /usr/local/sbin/togglefans
Furthermore, to make the computer hibernate automatically when the lid is closed, I made another executable script in /etc/acpi/local/lid.sh.post:
#!/bin/sh
if grep -q closed /proc/acpi/button/lid/*/state ; then
        /usr/local/sbin/hibernate
fi
Finally, add the line
OnResume 31 /etc/acpi/lid.sh
to/etc/hibernate/hibernate.conf, just after the togglefans line. This line is just there to make the acpi-support programs aware that the lid is open again.

Rebooting

Not really ACPI, but fits best here. Add reboot=b to the kernel parameters (in /boot/grub/menu.lst) to make reboot work. It makes Linux run the BIOS reboot code.

SecureDigital flash reader: TI PCI7621

The TI PCI7621 is a highly integrated PC Card controller, IEEE1394 controller, SD/MMC interface, and lots of other things in one. There seems there is no Linux driver for the SD features of this chip, and I haven't even found one being worked on.

Smartcard reader: TI PCI7621

I guess that this is handled by the same chip as the SecureDigital flash reader, so no luck here either.

PC card slot: TI PCI7621

This too seems to be handled by the same chip as the SD, SC and IEEE1394 controller. No luck as of yet.

Trusted Computing Platform: tpm

Don't know about this one.

Output from lspci

The output from lspci -v is in lspci-nw8240.out.

Kernel patches

Related pages