89 lines
2.5 KiB
Diff
89 lines
2.5 KiB
Diff
|
From 44f21855901b1fd618ac16b07dbd14e8fea4ee13 Mon Sep 17 00:00:00 2001
|
||
|
From: Mario Limonciello <mario.limonciello@amd.com>
|
||
|
Date: Sat, 31 Aug 2024 21:49:11 -0500
|
||
|
Subject: cpufreq/amd-pstate: Export symbols for changing modes
|
||
|
|
||
|
In order to effectively test all mode switch combinations export
|
||
|
everything necessarily for amd-pstate-ut to trigger a mode switch.
|
||
|
|
||
|
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
|
||
|
---
|
||
|
drivers/cpufreq/amd-pstate.c | 23 ++++++++++-------------
|
||
|
drivers/cpufreq/amd-pstate.h | 14 ++++++++++++++
|
||
|
2 files changed, 24 insertions(+), 13 deletions(-)
|
||
|
|
||
|
--- a/drivers/cpufreq/amd-pstate.c
|
||
|
+++ b/drivers/cpufreq/amd-pstate.c
|
||
|
@@ -60,18 +60,6 @@
|
||
|
#define AMD_CPPC_EPP_BALANCE_POWERSAVE 0xBF
|
||
|
#define AMD_CPPC_EPP_POWERSAVE 0xFF
|
||
|
|
||
|
-/*
|
||
|
- * enum amd_pstate_mode - driver working mode of amd pstate
|
||
|
- */
|
||
|
-enum amd_pstate_mode {
|
||
|
- AMD_PSTATE_UNDEFINED = 0,
|
||
|
- AMD_PSTATE_DISABLE,
|
||
|
- AMD_PSTATE_PASSIVE,
|
||
|
- AMD_PSTATE_ACTIVE,
|
||
|
- AMD_PSTATE_GUIDED,
|
||
|
- AMD_PSTATE_MAX,
|
||
|
-};
|
||
|
-
|
||
|
static const char * const amd_pstate_mode_string[] = {
|
||
|
[AMD_PSTATE_UNDEFINED] = "undefined",
|
||
|
[AMD_PSTATE_DISABLE] = "disable",
|
||
|
@@ -81,6 +69,14 @@ static const char * const amd_pstate_mod
|
||
|
NULL,
|
||
|
};
|
||
|
|
||
|
+const char *amd_pstate_get_mode_string(enum amd_pstate_mode mode)
|
||
|
+{
|
||
|
+ if (mode < 0 || mode >= AMD_PSTATE_MAX)
|
||
|
+ return NULL;
|
||
|
+ return amd_pstate_mode_string[mode];
|
||
|
+}
|
||
|
+EXPORT_SYMBOL_GPL(amd_pstate_get_mode_string);
|
||
|
+
|
||
|
struct quirk_entry {
|
||
|
u32 nominal_freq;
|
||
|
u32 lowest_freq;
|
||
|
@@ -1392,7 +1388,7 @@ static ssize_t amd_pstate_show_status(ch
|
||
|
return sysfs_emit(buf, "%s\n", amd_pstate_mode_string[cppc_state]);
|
||
|
}
|
||
|
|
||
|
-static int amd_pstate_update_status(const char *buf, size_t size)
|
||
|
+int amd_pstate_update_status(const char *buf, size_t size)
|
||
|
{
|
||
|
int mode_idx;
|
||
|
|
||
|
@@ -1409,6 +1405,7 @@ static int amd_pstate_update_status(cons
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
+EXPORT_SYMBOL_GPL(amd_pstate_update_status);
|
||
|
|
||
|
static ssize_t status_show(struct device *dev,
|
||
|
struct device_attribute *attr, char *buf)
|
||
|
--- a/drivers/cpufreq/amd-pstate.h
|
||
|
+++ b/drivers/cpufreq/amd-pstate.h
|
||
|
@@ -103,4 +103,18 @@ struct amd_cpudata {
|
||
|
bool boost_state;
|
||
|
};
|
||
|
|
||
|
+/*
|
||
|
+ * enum amd_pstate_mode - driver working mode of amd pstate
|
||
|
+ */
|
||
|
+enum amd_pstate_mode {
|
||
|
+ AMD_PSTATE_UNDEFINED = 0,
|
||
|
+ AMD_PSTATE_DISABLE,
|
||
|
+ AMD_PSTATE_PASSIVE,
|
||
|
+ AMD_PSTATE_ACTIVE,
|
||
|
+ AMD_PSTATE_GUIDED,
|
||
|
+ AMD_PSTATE_MAX,
|
||
|
+};
|
||
|
+const char *amd_pstate_get_mode_string(enum amd_pstate_mode mode);
|
||
|
+int amd_pstate_update_status(const char *buf, size_t size);
|
||
|
+
|
||
|
#endif /* _LINUX_AMD_PSTATE_H */
|