diff options
author | Shyam Sundar S K <Shyam-sundar.S-k@amd.com> | 2022-08-02 20:41:46 +0530 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2022-08-15 13:23:38 +0200 |
commit | 3f5571d9952473c183762b801c61c42b9dbe1903 (patch) | |
tree | 1e215b0ed738b2b3155a2bf17e8f3dfa1e68f9ee /drivers/platform/x86/amd/pmf/core.c | |
parent | 1a409b35c9956617f9e201120225f230f1695d6e (diff) |
platform/x86/amd/pmf: Add support for Auto mode feature
This feature has 3 modes quiet, balanced, performance
The objective of this feature is to track the moving average of system
power over the time period specified and switch to the subsequent mode.
In order to do this, PMF driver will get the moving average of APU power
from PMFW and power threshold, time constants, system config parameters
from OEM inputs.
System power as read by PMF driver from PMFW is the filtered value over
the sampling window. Every sampling window, moving average of system power
is computed. At the end of the monitoring window, the moving average is
compared against the threshold for mode switch for decision making.
With AMD managing the system config limits, any mode switch within
auto-mode will result in limits of fPPT/sPPT/STAPM or STT being scaled
down.
When "auto mode" is enabled, the static slider control remains out of
the PMF driver, so the platform_profile registration would not
happen in PMF driver.
The transition to auto-mode only happens when the APMF fn5 is enabled
in BIOS, platform_profile set to "balanced" and a AMT
(Auto Mode transition) is received.
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://lore.kernel.org/r/20220802151149.2123699-9-Shyam-sundar.S-k@amd.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/platform/x86/amd/pmf/core.c')
-rw-r--r-- | drivers/platform/x86/amd/pmf/core.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/platform/x86/amd/pmf/core.c b/drivers/platform/x86/amd/pmf/core.c index 5f09458abb9c..d27560f1ebb7 100644 --- a/drivers/platform/x86/amd/pmf/core.c +++ b/drivers/platform/x86/amd/pmf/core.c @@ -240,12 +240,21 @@ static void amd_pmf_init_features(struct amd_pmf_dev *dev) amd_pmf_init_sps(dev); dev_dbg(dev->dev, "SPS enabled and Platform Profiles registered\n"); } + + /* Enable Auto Mode */ + if (is_apmf_func_supported(dev, APMF_FUNC_AUTO_MODE)) { + amd_pmf_init_auto_mode(dev); + dev_dbg(dev->dev, "Auto Mode Init done\n"); + } } static void amd_pmf_deinit_features(struct amd_pmf_dev *dev) { if (is_apmf_func_supported(dev, APMF_FUNC_STATIC_SLIDER_GRANULAR)) amd_pmf_deinit_sps(dev); + + if (is_apmf_func_supported(dev, APMF_FUNC_AUTO_MODE)) + amd_pmf_deinit_auto_mode(dev); } static const struct acpi_device_id amd_pmf_acpi_ids[] = { |