XPS13, Linux, suspend and Intel Rapid Start Technology

As an addendum to my previous post on how to install Debian Sid on the XPS13, I’ve been having issues with suspend – the laptop would sporadicaly not go to sleep properly on lid close, or it wouldn’t come out of suspend afterwards.

I seem to have found a solution for both:

  • The laptop suspends correctly after upgrading the xserver-xorg-video-intel driver to the version available in experimental, and upgrading the kernel to kernel 3.9 rc 6 (which contains a bunch of fixes for Ivy Bridge, and the touchpad driver comes built-in). You’ll need to manually build this kernel as detailed in the Debian Kernel Handbook.
  • The not waking up part seems to have been caused by the Intel Rapid Start Technology (iRST in short), which basically is an (S4) hibernate triggered from the BIOS a short while after you put the laptop in (S3) suspend (you never see this from the OS side). The laptop will dump the memory contents to a special partition on the harddisk and shutdown completely. Very good for battery life, less so for waking up from suspend – sometimes it would be instantaneously, sometimes it would take a minute or two, and at other times it just wouldn’t do anything.
    After disabling this in the BIOS the laptop works as expected.
    (you can find more about iRST and Dell here)

Dell XPS 13 and Debian Sid

I purchased a Dell XPS 13 Ultrabook, to replace my ageing Apple Macbook 2,1. After six years of daily use, it’s (over)due to retire.

The reasons for not going for another Apple product:

  • I don’t agree with their behaviour in the various markets where they’re competing. It’s competing, Apple, not sueing for the smallest tidbit. Want to survive, innovate.
  • I no longer use OSX. Linux all the way, baby.
  • Seriously overpriced hardware for the same specifications. The only thing going for them is the screen resolution on the Retina models.

Extra reasons to go for the XPS 13:

  • Nice extra discount through work.
  • Very nice screen resolution on a 13″. Not quite up to retina specs yet, but this is good enough ;)
  • Ultrabook. Light. Long battery.
  • SSD, and loads of RAM

Spec comparison:

Apple Macbook 2,1Dell XPS 13 (2013)
Weight:2.3kg1.03kg
Screen resolution:1200×8001920×1200
Memory:2GiB8GiB
Storage:80GiB HDD256GiB SSD
CPU:Core2Duo 2GHzCore i5-3337U
Battery life:3-4 hours7-8 hours

The laptop arrived in a sortof-stylish black Dell box, unfortunately taped over with all kinds of deliver stickers. Oh well.

The box it was shipped in

The box it was shipped in

Inside you can see the box for the power cord, and the box with the actual laptop. Nicely packaged, pluspoints here, Dell ;)

Nicely packaged

Nicely packaged

Fancy Dell box containing the actual laptop

Fancy Dell box containing the actual laptop

The actual laptop. Wrapped in plastic, protected with foam

The actual laptop. Wrapped in plastic, protected with foam

All unpacked and ready to rock!

All unpacked and ready to rock!

It’s also a bit smaller than my old Macbook, although they’re both rated as being 13″ laptops.

Dell XPS13 on top of my Macbook 2.1. Bit smaller. A lot lighter.

Dell XPS13 on top of my Macbook 2.1. Bit smaller. A lot lighter.

Unfortunately, the laptop I got shipped originally had some issues: plenty of backlight bleeding, and a wifi module that was broken – it would detect a wireless network for 1-2 minutes after powerup, and then nothing.
I called Dell, they sent round a technician… but after this repair, it was completely dead. So they shipped me a replacement, on which I’m typing this blog-post.

Back to the actual laptop – it’s a nice piece of hardware, but the Core i5 version comes shipped with Windows 8, unfortunately. Luckely for us, it’s easy to put something else on (or next) to it ;)
(note: the Core i7 version is the ‘developer’ version, which is shipped with Ubuntu! :D It’s called Project Sputnik)

Steps to shrink the Windows 8 partition (if you want to keep it around, otherwise you can just wipe the entire SDD. Don’t forget to first create some recovery images, though!):

  • Disable hibernate: open a command prompt (in admin mode) and type: powercfg /H off
  • Disable the windows pagefile (you can do this in Control Panel – System – Advanced Settings)
  • Disable system restore (ditto)

A reboot later, you should be able to shrink the partition to the minimum required (I left it around 50GiB). If you don’t disable all that crap, Windows will only allow you to shrink down to around 110GiB, which is frankly ridiculous.
You can enable everything again after shrinking the partition.

This will leave us with a nice amount of storage to put Linux on.

