Last update: 2012-11-17: modesetting now works
Last update: 2012-10-14: New kernel, new drivers...
Next update: 2010-08-21: note about out of date status
Next update: 2009-07-25: expand on the brightness control, more lpia packages
First update: 2009-07-15

The new setup, gma500_gfx

Since some time, Alan Cox has been working on a new, opensource poulsbo KMS driver. I decided to give it a try, and reinstalled the notebook, using Debian Wheezy - as usual, I compiled my own kernel. It works surprisingly well with kernel 3.6.1.

Graphics

VESA works, it is even faster when scrolling than the original (old-setup) driver. However, there is no external monitor support, so you'd be (much) better off using gma500_gfx driver.

gma50_gfx works, use CONFIG_DRM_GMA500=m (or y). The console has to use framebuffer, though. To get bigger fonts on the console, I've used FONT="Uni3-Terminus32x16.psf.gz" in /etc/default/console-setup. To get bigger fonts from the very beginning, I set up CONFIG_FONT_SUN12x22=y in the kernel config and fbcon=font:SUN12x22 kernel parameter (GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub).

Brightness can be set up by echoing a value to /sys/class/backlight/psb-bl/brightness.

You should use Driver "modesetting" in the /etc/X11/xorg.conf file. However, Debian driver (at the time of writing) xserver-xorg-video-modesetting 0.3.0-1 does not work and you have to get a newer version. Get version 0.5.0 from http://cgit.freedesktop.org/xorg/driver/xf86-video-modesetting/ and compile it. You need to install the packages libdrm-dev libkms-dev xserver-xorg-dev pkg-config along with all the dependencies and then ./configure; make. You need just the file xf86-video-modesetting-0.5.0/src/.libs/modesetting_drv.so - first strip it: strip modesetting_drv.so and then replace /usr/lib/xorg/modules/drivers/modesetting_drv.so with this version.

You can get the file compiled for my system here; it might (or might not) work on your system... With this, pm-hibernate works (and there is no need to save/restore the videocard state, nor change into framebuffer console), but upon resuming, the screen is garbled - you need to switch resolutions with xrandr to restore it (most likely by typing blindly). I have created a python script zoomlcd that changes resolution, while keeping aspect ratio. Use: zoomlcd + to zoom in (decrease the resolution) or zoomlcd - to zoom out (increase the resolution). I bound this commands to the zoom in/zoom out keys (Fn F9/Fn F10), and also incorporated into the hibernate script:

#!/bin/sh

brightness=`cat /sys/class/backlight/psb-bl/brightness`

sync
rfkill block all
sync
echo 3 > /proc/sys/vm/drop_caches
sync
pm-hibernate
su - garabik -c "DISPLAY=:0.0 exec zoomlcd +"
su - garabik -c "DISPLAY=:0.0 exec zoomlcd -
echo $brightness > /sys/class/backlight/psb-bl/brightness
to hibernate and:
echo mem > /sys/power/state
to sleep. Using pm-hibernate --quirk-vbemode-restore or --quirk-vbestate-restore does not restore the graphics.

3G modem works, but I had to downgrade ppp to 2.4.4rel-10.1 - the wheezy version cannot connect when called from scripts (as opposed to the command line) - see Debian bug #598551.

GPS probably works - first initialise it with:

$ screen /dev/ttyHS4 9600
AT_OGPS=2
and then get the raw data with screen /dev/ttyHS1 (hint taken from this page). The devices can be different in your case. I did not investigate the GPS further.

New setup without modesetting (obsolete)

The picture is shifted by about 2 pixels upwards - I can live with that.

You have to use Driver "fbdev" in the /etc/X11/xorg.conf file - Driver "modesetting" does not work (with xserver-xorg-video-modesetting 0.3.0-1). This unfortunately means that xrandr won't work.

Brightness can be set up by echoing a value to /sys/class/backlight/psb-bl/brightness.

External display kind of works - the results differ depending on whether you plug in the display after booting, or boot with the display attached. In the former case, only a 1024x768 rectangle is visible on the external display. In the latter case, the resolution of the internal display is set up to 1024x768 and the external is duplicated. EDID does not work - there is a kind of workaround by setting CONFIG_DRM_LOAD_EDID_FIRMWARE=y and putting options drm_kms_helper edid_firmware=edid/1920x1080.bin (assuming your monitor can take 1920x1080 resolution) in /etc/modprobe.d/drm-kms-helper.conf file. 1680x1050.bin does not work well - the console is OK, but the X11 display is cut in the middle and the halves are transposed.

Suspending and hibernating work. I am using following script

#!/bin/sh

chvt 1
sync
rfkill block all
vbstate=/var/lib/vbetool.state
vbetool vbestate save > $vbstate
sync
echo 3 > /proc/sys/vm/drop_caches
sync
pm-hibernate
vbetool vbestate restore < $vbstate
chvt 7
to hibernate and:
echo mem > /sys/power/state
to sleep. Using pm-hibernate --quirk-vbemode-restore or --quirk-vbestate-restore does not work, and the computer does not wake up from pm-suspend.

