johnfanv2 / LenovoLegionLinux

Driver and tools for controlling Lenovo Legion laptops in Linux including fan control and power mode.
https://github.com/johnfanv2/LenovoLegionLinux
GNU General Public License v2.0
1.3k stars 49 forks source link

Add support for the Legion Go #185

Open antheas opened 3 months ago

antheas commented 3 months ago

This pr adds support for the legion go. Right now, tdp modes and full fan speed work. Fan curves do not, and there is a lot of logging to dmesg.

antheas commented 3 months ago

Here is a log sample. The other WMI function seems like it is called incorrectly. In addition the fan curve buffer looks wrong.

[105816.100567] legion_laptop: Creating platform profile support
[105816.100575] legion_laptop: Init WMI driver support
[105816.100749] legion_wmi 887B54E3-DDDC-4B2C-8B88-68A26A8835D0: Register after probing for WMI.
[105816.100821] legion_wmi BFD42481-AEE3-4501-A107-AFB68425C5F8: Register after probing for WMI.
[105816.100843] legion_wmi D062906B-12D4-4510-999D-4831EE80E985: Register after probing for WMI.
[105816.100858] legion_wmi BFD42481-AEE3-4502-A107-AFB68425C5F8: Register after probing for WMI.
[105816.100877] legion_wmi BC72A435-E8C1-4275-B3E2-D8B8074ABA59: Register after probing for WMI.
[105816.100891] legion_wmi 10AFC6D9-EA8B-4590-A2E7-1CD3C84BB4B1: Register after probing for WMI.
[105816.100905] legion_wmi D320289E-8FEA-41E0-86F9-611D83151B5F: Register after probing for WMI.
[105816.100956] legion_laptop: Init keyboard backlight LED driver
[105816.100957] legion_laptop: Keyboard backlight handling disabled by this driver
[105816.100958] legion PNP0C09:00: Failed to init keyboard backlight LED driver. Skipping ...
[105816.100959] legion_laptop: Init Y-Logo LED driver
[105816.101187] legion_laptop: ACPI result for 8C5B9127-ECD4-4657-980F-851019F99CA5:1: ACPI buffer length: 2
[105816.101344] legion_laptop: ACPI result for 8C5B9127-ECD4-4657-980F-851019F99CA5:1: ACPI buffer length: 2
[105816.101347] legion_laptop: Init IO-Port LED driver
[105816.101387] legion_laptop: ACPI result for 8C5B9127-ECD4-4657-980F-851019F99CA5:1: ACPI buffer length: 2
[105816.101390] legion_laptop: Error WMI call for reading brightness: expected a value between 1 and 2, but got 0
[105816.101393] legion_laptop: Error reading brightness for light: 5
[105816.101394] legion PNP0C09:00: Failed to init IO-Port LED driver. Skipping ...
[105816.101396] legion PNP0C09:00: legion_laptop loaded for this device
[105816.467569] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105818.021337] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105818.503612] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105820.053678] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105820.536683] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105822.089345] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105822.575668] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105824.124827] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105824.617748] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105826.160999] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105826.655855] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105828.198662] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105828.694021] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105830.230091] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105830.725343] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105832.262414] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105832.762950] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105834.289799] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105834.801039] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105836.207546] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105836.207853] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105836.209310] legion_laptop: ACPI result for 8C5B9127-ECD4-4657-980F-851019F99CA5:1: ACPI buffer length: 2
[105836.209314] legion_laptop: Error WMI call for reading brightness: expected a value between 1 and 3, but got 0
[105836.209387] legion_laptop: ACPI result for 8C5B9127-ECD4-4657-980F-851019F99CA5:1: ACPI buffer length: 2
[105836.209510] legion_laptop: ACPI result for 8C5B9127-ECD4-4657-980F-851019F99CA5:1: ACPI buffer length: 2
[105836.209572] legion_laptop: Unexpected value in MINIFANCURVE register: 0
[105836.209830] legion_laptop: Size of object: 48
[105836.209844] ACPI BIOS Error (bug): AE_AML_BUFFER_LIMIT, Field [FID0] at bit offset/length 0/8 exceeds size of target Buffer (0 bits) (20230628/dsopcode-198)
[105836.209849] ACPI Error: Aborting method \_SB.GZFD.WMAB due to previous error (AE_AML_BUFFER_LIMIT) (20230628/psparse-529)
[105836.209856] legion_laptop: ACPI evaluation error for: 92549549-4bde-4f06-ac04-ce8bf898dbaa:5
[105836.209857] legion_laptop fan table wmi buffer00000000059bac4b: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
[105836.209859] legion_laptop fan table wmi buffer000000003f54ae3b: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
[105836.209860] legion_laptop fan table wmi buffer00000000d9e825c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
[105836.209861] legion_laptop fan table wmi buffer00000000abefa048: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
[105836.209862] legion_laptop fan table wmi buffer000000008c489f0d: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
[105836.209863] legion_laptop fan table wmi buffer00000000c8452625: 00 00 00 00 00 00 00 00                          ........
[105836.209865] legion_laptop: Size of object: 48
[105836.209877] ACPI BIOS Error (bug): AE_AML_BUFFER_LIMIT, Field [FID0] at bit offset/length 0/8 exceeds size of target Buffer (0 bits) (20230628/dsopcode-198)
[105836.209881] ACPI Error: Aborting method \_SB.GZFD.WMAB due to previous error (AE_AML_BUFFER_LIMIT) (20230628/psparse-529)
[105836.209886] legion_laptop: ACPI evaluation error for: 92549549-4bde-4f06-ac04-ce8bf898dbaa:5
[105836.209887] legion_laptop fan table wmi buffer00000000abefa048: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
[105836.209888] legion_laptop fan table wmi buffer000000008c489f0d: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
[105836.209889] legion_laptop fan table wmi buffer00000000c8452625: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
[105836.209890] legion_laptop fan table wmi buffer00000000a80ee6d8: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
[105836.209891] legion_laptop fan table wmi buffer00000000e189ce62: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
[105836.209892] legion_laptop fan table wmi buffer00000000cf925ad5: 00 00 00 00 00 00 00 00                          ........
[105836.321254] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105836.839990] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105838.354577] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105838.878666] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105840.382593] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105840.908893] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105842.418807] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105842.948667] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105844.451798] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105844.980296] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105846.482915] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105847.016740] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
[105848.521815] legion_laptop: Unexpected ACPI result for dc2a8805-3a8c-41ba-a6f7-092e0089cd3b:17: expected type 1 but got 3
antheas commented 3 months ago

The fan curve function though does match the WMI of the go. It just seems there is a buffer misalignment. I dont recall it being 88 bytes long.

Hm, maybe the GUID is different.

MrDuartePT commented 3 months ago

The fan curve function though does match the WMI of the go. It just seems there is a buffer misalignment. I dont recall it being 88 bytes long.

Hm, maybe the GUID is different.

The GUID apear to be the right: LLL driver line legion go WMI List

antheas commented 3 months ago

Yeah the buffer read is too small. The new buffer interface is larger and contains temps too.

antheas commented 3 months ago

I fixed the wmi for the fan curves in the new laptops. However, it expects percentages, and the autoset function expects rpm. So the driver does not let me set the values.