Now, download the Debian Testing latest weekly dvd 1 for amd64. You’ll also need a USB stick of 8GiB (4.5 is needed). Format that stick as FAT32, and copy the content of the DVD image on the stick (not the actual ISO).

After this is done, you can reboot the laptop. When you see the Dell logo flash on the screen, quickly hit F12 (repeatedly). This will present you with the boot menu, where you can choose what to boot. I recommend to pick ‘Legacy mode’, and from there ‘USB storage’. Normally this will boot the Debian installer from the memory stick.

To install Debian, I refer you to the Debian Installation Manual, an excellent document that details all the steps. Just be careful not to wipe out the existing Windows partition, should you want to keep it ;)

Some time later, you’ll get to reboot the system, and Debian should be the default choice to boot with the UEFI boot manager ;)

At this point it’s also highly recommended to add unstable and experimental sources to your /etc/apt/sources.list file – the testing distribution just installed it – ahem – slightly outdated in software terms, and we’ll definitely need a new kernel.

Add this to /etc/apt/sources.list (replacing XX with your two-letter country code):

deb http://ftp.XX.debian.org/debian/ sid main contrib non-free
deb http://ftp.XX.debian.org/debian/ experimental main contrib non-free
deb-src http://ftp.XX.debian.org/debian/ experimental main contrib non-free

Do an apt-get update && apt-get dist-upgrade and you’re good to go on the packages. For a newer kernel, do apt-cache search linux-image and check for the latest kernel release, right now that is linux-image-3.8-trunk-amd64, which you can install with apt-get install -t experimental linux-image-3.8-trunk-amd64.

Now, to fix some of the issues I’ve encountered:

Non-functional wifi
On another laptop (or in Windows), download the firmware-iwlwifi package. Install it – a reboot later you should be able to configure the wireless interface. You might also need wpasupplicant if you use encryption on your network. (I’m lazy, so I downloaded all the packages needed for wicd and configured stuff that way.)

Laptop wakes from suspend out of the blue
I’ve encountered a few times that the machine came out of suspend without any trigger from me – highly annoying (and dangerous, should this happen while the machine is in a backpack and start to heat up). I’ve found this Bug report on Launchpad about it. The fix seems to be to disable “Smart Connect” in the BIOS. I’ve tried it here, seems to work.

Touchpad isn’t recognized as a touchpad
The patches to support the touchpad are on route to be included in kernel 3.9, but (at the time of writing) that one hasn’t been released yet. So we need to take the latest kernel available in Debian Experimental (3.8.5) and patch this with the driver. Luckely Debian has The Linux Kernel Handbook which explains how to do all this the proper Debian way ;)

First, install the necessary build packages: apt-get install build-essential fakeroot devscripts && apt-get build-dep linux-3.8
Next, get the kernel sourcecode: apt-get source linux-image-3.8-trunk-amd64 -t experimental
Download the patches too: wget 'https://patchwork.kernel.org/patch/1859901/raw/' -O /usr/src/cypress-touchpad-v7.patch and wget 'https://patchwork.kernel.org/patch/1859901/raw/' -O /usr/src/cypress-touchpad-v7.patch
Now, go to the source directory cd /usr/src/linux-3.8.5 and execute the script to rebuild the kernel with the two patches:  bash debian/bin/test-patches ../cypress-touchpad-v7.patch ../increase-struct-ps2dev-cmdbuf-to-8-bytes.patch
Now go eat a pizza, make some coffee, solve a theorem or so. It’ll take a bit. When it finishes, you’ll have another shiny kernel in /usr/src, which you can install with dpkg -i linux-image-3.8-trunk-amd64_3.8.5-1~experimental.1a~test_amd64.deb And Bob’s your uncle.

Brightness level doesn’t stick after a suspend/resume
For this I made a custom suspend-resume hook for pm-utils. Add the following script as /etc/pm.d/sleep.d/00backlight

#!/bin/bash

SYSFS=/sys/class/backlight/intel_backlight
TMP=/var/tmp/backlight-restore

case $1 in
“suspend”|”hibernate”)
echo “Saving backlight brightness level…”
cat $SYSFS/actual_brightness > $TMP
;;
“resume”|”thaw”)
if [ -e $TMP ]; then
echo “Restoring backlight brightness level…”
cat $TMP > $SYSFS/brightness
rm $TMP
else
echo “No brightness level save file found.”
fi
;;
*)
echo “Dunno what you’re trying…”
exit 1
;;
esac