The old setup

Currently (middle 2010) I am using the laptop with not-so-updated debian unstable, kernel 2.6.33.3 and pretty much everything works. Video works (I had to compile the kernel modules and psb drivers by myself), 3G built in modem works (as /dev/ttyHS6, the battery has to be present), LCD brightness change works (with a patch to allow lower brightness than unreasonable bright default), sound card and microphone work (options snd-hda-intel model=toshiba-s06), webcam works (mplayer tv://), xrandr to set up external display works as expected. The graphic feels sluggish, though, and is outright unusable if you rotate the external display. Hibernation to disk (tuxonice) and hibernating to ram work perfectly, with echo N > /sys/class/backlight/psblvds/brightness to wake up the display after resuming (where N is a small number, let's say 3). Bluetooth works, wi-fi works (but has problems associating with some APs, while others work flawlessly). Card reader works, all the special keys are recognised (modprobe sony-laptop)

Update: with kernel 2.6.36, the kernel does not recognise 3G modem, neither wifi nor bluetooth. As if the devices were not there. I am therefore back to 2.6.33.3.

The only major issue that I have not been able to resolve is missing GPS - the kernel simply does not see the device.

First impressions

I have been a happy user of Fujitsu/Siemens P1510 for some time (and a Dell Latitude X300 before that, and an Asus EEE 701 during some short periods), so my impressions are a bit biased towards small, light notebooks.

The Sony has 2GB RAM, 60 GB HDD (unfortunately, I could not get the SSD version), 8" LCD, wifi, 2× USB, SD Card reader, bluetooth, 3G HSDPA, 1.33GHz Z520 Intel Atom CPU, external VGA and ethernet via an adapter and Windows Vista.

Installation

First things first, I booted Debian Lenny CDROM (via an external USB CD drive) and got rid of Vista immediately. I allocated 2.5GB for the swapfile (for hibernation), used reiserfs and installed base Debian. All went nice, though the kernel did not recognise neither wifi nor ethernet. After the installation, I downloaded newer kernel from lenny backports, transfered it on an USB stick and booted -- now the ethernet has been recognised. That was enough to install additional packages via web.

VGA

Now, Poulsbo VGA driver support for linux is bad -- I was prepared for some difficulties (like compiling my own X11 driver etc...), but after extensive testing and googling I found out that native driver just won't work with kernels later than 2.6.28.

Standard text mode (80x25) is fine, the resolution is so high that you do not see the pixelisation, unfortunately the screen is too wide -- wide enough to be uncomfortable (the characters are wider that their height). Framebuffer works well, but the native resolution has tiny tiny letters, almost unreadable. So good bye text console... we'll do our daily work in fullscreen xterm (or rxvt).

There are two possibilities how to run the X11 in non-native mode. One is fbdev, another one vesa. Both work well, both run on the native resolution, both are equally slow. The slowness would not be much of an issue (I am not going to play OpenArena on this), but what is crucial is that neither of them supports external display. And that is essential (yes, I do a lot of presentations).

So that left me with attempts to run native psb drivers.

The X11 driver won't work without corresponding kernel module and some binary blobs; the last kernel module available is for 2.6.28, it does not even compile with 2.6.30, due to some changes in API.

At the end, I used the method outlined at http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=30;bug=533450 I used jaunty instead of intrepid, though.

So now I am running 2.6.28, debian lenny, with X11 server from jaunty, I added psb to the /etc/modules file.

I had to add Option "IgnoreACPI" "true" to the /etc/X11/xorg.file and boot the kernel with mem=1800M.

The X feels pretty slow, but not unusably so. Running it in 16bpp mode helps a bit. It is accelerated, though -- playing video through mplayer and xv works perfectly.

The X11 server was rather unstable, from time to time (after ~1 hour of work) X11 stopped reacting to keyboard -- not even Crtl+Alt+Bksp nor Ctrl+Alt+Fn. Mouse worked, I could ssh into the machine, I could kill X with Alt+SysRq+K and blindly log in and start new X, which worked for another hour. First I thought the xmonad window manager is responsible, but after some trials and errors I booted kernel in uniprocessor mode (kernel parameter nosmp) and had no crash ever since.

Opera was still unusably slow, though. While browsing was OKish, editing forms was impossible -- it took 2 seconds from pressing a key for the character to display. Firefox was fine, though. Finally I discovered that turning xft fonts off (via about:config) helped -- without them, opera is super fast again. The glyphs are a bit jarred, unfortunately.

Wifi

ath9k in 2.6.28 worked, with some issues -- it did not see channels 12 and 13 (bad), and was fairly unstable. Bringing the interface up (ifconfig wlan0 up) before the wireless link has been established was a certain recipe for an oops (and reboot). Fortunately, there is the linux-backports-modules-2.6.28-11-generic package in ubuntu, which brings newer version of some modules (ath9k included) to 2.6.28. With this installed, wifi works perfectly. WEP works, I did not try WPA yet.

Hibernating

Works out of the box, but you have to switch off the X11 -- changing to a framebuffer console is enough. I am using following script to suspend to RAM:
#!/bin/sh
umountpy
sync
sudo chvt 1
sudo sh -c '(echo mem > /sys/power/state)'
sudo chvt 7
and this to hibernate to disk:
#!/bin/sh
umountpy
sync
sudo chvt 1
sudo sh -c '(echo shutdown > /sys/power/disk)'
sudo sh -c '(echo disk > /sys/power/state)'
sudo sh -c '(echo 3 > /proc/sys/vm/drop_caches)'
sudo chvt 7
Waking from suspend to RAM still takes a while, because the X server has to re-initialise the graphics adapter.

Using "proper" desktop environment, there will be probably an icon for these actions, displayed when logging off.

I decided to wait until poulsbo driver becomes available for kernels >=2.6.30 and then patch my kernel with TuxOnIce, which will give it better hibernate speeds.

Special keys

Audio up/down/mute works (Fn + F2,F3,F4), if you use suitable key management (I am using pyeve); nothing else (brightness Fn + F5,F6; Fn F9,F10,F12, special keys in the front) does with 2.6.28. Those special keys however do return keycodes with kernel 2.6.30, so mapping them to something useful will be possible. Until then, I can manage without.

Without poulsbo driver (console, vesa or fbdev X11) setpci -s 00:02.0 F4.B=XX, where XX∈<0, FF> (hexadecimal) (see also zbright script) can be used to change the brightness.

However, with poulsbo X11, this no longer works, but xbacklight does - so I guess that with appropriate hotkey/window manager configuration, it will work out of the box

There are these files connecting with backlight control:

Unfortunately, setting brightness to 0 results in the display still too bright for reading in twilight - with the setpci method, the brightness level was lower. I mapped brightness cycling to the otherwise unused key right to the left of spacebar (\|), and that's enough for me.

Final tuning

I installed the xmonad window manager, with a gkrellm on the right it is the ideal compibation -- the screen is so wide that the place taken by gkrellm does not matter, while a "traditional" taskbar would take up precious vertical space.

I am using following script to change LCD monitor resolution:

#!/bin/sh

x="$1" # x resolution
y="$2" # y resolution
r="$3" # refresh rate, use 60

out=`gtf $x $y $r |grep Modeline`
name=`echo $out|cut -d ' ' -f 2`
mode=`echo $out|cut -d ' ' -f 2-`
str="xrandr --newmode $mode"
$str
xrandr --addmode LVDS0 $name
xrandr --output LVDS0 --mode $name
I saved it as setmodes.sh and I am using it e.g. setmodes 1000 480 60. The native resolution is so great that there is no pixelization visible, and you do not have to turn up DPI to an insanely huge value (like 220) and using huge fonts (size 20+), which messes up layout of some pages etc... And lower resolution is easier on the CPU when playing fullscreen games :-)

