Linux on the NEC Versa P520

I provide here some notes regarding Linux on the NEC Versa P520. These notes are probably incomplete, because I've probably forgotten a step or two. Please email me if you have any questions. Also, you may want to check other Linux laptop sites, including this German Linux Wiki site and Linux on Laptops (our site is found here).

These notes may be useful for other laptops, too. In particular, if you are using a laptop with 1400 x 1050 resolution monitor and an Intel video card, then you may want to check out the Video Card section. I see by my logs that a number of my hits come from Google users with search terms "855GM" and "1400 x 1050". If you came to this page looking for information on a different laptop, check here and see if I have any specific information regarding your machine. If not, then please let me know what make and model your laptop is, how the manufacturer replied to your requests for a Video BIOS update (if appropriate) and whether the NEC Video BIOS workaround I mention below works for your laptop. I'll update this page as information comes in.

If you're interested in purchasing a laptop for Linux, I would caution against an NEC product. NEC has never satisfactorily replied to requests for fixes for a broken VBIOS. As far as they are concerned, if it works on the latest MS Windows, then it isn't broken.

Note that NEC does not claim to support Linux, although so far, their help desk has been friendly enough. But if you go with Linux, you should consider that you're on your own. This laptop has been put together for Windows XP and no other operating system. Of course, few OEMs support Linux, so this is nothing new. But the point is that here, we have a Video BIOS which is badly configured by any reasonable evaluation and NEC is reluctant to fix it.

Just ask yourself: Do I want to purchase a laptop from a manufacturer who believes that, if it works with Windows XP, then it is not mis-configured?

Preparations for Linux

My employer (the Technical University of Eindhoven) provided me with this laptop, with Windows 2000 (not XP) pre-installed and configured. I don't use Windows, but I originally chose to set it up as a dual-boot, just in case I needed Windows to do my job.

I have used Slackware for several years now (since 1996), and so I chose to install Slackware 9.0 on the laptop. Slackware's second ("extras") disk contains parted, a tool for resizing existing partitions. However, it doesn't know what to do with ntfs partitions, which is what Windows 2000 uses. Instead, I found ntfsresize, a handy tool which did the trick.

The employer had devoted the whole 40 gigabyte hard drive to two equally sized Windows partitions. Ntfsresize shrunk these partitions to 5 gigabytes each, but no further. That means that I still had 1/4 of the hard disk devoted to Windows at present. Too bad. Still, the disk is pretty damn big, so I chose to ignore that wasted space for a while.

I used fdisk to create /, /usr, /usr/local and /home partitions. You may prefer to have just one root partition. One advantage of multiple partitions is that if your hard drive goes screwy and you lose an entire partition, you may still find the others salvageable. This has happened to me recently. On the other hand, guessing the correct size of each partition can be difficult and maybe the hassle isn't worth the slight increase in safety that multiple partitions provide. When I installed Slackware 9.0, I chose a full install. What the heck, might as well use the hard drive.

The video card

Let's start with the greatest source of frustration here. The LCD on this laptop uses 1400 x 1050 resolution. The onboard video card (which uses the i855 chipset) does not report that it can use this resolution at all. The result: X must use 1280x1024 resolution on a 1400 x 1050 monitor. This gives horizontal bands of fuzziness and is hard on the eyes. The difference with Windows appearance on the same LCD is striking (but there is a fix).

Note: I don't really know diddly about video cards and XFree86. The description that follows is what I've learned while tussling with this laptop. I recommend that users search for help from the devel@xfree86 or Dri-users mailing lists.

