Preserve advanced fan curve across AC/DC profile switches#317
Open
basselemam0612 wants to merge 1 commit into
Open
Preserve advanced fan curve across AC/DC profile switches#317basselemam0612 wants to merge 1 commit into
basselemam0612 wants to merge 1 commit into
Conversation
When a user enables Advanced fan control (custom curve), setUserMode() was unconditionally overwriting fan_mode back to auto_fan_mode. This happens implicitly via on_ChargerStateChange() whenever AC state is detected or changes (including at MCC startup), silently disabling the user's curve. Skip the setFanMode() call inside setUserMode() when the user has fanModeAdvanced=true persisted, so manual fan curves survive AC/DC auto-profile transitions and PPD-driven mode switches.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
With
autoAcDcProfilesState=trueandfanModeAdvanced=true, every AC connect / disconnect — and the initial detection at MCC startup — triggerson_ChargerStateChange()→setModeFromSelection()→setUserMode(). InsidesetUserMode(),fanModeis hardcoded toauto_fan_modefor every profile except Silent, and unconditionally written to the EC viamsiEcHelper.setFanMode().This silently disables the user's custom fan curve. Externally observable as
fan_mode=autoin/sys/devices/platform/msi-ec/fan_modeeven when the GUI checkbox "Advanced fan control" is still ticked. The fan curve registers (e.g. 0x6A–0x78 on G2_10 devices) remain populated, but the EC is no longer in advanced mode to use them, so the fan reverts to the EC's built-in auto curve.This was introduced by the Charger Detection + PPD Integration change (#307), because that is what wired up the auto
setUserMode()call path on charger state changes.Fix
In
Operate::setUserMode(), before pushingfanMode, check the persistedfanModeAdvancedsetting. If the user has advanced fan control enabled, leave the EC'sfan_modealone —shift_modeandsuper_batteryare still applied as before, so the rest of the profile transition still works. This preserves the user's intent across AC/DC and PPD-driven transitions.No behavior change for users with
fanModeAdvanced=false.Verified
Reproduced and fixed on MSI Raider 18 HX AI A2XWJG (MS-1824), EC firmware
1824EMS1.108, kernel 6.17.0-29, msi-ec 0.13:fan_modeflips fromadvancedtoautowithin ~1 s of startup. Plug/unplug AC reproduces it on demand.fan_mode=advancedis preserved across MCC start, AC connect/disconnect, and PPD mode changes.shift_modecontinues to follow the selected profile. The EC fan curve registers drive the fans as the user configured.