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.29k stars 49 forks source link

Support for Lenovo 7 Pro 16IRX9 (2023) #209

Closed stealthcopter closed 2 months ago

stealthcopter commented 2 months ago

Nothing seems to work when force loading the module with this laptop. Thanks in advance for looking at this.

Model and Debug Info

Distribution: Pop!_OS 22.04 LTS Model name: 16IRX9 CPU model: i9-14900HX GPU model: NVIDIA RTX 4060 Keyboard backlight: Per key RGB Light in lid or logo: no Light at IO-Ports at back: no

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

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

Handle 0x0001, DMI type 1, 27 bytes
System Information
    Manufacturer: LENOVO
    Product Name: 83FD
    Version: Legion 7 16IRX9
    Serial Number: <REDACTED>
    UUID: <REDACTED>
    Wake-up Type: Power Switch
    SKU Number: LENOVO_MT_83FD_BU_idea_FM_Legion 7 16IRX9
    Family: Legion 7 16IRX9

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.3
Getting SMBIOS data from sysfs.
SMBIOS 3.4 present.

Handle 0x0000, DMI type 0, 26 bytes
BIOS Information
    Vendor: LENOVO
    Version: NSCN23WW
    Release Date: 01/08/2023
    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.23
    Firmware Revision: 1.23

Handle 0x0025, DMI type 13, 22 bytes[legion-laptop.c](..%2F..%2Fworkspace%2FLenovoLegionLinux%2Fkernel_module%2Flegion-laptop.c)
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:

EC Chip ID: 5507
EC Chip Version: 2a4
legion_laptop features: fancurve powermode platformprofile platformprofilenotify minifancurve
legion_laptop ec_readonly: 0
ACPI CFG error: 0
ACPI CFG: 4245487636
temperature access method: 1
CPU temperature error: 0
CPU temperature: 0
CPU temperature EC error: 0
CPU temperature EC: 0
CPU temperature ACPI error: -5
CPU temperature ACPI: 0
CPU temperature WMI error: 0
CPU temperature WMI: 54
CPU temperature WMI2 error: 0
CPU temperature WMI2: 0
CPU temperature WMI3 error: 0
CPU temperature WMI3: 54
GPU temperature error: 0
GPU temperature: 0
GPU temperature EC error: 0
GPU temperature EC: 0
GPU temperature ACPI error: -5
GPU temperature ACPI: 0
GPU temperature WMI error: 0
GPU temperature WMI: 35
GPU temperature WMI2 error: 0
GPU temperature WMI2: 0
GPU temperature WMI3 error: 0
GPU temperature WMI3: 35
fan speed access method: 1
1 fanspeed error: 0
1 fanspeed: 0
1 fanspeed EC error: 0
1 fanspeed EC: 0
1 fanspeed ACPI error: -5
1 fanspeed ACPI: 0
1 fanspeed WMI error: 0
1 fanspeed WMI: 0
1 fanspeed WMI2 error: 0
1 fanspeed WMI2: 0
1 fanspeed WMI3 error: 0
1 fanspeed WMI3: 1400
2 fanspeed error: 0
2 fanspeed: 0
2 fanspeed EC error: 0
2 fanspeed EC: 0
2 fanspeed ACPI error: 0
2 fanspeed ACPI: 1700
2 fanspeed WMI error: 0
2 fanspeed WMI: 0
2 fanspeed WMI2 error: 0
2 fanspeed WMI2: 0
2 fanspeed WMI3 error: 0
2 fanspeed WMI3: 1700
powermode access method: 3
powermode error: 0
powermode: 3
powermode EC error: 0
powermode EC: 0
powermode ACPI error: -5
powermode ACPI: 0
powermode WMI error: 0
powermode WMI: 3
has custom powermode: 1
ACPI rapidcharge error: 0
ACPI rapidcharge: 1
WMI backlight 2 state: 0
WMI backlight 3 state: -14
WMI light IO port: 0
WMI light Y logo/lid: 0
EC minifancurve feature enabled: 1
EC minifancurve on cool: error
EC lockfancontroller error: 0
EC lockfancontroller: true
fanfullspeed error: 0
fanfullspeed: 0
fanfullspeed EC error: -1
fanfullspeed EC: 0
EC fan curve current point id: 10
EC fan curve points size: 10
Current fan curve in hardware:
rpm1|rpm2|acceleration|deceleration|cpu_min_temp|cpu_max_temp|gpu_min_temp|gpu_max_temp|ic_min_temp|ic_max_temp
6800     0   0   0   0   0   0   0   0   255
9000     0   0   0   0   0   0   0   0   255
4000     0   0   0   0   0   0   0   0   255
6800     0   0   0   0   0   0   0   0   255
9000     0   0   0   0   0   0   0   0   255
4000     0   0   0   0   0   0   0   0   255
6800     0   0   0   0   0   0   0   0   255
9900     0   0   0   0   0   0   0   0   255
4000     0   0   0   0   0   0   0   0   255
9400     0   0   0   0   0   0   0   0   255

