Am 26.10.24 um 12:45 schrieb Mohamed Ghanmi:
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()
Ok, i will wait for Luke to give feedback on this series. In my opinion the order change is
ok since users likely expect the "old" Asus switching order.
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]