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.62k stars 60 forks source link

Lenovo 7 16IAX7 support #70

Open FY0u11 opened 1 year ago

FY0u11 commented 1 year ago

Hi there.

I have this model. And stuck at first step of tests.

image

As I can understand my laptop is not supported. Any things I can do to fix it?

Is your feature request related to a problem? Please describe. Cannot pass first test

Describe the solution you'd like My laptop version is supported

Describe alternatives you've considered

Model and Debug Info

Distribution: Arch Linux x86_64 (kernel 6.3.8-arch1-1) Model name: Legion 7 16IAX7 CPU model: 12th Gen Intel i7-12800HX (24) @ 4.700GHz GPU model: NVIDIA Geforce RTX 3070 Ti Laptop GPU Keyboard backlight: RGB Light in lid or logo: seems no (not sure) Light at IO-Ports at back: yes

Output of sudo dmidecode -t system. Please remove Serial Number and UUID for privacy:

# dmidecode 3.5
Getting SMBIOS data from sysfs.
SMBIOS 3.3 present.

Handle 0x0001, DMI type 1, 27 bytes
System Information
    Manufacturer: LENOVO
    Product Name: 82TD
    Version: Legion 7 16IAX7
    Serial Number: ***
    UUID: ***
    Wake-up Type: Power Switch
    SKU Number: LENOVO_MT_82TD_BU_idea_FM_Legion 7 16IAX7
    Family: Legion 7 16IAX7

Handle 0x0024, DMI type 12, 5 bytes
System Configuration Options
    Option 1: ConfigOptions1
    Option 2: ConfigOptions2
    Option 3: ConfigOptions3

Handle 0x0027, DMI type 15, 29 bytes
System Event Log
    Area Length: 0 bytes
    Header Start Offset: 0x0000
    Header Length: 8192 bytes
    Data Start Offset: 0x2000
    Access Method: General-purpose non-volatile data functions
    Access Address: 0x0000
    Status: Valid, Not Full
    Change Token: 0x12345678
    Header Format: OEM-specific
    Supported Log Type Descriptors: 3
    Descriptor 1: POST memory resize
    Data Format 1: None
    Descriptor 2: POST error
    Data Format 2: POST results bitmap
    Descriptor 3: Log area reset/cleared
    Data Format 3: None

Handle 0x0034, DMI type 32, 11 bytes
System Boot Information
    Status: No errors detected

Output of sudo dmidecode -t bios:

# dmidecode 3.5
Getting SMBIOS data from sysfs.
SMBIOS 3.3 present.

Handle 0x0000, DMI type 0, 26 bytes
BIOS Information
    Vendor: LENOVO
    Version: K1CN28WW
    Release Date: 06/15/2022
    Address: 0xE0000
    Runtime Size: 128 kB
    ROM Size: 16 MB
    Characteristics:
        PCI is supported
        BIOS is upgradeable
        BIOS shadowing is allowed
        Boot from CD is supported
        Selectable boot is supported
        EDD is supported
        Japanese floppy for NEC 9800 1.2 MB is supported (int 13h)
        Japanese floppy for Toshiba 1.2 MB is supported (int 13h)
        5.25"/360 kB floppy services are supported (int 13h)
        5.25"/1.2 MB floppy services are supported (int 13h)
        3.5"/720 kB floppy services are supported (int 13h)
        3.5"/2.88 MB floppy services are supported (int 13h)
        8042 keyboard services are supported (int 9h)
        CGA/mono video services are supported (int 10h)
        ACPI is supported
        USB legacy is supported
        BIOS boot specification is supported
        Targeted content distribution is supported
        UEFI is supported
    BIOS Revision: 1.28
    Firmware Revision: 1.32