=====================
Current fan curve in hardware (WMI; might be empty)
rpm1|rpm2|acceleration|deceleration|cpu_min_temp|cpu_max_temp|gpu_min_temp|gpu_max_temp|ic_min_temp|ic_max_temp
=====================

fwts_wmi.log

acpi_re.zip

I don't have windows to get the additional information, but let me know if there's anything else from Linux I can get that would be helpful. Cheers!

st0nie commented 2 months ago

https://github.com/johnfanv2/LenovoLegionLinux/commit/1d4e1d3e78fda6fd43a8c642d5e10714dd4a596c Added to list Need back report

stealthcopter commented 2 months ago

Thanks @st0nie, I tried building and reloading that but it does not seem happy:

[Sun Apr 28 13:08:16 2024] legion_laptop: Loading legion_laptop
[Sun Apr 28 13:08:16 2024] legion PNP0C09:00: legion_laptop platform driver probing
[Sun Apr 28 13:08:16 2024] legion PNP0C09:00: Read identifying information: DMI_SYS_VENDOR: LENOVO; DMI_PRODUCT_NAME: 83FD; DMI_BIOS_VERSION:NSCN23WW
[Sun Apr 28 13:08:16 2024] legion_laptop: Read identifying information: DMI_SYS_VENDOR: LENOVO; DMI_PRODUCT_NAME: 83FD; DMI_BIOS_VERSION:NSCN23WW
[Sun Apr 28 13:08:16 2024] legion PNP0C09:00: is_denied: 0; is_allowed: 1; do_load_by_list: 1; do_load: 1
[Sun Apr 28 13:08:16 2024] legion PNP0C09:00: Using configuration for system: NSCN
[Sun Apr 28 13:08:16 2024] legion PNP0C09:00: Could not evaluate ACPI _STA
[Sun Apr 28 13:08:16 2024] legion PNP0C09:00: Could not init ACPI access: -5
[Sun Apr 28 13:08:16 2024] legion_laptop: Unloading legion shared
[Sun Apr 28 13:08:16 2024] legion_laptop: Unloading legion shared done
[Sun Apr 28 13:08:16 2024] legion PNP0C09:00: legion_laptop not loaded for this device
[Sun Apr 28 13:08:16 2024] legion: probe of PNP0C09:00 failed with error -5

Please let me know if there's further information I can provide that will help! Cheers

st0nie commented 2 months ago

https://github.com/johnfanv2/LenovoLegionLinux/commit/19033d5e0bd3dfcbe1b067194b77f179aaedcab6

Can you retry it?

need output of: sudo cat /sys/kernel/debug/legion/fancurve

stealthcopter commented 2 months ago

Thanks. sudo make forcereloadmodule outputs:

