guillaumezin / nvidiabl

/!\ Please note that I don't maintain this repository anymore, please have a look at forked projects. /!\
82 stars 82 forks source link

Add support for Lenovo Thinkpad W510 #89

Open mspacek opened 10 years ago

mspacek commented 10 years ago

Hello! I have a Lenovo Thinkpad W510 with a Quadro FX 880M (GT216) GPU, and I suffer from this longstanding bug in Xubuntu 12.10 (but also previously in Ubuntu 10.10, 11.04, plus Xubuntu 13.10 and 14.04):

"Backlight controls of laptops with NVIDIA NVS and Quadro FX 880M GPUs no longer function while using proprietary drivers" https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers/+bug/562005

I've had this problem on every nvidia blob I've tried in the last 4 years. I'm currently running 331.20. I've used the "RegistryDwords" "EnableBrightnessControl=1" option in xorg.conf as a fix, but that results in uneven brightness increments. So, I thought I'd try removing that option and try nvidiabl instead. Here are some details:

$ lspci -nn
00:00.0 Host bridge [0600]: Intel Corporation Core Processor DMI [8086:d132] (rev 11)
00:03.0 PCI bridge [0604]: Intel Corporation Core Processor PCI Express Root Port 1 [8086:d138] (rev 11)
00:08.0 System peripheral [0880]: Intel Corporation Core Processor System Management Registers [8086:d155] (rev 11)
00:08.1 System peripheral [0880]: Intel Corporation Core Processor Semaphore and Scratchpad Registers [8086:d156] (rev 11)
00:08.2 System peripheral [0880]: Intel Corporation Core Processor System Control and Status Registers [8086:d157] (rev 11)
00:08.3 System peripheral [0880]: Intel Corporation Core Processor Miscellaneous Registers [8086:d158] (rev 11)
00:10.0 System peripheral [0880]: Intel Corporation Core Processor QPI Link [8086:d150] (rev 11)
00:10.1 System peripheral [0880]: Intel Corporation Core Processor QPI Routing and Protocol Registers [8086:d151] (rev 11)
00:16.0 Communication controller [0780]: Intel Corporation 5 Series/3400 Series Chipset HECI Controller [8086:3b64] (rev 06)
00:16.3 Serial controller [0700]: Intel Corporation 5 Series/3400 Series Chipset KT Controller [8086:3b67] (rev 06)
00:19.0 Ethernet controller [0200]: Intel Corporation 82577LM Gigabit Network Connection [8086:10ea] (rev 06)
00:1a.0 USB controller [0c03]: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller [8086:3b3c] (rev 06)
00:1b.0 Audio device [0403]: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio [8086:3b56] (rev 06)
00:1c.0 PCI bridge [0604]: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 1 [8086:3b42] (rev 06)
00:1c.1 PCI bridge [0604]: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 2 [8086:3b44] (rev 06)
00:1c.3 PCI bridge [0604]: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 4 [8086:3b48] (rev 06)
00:1c.4 PCI bridge [0604]: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 5 [8086:3b4a] (rev 06)
00:1c.6 PCI bridge [0604]: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 7 [8086:3b4e] (rev 06)
00:1c.7 PCI bridge [0604]: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 8 [8086:3b50] (rev 06)
00:1d.0 USB controller [0c03]: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller [8086:3b34] (rev 06)
00:1e.0 PCI bridge [0604]: Intel Corporation 82801 Mobile PCI Bridge [8086:2448] (rev a6)
00:1f.0 ISA bridge [0601]: Intel Corporation Mobile 5 Series Chipset LPC Interface Controller [8086:3b07] (rev 06)
00:1f.2 SATA controller [0106]: Intel Corporation 5 Series/3400 Series Chipset 6 port SATA AHCI Controller [8086:3b2f] (rev 06)
00:1f.3 SMBus [0c05]: Intel Corporation 5 Series/3400 Series Chipset SMBus Controller [8086:3b30] (rev 06)
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GT216 [Quadro FX 880M] [10de:0a3c] (rev a2)
01:00.1 Audio device [0403]: NVIDIA Corporation High Definition Audio Controller [10de:0be2] (rev a1)
03:00.0 Network controller [0280]: Intel Corporation Centrino Ultimate-N 6300 [8086:4238] (rev 35)
0d:00.0 SD Host controller [0805]: Ricoh Co Ltd MMC/SD Host Controller [1180:e822] (rev 01)
0d:00.1 System peripheral [0880]: Ricoh Co Ltd R5U2xx (R5U230 / R5U231 / R5U241) [Memory Stick Host Controller] [1180:e230] (rev 01)
0f:00.0 USB controller [0c03]: NEC Corporation uPD720200 USB 3.0 Host Controller [1033:0194] (rev 03)
17:00.0 SD Host controller [0805]: Ricoh Co Ltd MMC/SD Host Controller [1180:e822] (rev 01)
17:00.3 FireWire (IEEE 1394) [0c00]: Ricoh Co Ltd R5C832 PCIe IEEE 1394 Controller [1180:e832] (rev 01)
ff:00.0 Host bridge [0600]: Intel Corporation Core Processor QuickPath Architecture Generic Non-Core Registers [8086:2c52] (rev 04)
ff:00.1 Host bridge [0600]: Intel Corporation Core Processor QuickPath Architecture System Address Decoder [8086:2c81] (rev 04)
ff:02.0 Host bridge [0600]: Intel Corporation Core Processor QPI Link 0 [8086:2c90] (rev 04)
ff:02.1 Host bridge [0600]: Intel Corporation Core Processor QPI Physical 0 [8086:2c91] (rev 04)
ff:03.0 Host bridge [0600]: Intel Corporation Core Processor Integrated Memory Controller [8086:2c98] (rev 04)
ff:03.1 Host bridge [0600]: Intel Corporation Core Processor Integrated Memory Controller Target Address Decoder [8086:2c99] (rev 04)
ff:03.4 Host bridge [0600]: Intel Corporation Core Processor Integrated Memory Controller Test Registers [8086:2c9c] (rev 04)
ff:04.0 Host bridge [0600]: Intel Corporation Core Processor Integrated Memory Controller Channel 0 Control Registers [8086:2ca0] (rev 04)
ff:04.1 Host bridge [0600]: Intel Corporation Core Processor Integrated Memory Controller Channel 0 Address Registers [8086:2ca1] (rev 04)
ff:04.2 Host bridge [0600]: Intel Corporation Core Processor Integrated Memory Controller Channel 0 Rank Registers [8086:2ca2] (rev 04)
ff:04.3 Host bridge [0600]: Intel Corporation Core Processor Integrated Memory Controller Channel 0 Thermal Control Registers [8086:2ca3] (rev 04)
ff:05.0 Host bridge [0600]: Intel Corporation Core Processor Integrated Memory Controller Channel 1 Control Registers [8086:2ca8] (rev 04)
ff:05.1 Host bridge [0600]: Intel Corporation Core Processor Integrated Memory Controller Channel 1 Address Registers [8086:2ca9] (rev 04)
ff:05.2 Host bridge [0600]: Intel Corporation Core Processor Integrated Memory Controller Channel 1 Rank Registers [8086:2caa] (rev 04)
ff:05.3 Host bridge [0600]: Intel Corporation Core Processor Integrated Memory Controller Channel 1 Thermal Control Registers [8086:2cab] (rev 04)
$ cat /sys/class/dmi/id/sys_vendor
LENOVO
$ cat /sys/class/dmi/id/product_name
4318CTO