This script will read the backlight brightness level upon suspend, and store it in a file in /var/tmp. Upon resume, the value is read from the file and the brightness level set to it.

The permanent fix is also scheduled for kernel 3.9.

Unreadable (way too tiny) fonts in applications
This is actually a drawback from having a high-resolution screen: a lot fits on it, but the fonts are tiny.
I had the issue mostly in Opera, IceDove (a rebranded Thunderbird) and XTerm, my X Terminal of choice.

In Opera you can just set the default zoom level. I put this at 120%, everything is readable now.
For Thunderbird, I can advise installing the ViewAbout extension, and then looking in View -> ViewAbout -> about:config for the setting layout.css.devPixelsPerPx, and setting this to “1.2”.
For XTerm, I added this to .Xresources (in my home directory):

XTerm*faceName: Dejavu Sans Mono
XTerm*faceSize: 11

so that XTerm uses the Dejavu Sans Mono truetype font, size 11, instead of the default.

Running Linux on a Dell Latitude D610

This page documents my attempts (and successes!) to get Linux fully working on a Dell D610 laptop.

NOTE: The information contained herein assumes that you know how to work from the commandline, patch kernels and compile programs.

DISCLAIMER: This information is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. If you fry your system by using this information that’s _your_ problem. Not mine. I accept no responsability for what happens with this information whatsoever.

Update notes

I no longer have access to the Dell Latitude D610 laptop since I changed work, so I can no longer update this page. I’ll keep it up as a reference.

Technical Specifications

Intel Pentium M processor (1024KB L2 Cache), supports Enhanced Intel SpeedStep
Intel PRO/Wireless 2915AB network connection
Intel 915 chipset
Standard 512MB DDR SDRAM, upgradeable to max. 2048MB
Toshiba MK8026GA – 80GB Ultra ATA/100 HDD
14.0″ SXGA+ TFT colour LCD, 1400×1050, 16.7M colours
Intel 915 video chip, up to 128mb shared memory
SoundBlaster-Pro and MS DirectSound compatible
10/100/1000Mbps Fast Ethernet; Wake-on-LAN ready
56K ITU V.92 data/fax software modem; Wake-on-Ring ready
Integrated Bluetooth

PCI Specs

0000:00:00.0 Host bridge: Intel Corporation Mobile 915GM/PM/GMS/910GML Express Processor to DRAM Controller (rev 03)
0000:00:02.0 VGA compatible controller: Intel Corporation Mobile 915GM/GMS/910GML Express Graphics Controller (rev 03)
0000:00:02.1 Display controller: Intel Corporation Mobile 915GM/GMS/910GML Express Graphics Controller (rev 03)
0000:00:1c.0 PCI bridge: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) PCI Express Port 1 (rev 03)
0000:00:1d.0 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #1 (rev 03)
0000:00:1d.1 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #2 (rev 03)
0000:00:1d.2 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #3 (rev 03)
0000:00:1d.3 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #4 (rev 03)
0000:00:1d.7 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB2 EHCI Controller (rev 03)
0000:00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev d3)
0000:00:1e.2 Multimedia audio controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) AC'97 Audio Controller (rev 03)
0000:00:1e.3 Modem: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) AC'97 Modem Controller (rev 03)
0000:00:1f.0 ISA bridge: Intel Corporation 82801FBM (ICH6M) LPC Interface Bridge (rev 03)
0000:00:1f.2 IDE interface: Intel Corporation 82801FBM (ICH6M) SATA Controller (rev 03)
0000:02:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5751 Gigabit Ethernet PCI Express (rev 01)
0000:03:01.0 CardBus bridge: Texas Instruments PCI6515 Cardbus Controller
0000:03:01.5 Communication controller: Texas Instruments PCI6515 SmartCard Controller
0000:03:03.0 Network controller: Intel Corporation PRO/Wireless 2915ABG MiniPCI Adapter (rev 05)

Here’s a detailed pci listing.

Linux 2.6.x kernel

The latest 2.6 kernel is: 2.6.39.4.
Here’s my 2.6.15.6 kernel configuration.

USB

Hardware: this is the Intel 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB chip.

USB worked out of the box by loading the following modules:

  • usb-uhci (USB 1.x support)
  • ehci-hcd (USB 2 support)
  • usbcore (which is automatically loaded by the previous ones)

It is advisable to install the hotplug system so the necessary modules are loaded upon plugging. For Debian, install the hotplug package.

These days you’re actually better of installing the udev package, which also handles hotplug.

10/100/1000 MBit ethernet LAN

