Tuesday, March 9, 2010

Introducing Spoor


Phew, I haven't updated this blog in a long time, have I? Well, I have been in some kind of a serious slump these past few years and am working on fixing myself and picking up a couple of projects on the way. This might give me more to write about in the future. For now, let me introduce you to spoor.


Without further ado, spoor is my new laptop. It's a Dell Inspiron 13z (or 1370) with an Intel ULV dual core processor, both cores clocked at 1.3ghz, 4gb of ram and nVidia G105M graphics. Here are some pictures:

She will replace nyu (my old laptop, a Dell Inspiron 630m) as my primary mobile computer. nyu is currently waiting for her replacement screen hinges since her old ones broke a couple of days ago:

So far, spoor's battery life running linux has me pleasantly surprised. She can hold out on a single charge for up to 7 hours with wifi enabled and normal work load. (That's without letting her hard
drive spin down.)

There have been non-trivial problems however, namely:
  • no backlight control (backlight is at full display brightness always)
  • distorted display after switching to console / waking up from hardware suspend with drivers older than version 195.36.08
  • no fan control (fans are on always)
I have managed to find a solution for the backlight problem. A kernel module called nvidia_bl provides a /sys/class/backlight interface that works for a wide range of nvidia chips. Sadly, initial
trials suggested that mine was unsupported. "Oh well", I thought, "let's do the hackety thing", after I had noticed an unsuspicious reference to the G105M in the module's source.

Backlight fix

After adding a bit of code the module would load and using the sysctl interface it was indeed possible to change the display brightness. However, that was only within a range of *very low*
brightness levels. I figured that the problem was in the way the brightness register worked for this specific chip .. and didn't give a damn. Instead, I tweaked the module to use rather bloated values I got through trial and error for the minimum and maximum register values. It works, but if anyone out there knows of the correct way to handle this, please drop me a message.

Here is a patch:

--- nvidia_bl_orig.c 2010-02-02 22:35:41.000000000 +0100
+++ nvidia_bl.c 2010-03-08 15:20:44.793041658 +0100
@@ -44,6 +44,8 @@
#define NV5X_PDISPLAY_SOR0_BRIGHTNESS 0x0000c084
/* Driver private data structure */
struct driver_data {
/* PCI region (BAR) the smartdimmer register is in */
@@ -73,14 +75,14 @@
if (reg_value == off)
return 0;
- return (reg_value - min) * (FB_BACKLIGHT_LEVELS - 1) / (max - min);
+ return (reg_value - min) * (SPOOR_BACKLIGHT_LEVELS - 1) / (max - min);
static inline unsigned int set_intensity(unsigned int intensity, int off, int min, int max, int forceoff) {
if (forceoff)
return off;
- return min + (intensity * (max - min) / (FB_BACKLIGHT_LEVELS - 1));
+ return min + (intensity * (max - min) / (SPOOR_BACKLIGHT_LEVELS - 1));
@@ -169,8 +171,11 @@
.reg_size = 4,
.off = 0,
- .min = 50,
- .max = 1024,
+ /* hacked for spoor */
+ .min = 6628, //50,
+ .max = 138090, //1024,
.backlight_ops = {
@@ -310,6 +315,8 @@
{ PCI_VDEVICE(NVIDIA, 0x06eb), (kernel_ulong_t)&nv5x_driver_data },
/* nVidia Geforce G105M */
{ PCI_VDEVICE(NVIDIA, 0x06ec), (kernel_ulong_t)&nv5x_driver_data },
+ /* nVidia GeForce G105M on spoor */
+ { PCI_VDEVICE(NVIDIA, 0x0a69), (kernel_ulong_t)&nv5x_driver_data },
/* nVidia QuadroFX 370M */
{ PCI_VDEVICE(NVIDIA, 0x06fb), (kernel_ulong_t)&nv5x_driver_data },
/* nVidia Geforce 9400M */
@@ -386,6 +393,15 @@
static const struct dmi_system_id /* __initdata */ nvidia_bl_dmi_table[] = {
.callback = &nvidia_bl_dmi_match,
+ .ident = "Inspiron 1370",
+ .matches = {
+ DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1370"),
+ },
+ .driver_data = (void *)0x0a69, /* nVidia Geforce G105M - obtained from lspci -nn */
+ },
+ {
+ .callback = &nvidia_bl_dmi_match,
.ident = "VGN-AW11",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
@@ -529,7 +545,7 @@
/* Set up backlight device */
- nvidia_bl_device->props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
+ nvidia_bl_device->props.max_brightness = SPOOR_BACKLIGHT_LEVELS - 1;
nvidia_bl_device->props.brightness =

Unsolved problems

As for the distorted/flickering display after console switch, that has started happening only after a nVidia driver downgrade by my linux distribution (Arch Linux). Apparently the newer driver stopped fans from working and thus caused hardware damage. I doubt spoor has a fan
specifically for the gpu. Anyway, I will wait for another update from nVidia, I guess, since these drivers are proprietary (or use the free nouveau driver, but that's a different story).

Last but not least, there is the lack of cpu fan control. On nyu I used to be able to load the i8k module which enabled me to control the fans. spoor will just crash loading it. What's more is that Dells apparently don't use acpi to do fan control, so hacking the DSDT is out of question. I guess I will have to live with the useless noise for the time being.


All that being said, I am quite happy with spoor and am sure linux support will become better rather than worse. ;)

There are some software projects I intend to do and blog about soon. Let's see how that goes.


kenjiru said...

The brightness problem can be solved without installing any additional module. You just needed to add the following line to the "Device" section of your xorg.conf:

Option "RegistryDwords" "EnableBrightnessControl=1"

After adding the line, just restart your X server and everything will work fine, including the auto brightness dimming.

brx said...

If only that was so. :)

I admit to not having been aware of that option before, but I tried it and it doesn't seem to work with this hardware. So .. back to the module.

Thanks for making me aware of it though.

kenjiru said...

One detail, I'm using the nVidia proprietary driver 195.36.08, which has been withdrawn from the download page.

I haven't tested this option with other drivers.

Good luck!

brx said...

Thank you! :) I will try again when a new driver comes out then.

Anonymous said...

Maybe you will want to put a facebook icon to your site. Just bookmarked the article, however I had to do this manually. Simply my $.02 :)

Anonymous said...

Ek hou van hierdie post - heeltemal kewl! Goed gedoen! Ek is terug na hierdie een kom ...