...
[Sun Apr 28 13:21:37 2024] legion PNP0C09:00: Read identifying information: DMI_SYS_VENDOR: LENOVO; DMI_PRODUCT_NAME: 83FD; DMI_BIOS_VERSION:NSCN23WW
[Sun Apr 28 13:21:37 2024] legion_laptop: Read identifying information: DMI_SYS_VENDOR: LENOVO; DMI_PRODUCT_NAME: 83FD; DMI_BIOS_VERSION:NSCN23WW
[Sun Apr 28 13:21:37 2024] legion PNP0C09:00: is_denied: 0; is_allowed: 1; do_load_by_list: 1; do_load: 1
[Sun Apr 28 13:21:37 2024] legion PNP0C09:00: legion_laptop is forced to load.
[Sun Apr 28 13:21:37 2024] legion PNP0C09:00: Using configuration for system: NSCN
[Sun Apr 28 13:21:37 2024] legion PNP0C09:00: Skipping ACPI _STA check
[Sun Apr 28 13:21:37 2024] legion_laptop: Creating RAM access to embedded controller
[Sun Apr 28 13:21:37 2024] legion_laptop: Successfully mapped embedded controller: 0xfe0b0400 (in RAM)/0x0 (in EC) to virtual 0x00000000932dae22
[Sun Apr 28 13:21:37 2024] legion PNP0C09:00: Read embedded controller ID 0x5507
[Sun Apr 28 13:21:37 2024] legion PNP0C09:00: Skipped checking embedded controller id
[Sun Apr 28 13:21:37 2024] legion PNP0C09:00: Creating debugfs interface
[Sun Apr 28 13:21:37 2024] legion_laptop: Creating sysfs interface
[Sun Apr 28 13:21:37 2024] legion_laptop: Creating hwmon interface
[Sun Apr 28 13:21:37 2024] legion_laptop: Creating platform profile support
[Sun Apr 28 13:21:37 2024] legion_laptop: Init WMI driver support
[Sun Apr 28 13:21:37 2024] legion_wmi 887B54E3-DDDC-4B2C-8B88-68A26A8835D0: Register after probing for WMI.
[Sun Apr 28 13:21:37 2024] legion_wmi BFD42481-AEE3-4501-A107-AFB68425C5F8: Register after probing for WMI.
[Sun Apr 28 13:21:37 2024] legion_wmi D062906B-12D4-4510-999D-4831EE80E985: Register after probing for WMI.
[Sun Apr 28 13:21:37 2024] legion_wmi BFD42481-AEE3-4502-A107-AFB68425C5F8: Register after probing for WMI.
[Sun Apr 28 13:21:37 2024] legion_wmi BC72A435-E8C1-4275-B3E2-D8B8074ABA59: Register after probing for WMI.
[Sun Apr 28 13:21:37 2024] legion_wmi 10AFC6D9-EA8B-4590-A2E7-1CD3C84BB4B1: Register after probing for WMI.
[Sun Apr 28 13:21:37 2024] legion_wmi D320289E-8FEA-41E0-86F9-611D83151B5F: Register after probing for WMI.
[Sun Apr 28 13:21:37 2024] legion_laptop: Init keyboard backlight LED driver
[Sun Apr 28 13:21:37 2024] legion_laptop: Error WMI call for reading brightness: expected a value between 1 and 3, but got 0
[Sun Apr 28 13:21:37 2024] legion_laptop: Error reading keyboard brightness
[Sun Apr 28 13:21:37 2024] legion PNP0C09:00: Failed to init keyboard backlight LED driver. Skipping ...
[Sun Apr 28 13:21:37 2024] legion_laptop: Init Y-Logo LED driver
[Sun Apr 28 13:21:37 2024] legion_laptop: Init IO-Port LED driver
[Sun Apr 28 13:21:37 2024] legion_laptop: Error WMI call for reading brightness: expected a value between 1 and 2, but got 0
[Sun Apr 28 13:21:37 2024] legion_laptop: Error reading brightness for light: 5
[Sun Apr 28 13:21:37 2024] legion PNP0C09:00: Failed to init IO-Port LED driver. Skipping ...
[Sun Apr 28 13:21:37 2024] legion PNP0C09:00: legion_laptop loaded for this device

and sudo cat /sys/kernel/debug/legion/fancurve outputs:

