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!

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 notebooks by the "bad state" problem (the system after linux shutdown or reboot is slow booting bios, keyboard often don't work, processor fixed to at maximum 1.33ghz). To reset the bad state, it's necessary to remove ac power and battery.
The cause of this problem is in the psmouse module and its interaction with the bios (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.
These are patched reboot and halt init.d scripts for ubuntu 6.10:
Another ACPI related problem it's in thermal zone 4, that sometimes gives a fixed temperature (0°C or even 100°C) that causes abnormal fan operation. It seems that fixing DSDT makes it work reliabily.
This is the fixed DSDT (bios version F06): DSDT.dsl DSDT.aml

Update: the DSDT fix is not related to 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.
That problem occurs when the thermal module is loaded in initramfs/initrd (the default behaviour on ubuntu) especially after resume from suspend to disk (the module is the loaded twice and the bios gets confused).
See http://www.mail-archive.com/linux-acpi@vger.kernel.org/msg02785.html for an explanation of what I've changed (it refers to hp nc6400, but it has the same DSDT problems).
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
Updated: don't use bios F07 update unless you have a Core 2 Duo cpu (you need it to support that cpu), because frequency scaling doesn't work with it. I've received news about this. I have not tried it, because I have now a fully working configuration with F06 and I wouldn't break it!!

Updated (11-12-2006): you need to load speedstep-centrino module to enable cpu frequency scaling. acpi-cpufreq will not work (for kernel versions <=2.6.19). There are plans to extend acpi-cpufreq and deprecate use of speedstep-centrino, but it's not yet done.

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.
SATA controller is the source of all suspend related problems on this machine. Drivers are being developed and there are many patches on the web.
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. In AHCI mode to make suspend to disk work AHCI power management patches are needed. These can be found on >2.6.19-rc1 vanilla kernels. Ubuntu 6.10 2.6.17-10.33 kernel has this patches inside, so suspend to disk works. Suspend to disk don't need a method to resume video card operation on this notebook.
I've not yet got suspend to ram working on this notebook, even using the current -mm kernel tree (2.6.19-rc2-mm2), due to the SATA controller, in both operation modes. I've been able to resume operation of the machine (even with Xorg+AIGL+beryl actived) but the HD doesn't work after resume. Don't use vbesave savestate with this notebook as hangs the machine. Having the HD out of work after resume, makes me unable to reinitialise lcd panel backlight with vbetool post, so you will notice the screen active but without backlight (you can use an external monitor.....).
I tried also using libata-dev patches, fedora and suse development kernels, but none of them worked!


Updated: ATTENTION!!!! The fan often don't work after resume from hibernation because the thermal module is loaded using the initrd before resume from swap. This causes the thermal control to work bad.
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 for a week using intesively suspend 2 and the fan now works reliably.
Updated: SATA disk didn't wake up beacuse I had enabled Drivelock password on bios. On suspend the bios locked the drive but nobody unlocked it on resume. Using windows perhaps some 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)
now I can resume the notebook from suspend with kernel 2.6.19-rc5. Ubuntu kernel 2.6.17-10.33 don't resume well the SATA HD.
The only thing that don't work now is the screen backlight that remains powered off. 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 ;-)
Sometimes the keyboard is not reinitialised after resume. The only way to recover is use an external usb keyboard or ssh. Keyboard driver can be reset with this command:
echo -n reconnect > /sys/bus/serio/devices/serio0/drvctl
So I insert that command on hibernate suspend to ram file as:
OnResume 20 bash -c 'echo -n reconnect > /sys/bus/serio/devices/serio0/drvctl'
I've not yet tested it too much, but it seems working... see this page for updates...
There is still an APIC error on CPU1 after suspend, but I've read that it's common in many notebooks. I don't know if it's harmful.

Update: that fixes are not useful 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..
I'm using now (28-11-2006) 2.6.19-rc6 with suspend2 2.2.9 and it works reliably. This is the config with i8042 as module:
Updated: the same works with final kernel release 2.6.19
This is my /etc/default/acpi-support configuration file.
I also used the hibernate script, these are my configuration files: hibernate-conf-nx7400.tar.bz2(new - 16-11-2006)
Suspend to ram works as described using 'hibernate -F /etc/hibernate/ram.conf'.

Kernel configuration:
I tried many and many kernels with this notebook.... Now I'm using a customized vesion of ubuntu 6.10 edgy kernel 2.6.17-10.33. I've merged in this kernel ieee80211 version 1.2.15. 
I use this script to compile the custom kernel using kernel-package:
and these are kernel config files for 2.6.17, 2.6.18, 2.6.19. You can use them as a starting point:
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).
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

BIOS F08 and DSDT fix
Hp released a new version of bios that fixes the problems of F07 (no cpu frequency scaling). In addition to F06 it supports Core 2 duo cpus and new nx7400 series models.
The upgrade could be done using a bootable cdrom or from windows.
The DSDT provided with this version has only one compilation error, many of the past errors are fixed.
This is the patch:
--- DSDT.dsl 2006-12-10 15:40:36.000000000 +0100
+++ DSDT-fixed.dsl 2006-12-10 15:40:27.000000000 +0100
@@ -12965,7 +12965,7 @@
{
If (LEqual (\_SB.C002.C003.C1FD._STA (), 0x0F))
{
- CreateByteField (C1E3, \_SB.C002.C003._X0C._LEN, C08F)
+ CreateByteField (C1E3, \_SB.C002.C003.C336._X0C._LEN, C08F)
Store (0x60, C08F)
}

Thanks to: http://www.thinkwiki.org/ for all the 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