Hardware: this is a Broadcom Corporation Broadcom Corporation NetXtreme BCM5751 Gigabit Ethernet chip.

Lan also worked out of the box, using the tg3 module.

Soundcard

Hardware: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) AC’97 Audio Controller

What can I say? It worked perfectly with the ALSA module called snd_intel8x0 module.

For Debian, install the alsa-base and alsa-utils packages.

VGA Framebuffer console

Hardware: Intel Corporation Mobile 915GM/GMS/910GML Express Graphics Controller

You can use the intelfb framebuffer driver (titled Intel 830M/845G/852GM/855GM/865G support which comes included with the kernel.

To use it, specify this on your kernel command line: video=intelfb:mtrr,noaccel vga=0x834.

VGA XFree86/X.Org

Hardware: Intel Corporation Mobile 915GM/GMS/910GML Express Graphics Controller

To make it working just set your video driver to i810:

		Section "Device"
			Identifier	"Generic Video Card"
			Driver		"i810"
		EndSection

The screen section looks like this:

		Section "Screen"
			Identifier	"Default Screen"
			Device		"Generic Video Card"
			Monitor		"Generic Monitor"
			DefaultDepth	24
			SubSection "Display"
				Depth		24
				Modes		"1400x1050" "1024x768"
			EndSubSection
		EndSection

To get the 1400×1050 resolution working, you have to patch the video bios. There’s a utility for that called 915resolution.
(for debian install the 915resolution package). The command to run at every bootup is 915resolution 3c 1400 1050.
After this, X will accept the resolution.

Here’s my complete xorg.conf file

TV Out

This is rumored to work with the standard i810 X.Org driver. Not tested.

Modem

Hardware: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) AC’97 Modem Controller – Winmodem.

This modem can be gotten to work using the Linuxant HSF Softmodem drivers. Unfortunately, they are payware.
They also have a limited-speed test driver, you can see if that works for you before deciding to buy the driver.

NOTE: You have to compile your kernel without CONFIG_4KSTACKS! If you use this driver with 4K stacks enabled, it _will_ crash your system!

CDRW/DVDRW

Hardware: SONY DVD+-RW DW-Q58A.