I added my model number to nvidia-laptops.h, like this:

NVIDIABL_DECLARE_LAPTOP_MODEL("LENOVO", "4318CTO", PCI_ANY_ID, NVIDIABL_SC_AUTO, NVIDIABL_AUTO, NVIDIABL_AUTO, NVIDIABL_AUTO), make dkms-install worked fine. I also added options thinkpad_acpi brightness_enable=0 to /etc/modprobe.d/thinkpad.conf as suggested in the README to get keyboard controls working. After a reboot, I get these relevant lines in /var/log/syslog:

Apr  1 20:52:26 Escher kernel: [   19.883588] nvidiabl: loading driver version 0.86
Apr  1 20:52:26 Escher kernel: [   19.883594] nvidiabl: LENOVO - 4318CTO model detected in DMI tables
Apr  1 20:52:26 Escher kernel: [   19.883601] nvidiabl: Supported Nvidia graphics adapter 10de:0a3c:17aa:2145 detected
Apr  1 20:52:26 Escher kernel: [   19.883629] nvidiabl: smartdimmer register at address 0xcc61c084 mapped at address 0xffffc9000305c084
Apr  1 20:52:26 Escher kernel: [   19.883630] nvidiabl: backlight type is raw
Apr  1 20:52:26 Escher kernel: [   19.883662] nvidiabl: backup register value 0x40007490
Apr  1 20:52:26 Escher kernel: [   19.883663] nvidiabl: autodetecting maximum
Apr  1 20:52:26 Escher kernel: [   19.883664] nvidiabl: using value 0x7490 as maximum
Apr  1 20:52:26 Escher kernel: [   19.883665] nvidiabl: autodetecting off
Apr  1 20:52:26 Escher kernel: [   19.883666] nvidiabl: using value 0x0 as off
Apr  1 20:52:26 Escher kernel: [   19.883667] nvidiabl: autodetecting minimum
Apr  1 20:52:26 Escher kernel: [   19.883669] nvidiabl: minimum is 5% of maximum
Apr  1 20:52:26 Escher kernel: [   19.883670] nvidiabl: using value 0x5d4 as minimum
Apr  1 20:52:26 Escher kernel: [   19.906483] mei 0000:00:16.0: setting latency timer to 64
Apr  1 20:52:26 Escher kernel: [   19.906554] mei 0000:00:16.0: irq 55 for MSI/MSI-X
Apr  1 20:52:26 Escher kernel: [    1.456616] ACPI: Invalid Power Resource to register!
Apr  1 20:52:26 Escher kernel: [   19.910640] ACPI Warning: 0x0000000000001028-0x000000000000102f SystemIO conflicts with Region \_SB_.PCI0.LPC_.PMIO 1 (20120913/utaddress-251)
Apr  1 20:52:26 Escher kernel: [   19.910649] ACPI: If an ACPI driver is available for this device, you should use it instead of the native driver
Apr  1 20:52:26 Escher kernel: [   19.910657] ACPI Warning: 0x00000000000011c0-0x00000000000011cf SystemIO conflicts with Region \_SB_.PCI0.LPC_.LPIO 1 (20120913/utaddress-251)
Apr  1 20:52:26 Escher kernel: [   19.910663] ACPI: If an ACPI driver is available for this device, you should use it instead of the native driver
Apr  1 20:52:26 Escher kernel: [   19.910665] ACPI Warning: 0x00000000000011b0-0x00000000000011bf SystemIO conflicts with Region \_SB_.PCI0.LPC_.LPIO 1 (20120913/utaddress-251)
Apr  1 20:52:26 Escher kernel: [   19.910668] ACPI: If an ACPI driver is available for this device, you should use it instead of the native driver
Apr  1 20:52:26 Escher kernel: [   19.910670] ACPI Warning: 0x0000000000001180-0x00000000000011af SystemIO conflicts with Region \_SB_.PCI0.LPC_.LPIO 1 (20120913/utaddress-251)
Apr  1 20:52:26 Escher kernel: [   19.910673] ACPI: If an ACPI driver is available for this device, you should use it instead of the native driver
Apr  1 20:52:26 Escher kernel: [   19.910674] lpc_ich: Resource conflict(s) found affecting gpio_ich
Apr  1 20:52:26 Escher kernel: [   19.915018] microcode: CPU0 sig=0x106e5, pf=0x10, revision=0x5
Apr  1 20:52:26 Escher kernel: [   19.935545] tpm_tis 00:0b: 1.2 TPM (device-id 0x0, rev-id 78)
Apr  1 20:52:26 Escher kernel: [   19.947146] microcode: CPU1 sig=0x106e5, pf=0x10, revision=0x5
Apr  1 20:52:26 Escher kernel: [   19.948435] microcode: CPU2 sig=0x106e5, pf=0x10, revision=0x5
Apr  1 20:52:26 Escher kernel: [   19.949694] microcode: CPU3 sig=0x106e5, pf=0x10, revision=0x5
Apr  1 20:52:26 Escher kernel: [   19.950986] microcode: CPU4 sig=0x106e5, pf=0x10, revision=0x5
Apr  1 20:52:26 Escher kernel: [   19.952214] microcode: CPU5 sig=0x106e5, pf=0x10, revision=0x5
Apr  1 20:52:26 Escher kernel: [   19.953406] microcode: CPU6 sig=0x106e5, pf=0x10, revision=0x5
Apr  1 20:52:26 Escher kernel: [   19.954684] microcode: CPU7 sig=0x106e5, pf=0x10, revision=0x5
Apr  1 20:52:26 Escher kernel: [   19.955988] microcode: Microcode Update Driver: v2.00 <tigran@aivazian.fsnet.co.uk>, Peter Oruba
Apr  1 20:52:26 Escher kernel: [   19.962691] wmi: Mapper loaded
Apr  1 20:52:26 Escher kernel: [   19.993807] tpm_tis 00:0b: TPM is disabled/deactivated (0x6)
Apr  1 20:52:26 Escher kernel: [   20.072007] EDAC MC: Ver: 3.0.0
Apr  1 20:52:26 Escher kernel: [   20.079394] cfg80211: Calling CRDA to update world regulatory domain
Apr  1 20:52:26 Escher kernel: [   20.137352] Non-volatile memory driver v1.3
Apr  1 20:52:26 Escher kernel: [   20.226433] kvm: VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL does not work properly. Using workaround
Apr  1 20:52:26 Escher kernel: [   20.402269] EDAC i7core: Device not found: dev 00.0 PCI ID 8086:2c50
Apr  1 20:52:26 Escher kernel: [   20.659923] thinkpad_acpi: ThinkPad ACPI Extras v0.24
Apr  1 20:52:26 Escher kernel: [   20.659927] thinkpad_acpi: http://ibm-acpi.sf.net/
Apr  1 20:52:26 Escher kernel: [   20.659929] thinkpad_acpi: ThinkPad BIOS 6NET84WW (1.45 ), EC 6MHT46WW-1.21
Apr  1 20:52:26 Escher kernel: [   20.659931] thinkpad_acpi: Lenovo ThinkPad W510, model 4318CTO
Apr  1 20:52:26 Escher kernel: [   20.660711] thinkpad_acpi: detected a 8-level brightness capable ThinkPad
Apr  1 20:52:26 Escher kernel: [   20.660900] thinkpad_acpi: radio switch found; radios are enabled
Apr  1 20:52:26 Escher kernel: [   20.660916] thinkpad_acpi: This ThinkPad has standard ACPI backlight brightness control, supported by the ACPI video driver
Apr  1 20:52:26 Escher kernel: [   20.660918] thinkpad_acpi: Disabling thinkpad-acpi brightness events by default...
Apr  1 20:52:26 Escher kernel: [   20.662635] Registered led device: tpacpi::thinklight
Apr  1 20:52:26 Escher kernel: [   20.662680] Registered led device: tpacpi::power
Apr  1 20:52:26 Escher kernel: [   20.662702] Registered led device: tpacpi::standby
Apr  1 20:52:26 Escher kernel: [   20.662728] Registered led device: tpacpi::thinkvantage
Apr  1 20:52:26 Escher kernel: [   20.665494] thinkpad_acpi: Console audio control enabled, mode: monitor (read only)
Apr  1 20:52:26 Escher kernel: [   20.666628] input: ThinkPad Extra Buttons as /devices/platform/thinkpad_acpi/input/input6