EC Chip ID: 5507
EC Chip Version: 2a4
legion_laptop features: fancurve powermode platformprofile platformprofilenotify minifancurve
legion_laptop ec_readonly: 0
ACPI CFG error: 0
ACPI CFG: 4245487636
temperature access method: 5
CPU temperature error: 0
CPU temperature: 56
CPU temperature EC error: 0
CPU temperature EC: 0
CPU temperature ACPI error: -5
CPU temperature ACPI: 0
CPU temperature WMI error: 0
CPU temperature WMI: 56
CPU temperature WMI2 error: 0
CPU temperature WMI2: 0
CPU temperature WMI3 error: 0
CPU temperature WMI3: 56
GPU temperature error: 0
GPU temperature: 35
GPU temperature EC error: 0
GPU temperature EC: 0
GPU temperature ACPI error: -5
GPU temperature ACPI: 0
GPU temperature WMI error: 0
GPU temperature WMI: 35
GPU temperature WMI2 error: 0
GPU temperature WMI2: 0
GPU temperature WMI3 error: 0
GPU temperature WMI3: 35
fan speed access method: 5
1 fanspeed error: 0
1 fanspeed: 1400
1 fanspeed EC error: 0
1 fanspeed EC: 0
1 fanspeed ACPI error: -5
1 fanspeed ACPI: 0
1 fanspeed WMI error: 0
1 fanspeed WMI: 0
1 fanspeed WMI2 error: 0
1 fanspeed WMI2: 0
1 fanspeed WMI3 error: 0
1 fanspeed WMI3: 1400
2 fanspeed error: 0
2 fanspeed: 1700
2 fanspeed EC error: 0
2 fanspeed EC: 0
2 fanspeed ACPI error: 0
2 fanspeed ACPI: 1700
2 fanspeed WMI error: 0
2 fanspeed WMI: 0
2 fanspeed WMI2 error: 0
2 fanspeed WMI2: 0
2 fanspeed WMI3 error: 0
2 fanspeed WMI3: 1700
powermode access method: 3
powermode error: 0
powermode: 2
powermode EC error: 0
powermode EC: 0
powermode ACPI error: -5
powermode ACPI: 0
powermode WMI error: 0
powermode WMI: 2
has custom powermode: 1
ACPI rapidcharge error: 0
ACPI rapidcharge: 1
WMI backlight 2 state: 0
WMI backlight 3 state: -14
WMI light IO port: 0
WMI light Y logo/lid: 0
EC minifancurve feature enabled: 0
EC minifancurve on cool: error
EC lockfancontroller error: 0
EC lockfancontroller: true
fanfullspeed error: 0
fanfullspeed: 0
fanfullspeed EC error: -1
fanfullspeed EC: 0
EC fan curve current point id: 0
EC fan curve points size: 0
Current fan curve in hardware:
rpm1|rpm2|acceleration|deceleration|cpu_min_temp|cpu_max_temp|gpu_min_temp|gpu_max_temp|ic_min_temp|ic_max_temp
=====================
Current fan curve in hardware (WMI; might be empty)
rpm1|rpm2|acceleration|deceleration|cpu_min_temp|cpu_max_temp|gpu_min_temp|gpu_max_temp|ic_min_temp|ic_max_temp
=====================
st0nie commented 2 months ago

Seems most of things work excluding fancurve try to edit this line https://github.com/johnfanv2/LenovoLegionLinux/blob/19033d5e0bd3dfcbe1b067194b77f179aaedcab6/kernel_module/legion-laptop.c#L676

available options: ACCESS_METHOD_EC ACCESS_METHOD_EC2 ACCESS_METHOD_EC3 ACCESS_METHOD_WMI3

If none of the above work, we'll mark the fancurve feature as unimplemented for the time being

Thank U :)

stealthcopter commented 2 months ago

ACCESS_METHOD_EC

EC minifancurve feature enabled: 0
EC minifancurve on cool: error
EC lockfancontroller error: 0
EC lockfancontroller: true
fanfullspeed error: 0
fanfullspeed: 0
fanfullspeed EC error: -1
fanfullspeed EC: 0
EC fan curve current point id: 10
EC fan curve points size: 10
Current fan curve in hardware:
rpm1|rpm2|acceleration|deceleration|cpu_min_temp|cpu_max_temp|gpu_min_temp|gpu_max_temp|ic_min_temp|ic_max_temp
6800     0   0   0   0   0   0   0   0   255
9000     0   0   0   0   0   0   0   0   255
4000     0   0   0   0   0   0   0   0   255
6800     0   0   0   0   0   0   0   0   255
9000     0   0   0   0   0   0   0   0   255
4000     0   0   0   0   0   0   0   0   255
6800     0   0   0   0   0   0   0   0   255
9900     0   0   0   0   0   0   0   0   255
4000     0   0   0   0   0   0   0   0   255
9400     0   0   0   0   0   0   0   0   255
=====================
Current fan curve in hardware (WMI; might be empty)
rpm1|rpm2|acceleration|deceleration|cpu_min_temp|cpu_max_temp|gpu_min_temp|gpu_max_temp|ic_min_temp|ic_max_temp
=====================

