Linux on Sony Vaio VPCZ12

For some time, I’ve been the more or less proud owner of a Sony Vaio VPC Z12 laptop. It’s quite a nice machine with a Core i5 CPU, a fast SSD and a superb FullHD panel at 13″. Hardware support on Linux hasn’t been great however, so it needed some fiddling to get everything working properly for me. Well, everything I care about at least.Here are some pointers that might help somebody getting things set up.

Power Consumption

Since this model has a hybrid graphics setup, essentially two graphics chips, it drains a lot of power in a default Linux setup. As I do not need the fast NVidia graphics most of the time, I switch the chip off (it’s on by default and consumes a good 10W, even when unused). Needless to say, that this vastly improves battery life.

For this to work, you need to install an updates sony-laptop Kernel module, which will also bring a bunch of other useful features. This module is based on Eva Brucherseifer’s work and continued by Norbert Preining (thanks to both for making my laptop a lot better!), you can find its latest version here. I’ll not go into the details of installing and loading the module, I think if you don’t know how to do that, I should probably not enable you to fiddle with your expensive hardware on this level.

After installing the kernel module, add a bunch of options to your grub command line, I have the following:

 root=/dev/md126p1 splash=silent quiet vga=0x31a vdso=0 i915.i915_enable_rc6=1 \

    pcie_aspm=force acpi_osi="!Windows 2006" speed_stamina=0 

Let’s look at the interesting option here:
speed_stamina: set this option to 0 for intel only (stamina), to 1 for nvidia only (speed), or two 2 if you want to choose automatically. I haven’t figured out the automatic bits, since it needs some user space components and I don’t care a lot about that at the moment. You can find a bunch of pointers on this useful page, if you’re interested in the details.
i915.i915_enable_rc6=1: This option enables a few power consumption improvements that are rather critical. If not enabled, certain devices won’t be powered down properly. If you encounter stability problems with this option enabled, try removing it.

With these options, power consumption goes down from 25W to a 15W, making the battery last about two hours longer on the road while saving the world!

Keyboard backlight, etc.

There’s a few annoyances left. Since I’m very much a nightly hacker, the keyboard backlight is a very useful thing to have — yet it doesn’t work out of the box for me. Again, the sony-laptop kernel module relieves me. It has a good bunch of interesting options, most of them nicely documented in its source code ;). By adding a bunch of actions to one of the scripts run at boot (I’m using /etc/rc.d/boot.local), we fix some issues:
This enables the keyboard backlight, and sets its timeout to 30 seconds: (use 0 as timeout setting for no timeout, 1 for 30 seconds, 2 for 60 seconds):

 echo 1 > /sys/devices/platform/sony-laptop/kbd_backlight 
echo 1 > /sys/devices/platform/sony-laptop/kbd_backlight_timeout 

If you look into /sys/devices/platform/sony-laptop/, there is a couple of other interesting files in there:
als_*: helps you using the ambient light sensor
lid_resume_control: Used to control the behaviour when the lid is opened. 0 means do nothing, 1 means resume from hibernate (S4), 2 means resume from Suspend (S3) and 3 means resume from both.
touchpad: Allows you to enable and disable the touchpad at runtime

Sound

In some cases, the laptop doesn’t switch off its internal speakers when you plug in a headphone (which can lead to rather embarrassing situations in public places, believe me). Switching the output from External speakers to headphone in “pavucontrol” (Pulseaudio’s mixer app) is able to change that, though I’m still looking for a more automatic solution here.

Touchpad setup

You may find your touchpad to be lacking some features which are rather critical for ergonomic usage, such as two-finger scrolling or tap-to-click not working. By passing a couple of options to the Xorg touchpad driver, we can enable this functionality. Try putting the following into a file /etc/X11/xorg.conf.d/50-synaptics.conf:

Section "InputClass"
        Identifier "touchpad catchall"
        Driver "synaptics"
        MatchIsTouchpad "on"
        MatchDevicePath "/dev/input/event*"
        Option  "HorizScrollDelta" "0"
        Option "TapButton1" "1"
        Option "TapButton2" "2"
        Option "RBCornerButton" "3"
        Option "VertTwoFingerScroll" "1"
EndSection

This enabled two-finger scolling, tap-to-click, scrolling on the edges and right mouse button triggering when tapping the lower right corner of the touchpad, making your machine much less frustrating to operate.

I hope these pointers make it easier for some owning the same hardware to get the best out of it.