From what I understand, Linux drivers (including Intel's own release, found here) query the BIOS of the card for its resolutions. The Windows drivers do not rely on the card's BIOS but directly set the resolution appropriately. Intel has not given the means to do this, either with their own driver or by providing the technical details to the open source community. Therefore, X can only use the modes the card reports, and this does not include the resolution of the LCD.

How to diagnose this behavior

Here's how to confirm that your laptop has the same troubling problem as mine.

First, just start X without any window manager (type X, instead of startx, for instance). This will ensure that you see the plain stippled background. If your laptop is like mine, there will be easily visible horizontal bands of fuzzy stippling. ("Do you like stippling?" "I don't know. I've never stippled.")

Alternatively, check out the logs, probably found at /var/log/XFree86.0.log. In the following snippet, you see that my monitor is 1400 x 1050.


	(II) I810(0): 2 display pipes available.
	(II) I810(0): Display Info: CRT: attached: FALSE, present: TRUE, size: (0,0)
	(II) I810(0): Display Info: TV: attached: FALSE, present: FALSE, size: (0,0)
	(II) I810(0): Display Info: DFP (digital flat panel): attached: FALSE, present: FALSE, size: (0,0)
	(II) I810(0): Display Info: LFP (local flat panel): attached: TRUE, present: TRUE, size: (1400,1050)
	(II) I810(0): Display Info: TV2 (second TV): attached: FALSE, present: FALSE, size: (0,0)
	(II) I810(0): Display Info: DFP2 (second digital flat panel): attached: FALSE, present: FALSE, size: (0,0)
	(II) I810(0): Size of device LFP (local flat panel) is 1400 x 1050
	(II) I810(0): No active displays on Pipe A.
	(II) I810(0): Currently active displays on Pipe B:
	(II) I810(0): 	LFP (local flat panel)
	(II) I810(0): Lowest common panel size for pipe B is 1400 x 1050
      
Go a little bit lower and you'll see a section beginning like so:

	(II) I810(0): Will use BIOS call 0x5f05 to set refresh rates for CRTs.
	(II) I810(0): Will use BIOS call 0x5f64 to enable displays.
	(--) I810(0): Maximum space available for video modes: 8000 kByte
	Mode: 30 (640x480)
	        ModeAttributes: 0x9b
	        WinAAttributes: 0x7
	        WinBAttributes: 0x0
	        WinGranularity: 64
	
This section goes on for some space, with a large number of modes reported. Search through the lines that look like

	Mode: 34 (1024x768)
      
If you don't see 1400 x 1050, then you face the same problem I have. Don't expect a sharp appearance when you run X. This problem is not limited to NEC Versa laptops. Others have reported similar problems with the i855, i810 or other chipsets. Some of these laptops are discussed below. Also, see this discussion on the xfree86 xpert mailing list.

The fix

Petric Frank told me about 855resolution, a fix for the VBIOS limitations of i855 cards. This fix is still experimental, but works great for me. Thanks to Alain Poirier for this.

The instructions for 855resolution can be found at that page, but there is one important step not mentioned there. Version 0.2 gives an error message when installed as is.

Try running "855resolution -l". If you see the error message

Unknow VBIOS structure
then try changing line 34 of 855resolution.c to read
*bios_type = 0;
Explicitly: change that value of -1 to 0. Then everything works just peachy, at least for me. Thanks again to Petric for that fix.

Once you have "855resolution -l" working without any error, then add the following lines to /etc/rc.d/rc.local.

echo "855 resolution fix"
/usr/sbin/855resolution 4d 1400 1050
If you're not using Slackware, then maybe /etc/rc.d/rc.local isn't the right file to edit. Sorry, I know only Slackware.

The fix for 810/815 chipsets

If you are having similar problems with an i810 or i815, then you might want to look into the i810fb module, which comes with the 2.6.6 kernel. This framebuffer module allows one to force the video card into a resolution which is not reported in the BIOS. Check out the Sourceforge project page for this module.

Less perfect workarounds

If you can't get 855resolution to work for you, then poke around your BIOS at boot time. Koen Vossen pointed out that the NEC Versa P520 has a BIOS setting not to stretch the display to fit the LCD. It's the stretching that causes the fuzzy display. You can edit the setting by hitting F2 at boot time, while the ugly-ass NEC splash screen is showing.

If you disable the stretching, then your 1280 x 1024 resolution will be displayed in the center of the LCD with black bands around the border. Not perfect, but workable. I used this for months before 855resolution was available. With the NEC Versa P520, you can even change whether the image is stretched or not while the laptop is running. Hit CTRL-ALT-F5 to toggle stretching.

(In fact, Koen discovered the BIOS entry after accidentally discovering the toggle. When running X, CTRL-ALT-F5 switches to virtual console 5. This laptop has hijacked those keys to instead change the behavior of the LCD (hit it twice without letting up on the CTRL-ALT keys to go to virtual console 5). No one in NEC apparently remembers this feature either -- at least no one I talked to.)

XF86Config

Here's my XF86Config file, found in /etc/X11 on Slackware.

Other laptops with similar issues

I'll update this section as I get feedback about other models of laptops with similar issues.

If your laptop is not listed above and you've confirmed that it has the same video problems I've discussed here, drop me a line. I'll list your laptop here so that others can find this information more easily via Google.

Other configuration issues for the Versa P520

So, the resolution is a bit of a problem. What about the rest of the laptop? How's it work? Pretty well. No real complaints.

Sound card

There were no configuration issues regarding the sound card. Slackware did everything for me, so that I had sound support on the first boot. The loaded modules are i810_audio and ac97_codec.

Subsequently, however, a serious problem arose. I've found that sometimes I have no sound on boot-up. Worse, sometimes when I have sound at bootup, I later lose it. I see the following entry in /var/log/syslog:

Nov 2 21:53:48 euclid kernel: ALSA intel8x0.c:599: codec_read 0: semaphore is not ready for register 0x32

As far as I can tell, all of the drivers are loaded. A reboot usually fixes the problem. If anyone else sees similar behavior or, better, has a fix for it, let me know. The problem does not seem to be related to Linux. I have gone back to the OSS modules, and also gone to the latest ALSA modules, the 2.6 kernel, everything I can think of. The problem has not gone away.

Some time before I noticed the problem, I had "upgraded" my BIOS, using a BIOS found at their site. I don't know if that's relevant at all. NEC insists that the BIOS on their site is the same BIOS that was put on the machine (although, months ago they told me it was an upgrade which might solve the VBIOS problem). Koen Vossen reports that he has similar experiences. He flashed his BIOS with the same file as I used and then started experiencing semaphore errors.

I don't know the source of the error for sure, but maybe it's a hardware error. I have returned my laptop to my employer for repair a couple of times. This has included installation of a new sound card. Right now, my employer says that they can't recreate the bug in Windows and NEC won't do anything more to repair it. However, since the loaner laptops they have given me work with exactly the same Slackware 9.1 distribution and exactly the same configuration, I don't view this as a Linux issue. It must be either a hardware or firmware issue, as near as I can figure. Just to be sure, I did something that I have never done before: I reinstalled Linux. Naturally, the problem remained.

You don't solve problems by reinstalling Linux. Maybe you solve problems by reinstalling Windows (at least, for a while).

In any case, the error persists with that laptop. My solution is to keep the latest loaner laptop and let my employer lose my laptop in the pile of problem laptops. If you're seeing the same semaphore error with your card, then I don't have much advice, but I'd like to hear from you.

Kasper Daniel Hansen has told me about his semaphore problems, which he thinks may be related to acpi's suspend-to-disk functionality. I have never played with that functionality, so his problem is distinct from mine, but you can read about it.

Onboard network card

This did not work out of the box. The card uses the e1000 driver, which is part of Slackware's standard distribution, but that module didn't work for me. I had to go to Intel for a driver. This driver works perfectly. Unfortunately, even from the e1000 page, it's not really obvious where the driver can be downloaded. I used this link.

The stock driver in the Linux 2.6.6 kernel works fine. If you use such a recent kernel, you shouldn't have to download another driver.

Onboard wireless card

For this, I recommend Intel's open source Centrino driver (still experimental, I think). You could also try the Linuxant wrapper. Koen has tried it out and assures that it works. As I understand it, it has a 30-day trial period and is thereafter available for $19.95. See the Linuxant store for details.

As well, there is another free solution available, too. The ndiswrapper project works with our onboard wireless card, although I had occasional problems with this one.

In any case, now that Intel's released a driver, I don't see much reason to use a third party solution.

Modem

Sorry, I haven't tried the modem. No idea if it works easily or not.

Keyboard

The keyboard has a combination backslash-pipe key in the lower left hand corner. When I installed Slackware, this key was mis-configured as a greater-than/less-than key. Fixing this requires two different steps, one for the console and the other for X.

For the console:
In Slackware, put the following commands in /etc/rc.d/rc.keymap.
    loadkeys << EOF
    keycode 86 = backslash
    shift keycode 86 = bar
    EOF
    
Make sure the file is executable. For other distributions, you want to put those commands in whatever scripts are executed at startup.
For X:
Create a file .Xmodmap in your home directory and put the following in it.
    keycode 94 = backslash bar
    
In fact, I also put these in my .Xmodmap, since I got tired of always hitting the CapsLock key.
    remove Lock = Caps_Lock
    keysym Caps_Lock = Control_L
    add Control = Control_L
    
These have the effect of re-defining CapsLock as an additional Control key.

I don't know offhand how to fix X globally. I'm the only user on my laptop (aside from root), so I didn't look deeply into that problem.

Recent CD woes?

Lately, I have suffered some problems playing audio CDs. Every day or so, while listening to music in xmms, my drive starts acting up. /var/log/syslogreports:
    Jul  1 14:08:23 euclid kernel: cdrom: dropping to single frame dma
    
I've no idea what started this. My cdrom works if I rmmod ide_cd and then modprobe it.

I'm running a 2.6.7 kernel these days to try and fix this problem, but it didn't do it. I've seen others report this error message, too, but nothing concrete about fixes. Let me know if you've seen and fixed this error.

Anything missed?

If there are any other issues regarding this laptop, drop me a line. The above is about all I did to prepare my NEC Versa P520 for Linux.


Jesse F. Hughes
Last modified: Sat Jul 3 22:25:43 CEST 2004