To get this device working with the SATA driver, put libata.atapi_enabled=1 in your kernel parameters, in your boot loader (which usually is /etc/lilo.conf or /boot/grub/menu.lst.

You can use /dev/scd0 (the cdrom device) directly for cd burning.

BlueTooth

Hardeware: Dell Wireless 350 Bluetooth – connected to the USB bus.

Works perfectly with the bluez and hci-usb modules. In fact, if you install hotplug the driver will be loaded automatically if you press the bluetooth button!

Debian users might want to install the buetooth package.

Harddisk

Hardware: Toshiba MK8026GA

I’m not sure if this drive is a SATA or a PATA drive, but it’s behind the SATA bus. As such, you need to activate the SCSI SATA driver ata_piix.

DMA is automagically enabled. I use hdparm to set an extra parameter: hdparm -F /dev/sda

Explanation:

  • -F: set security-freeze (so that nothing can accidentily lock your disk with a password)

For Debian; check the hdparm package.

Speedstep

You need this if you don’t want your CPU to eat your batteries empty. It’s included in the kernel config.

It works perfectly after loading the speedstep-centrino and any of the cpufreq- modules.

You can either install the cpufreqd daemon, or use the cpufreq_ondemand module (which modulates the speed by requirement).
I use this init script to setup everything at bootup.

For Debian, check the cpufreqd or powernowd packages.

Wireless Lan

Hardware: Intel Corporation PRO/Wireless 2915ABG MiniPCI Adapter

Driver status: native linux driver available at http://ipw2200.sourceforge.net/

The native driver works out of the box. Just extract, compile (using make; make install) and run modprobe ipw2200.
For information on how to configure your wlan card, please see the above website.

If you want your nifty wlan led to light, add led=1 to the modprobe line, or add options ipw2200 led=1 to a file in /etc/modprobe.d/.

For Debian there are the ipw2200-source and ieee80211-source packages available, which simplifies following up on new releases.

PCMCIA

Hardware: Texas Instruments PCI6515 Cardbus Controller

You have to install the pcmciautils package, and enable the yenta_socket module in the kernel.

For Debian, check the pcmciautils package.

SmartCard reader

Hardware: ??

Not tested at the moment.

Infrared

Works with the FIR smsc-ircc2 module.

To get the smsc-ircc2 module, you need to enable ISA Support in the Bus Options menu.

Here’s what you need to do:

  1. Enable the port in the BIOS, and assign it to e.g. COM2
  2. Disable the tty port in linux: setserial /dev/ttyS1 uart none
  3. Load the smsc-ircc2 module with the correct parameters: modprobe smsc-ircc2 ircc_irq=3 ircc_dma=3 ircc_sir=0x2f8 ircc_fir=0x280
  4. Launch irattach on the irda0 device: irattach irda0 -s

For Debian, I advise the irda-utils package.

Multimedia Keys

This laptop has several ‘function’ and ‘multimedia’ keys, which are not mapped by the bios but generate scancodes.
These include:

  • Volume up (Fn-PgUp)
  • Volume down (Fn-PgDown)
  • Mute (Fn-End)
  • Hibernate (Fn-F1)
  • Battery (Fn-F3)
  • Eject CD (Fn-F10)

Normally the Mute, Eject CD, Battery and Hibernate buttons don’t generate key-up events, causing the, to ‘hang’. You can solve that problem by using this kernel patch. (apply it by using cat d610-fnkeys-fix.patch | patch -p1 in the kernel sourcedir)

The last three keys generate scancodes, but no keycodes by default. To fix this, you can map them using setkeycodes. You can also use this init.d script.

I used the hotkeys for it, with this delld610.def file in /usr/share/hotplug/ and then starting hotkeys as
hotkeys --no-splash --cdrom-dev=/dev/scd0 --osd=off from your .xsession file. I also use a seperate script to get the ACPI Battery status into a kdialog window, this is mapped to the Battery Status key.

Debian users can install the hotkeys package.

Thanks to Alexander Wintermans for the extra info on getting this to work.

Software Suspend

Not yet tried.

Suspend to RAM

This works pretty well – there are some caveats to take note off tho:

This site has some hints with respect to the SATA side of suspending.

On kernels < 2.6.16 you have to apply this patch to get the SATA suspend/resume to work.

To get the display back to life, you have to use vbetool (debian package vbetool).

I use the following suspend script in /etc/acpi/events (which is triggered when I press my suspend button), and this suspend2ram script to do the actual suspending.

Touchpad in XFree86/X.Org

This is a ALPS touchpad. You can use it with this driver.
Extract from the INSTALL file:

1. Copy the driver-module "synaptics_drv.o" into the XFree-module path
"ex. /usr/X11R6/lib/modules/input/".

2. Load the driver by changig the XFree configuration file through
adding the line 'Load "synaptics"' in the module section.

3. Add/Replace in the InputDevice-section for the touchpad the
following lines:

Section "InputDevice"
  Driver        "synaptics"
  Identifier    "Mouse[1]"
  Option        "Device"                "/dev/psaux"
  Option        "Protocol"              "auto-dev"
  Option        "LeftEdge"              "120"
  Option        "RightEdge"             "830"
  Option        "TopEdge"               "120"
  Option        "BottomEdge"            "650"
  Option        "FingerLow"             "14"
  Option        "FingerHigh"            "15"
  Option        "MaxTapTime"            "180"
  Option        "MaxTapMove"            "110"
  Option        "EmulateMidButtonTime"  "75"
  Option        "VertScrollDelta"       "20"
  Option        "HorizScrollDelta"      "20"
  Option        "MinSpeed"              "0.3"
  Option        "MaxSpeed"              "0.75"
  Option        "AccelFactor"           "0.015"
  Option        "EdgeMotionMinSpeed"    "200"
  Option        "EdgeMotionMaxSpeed"    "200"
  Option        "UpDownScrolling"       "1"
  Option        "CircularScrolling"     "1"
  Option        "CircScrollDelta"       "0.1"
  Option        "CircScrollTrigger"     "2"
EndSection

Change the Identifier to the same name as in the ServerLayout-section.

4. Add the "CorePointer" option to the InputDevice line at the ServerLayout section:

Section "ServerLayout"
...
InputDevice "Mouse[1]"  "CorePointer"
...

Here’s my complete xorg.conf file

Debian users can install the xfree86-driver-synaptics package (for both XFree86 and X.Org).

LID-switch problem

There’s a BIOS bug in this laptop which causes the display to stay blank when the lid is closed. As a workaround, we re-enable the LCD display after the lid has been opened again.

For this to work, you need to activate the video ACPI module.

Install this lidswitch event script in /etc/acpi/events, and lidswitch trigger script in /etc/acpi.

What we basically do is echo 0x80000001 > /proc/acpi/video/VID/LCD/state, which reactivates the LCD screen.

Links