archfan / coreboot

Coreboot for Lenovo Thinkpad T440P with additional patches
GNU General Public License v2.0
14 stars 2 forks source link

Backlight function doesn't work #1

Open archfan opened 4 years ago

archfan commented 4 years ago

ecdiff kbl_on2.txt kbl_on1.txt kbl_off.txt

The original Lenovo firmware allows changing keyboard backlight parameters with ectool

low brightness sudo ./ectool -w 0xd -z 0x42

high brightness sudo ./ectool -w 0xd -z 0x82

disable backlight sudo ./ectool -w 0xd -z 0x02

On coreboot this doesn't work at all. The backlight stays off in any case.

0xSigi commented 4 years ago

Hey! Can you test and see if force loading a thinkpad_acpi solves this issue? To do it you'd need to create a thinkpad-acpi.conf file in /etc/modprobe.d that contains "options thinkpad_acpi force_load=1" without quotes, after that reboot your machine and test again. If this won't work we can try to manually control this via conf file.

dwzg commented 4 years ago

Regarding thinkpad_acpi: While testing, I realized that thinkpad_acpi has issues detecting the EC version of a T440p running coreboot. I found, that thinkpad_acpi expects a specially formatted SMBIOS version string. In other ThinkPads this is achieved by prepending the string "CBET4000" to the coreboot version when reading the SMBIOS version. This is done in src/drivers/i2c/at24rf08c/lenovo_serials.c and I guess the T440p is not using this EEPROM driver. I fixed this, by integrating the SMBIOS version function into the mainboard.c of the T440p, like it was once done in coreboot before the code got moved to the EEPROM driver (see commit 537283ddc55549b5fa0f1ba05f2b447a0cd9478f). The thinkpad_acpi module now correctly detects the EC version, but this had no influence on the backlight issue.

Edit: I just checked something. Fixing this issues resolves the necessity to force_load thinkpad_acpi. The module now loads automatically without any additional parameters.

0xSigi commented 4 years ago

The thinkpad_acpi module now correctly detects the EC version, but this had no influence on the backlight issue.

Edit: I just checked something. Fixing this issues resolves the necessity to force_load thinkpad_acpi. The module now loads automatically without any additional parameters.

The issue with the EC not being detected also impacts tlp charging / calibration thresholds as the tpacpi-bat returns error that the device is not supported.. Most probably this would also be fixed by the change done by @dwzg Unfortunately my keyboard won't arrive until at least end of next week :/

dwzg commented 4 years ago

I got the backlight to work! Writing 0x05 to the address 0x01 in ectool does the trick for me. After this I can control the backlight with Fn+Space, like on a noncorebooted T440p. Still no clue where this problem comes from and how to fix it permanently.

dwzg commented 4 years ago

Backlight is fixed now: https://review.coreboot.org/c/coreboot/+/38650