diff options
| author | Shyam Sundar S K <Shyam-sundar.S-k@amd.com> | 2026-06-09 13:40:41 +0530 |
|---|---|---|
| committer | Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> | 2026-07-10 15:13:47 +0300 |
| commit | c7bdedfcb8bab6dc5074623462bddd3241f0f311 (patch) | |
| tree | 34ab6940f0d35a4a06c0a21f3ab8eae218a5de7d /include/uapi | |
| parent | 08f3df928fc8cbab2cae09296f568ed294b3a81a (diff) | |
| download | linux-c7bdedfcb8bab6dc5074623462bddd3241f0f311.tar.gz linux-c7bdedfcb8bab6dc5074623462bddd3241f0f311.zip | |
platform/x86/amd/pmf: Move debug helper functions to UAPI header
These debug helper functions convert enumerated values to appropriate
message and can be useful for userspace tools and other kernel components
that need to interpret AMD PMF state values.
By making them inline functions in the UAPI header, they become available
to both kernel and userspace without code duplication. Also, prefix the
function names with amd_pmf_.
Also, include a case to cover unused enum entries.
Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://patch.msgid.link/20260609081044.2416731-5-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Diffstat (limited to 'include/uapi')
| -rw-r--r-- | include/uapi/linux/amd-pmf.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/include/uapi/linux/amd-pmf.h b/include/uapi/linux/amd-pmf.h index bd802f25a717..24cf9926dc59 100644 --- a/include/uapi/linux/amd-pmf.h +++ b/include/uapi/linux/amd-pmf.h @@ -116,6 +116,64 @@ enum amd_pmf_platform_type { AMD_PMF_PTYPE_INVALID = 0xf, }; +static inline const char *amd_pmf_get_platform_type(unsigned int platform_type) +{ + switch (platform_type) { + case AMD_PMF_CLAMSHELL: + return "CLAMSHELL"; + case AMD_PMF_LID_CLOSE: + return "LID_CLOSE"; + case AMD_PMF_FLAT: + return "FLAT"; + case AMD_PMF_TENT: + return "TENT"; + case AMD_PMF_STAND: + return "STAND"; + case AMD_PMF_TABLET: + return "TABLET"; + case AMD_PMF_BOOK: + return "BOOK"; + case AMD_PMF_PRESENTATION: + return "PRESENTATION"; + case AMD_PMF_PULL_FWD: + return "PULL_FWD"; + default: + return "UNKNOWN"; + } +} + +static inline const char *amd_pmf_get_laptop_placement(unsigned int device_state) +{ + switch (device_state) { + case AMD_PMF_ON_TABLE: + return "ON_TABLE"; + case AMD_PMF_ON_LAP_MOTION: + return "ON_LAP_MOTION"; + case AMD_PMF_IN_BAG: + return "IN_BAG"; + case AMD_PMF_OUT_OF_BAG: + return "OUT_OF_BAG"; + default: + return "UNKNOWN"; + } +} + +static inline const char *amd_pmf_get_slider_position(unsigned int state) +{ + switch (state) { + case AMD_PMF_TA_BEST_PERFORMANCE: + return "PERFORMANCE"; + case AMD_PMF_TA_BETTER_PERFORMANCE: + return "BALANCED"; + case AMD_PMF_TA_BEST_BATTERY: + return "POWER_SAVER"; + case AMD_PMF_TA_BETTER_BATTERY: + return "BALANCED_BATTERY"; + default: + return "Unknown TA Slider State"; + } +} + struct amd_pmf_info { __u64 size; |
