Commit fc6e0837 authored by Mario Limonciello's avatar Mario Limonciello

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: default avatarArtem S. Tashkinov <aros@gmx.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217931#c61Reviewed-by: default avatarPerry Yuan <perry.yuan@amd.com>
Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
parent c00d476c
...@@ -282,10 +282,8 @@ static int amd_pstate_set_energy_pref_index(struct amd_cpudata *cpudata, ...@@ -282,10 +282,8 @@ static int amd_pstate_set_energy_pref_index(struct amd_cpudata *cpudata,
int epp = -EINVAL; int epp = -EINVAL;
int ret; int ret;
if (!pref_index) { if (!pref_index)
pr_debug("EPP pref_index is invalid\n"); epp = cpudata->epp_default;
return -EINVAL;
}
if (epp == -EINVAL) if (epp == -EINVAL)
epp = epp_values[pref_index]; epp = epp_values[pref_index];
...@@ -1441,7 +1439,7 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) ...@@ -1441,7 +1439,7 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy)
policy->driver_data = cpudata; policy->driver_data = cpudata;
cpudata->epp_cached = amd_pstate_get_epp(cpudata, 0); cpudata->epp_cached = cpudata->epp_default = amd_pstate_get_epp(cpudata, 0);
policy->min = policy->cpuinfo.min_freq; policy->min = policy->cpuinfo.min_freq;
policy->max = policy->cpuinfo.max_freq; policy->max = policy->cpuinfo.max_freq;
......
...@@ -99,6 +99,7 @@ struct amd_cpudata { ...@@ -99,6 +99,7 @@ struct amd_cpudata {
u32 policy; u32 policy;
u64 cppc_cap1_cached; u64 cppc_cap1_cached;
bool suspended; bool suspended;
s16 epp_default;
}; };
#endif /* _LINUX_AMD_PSTATE_H */ #endif /* _LINUX_AMD_PSTATE_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment