Skip to content

Commit fc6e083

Browse files
committed
cpufreq: amd-pstate: Allow users to write 'default' EPP string
The EPP string for 'default' represents what the firmware had configured as the default EPP value but once a user changes EPP to another string they can't reset it back to 'default'. Cache the firmware EPP value and allow the user to write 'default' using this value. Reported-by: Artem S. Tashkinov <aros@gmx.com> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217931#c61 Reviewed-by: Perry Yuan <perry.yuan@amd.com> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
1 parent c00d476 commit fc6e083

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

drivers/cpufreq/amd-pstate.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,8 @@ static int amd_pstate_set_energy_pref_index(struct amd_cpudata *cpudata,
282282
int epp = -EINVAL;
283283
int ret;
284284

285-
if (!pref_index) {
286-
pr_debug("EPP pref_index is invalid\n");
287-
return -EINVAL;
288-
}
285+
if (!pref_index)
286+
epp = cpudata->epp_default;
289287

290288
if (epp == -EINVAL)
291289
epp = epp_values[pref_index];
@@ -1441,7 +1439,7 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy)
14411439

14421440
policy->driver_data = cpudata;
14431441

1444-
cpudata->epp_cached = amd_pstate_get_epp(cpudata, 0);
1442+
cpudata->epp_cached = cpudata->epp_default = amd_pstate_get_epp(cpudata, 0);
14451443

14461444
policy->min = policy->cpuinfo.min_freq;
14471445
policy->max = policy->cpuinfo.max_freq;

drivers/cpufreq/amd-pstate.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ struct amd_cpudata {
9999
u32 policy;
100100
u64 cppc_cap1_cached;
101101
bool suspended;
102+
s16 epp_default;
102103
};
103104

104105
#endif /* _LINUX_AMD_PSTATE_H */

0 commit comments

Comments
 (0)