From 29e640a5588aaa21d0671aff13ddbe42d2843214 Mon Sep 17 00:00:00 2001 From: Ming Wang Date: Thu, 31 Oct 2024 17:44:39 +0800 Subject: [PATCH] cpufreq: loongson3-acpi: Initialize scaling_cur_freq correctly The policy->cur was not being initialized properly during CPU initialization, leading to it always reporting 0. This commit addresses this issue by setting the initial frequency to the normal maximum frequency. This ensures that the current frequency reflects the actual CPU operating frequency. Fixes: 31a15a203ba9 ("cpufreq: loongson3-acpi: Initialize scaling_cur_freq correctly") Signed-off-by: Ming Wang --- drivers/cpufreq/loongson3-acpi-cpufreq.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/cpufreq/loongson3-acpi-cpufreq.c b/drivers/cpufreq/loongson3-acpi-cpufreq.c index db7de3fd1b45..b5ffcb5c89b7 100644 --- a/drivers/cpufreq/loongson3-acpi-cpufreq.c +++ b/drivers/cpufreq/loongson3-acpi-cpufreq.c @@ -1257,6 +1257,8 @@ static int loongson3_cpufreq_cpu_init(struct cpufreq_policy *policy) if (has_boost_freq() && boost_supported()) loongson3_cpufreq_attr[1] = &cpufreq_freq_attr_scaling_boost_freqs; + policy->cur = core->normal_max_freq * 1000; + pr_info("CPU%u - ACPI performance management activated.\n", cpu); for (i = 0; i < perf->state_count; i++) pr_debug(" %cP%d: %d MHz, %d mW, %d uS %d level\n",