(Note that this machine is capable of 16 brightness levels in Windows 7. In the syslog, thinkpad_acpi says only 8 brightness levels are detected. I think I only get 8 levels whenever I try nouveau.)

It all looks good, and nvidiabl is listed in lsmod, yet nothing happens when I try to change brightness using the keyboard controls or the XFCE panel brightness applet. Any tips? Do I need to manually guess the backlight register and/or birghtness levels?

guillaumezin commented 10 years ago

Hi,

What happens if you type in these commands :

echo 50 | sudo tee /sys/class/backlight/nvidia_backlight/brightness echo 127 | sudo tee /sys/class/backlight/nvidia_backlight/brightness

mspacek commented 10 years ago

On Xubuntu 13.10 with nvidiabl installed from source, my model added to nvidia-laptops.h, nvidia 331.20 installed and no xorg.conf, I get this:

$ echo 50 | sudo tee /sys/class/backlight/nvidia_backlight/brightness
50
$ echo 127 | sudo tee /sys/class/backlight/nvidia_backlight/brightness
127

When set to 50, it dims quite a bit. At 127, it looks like it's around half brightness. I can tell because if I switch to a TTY (say Ctrl+Alt+1) and manipulate brightness from there with the keyboard controls, the halfway point (level 8 out of 16) is about the same as the 127 setting. However, the level usually jumps by an uneven amount the first time I adjust it after going to the TTY.

