i945 backlight controls on X60/T60

back to index


Contents


X60 native graphics initialization (with backlight controls)

The fix below was done on 5320/6 (review.coreboot.org) under src/mainboard/lenovo/x60/devicetree.cb

Works on the ThinkPad X60, X60s and X60 Tablet. This change is also included by default in libreboot 6th release.

Add backlight controls: in src/mainboard/lenovo/x60/devicetree.cb, change gpu_backlight to 0x879F879E

That's all! This was also backported into libreboot 5th release (line 1233 in src/mainboard/lenovo/x60/i915io.c). GNUtoo (Denis Carikli) told me about the register BLC_PWM_CTL and that you could set it to control backlight. I read that address using devmem2 while running the VBIOS:
# devmem2 0xe4361254 w

When doing this, it gave back that value. The same trick was used to get backlight controls for T60 (see #t60_native_notes).

Further notes (as of 6th libreboot release, initial revision)

Reading 0xe4361254 (address) in Lenovo BIOS always yields FFFFFFFF, even when writing to it (and writing to it doesn't affect brightness controls). 'mtjm' on IRC found that the buttons (Fn keys) control /sys/class/backlight/acpi_video0 which has no affect on 61254 (BLC_PWM_CTL). He says intel_backlight has different values and uses the register. devmem2 works, needs checking lspci -vv for where the memory is mapped, which is different than on coreboot; mtjm found that it was 0xec061254 on his machine (X60 Tablet), and the register value is different too. This is relevant, because we still don't know how backlight controls are actually handled. We got it working by accident. We need to know more..

Intel-gpu-tools may prove useful for further debugging: http://cgit.freedesktop.org/xorg/app/intel-gpu-tools/

mtjm says 0xe4300000 is an MMIO region of the gpu (lspci -vv shows it), 0x61254 (BLC_PWM_CTL) is a documented register. Searching the kernel driver for backlight shows that in intel_panel.c this register is used (there is an XXX comment about finding the right value, where recent kernels get it from.

What we want to do is calculate a good value, instead of setting it in devicetree.cb. mtjm says about backlight physics: it has a light source , uses pulse width modulation (PWM) to turn it on/off, dimming is done by spending less time on. Note: this may not be correct; he says his understanding is based on how the Lenote yeeloong works.

mtjm goes on to say, that the register specifies the frequency used for PWM in its depending on the GPU core frequency, so it might be possible to calculate it without hardcoded laptop-specific values. Therefore, I am supposed to find out the 'display core frequency' (mtjm says there might be a register for it; also, it might be in 5320 or the replay code) and the PWM modulation frequency. https://en.wikipedia.org/wiki/Backlight#Flicker_due_to_backlight_dimming

phcoder (Vladimir Serbinenko) who is author of 5320 (review.coreboot.org) talks about 'duty cycle limit' and 'flickering frequency'.

Back to top of page


T60 native graphics initialization (with backlight controls)

The fix below was done on an earlier version of 5345 (review.coreboot.org) cherry-picked on top of 5320 checkout, but also works on the current version.

This change is also included by default in libreboot 6th release.

Add backlight controls: in src/mainboard/lenovo/t60/devicetree.cb, change gpu_backlight to 0x58BF58BE

Back to top of page


Copyright © 2014 Francis Rowe, All Rights Reserved.
See license.html for license conditions.