1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>i945 backlight in libreboot</title>
<style type="text/css">
body {
font-family: sans-serif;
font-size: 1em;
background: #fff;
color: #000;
}
</style>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="glugman">
<meta name="description" content="tutorials for libreboot, the reboot library.">
<meta name="robots" content="all">
</head>
<body>
<header>
<h1 id="pagetop">i945 backlight controls on X60/T60</h1>
</header>
<p>
<a href="index.html">back to index</a>
</p>
<hr/>
<h2>Contents</h2>
<ul>
<li><a href="#x60_native_notes">X60 native graphics initialization (backlight controls)</a></li>
<li><a href="#t60_native_notes">T60 native graphics initialization (backlight controls)</a></li>
</ul>
<hr/>
<h1 id="x60_native_notes">X60 native graphics initialization (with backlight controls)</h1>
<p>
<b>The fix below was done on 5320/6 (review.coreboot.org) under src/mainboard/lenovo/x60/devicetree.cb</b>
</p>
<p>
Works on the ThinkPad X60, X60s and X60 Tablet. This change is also included by default in libreboot 6th release.
</p>
<p>
<b>Add backlight controls:</b> in <i>src/mainboard/lenovo/x60/devicetree.cb</i>, change <b>gpu_backlight</b> to <b>0x879F879E</b>
</p>
<p>
That's all! <b>This was also backported into libreboot 5th release (line 1233 in src/mainboard/lenovo/x60/i915io.c)</b>. GNUtoo (Denis Carikli)
told me about the register <b>BLC_PWM_CTL</b> and that you could set it to control backlight. I read that address using devmem2 while running the VBIOS:<br/>
<b># devmem2 0xe4361254 w</b>
</p>
<p>
When doing this, it gave back that value. The same trick was used to get backlight controls for T60 (see <a href="#t60_native_notes">#t60_native_notes</a>).
</p>
<h2>Further notes (as of 6th libreboot release, initial revision)</h2>
<p>
Reading <b>0xe4361254</b> (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 <b>lspci -vv</b> 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.
<b>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.</b>.
</p>
<p>
Intel-gpu-tools may prove useful for further debugging: <a href="http://cgit.freedesktop.org/xorg/app/intel-gpu-tools/">http://cgit.freedesktop.org/xorg/app/intel-gpu-tools/</a>
</p>
<p>
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.
</p>
<p>
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.
<b>Note: this may not be correct; he says his understanding is based on how the Lenote yeeloong works</b>.
</p>
<p>
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
</p>
<p>
phcoder (Vladimir Serbinenko) who is author of 5320 (review.coreboot.org) talks about 'duty cycle limit' and 'flickering frequency'.
</p>
<p><a href="#pagetop">Back to top of page</a></p>
<hr/>
<h1 id="t60_native_notes">T60 native graphics initialization (with backlight controls)</h1>
<p>
<b>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.</b>
</p>
<p>
This change is also included by default in libreboot 6th release.
</p>
<p>
<b>Add backlight controls:</b> in <i>src/mainboard/lenovo/t60/devicetree.cb</i>, change <b>gpu_backlight</b> to <b>0x58BF58BE</b>
</p>
<p><a href="#pagetop">Back to top of page</a></p>
<hr/>
<p>
Copyright © 2014 Francis Rowe, All Rights Reserved.<br/>
See <a href="license.html">license.html</a> for license conditions.
</p>
</body>
</html>
|