Skip to content

Commit 8d91681

Browse files
committed
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. Reviewed-by: Perry Yuan <[email protected]> Signed-off-by: Mario Limonciello <[email protected]>
1 parent 15a2b76 commit 8d91681

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

drivers/cpufreq/amd-pstate.c

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,6 @@
5858
#define AMD_CPPC_EPP_BALANCE_POWERSAVE 0xBF
5959
#define AMD_CPPC_EPP_POWERSAVE 0xFF
6060

61-
/*
62-
* enum amd_pstate_mode - driver working mode of amd pstate
63-
*/
64-
enum amd_pstate_mode {
65-
AMD_PSTATE_UNDEFINED = 0,
66-
AMD_PSTATE_DISABLE,
67-
AMD_PSTATE_PASSIVE,
68-
AMD_PSTATE_ACTIVE,
69-
AMD_PSTATE_GUIDED,
70-
AMD_PSTATE_MAX,
71-
};
72-
7361
static const char * const amd_pstate_mode_string[] = {
7462
[AMD_PSTATE_UNDEFINED] = "undefined",
7563
[AMD_PSTATE_DISABLE] = "disable",
@@ -79,6 +67,14 @@ static const char * const amd_pstate_mode_string[] = {
7967
NULL,
8068
};
8169

70+
const char *amd_pstate_get_mode_string(enum amd_pstate_mode mode)
71+
{
72+
if (mode < 0 || mode >= AMD_PSTATE_MAX)
73+
return NULL;
74+
return amd_pstate_mode_string[mode];
75+
}
76+
EXPORT_SYMBOL_GPL(amd_pstate_get_mode_string);
77+
8278
struct quirk_entry {
8379
u32 nominal_freq;
8480
u32 lowest_freq;
@@ -1286,7 +1282,7 @@ static ssize_t amd_pstate_show_status(char *buf)
12861282
return sysfs_emit(buf, "%s\n", amd_pstate_mode_string[cppc_state]);
12871283
}
12881284

1289-
static int amd_pstate_update_status(const char *buf, size_t size)
1285+
int amd_pstate_update_status(const char *buf, size_t size)
12901286
{
12911287
int mode_idx;
12921288

@@ -1303,6 +1299,7 @@ static int amd_pstate_update_status(const char *buf, size_t size)
13031299

13041300
return 0;
13051301
}
1302+
EXPORT_SYMBOL_GPL(amd_pstate_update_status);
13061303

13071304
static ssize_t status_show(struct device *dev,
13081305
struct device_attribute *attr, char *buf)

drivers/cpufreq/amd-pstate.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,18 @@ struct amd_cpudata {
103103
bool boost_state;
104104
};
105105

106+
/*
107+
* enum amd_pstate_mode - driver working mode of amd pstate
108+
*/
109+
enum amd_pstate_mode {
110+
AMD_PSTATE_UNDEFINED = 0,
111+
AMD_PSTATE_DISABLE,
112+
AMD_PSTATE_PASSIVE,
113+
AMD_PSTATE_ACTIVE,
114+
AMD_PSTATE_GUIDED,
115+
AMD_PSTATE_MAX,
116+
};
117+
const char *amd_pstate_get_mode_string(enum amd_pstate_mode mode);
118+
int amd_pstate_update_status(const char *buf, size_t size);
119+
106120
#endif /* _LINUX_AMD_PSTATE_H */

0 commit comments

Comments
 (0)