Hi, On 26-Oct-24 12:45 PM, Mohamed Ghanmi wrote: > On Fri, Oct 25, 2024 at 09:15:14PM +0200, Armin Wolf wrote: >> When changing the thermal policy using the platform profile API, >> a Vivobook thermal policy is stored in throttle_thermal_policy_mode. >> >> However everywhere else a normal thermal policy is stored inside this >> variable, potentially confusing the platform profile. >> >> Fix this by always storing normal thermal policy values inside >> throttle_thermal_policy_mode and only do the conversion when writing >> the thermal policy to hardware. >> >> Fixes: bcbfcebda2cb ("platform/x86: asus-wmi: add support for vivobook fan profiles") >> Signed-off-by: Armin Wolf <W_Armin@xxxxxx> >> --- >> drivers/platform/x86/asus-wmi.c | 64 +++++++++++---------------------- >> 1 file changed, 21 insertions(+), 43 deletions(-) > > the original patch that i submitted did actually have the remapping > of the different fan profiles in the throttle_thermal_policy_write() methods > because it was the cleaner solution [1]. however after having a discussion with luke, > he shared that he might be planning to remove the throttle_thermal_policy sysfs interface > in favour of platform_profiles [2] because of a refactoring he had been working on. > > currently to control fan profiles through this driver you could use > either /sys/devices/platform/asus-nb-wmi/throttle_thermal_policy > (redundant and might get removed in the future) or through platform profiles which is the > better way of doing things. > > for the reasons mentionned above, I decided to keep > throttle_therma_policy_write() unchanged and to move the remapping logic > to the asus_wmi_platform_profile_set(). this adopts the approach of > having a logical mapping stored in asus_wmi struct that has to be > converted to a physical mapping whenever needed [3]. > > so, if luke thinks that this won't cause any merge conflicts with his > work [4] then i see no problem with this approach even though it might cause an > order change when calling throttle_thermal_policy_switch_next() Talking about throttle_thermal_policy_switch_next() we also have platform_profile_cycle() and since asus-wmi supports platform-profiles now I'm wondering if it would not be better to simply completely drop throttle_thermal_policy_switch_next() and call platform_profile_cycle() instead? This will also keep the cycle order the same for "normal" vs vivo even after Armin's patch. Anyways I'll go and apply patch 1/2 to pdx86/fixes since that one is obviously correct and fixes th Lunar Lake performance issues. And we can keep discussing what to do wrt 2/2 and maybe also drop throttle_thermal_policy_switch_next() if favor of platform_profile_cycle(). Regards, Hans > > Best Regards, > Mohamed G. > > Link: https://lore.kernel.org/platform-driver-x86/20240421194320.48258-2-mohamed.ghanmi@xxxxxxxxx/ # [1] > Link: https://lore.kernel.org/platform-driver-x86/4de768c5-aae5-4fda-a139-a8b73c8495a1@xxxxxxxxxxxxxxxx/ # [2] > Link: https://lore.kernel.org/platform-driver-x86/ZnlEuiP4Dgqpf51C@laptop/ # [3] > Link: https://lore.kernel.org/platform-driver-x86/20240930000046.51388-1-luke@xxxxxxxxxx/ # [4] >