pobrn / qc71_laptop

Linux kernel platform driver for QC71 based laptops.
GNU General Public License v2.0
33 stars 11 forks source link

Not working on XMG Fusion 15 #13

Open BeWo123 opened 2 years ago

BeWo123 commented 2 years ago

Hi there, got a new XMG Fusion 15 these days. Compile without problems, loading the module says:

kernel: qc71_laptop/main: qc71_laptop_module_init: project id: 8 kernel: qc71_laptop/main: qc71_laptop_module_init: platform id: 208 kernel: qc71_laptop/features: check_features_bios: no DMI match kernel: qc71_laptop/main: qc71_laptop_module_init: supported features: kernel: input: QC71 laptop input device as /devices/platform/qc71_laptop/input/input44 kernel: qc71_laptop/main: qc71_laptop_module_init: failed to initialize battery submodule: -19 kernel: qc71_laptop/main: qc71_laptop_module_init: failed to initialize led_lightbar submodule: -19 kernel: qc71_laptop/main: qc71_laptop_module_init: failed to initialize debugfs submodule: -19 <<

There is no /sys/class/leds/qc71_laptop to be found. Is there a chance to get it working?


Additional details, head /sys/devices/virtual/dmi/id/* 2>/dev/null shows

==> /sys/devices/virtual/dmi/id/bios_date <==
11/26/2021

==> /sys/devices/virtual/dmi/id/bios_release <==
5.19

==> /sys/devices/virtual/dmi/id/bios_vendor <==
Intel Corp.

==> /sys/devices/virtual/dmi/id/bios_version <==
KCTGL357.0040.2021.1126.1843

==> /sys/devices/virtual/dmi/id/board_asset_tag <==

==> /sys/devices/virtual/dmi/id/board_name <==
LAPKC71E

==> /sys/devices/virtual/dmi/id/board_vendor <==
Intel Corporation

==> /sys/devices/virtual/dmi/id/board_version <==
M22221-402

==> /sys/devices/virtual/dmi/id/chassis_asset_tag <==

==> /sys/devices/virtual/dmi/id/chassis_type <==
10

==> /sys/devices/virtual/dmi/id/chassis_vendor <==
SchenkerTechnologiesGmbH

==> /sys/devices/virtual/dmi/id/chassis_version <==
2.0

==> /sys/devices/virtual/dmi/id/ec_firmware_release <==
1.11

==> /sys/devices/virtual/dmi/id/modalias <==
dmi:bvnIntelCorp.:bvrKCTGL357.0040.2021.1126.1843:bd11/26/2021:br5.19:efr1.11:svnSchenkerTechnologiesGmbH:pnXMGFUSION15(XFU15M22):pvrM38559-402:rvnIntelCorporation:rnLAPKC71E:rvrM22221-402:cvnSchenkerTechnologiesGmbH:ct10:cvr2.0:skuXFU15M22:

==> /sys/devices/virtual/dmi/id/power <==

==> /sys/devices/virtual/dmi/id/product_family <==

==> /sys/devices/virtual/dmi/id/product_name <==
XMG FUSION 15 (XFU15M22)

==> /sys/devices/virtual/dmi/id/product_sku <==
XFU15M22

==> /sys/devices/virtual/dmi/id/product_version <==
M38559-402

==> /sys/devices/virtual/dmi/id/subsystem <==

==> /sys/devices/virtual/dmi/id/sys_vendor <==
SchenkerTechnologiesGmbH

==> /sys/devices/virtual/dmi/id/uevent <==
MODALIAS=dmi:bvnIntelCorp.:bvrKCTGL357.0040.2021.1126.1843:bd11/26/2021:br5.19:efr1.11:svnSchenkerTechnologiesGmbH:pnXMGFUSION15(XFU15M22):pvrM38559-402:rvnIntelCorporation:rnLAPKC71E:rvrM22221-402:cvnSchenkerTechnologiesGmbH:ct10:cvr2.0:skuXFU15M22:

insmod qc71_laptop.ko debugregs=1; head /sys/kernel/debug/qc71_laptop/regs/* gives me:

==> /sys/kernel/debug/qc71_laptop/regs/1108 <==
0x4b

==> /sys/kernel/debug/qc71_laptop/regs/ap_bios_byte <==
0x02

==> /sys/kernel/debug/qc71_laptop/regs/batt_alert <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/batt_charge_ctrl <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/batt_status <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/battt_temp <==
0x20

==> /sys/kernel/debug/qc71_laptop/regs/bios_ctrl_1 <==
0x40

==> /sys/kernel/debug/qc71_laptop/regs/bios_ctrl_2 <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/bios_ctrl_3 <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/bios_info_1 <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/bios_info_5 <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/ctrl_1 <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/ctrl_2 <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/ctrl_3 <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/ctrl_4 <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/ctrl_5 <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/ctrl_6 <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/device_status <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/fan_ctrl <==
0x4c

==> /sys/kernel/debug/qc71_laptop/regs/fan_extra_speed <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/fan_l1_pwm <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/fan_l1_pwm_default <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/fan_l2_pwm <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/fan_l2_pwm_default <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/fan_l3_pwm <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/fan_l3_pwm_default <==
0x40

==> /sys/kernel/debug/qc71_laptop/regs/fan_l4_pwm <==
0x29

==> /sys/kernel/debug/qc71_laptop/regs/fan_l4_pwm_default <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/fan_l5_pwm <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/fan_l5_pwm_default <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/fan_min_speed <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/fan_min_temp <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/fan_mode_index <==
0x20

==> /sys/kernel/debug/qc71_laptop/regs/fan_pwm_1 <==
0x40

==> /sys/kernel/debug/qc71_laptop/regs/fan_pwm_2 <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/fan_temp_1 <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/fan_temp_2 <==
0x2a

==> /sys/kernel/debug/qc71_laptop/regs/keyboard_type <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/lightbar_blue <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/lightbar_ctrl <==
0x2a

==> /sys/kernel/debug/qc71_laptop/regs/lightbar_green <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/lightbar_red <==
0x40

==> /sys/kernel/debug/qc71_laptop/regs/pl_1 <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/pl_2 <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/pl_4 <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/platform_id <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/power_source <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/power_status <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/project_id <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/status_1 <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/support_1 <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/support_2 <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/support_5 <==
0x46

==> /sys/kernel/debug/qc71_laptop/regs/trigger_1 <==
0x00

==> /sys/kernel/debug/qc71_laptop/regs/trigger_2 <==
0x00
pobrn commented 2 years ago

My first impression is that it is markedly different from the 2019 Fusion 15. I am not sure what could be done, someone would have to reverse engineer how the control center works.

right-0903 commented 10 months ago

@pobrn actually fan, lightbar, battery, etc. ctl ec addresses, are same as 2019 Fusion 15, with different dmi strings. But how do you get those addresses?

BTW, I want to ask that, TCC set full fan mode before control fan speed (according to tcc, i.e. write 0x40 to 0x0751), as you do ec_write_byte(FAN_CTRL_ADDR, FAN_CTRL_FAN_BOOST) also , but why?

int qc71_fan_set_mode(uint8_t mode)
{
    int err, oldpwm;

    err = mutex_lock_interruptible(&fan_lock);
    if (err)
        return err;

    switch (mode) {
    case 0:
        err = ec_write_byte(FAN_CTRL_ADDR, FAN_CTRL_FAN_BOOST);
        if (err)
            goto out;

        err = qc71_fan_set_pwm(0, FAN_MAX_PWM);
        break;
    case 1:
        oldpwm = err = qc71_fan_get_pwm(0);
        if (err < 0)
            goto out;

        err = ec_write_byte(FAN_CTRL_ADDR, FAN_CTRL_FAN_BOOST);
        if (err < 0)
            goto out;

        err = qc71_fan_set_pwm(0, oldpwm);
        if (err < 0)
            (void) ec_write_byte(FAN_CTRL_ADDR, 0x80 | FAN_CTRL_AUTO);
            /* try to restore automatic fan control */

        break;
    case 2:
        err = ec_write_byte(FAN_CTRL_ADDR, 0x80 | FAN_CTRL_AUTO);
        break;
    default:
        err = -EINVAL;
        break;
    }

out:
    mutex_unlock(&fan_lock);
    return err;
}
pobrn commented 10 months ago

But how do you get those addresses?

I don't quite remember... many of them are from the xmg fusion 15 and neo 15 control centers.


BTW, I want to ask that, TCC set full fan mode before control fan speed (according to tcc, i.e. write 0x40 to 0x0751), as you do ec_write_byte(FAN_CTRL_ADDR, FAN_CTRL_FAN_BOOST) also , but why?

If the fan is in automatic mode and its speed is set, then it will start adjusting the speed immediately.