]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
cpufreq/amd-pstate: Export symbols for changing modes
authorMario Limonciello <mario.limonciello@amd.com>
Sun, 1 Sep 2024 02:49:11 +0000 (21:49 -0500)
committerMario Limonciello <mario.limonciello@amd.com>
Wed, 11 Sep 2024 15:23:23 +0000 (10:23 -0500)
In order to effectively test all mode switch combinations export
everything necessarily for amd-pstate-ut to trigger a mode switch.

Reviewed-by: Perry Yuan <Perry.Yuan@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
drivers/cpufreq/amd-pstate.c
drivers/cpufreq/amd-pstate.h

index f550d31f80eb384ca5d841efdb341a88521f8828..05b39a890bfaa8f3c0e5e513257d81ec09f532d0 100644 (file)
 #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",
@@ -79,6 +67,14 @@ static const char * const amd_pstate_mode_string[] = {
        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;
@@ -1286,7 +1282,7 @@ static ssize_t amd_pstate_show_status(char *buf)
        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;
 
@@ -1303,6 +1299,7 @@ static int amd_pstate_update_status(const char *buf, size_t size)
 
        return 0;
 }
+EXPORT_SYMBOL_GPL(amd_pstate_update_status);
 
 static ssize_t status_show(struct device *dev,
                           struct device_attribute *attr, char *buf)
index cc8bb2bc325aa3c35d4ac9381f44f7833e3d1c09..cd573bc6b6db83a62d7a5073fab8152b9d9e7b88 100644 (file)
@@ -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 */