Handle 0x0025, DMI type 13, 22 bytes
BIOS Language Information
    Language Description Format: Long
    Installable Languages: 8
        en|US|iso8859-1,0
        fr|FR|iso8859-1,0
        zh|TW|unicode,0
        ja|JP|unicode,0
        it|IT|iso8859-1,0
        es|ES|iso8859-1,0
        de|DE|iso8859-1,0
        pt|PT|iso8859-1,0
    Currently Installed Language: en|US|iso8859-1,0

Output of sudo cat /sys/kernel/debug/legion/fancurve:

[???](cat: /sys/kernel/debug/legion/fancurve: No such file or directory)
johnfanv2 commented 1 year ago

This seems to be a newer model from 2022. Please provide the following information so that I can configure the driver:

Inspecting WMI entries

# Install required tools
sudo apt install fwts

# Create folder for all the new files
mkdir fwts_re
cd fwts_re
sudo fwts wmi - > fwts_wmi.log

Then upload files.

Disassembling ACPI tables

# Install requiered tools
sudo apt install acpica-tools
# Create folder for all the new files
mkdir acpi_re
cd acpi_re

# List ACPI tables and copy them
ls /sys/firmware/acpi/tables/
sudo cp --no-preserve=mode /sys/firmware/acpi/tables/*SDT* .

# Disassemble tables to output DSDT.dsl
iasl -e SSDT* -d DSDT

Then upload files.

Gathering WMI info in Windows

If you have Windows, then the following information are very very useful to make use of the ACPI methods. If you do not have Windows skip it. Open powershell as admin in Windows and run the following script. It will list all available lenovo WMI methods. Copy output to a file and upload.

$wmi_classes = Get-WmiObject -Namespace 'ROOT/WMI' -List -Class "*LENOVO*"
foreach ($wmi_class in $wmi_classes){
  Write-Host "########################################"
  Write-Host "########################################"
  Write-Host "########################################"
  Write-Host "Name:" $wmi_class.Name
  Write-Host "Class Name:" $wmi_class.Name 
  Write-Host "Class GUID:" $wmi_class.Qualifiers["guid"].Value
  Write-Host "Description:" $wmi_class.Methods.Count
  Write-Host "Methods:"
  foreach ($method in $wmi_class.Methods){
    Write-Host "Name:" $method.Name
    Write-Host "WmiMethodId:" $method.Qualifiers["WmiMethodId"].Value
    Write-Host "Class Name:" $wmi_class.Name 
    Write-Host "Class GUID:" $wmi_class.Qualifiers["guid"].Value
    Write-Host "Description:" $method.Qualifiers["Description"].Value
    Write-Host "Implemented:" $method.Qualifiers["Implemented"].Value
    Write-Host ""
  }
  Write-Host ""
}

Which features are the most useful for you?

FY0u11 commented 1 year ago

FWTS

fwts.txt


ACPI

acpi.txt

FY0u11 commented 1 year ago

This is from windows

output.txt

FY0u11 commented 1 year ago

About the most useful features for me. I just want to control my fans speed. Sometimes they are spinning too loud and I have no opportunity to make them quite (it creates uncomfortable situations when I'm working away from home). On Windows I can enable quiet mode, so I would like the same feature on Linux. Thank you in advance.

johnfanv2 commented 1 year ago

@FY0u11 I added your model/BIOS to the kernel module. Please get the new version, recompile, and reload the kernel module (no need to force anymore).

Could you please upload all the files from the "Disassembling ACPI tables", e.g. in a zip file? Then I can get more information about the firmware and can adapt the driver.

In the meantime, please test the following features. We have to try a bit to find the correct configuration.

Temperatures and Fan Speeds

Please read the fan speeds and temperatures (see README) and confirm that they are sensible and change accordingly, e.g. when you put load onto the CPU the CPU temp and the fan speeds should increase, but GPU temp should stay roughly the same.

Powermode

We will start by confirming that power mode change work and to get me more debug info. Please change the power mode with Fn+Q and provide the output of the following commands in each mode.

sudo cat /sys/kernel/debug/legion/ecmemoryram | hexdump -C
sudo cat /sys/kernel/debug/legion/ecmemory | hexdump -C
sudo cat /sys/kernel/debug/legion/fancurve

Then please also check if the power mode is read correctly in the OS (see README). Then please check if you can set the power mode with the GUI (see README) and the LED changes accordingly.

Tests the following features with the GUI. Please check that if works or otherwise give precise information about what does not work. Please try to check that reading and writing works with the software.

Please provide the log output from the GUI from the log tab for all the tests.

Fn Lock

Win Key

Touchpad

Battery Conservation

Rapid Charging

Charge Output Always On

Display Overdrive

Keyboard Backlight

In order to fix/configure the keyboard backlight and begin with setting fan curves, please put your keyboard backlight to off, medium, or bright. Provide the output of the following commands (in that order) in each backlight state:

sudo cat /sys/kernel/debug/legion/fancurve
sudo dmesg | tail -n 30
FY0u11 commented 1 year ago

Now the output of make reloadmodule is following:

[21641.242671] legion_laptop: loading out-of-tree module taints kernel. [21641.242804] legion_laptop: module verification failed: signature and/or required key missing - tainting kernel [21641.246206] legion_laptop: legion_laptop starts loading [21641.246276] legion PNP0C09:00: legion_laptop platform driver probing [21641.246278] legion PNP0C09:00: Read identifying information: DMI_SYS_VENDOR: LENOVO; DMI_PRODUCT_NAME: 82TD; DMI_BIOS_VERSION:K1CN28WW [21641.246279] legion_laptop: Read identifying information: DMI_SYS_VENDOR: LENOVO; DMI_PRODUCT_NAME: 82TD; DMI_BIOS_VERSION:K1CN28WW [21641.246282] legion PNP0C09:00: is_denied: 0; is_allowed: 1; do_load_by_list: 1; do_load: 1 [21641.246283] legion PNP0C09:00: Using configuration for system: K1CN [21641.246363] legion PNP0C09:00: ACPI CFG: 3925729556 [21641.246364] legion_laptop: Creating RAM access to embedded controller [21641.246383] legion_laptop: Succeffuly mapped embedded controller: 0xfe00d400 (in RAM)/0x0 (in EC) to virtual 0x0000000070079181 [21641.246726] legion PNP0C09:00: Read embedded controller ID 0x5263 [21641.246727] legion PNP0C09:00: Expected EC chip id 0x8227 but read 0x5263 [21641.246728] legion_laptop: Unloading legion ecram [21641.246729] legion_laptop: Unloading legion ecram done [21641.246729] legion_laptop: Unmapping embedded controller memory at 0xfe00d400 (in RAM)/0x0 (in EC) at virtual 0x0000000070079181 [21641.246731] legion_laptop: Unloading legion shared [21641.246732] legion_laptop: Unloading legion shared done [21641.246733] legion PNP0C09:00: legion_laptop not loaded for this device [21641.247979] legion: probe of PNP0C09:00 failed with error -12

Here is all the files from the "Disassembling ACPI tables" acpi.tar.gz

johnfanv2 commented 1 year ago

Without the ACPI I assumed it is an older model. Is this a 2022 or 2023 model?

It seem to be a newer firmware. I updated the driver to use a newer config. Please get the new version, recompile, and reload the module and try again.

FY0u11 commented 1 year ago

Still the error. I bought the laptop in december, 2022. It should be 2022 model.

image

FY0u11 commented 1 year ago

It can help. https://psref.lenovo.com/Detail/Legion/Legion_7_16IAX7?M=82TD0075GE

johnfanv2 commented 1 year ago

Sorry, I made a mistake setting the ID, hence the driver does not load. Please get the newest version and try again. It would be good if you can just copy the text (Ctrl+Shift+C in terminal) instead of a screenshot. This makes it easier to copy some stuff.

MrDuartePT commented 1 year ago

@FY0u11 you can report if the latest version works?