nvidia_backlight/brightness doesn't seem to allow more than 127. If I go any higher, I get this:

$ echo 128 | sudo tee /sys/class/backlight/nvidia_backlight/brightness
128
tee: /sys/class/backlight/nvidia_backlight/brightness: Invalid argument
mspacek commented 10 years ago

Also, here are some possibly relevant bits from /var/log/syslog in Xubuntu 13.10, slightly different from 12.10:

Apr  5 16:18:02 ssd kernel: [   21.426466] nvidia: module license 'NVIDIA' taints kernel.
Apr  5 16:18:02 ssd kernel: [   21.426472] Disabling lock debugging due to kernel taint
Apr  5 16:18:02 ssd kernel: [   21.427541] tpm_tis 00:09: 1.2 TPM (device-id 0x0, rev-id 78)
Apr  5 16:18:02 ssd kernel: [   21.428921] Non-volatile memory driver v1.3
Apr  5 16:18:02 ssd kernel: [   21.434213] nvidia: module verification failed: signature and/or required key missing - tainting kernel
Apr  5 16:18:02 ssd kernel: [   21.436236] thinkpad_acpi: ThinkPad ACPI Extras v0.25
Apr  5 16:18:02 ssd kernel: [   21.436240] thinkpad_acpi: http://ibm-acpi.sf.net/
Apr  5 16:18:02 ssd kernel: [   21.436243] thinkpad_acpi: ThinkPad BIOS 6NET84WW (1.45 ), EC 6MHT46WW-1.21
Apr  5 16:18:02 ssd kernel: [   21.436245] thinkpad_acpi: Lenovo ThinkPad W510, model 4318CTO
Apr  5 16:18:02 ssd kernel: [   21.438915] thinkpad_acpi: detected a 8-level brightness capable ThinkPad
Apr  5 16:18:02 ssd kernel: [   21.441577] thinkpad_acpi: radio switch found; radios are enabled
Apr  5 16:18:02 ssd kernel: [   21.441614] thinkpad_acpi: This ThinkPad has standard ACPI backlight brightness control, supported by the ACPI video driver
Apr  5 16:18:02 ssd kernel: [   21.441617] thinkpad_acpi: Disabling thinkpad-acpi brightness events by default...
Apr  5 16:18:02 ssd kernel: [   21.443777] cfg80211: Calling CRDA to update world regulatory domain
Apr  5 16:18:02 ssd kernel: [   21.444996] vgaarb: device changed decodes: PCI:0000:01:00.0,olddecodes=io+mem,decodes=none:owns=io+mem
Apr  5 16:18:02 ssd kernel: [   21.445257] [drm] Initialized nvidia-drm 0.0.0 20130102 for 0000:01:00.0 on minor 0
Apr  5 16:18:02 ssd kernel: [   21.445273] NVRM: loading NVIDIA UNIX x86_64 Kernel Module  331.20  Wed Oct 30 17:43:35 PDT 2013
Apr  5 16:18:02 ssd kernel: [   21.449646] thinkpad_acpi: Console audio control enabled, mode: monitor (read only)
Apr  5 16:18:02 ssd kernel: [   21.451626] input: ThinkPad Extra Buttons as /devices/platform/thinkpad_acpi/input/input6
Apr  5 16:18:02 ssd kernel: [   21.452112] ACPI Warning: 0x0000000000001028-0x000000000000102f SystemIO conflicts with Region \_SB_.PCI0.LPC_.PMIO 1 (20130517/utaddress-251)
Apr  5 16:18:02 ssd kernel: [   21.452121] ACPI: If an ACPI driver is available for this device, you should use it instead of the native driver
Apr  5 16:18:02 ssd kernel: [   21.452131] ACPI Warning: 0x00000000000011c0-0x00000000000011cf SystemIO conflicts with Region \_SB_.PCI0.LPC_.LPIO 1 (20130517/utaddress-251)
Apr  5 16:18:02 ssd kernel: [   21.452137] ACPI: If an ACPI driver is available for this device, you should use it instead of the native driver
Apr  5 16:18:02 ssd kernel: [   21.452140] ACPI Warning: 0x00000000000011b0-0x00000000000011bf SystemIO conflicts with Region \_SB_.PCI0.LPC_.LPIO 1 (20130517/utaddress-251)
Apr  5 16:18:02 ssd kernel: [   21.452146] ACPI: If an ACPI driver is available for this device, you should use it instead of the native driver
Apr  5 16:18:02 ssd kernel: [   21.452149] ACPI Warning: 0x0000000000001180-0x00000000000011af SystemIO conflicts with Region \_SB_.PCI0.LPC_.LPIO 1 (20130517/utaddress-251)
Apr  5 16:18:02 ssd kernel: [   21.452155] ACPI: If an ACPI driver is available for this device, you should use it instead of the native driver

