[PATCH v1 00/10] platform/x86: msi-wmi-platform: Add fan curves/platform profile/tdp/battery limiting

Antheas Kapenekakis posted 10 patches 7 months, 1 week ago
.../wmi/devices/msi-wmi-platform.rst          |   26 +
drivers/platform/x86/Kconfig                  |    3 +
drivers/platform/x86/msi-wmi-platform.c       | 1181 ++++++++++++++++-
3 files changed, 1156 insertions(+), 54 deletions(-)
[PATCH v1 00/10] platform/x86: msi-wmi-platform: Add fan curves/platform profile/tdp/battery limiting
Posted by Antheas Kapenekakis 7 months, 1 week ago
This draft patch series brings into parity the msi-wmi-platform driver with
the MSI Center M Windows application for the MSI Claw (all models).
Unfortunately, MSI Center M and this interface do not have a discovery API,
necessitating the introduction of a quirk system.

While this patch series is fully functional and tested, there are still
some issues that need to be addressed:
  - Armin notes we need to disable fan curve support by default and quirk
    it as well, as it is not supported on all models. However, the way
    PWM enable ops work, this makes it a bit difficult, so I would like
    some suggestions on how to rework this.
  - It turns out that to fully disable the fan curve, we have to restore
    the default fan values. This is also what is done on the OEM software.
    For this, the last patch in the series is used, which is a bit dirty.

Sleep was tested with all values being preserved during S0iX (platform
profile, fan curve, PL1/PL2), so we do not need suspend/resume hooks, at
least for the Claw devices.

For PL1/PL2, we use firmware-attributes. So for that I +cc Kurt since if
his new high level interface is merged beforehand, we can use that instead.

Antheas Kapenekakis (8):
  platform/x86: msi-wmi-platform: Add unlocked msi_wmi_platform_query
  platform/x86: msi-wmi-platform: Add quirk system
  platform/x86: msi-wmi-platform: Add platform profile through shift
    mode
  platform/x86: msi-wmi-platform: Add PL1/PL2 support via firmware
    attributes
  platform/x86: msi-wmi-platform: Add charge_threshold support
  platform/x86: msi-wmi-platform: Drop excess fans in dual fan devices
  platform/x86: msi-wmi-platform: Update header text
  platform/x86: msi-wmi-platform: Restore fan curves on PWM disable and
    unload

Armin Wolf (2):
  platform/x86: msi-wmi-platform: Use input buffer for returning result
  platform/x86: msi-wmi-platform: Add support for fan control

 .../wmi/devices/msi-wmi-platform.rst          |   26 +
 drivers/platform/x86/Kconfig                  |    3 +
 drivers/platform/x86/msi-wmi-platform.c       | 1181 ++++++++++++++++-
 3 files changed, 1156 insertions(+), 54 deletions(-)


base-commit: 62b1dcf2e7af3dc2879d1a39bf6823c99486a8c2
-- 
2.49.0
Re: [PATCH v1 00/10] platform/x86: msi-wmi-platform: Add fan curves/platform profile/tdp/battery limiting
Posted by Armin Wolf 7 months ago
Am 11.05.25 um 22:44 schrieb Antheas Kapenekakis:

> This draft patch series brings into parity the msi-wmi-platform driver with
> the MSI Center M Windows application for the MSI Claw (all models).
> Unfortunately, MSI Center M and this interface do not have a discovery API,
> necessitating the introduction of a quirk system.
>
> While this patch series is fully functional and tested, there are still
> some issues that need to be addressed:
>    - Armin notes we need to disable fan curve support by default and quirk
>      it as well, as it is not supported on all models. However, the way
>      PWM enable ops work, this makes it a bit difficult, so I would like
>      some suggestions on how to rework this.
>    - It turns out that to fully disable the fan curve, we have to restore
>      the default fan values. This is also what is done on the OEM software.
>      For this, the last patch in the series is used, which is a bit dirty.
>
> Sleep was tested with all values being preserved during S0iX (platform
> profile, fan curve, PL1/PL2), so we do not need suspend/resume hooks, at
> least for the Claw devices.
>
> For PL1/PL2, we use firmware-attributes. So for that I +cc Kurt since if
> his new high level interface is merged beforehand, we can use that instead.

Overall the patch series looks promising, however the suspend/resume handling
and the quirk system still needs some work.

If you wish i can provide you with a patch for the EC-based quirk system. You
can then structure your exiting patches around that.

