On my ASUS Vivobook S14 (TP3402VA) I noticed that with kernel 6.12(-rc4,-rc7) several charge control related /sys entries are missing. with kernel 6.12 the corresponding folder looks like this: ls /sys/class/power_supply/BAT0/ alarm charge_now manufacturer status voltage_min_design capacity current_now model_name subsystem voltage_now capacity_level cycle_count power technology charge_full device present type charge_full_design hwmon3 serial_number uevent Specifically missing is charge_control_end_threshold, which is normally used to set individual charge end points. That worked nicely up to kernel 6.11, but is defect now in the current 6.12 version. Anything special you need from me to fix the problem?
Does the asus-wmi driver even load with kernel 6.12?
Hi Armin Yes, the asus-wmi driver loads, but the asus-nb-wmi driver fails with error 5. Here is the relevant dmesg: dmesg|grep asus [ 18.552935] asus_wmi: ASUS WMI generic driver loaded [ 18.570919] asus_wmi: Initialization: 0x1 [ 18.572730] asus_wmi: SFUN value: 0x21 [ 18.572746] asus-nb-wmi asus-nb-wmi: Detected ATK, not ASUSWMI, use DSTS [ 18.619578] asus_wmi: Failed to set throttle thermal policy (retval): 0x0 [ 18.619584] asus_wmi: Failed to set default thermal profile [ 18.619589] asus-nb-wmi asus-nb-wmi: probe with driver asus-nb-wmi failed with error -5
As a comparison, here's the dmesg from an earlier kernel with working asus-nb-wmi: ❯ dmesg|grep asus [ 14.268902] asus_wmi: ASUS WMI generic driver loaded [ 14.283569] asus_wmi: Initialization: 0x1 [ 14.284980] asus_wmi: SFUN value: 0x21 [ 14.284993] asus-nb-wmi asus-nb-wmi: Detected ATK, not ASUSWMI, use DSTS [ 14.329923] input: Asus WMI hotkeys as /devices/platform/asus-nb-wmi/input/input11
I see, the kewly added platform profile support fails to initialize and thus the whole driver fails to load. Can you share the output of "acpidump"?
Created attachment 307259 [details] acpidump of latest kernel 6.12-rc7
Created attachment 307260 [details] acpidump of older kernel 6.9.12
I did acpidumps on 6.12-rc7 (with the regression) and on an older kernel 6.9.12 (with no issue). Interestingly the dump is not identical. Not sure, if that is to be expected or not. See the two attachments. And here is the diff: ❯ diff acpidump_6.* 47639c47639 < 0000: 50 48 41 54 0D 06 00 00 01 2A 5F 41 53 55 53 5F PHAT.....*_ASUS_ --- > 0000: 50 48 41 54 0D 06 00 00 01 C0 5F 41 53 55 53 5F PHAT......_ASUS_ 47708,47709c47708,47709 < 0450: 45 00 45 00 43 00 33 00 29 00 00 00 01 48 FD FB E.E.C.3.)....H.. < 0460: A7 01 00 00 00 F1 B7 8E 98 01 00 00 00 2D 00 00 .............-.. --- > 0450: 45 00 45 00 43 00 33 00 29 00 00 00 01 1F 3D AA E.E.C.3.).....=. > 0460: A7 01 00 00 00 17 76 4B 99 01 00 00 00 2E 00 00 ......vK........
It seems that the ACPI method responsible for setting the thermal policy always returns the thermal policy passed as an argument. The driver however checks if the return value is zero and returns an error if its not. After checking the acpidumps from other ASUS machines, it seems that the return value has not special meaning (some always return 1, some return something different). Can you apply a patch and build a custom kernel?
Yes, sure. Would it be sufficient to build a module or is the full kernel build needed? (The latter takes significantly longer on the laptop.)
You will only need to build the module, i will send you a patch soon.
Can you check in the mean time if any BIOS updates are available for your device?
I am running the latest official BIOS version from ASUS (307 from 2024/04/03).
Created attachment 307261 [details] Prototype patch
Can you apply this patch and test if this solves the problem? I still suspect that this is somehow a BIOS issue, so if you have a dualboot setup then please try to verify if the ASUS software under Windows can successfully switch thermal policies.
Hi Armin I cannot comnpile the module. I get the following error: drivers/platform/x86/asus-wmi.c: In function 'fan_boost_mode_write': drivers/platform/x86/asus-wmi.c:3116:38: error: 'retval' undeclared (first use in this function) 3116 | &retval); | ^~~~~~ drivers/platform/x86/asus-wmi.c:3116:38: note: each undeclared identifier is reported only once for each function it appears in CC [M] drivers/platform/x86/gpd-pocket-fan.o drivers/platform/x86/asus-wmi.c: In function 'throttle_thermal_policy_write': drivers/platform/x86/asus-wmi.c:3699:13: warning: unused variable 'retval' [-Wunused-variable] 3699 | u32 retval; | ^~~~~~
Update: I removed the first part of the patch (where the retval declaration was removed). Now the patch applies and restores correct functionality.
Ok, i will try to fix the issue with the patch. Do you have a dualboot setup?
No, it is a single boot setup, running only linux. Here is the dmesg from 6.12-rc7 with the truncated patch applied: ❯ dmesg|grep asus [ 12.756754] asus_wmi: ASUS WMI generic driver loaded [ 12.797541] asus_wmi: Initialization: 0x1 [ 12.798530] asus_wmi: SFUN value: 0x21 [ 12.798540] asus-nb-wmi asus-nb-wmi: Detected ATK, not ASUSWMI, use DSTS [ 12.845043] asus-nb-wmi asus-nb-wmi: Using throttle_thermal_policy for platform_profile support [ 12.860431] input: Asus WMI hotkeys as /devices/platform/asus-nb-wmi/input/input11 [ 12.909854] asus_wmi: using asus-wmi for asus::kbd_backlight