ACCESS_METHOD_EC2

EC minifancurve feature enabled: 0
EC minifancurve on cool: error
EC lockfancontroller error: 0
EC lockfancontroller: true
fanfullspeed error: 0
fanfullspeed: 0
fanfullspeed EC error: -1
fanfullspeed EC: 0
EC fan curve current point id: 8
EC fan curve points size: 8
Current fan curve in hardware:
rpm1|rpm2|acceleration|deceleration|cpu_min_temp|cpu_max_temp|gpu_min_temp|gpu_max_temp|ic_min_temp|ic_max_temp
6800     0   0   0   0   0   0   0   0   0
9000     0   0   0   0   0   0   0   0   0
4000     0   0   0   0   0   0   0   0   0
6800     0   0   0   0   0   0   0   0   0
9000     0   0   0   0   0   0   0   0   0
4000     0   0   0   0   0   0   0   0   0
6800     0   0   0   0   0   0   0   0   0
9900     0   0   0   0   0   0   0   0   0
=====================
Current fan curve in hardware (WMI; might be empty)
rpm1|rpm2|acceleration|deceleration|cpu_min_temp|cpu_max_temp|gpu_min_temp|gpu_max_temp|ic_min_temp|ic_max_temp
=====================

ACCESS_METHOD_EC3

EC minifancurve feature enabled: 0
EC minifancurve on cool: error
EC lockfancontroller error: 0
EC lockfancontroller: true
fanfullspeed error: 0
fanfullspeed: 0
fanfullspeed EC error: -1
fanfullspeed EC: 0
EC fan curve current point id: 10
EC fan curve points size: 10
Current fan curve in hardware:
rpm1|rpm2|acceleration|deceleration|cpu_min_temp|cpu_max_temp|gpu_min_temp|gpu_max_temp|ic_min_temp|ic_max_temp
6800     0   0   0   0   0   0   0   0   0
6800     0   0   0   0   0   0   0   0   0
6800     0   0   0   0   0   0   0   0   0
9400     0   0   0   0   0   0   0   0   0
1700     0   0   0   0   0   0   0   0   0
0    0   0   0   0   0   0   0   0   0
0    0   0   0   0   0   0   0   0   0
0    0   0   0   0   0   0   0   0   0
0    0   0   0   0   0   0   0   0   0
0    0   0   0   0   0   0   0   0   0
=====================
Current fan curve in hardware (WMI; might be empty)
rpm1|rpm2|acceleration|deceleration|cpu_min_temp|cpu_max_temp|gpu_min_temp|gpu_max_temp|ic_min_temp|ic_max_temp
=====================

I'm not sure, but it looks like either ACCESS_METHOD_EC or ACCESS_METHOD_EC2 are ok?

st0nie commented 2 months ago

Unfortunately modifying the fan curve won't currently work on your machine, but everything else seems to work. We'll possibly fix it later.

stealthcopter commented 2 months ago

@st0nie thank you for your assistance getting this far, really appreciate your help! Do you know if it's possible for me to set the speed of the fans without using the fan curve at all?

st0nie commented 2 months ago

https://wiki.archlinux.org/title/fan_speed_control You can refer to archwiki to try various tools that can modify the fan speed. In addition to that, lenovolegionlinux offers the ability to lock the max speed and lock the fan speed, which I think might be useful for you!

st0nie commented 2 months ago

Not being able to adjust the fan curve doesn't affect your usage very much, legion has a default fan curve for each powermode, we just can't edit it right now. legion's default fan curve is more than enough for most people to use.

stealthcopter commented 2 months ago

@st0nie thanks, I'm just finding the fans aren't kicking in enough by default so my laptop gets very hot to the touch. I've found I can either have the fans completely off in quite mode or between 1400 and 2000 RPM in other modes.

I've been unable to get any external fan software working with this yet. I've tried inspecting the device exposed in /sys/module/legion_laptop/drivers/platform:legion/PNP0C09:00 but that doesn't seem to expose anything that could be used to directly control the fans without the fancurve, as those appear to be the only PWM items exposed.

stealthcopter commented 2 months ago

I've also tried using the lock on the max speed and lock the fan speed (using gui and by echo 1 | lockfancontroller directly) and it does not seem to keep the fans at a set RPM :(