HSDPA is not recognised in 2.6.28, however in 2.6.30, kernel sees the USB device. I have not investigated the matter further, having no spare SIM card. I am connecting either via Huawei 220 USB dongle (works perfectly) or bluetooth via my phone (works perfectly, but I have to issue hcitool scan at the beginning of the first connection, otherwise the phone won't be found, despite being already paired). 3g via bluetooth takes by ~10% less battery power than via USB.

You can install Ubuntu lpia packages (they are optimized for the Atom processor), e.g. from https://launchpad.net/ubuntu/karmic/lpia, they perform faster than stock debian i386 packages. However, you have to force their install: dpkg -i --force-architecture package.deb, because lpia is considered a different architecture.

lpia version of rxvt-unicode-ml definitely feels snappier. Calculating simple function (l(f(2000), where f is a recursively defined factorial) went down from 12 seconds with stock debian unstable bc to 8 seconds for the lpia version (bc_1.06.94-3ubuntu1_lpia.deb), but increased up to 20 seconds (!) with bc_1.06.94-3.1_lpia.deb.

So at the end I installed libdrm-poulsbo1_2.3.0-0ubuntu1~904um1_lpia.deb linux-backports-modules-2.6.28-11-lpia_2.6.28-11.11_lpia.deb linux-headers-2.6.28-11-lpia_2.6.28-11.41_lpia.deb linux-image-2.6.28-11-lpia_2.6.28-11.42_lpia.deb psb-modules_4.40-0ubuntu1~904um1_lpia.deb rxvt-unicode-ml_9.06-1_lpia.deb wireless-crda_1.7_lpia.deb xpsb-glx_0.18-0ubuntu1~904um1_lpia.deb xserver-xorg-video-psb_0.31.0-0ubuntu1~904um1_lpia.deb xpsb-glx_0.18-0ubuntu1~904um1_lpia.deb and xserver-xorg-video-psb_0.31.0-0ubuntu1~904um1_lpia.deb. Installing the kernel significantly improved time of resuming from suspend to RAM. (Display initialisation was much faster). Though that probably has nothing to do with gcc optimisation.