platform/x86/amd/pmf: Add support for Auto mode feature
authorShyam Sundar S K <Shyam-sundar.S-k@amd.com>
Tue, 2 Aug 2022 15:11:46 +0000 (20:41 +0530)
committerHans de Goede <hdegoede@redhat.com>
Mon, 15 Aug 2022 11:23:38 +0000 (13:23 +0200)
commit3f5571d9952473c183762b801c61c42b9dbe1903
tree1e215b0ed738b2b3155a2bf17e8f3dfa1e68f9ee
parent1a409b35c9956617f9e201120225f230f1695d6e
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>
drivers/platform/x86/amd/pmf/Makefile
drivers/platform/x86/amd/pmf/acpi.c
drivers/platform/x86/amd/pmf/auto-mode.c [new file with mode: 0644]
drivers/platform/x86/amd/pmf/core.c
drivers/platform/x86/amd/pmf/pmf.h