Linux on Hp Compaq nx7400 (old version)
DISCLAIMER: This is not intended to be a guide on how to install Ubuntu, Debian, or another distro, but a guide to how to configure it to work well with this notebook.
I'm not responsible if you damage your hardware or software following this guide.
I've used Ubuntu Edgy 6.10, but config files can be easily adapted to another distro.

Thanks to all the the people, forums, mailing lists and google for the informations I could collect about this notebook!

I'm now using Debian Etch, so the files attached are debian-relative. It's easy to apply the same things on other distributions.

News:
Todo:

Hardware specs:

What works:
lspci output
00:00.0 Host bridge: Intel Corporation Mobile 945GM/PM/GMS/940GML and 945GT Express Memory Controller Hub (rev 03)
00:02.0 VGA compatible controller: Intel Corporation Mobile 945GM/GMS/940GML Express Integrated Graphics Controller (rev 03)
00:02.1 Display controller: Intel Corporation Mobile 945GM/GMS/940GML Express Integrated Graphics Controller (rev 03)
00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 01)
00:1c.0 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 1 (rev 01)
00:1c.1 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 2 (rev 01)
00:1c.3 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 4 (rev 01)
00:1d.0 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #1 (rev 01)
00:1d.1 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #2 (rev 01)
00:1d.2 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #3 (rev 01)
00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #4 (rev 01)
00:1d.7 USB Controller: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller (rev 01)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev e1)
00:1f.0 ISA bridge: Intel Corporation 82801GBM (ICH7-M) LPC Interface Bridge (rev 01)
00:1f.1 IDE interface: Intel Corporation 82801G (ICH7 Family) IDE Controller (rev 01)
00:1f.2 SATA controller: Intel Corporation 82801GBM/GHM (ICH7 Family) Serial ATA Storage Controller AHCI (rev 01)
02:00.0 Network controller: Intel Corporation PRO/Wireless 3945ABG Network Connection (rev 02)
04:06.0 CardBus bridge: Texas Instruments Unknown device 8039
04:06.1 FireWire (IEEE 1394): Texas Instruments Unknown device 803a
04:0e.0 Ethernet controller: Broadcom Corporation BCM4401-B0 100Base-TX (rev 02)

Kernel boot log:
dmesg