...

Apr  5 16:18:02 ssd kernel: [   21.543606] nvidiabl: loading driver version 0.87
Apr  5 16:18:02 ssd kernel: [   21.543614] nvidiabl: LENOVO - 4318CTO model detected in DMI tables
Apr  5 16:18:02 ssd kernel: [   21.543626] nvidiabl: Supported Nvidia graphics adapter 10de:0a3c:17aa:2145 detected
Apr  5 16:18:02 ssd kernel: [   21.543660] nvidiabl: smartdimmer register at address 0xcc61c084 mapped at address 0xffffc90003060084
Apr  5 16:18:02 ssd kernel: [   21.543662] nvidiabl: backlight type is raw
Apr  5 16:18:02 ssd kernel: [   21.543726] nvidiabl: backup register value 0x4001145d
Apr  5 16:18:02 ssd kernel: [   21.543729] nvidiabl: autodetecting maximum
Apr  5 16:18:02 ssd kernel: [   21.543731] nvidiabl: using value 0x1145d as maximum
Apr  5 16:18:02 ssd kernel: [   21.543733] nvidiabl: autodetecting off
Apr  5 16:18:02 ssd kernel: [   21.543735] nvidiabl: using value 0x0 as off
Apr  5 16:18:02 ssd kernel: [   21.543737] nvidiabl: autodetecting minimum
Apr  5 16:18:02 ssd kernel: [   21.543739] nvidiabl: minimum is 5% of maximum
Apr  5 16:18:02 ssd kernel: [   21.543740] nvidiabl: using value 0xdd1 as minimum

...

Apr  5 16:18:02 ssd nvidia-persistenced: Started (1138)
Apr  5 16:18:02 ssd acpid: client connected from 1202[0:0]
Apr  5 16:18:02 ssd acpid: 1 client rule loaded
Apr  5 16:18:02 ssd nvidia-persistenced: Failed to query NVIDIA devices. Please ensure that the NVIDIA device files (/dev/nvidia*) exist, and that user 999 has read and write permissions for those files.
Apr  5 16:18:02 ssd nvidia-persistenced: The daemon no longer has permission to remove its runtime data directory /var/run/nvidia-persistenced
Apr  5 16:18:02 ssd nvidia-persistenced: Shutdown (1138)