Thanks,
Armin Wolf

> Antheas Kapenekakis (8):
>    platform/x86: msi-wmi-platform: Add unlocked msi_wmi_platform_query
>    platform/x86: msi-wmi-platform: Add quirk system
>    platform/x86: msi-wmi-platform: Add platform profile through shift
>      mode
>    platform/x86: msi-wmi-platform: Add PL1/PL2 support via firmware
>      attributes
>    platform/x86: msi-wmi-platform: Add charge_threshold support
>    platform/x86: msi-wmi-platform: Drop excess fans in dual fan devices
>    platform/x86: msi-wmi-platform: Update header text
>    platform/x86: msi-wmi-platform: Restore fan curves on PWM disable and
>      unload
>
> Armin Wolf (2):
>    platform/x86: msi-wmi-platform: Use input buffer for returning result
>    platform/x86: msi-wmi-platform: Add support for fan control
>
>   .../wmi/devices/msi-wmi-platform.rst          |   26 +
>   drivers/platform/x86/Kconfig                  |    3 +
>   drivers/platform/x86/msi-wmi-platform.c       | 1181 ++++++++++++++++-
>   3 files changed, 1156 insertions(+), 54 deletions(-)
>
>
> base-commit: 62b1dcf2e7af3dc2879d1a39bf6823c99486a8c2
Re: [PATCH v1 00/10] platform/x86: msi-wmi-platform: Add fan curves/platform profile/tdp/battery limiting
Posted by Kurt Borja 7 months, 1 week ago
Hi Antheas,

On Sun May 11, 2025 at 5:44 PM -03, Antheas Kapenekakis wrote:
> This draft patch series brings into parity the msi-wmi-platform driver with
> the MSI Center M Windows application for the MSI Claw (all models).
> Unfortunately, MSI Center M and this interface do not have a discovery API,
> necessitating the introduction of a quirk system.
>
> While this patch series is fully functional and tested, there are still
> some issues that need to be addressed:
>   - Armin notes we need to disable fan curve support by default and quirk
>     it as well, as it is not supported on all models. However, the way
>     PWM enable ops work, this makes it a bit difficult, so I would like
>     some suggestions on how to rework this.

If I understood the question correctly, then you should control the
visibility of all "curve" related attributes with the quirk.

The custom hwmon attribute_group has an is_visible callback, and so do
the hwmon_ops.

>   - It turns out that to fully disable the fan curve, we have to restore
>     the default fan values. This is also what is done on the OEM software.
>     For this, the last patch in the series is used, which is a bit dirty.

I have a couple questions about this.

* What are the default fan curves? Can these be statically defined?
* Are user-defined fan curves persistent between reboots?

I have some doubts about the approach you took on the last patch, but I
want to understand how the platform works first.

>
> Sleep was tested with all values being preserved during S0iX (platform
> profile, fan curve, PL1/PL2), so we do not need suspend/resume hooks, at
> least for the Claw devices.
>
> For PL1/PL2, we use firmware-attributes. So for that I +cc Kurt since if
> his new high level interface is merged beforehand, we can use that instead.

Hopefully!

-- 
 ~ Kurt

>
> Antheas Kapenekakis (8):
>   platform/x86: msi-wmi-platform: Add unlocked msi_wmi_platform_query
>   platform/x86: msi-wmi-platform: Add quirk system
>   platform/x86: msi-wmi-platform: Add platform profile through shift
>     mode
>   platform/x86: msi-wmi-platform: Add PL1/PL2 support via firmware
>     attributes
>   platform/x86: msi-wmi-platform: Add charge_threshold support
>   platform/x86: msi-wmi-platform: Drop excess fans in dual fan devices
>   platform/x86: msi-wmi-platform: Update header text
>   platform/x86: msi-wmi-platform: Restore fan curves on PWM disable and
>     unload
>
> Armin Wolf (2):
>   platform/x86: msi-wmi-platform: Use input buffer for returning result
>   platform/x86: msi-wmi-platform: Add support for fan control
>
>  .../wmi/devices/msi-wmi-platform.rst          |   26 +
>  drivers/platform/x86/Kconfig                  |    3 +
>  drivers/platform/x86/msi-wmi-platform.c       | 1181 ++++++++++++++++-
>  3 files changed, 1156 insertions(+), 54 deletions(-)
>
>
> base-commit: 62b1dcf2e7af3dc2879d1a39bf6823c99486a8c2