ACPI problems and fixes, bad state problem:
This notebook is affected like many of the Hp Compaq nc/nx notebooks by the "bad state" problem (the system after linux shutdown or reboot is slow booting bios, keyboard often don't work, processor speed can't go over 1.33ghz). To reset the state, it's necessary to remove ac power and battery.
The cause of this problem is in the psmouse module and bios interaction (I don't know if it's a bios bug or psmouse driver bug). A solution is to compile psmouse as module and unload it before  shutdown or reboot.
You must insert only an `/sbin/modprobe -r psmouse' in halt and reboot scripts.
These are patched reboot and halt init.d scripts for Debian Etch:
Thermal Zones
Thermal zone 4 is the cpu fan speed! So if it's always 0°C, even on high workload, the fan is not working.

Processor frequency scaling
Out of the box processor speed, using cpufreq, goes only to 1.33ghz. To fix this I use cpufreqd setting mix frequency to 0% and maximum to 100%. With these settings you have the same result as using cpufreq-utils and typing:
'cpufreq-set -c 0 -u 1667000 ; cpufreq-set -c 1 -u 1667000'
After this command the ondemand governor works normally. This is the cpufreqd configuration I use: cpufreqd.conf
See this forum for more informations: http://forums1.itrc.hp.com/service/forums/bizsupport/questionanswer.do?threadId=1026460
On
bios version F07 frequency scaling doesn't work. Later bios versions fixed this problem.

You need to load speedstep-centrino module to enable cpu frequency scaling on kernel <2.6.20. Acpi-cpufreq will not work. On kernel 2.6.20 acpi-cpufreq deprecates the use of speedstep-centrino on Core cpus.

Suspend to disk and to ram:
I've done many and many tests, I've tried many kernels, patches, and I've got a good knownledge of what makes suspend working with this notebook (now it's fully working!)
The problem was SATA controller power management support. This is fixed on vanilla kernel 2.6.19, but also 2.6.18 kernels from Debian and Redhat include this support.
This controller can work in two modes, normal mode and ahci mode (Native SATA setting enabled on bios). In normal mode suspend to disk works with all kernels > 2.6.15 without a special effort. AHCI mode need a newer kernel.

Now I use uswsusp tools version 0.5 and the provided tools s2ram and s2disk. s2ram handles correctly this model.

Sometimes I noticed hangs after resume from suspend to ram. I have not understood the real causes, but they are due to hardware/software incompatibilities.
Using gnome-power-manager 2.16, hibernate scripts, and uswsusp scripts it's 99% reliable. Using kde-guidance-power sometimes the system hangs after suspend to ram.


ATTENTION!!!! The fan may not work after resume from hibernation because the thermal module is loaded by initrd scripts before resume from swap. This confuses the bios.
On debian/ubuntu you need to remove the file /usr/share/initramfs-tools/hooks/thermal so the module doesn't get loaded. I don't know why they added this script....
I've monitored the cpu temperature using Gnome sensors applet after suspend to disk cycles and the fan works reliably using this fix.
SATA disk may not wake up after suspend if Drivelock password is enabled on bios. On suspend the bios locks the drive but it's not unlocked on resume. Using windows perhaps a driver unlock it.
These are tipical errors that a locked disk gives:
sd 1:0:0:0: SCSI error: return code = 0x08000002
sda: Current: sense key=0xb
ASC=0x0 ASCQ=0x0
end_request: I/O error, dev sdb, sector 0
ata1: EH complete
ata1.00: speed down requested but no transfer mode left
ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
ata1.00: tag 0 cmd 0x20 Emask 0x1 stat 0x51 err 0x4 (device error)
ata1: EH complete
ata1.00: speed down requested but no transfer mode left
ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
ata1.00: tag 0 cmd 0x20 Emask 0x1 stat 0x51 err 0x4 (device error)
ata1: EH complete
ata1.00: speed down requested but no transfer mode left
ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
ata1.00: tag 0 cmd 0x20 Emask 0x1 stat 0x51 err 0x4 (device error)
ata1: EH complete
ata1.00: speed down requested but no transfer mode left
ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
ata1.00: tag 0 cmd 0x20 Emask 0x1 stat 0x51 err 0x4 (device error)
ata1: EH complete
ata1.00: speed down requested but no transfer mode left
ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
ata1.00: tag 0 cmd 0x20 Emask 0x1 stat 0x51 err 0x4 (device error)
ata1: EH complete
ata1.00: speed down requested but no transfer mode left
ata1.0: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0

ata1.00: tag 0 cmd 0x20 Emask 0x1 stat 0x51 err 0x4 (device error)


Screen backlight could remain powered off after suspend to ram. If you press the brightness keys the backlight is enabled.
Using acpi_sleep parameters or vbetool post/save hang up the machine on resume. So I'll stick using the keys ;-)
Using latest s2ram script, this is fixed. It uses vbetool post. I tried using vbetool post with other scripts, but it never worked, as it hung the machine on resume. This is a mistery....
Sometimes the keyboard is not reinitialised after resume. IRQ are lost (if you enable i8042 debugging you can notice this). The only way to be able to control the notebook when keyboard don't work is using an external usb keyboard or ssh. Keyboard driver can be reset with this command:
echo -n reconnect > /sys/bus/serio/devices/serio0/drvctl
Sometimes it works, but there are always lost interrupts.
Compiling the i8042 (keyboard) driver as module, keyboard works reliably after resume. You don't have to change anything in hibernate as i8042 is in the blacklisted-modules list. It will unload it before suspend and reload it after resume.
Using windows you can notice a similar behaviour. Keyboard after resume is reinitialized after some seconds. So I think that it is needed for this model..

Compiling i8042 as module requires that CONFIG_EMBEDDED is set as yes, and keyboard, psmouse as module. 
This is my config for reference (debian kernel 2.6.18-3 with acpi-dsdt, ieee80211, ipw3945 patches):

Hibernate scripts configuration
I use hibernate script in conjunction with uswsusp 0.5, these are my configuration files: hibernate-conf-nx7400.tar.bz2
Suspend to ram works as described using 'hibernate -F /etc/hibernate/ram.conf'.

Xorg 7.1 configuration:
This is my xorg.conf with AIGLX enabled, and configuration for dual head using xinerama or merged fb (you can easily switch between configurations commenting and uncommenting lines).
If you want to use mergedfb and have 3d acceleration, you have to know about the physical limits of the intel 945gma card. It doesn't handle textures > 2048x2048. So the total framebuffer must not exceed this value.
Soft modem configuration
You need only sl-modem daemon. The driver is included in the snd-hda-intel alsa module, so sl-modem modules are not required. You have to specify the device (hw:0,6) and country in /etc/default/sl-modem-daemon.
It needs some testing. Kppp diagnostics give good results.
Power off and on the screen leaving keyboard active
Using vbetool you can power off and on the monitor leaving the keyboard active (unlike normal dpms the screen don't power on if you press a key). I find it useful to control amarok with the keyboard while leaving the screen off. Vbetool must be used as root, so you can add to the sudoers file (be careful after more general rules):
yourusername ALL = NOPASSWD: /usr/sbin/vbetool
The command used to power off the monitor is:
sudo /usr/sbin/vbetool dpms off
and the one to power on the monitor is:
sudo /usr/sbin/vbetool dpms on
If you accidentally power off the monitor and want to recover it you can simply switch to a console and then switch back to X.
These are scripts that call these commands. You can assign shortcuts on your window manager (metacity, beryl, compiz, kwin.......). disattivamonitor attivamonitor

Thanks to: http://www.thinkwiki.org/ for informations and howtos.

For corrections and suggestions write me (delete the NOSPAM word before sending me a mail): emisca84-1@NOSPAMyahoo.com
TuxMobil - Linux on Laptops, PDAs and mobile PhonesLinux On Laptops