hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/cpufreq/freq_table.c
....@@ -1,18 +1,15 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * linux/drivers/cpufreq/freq_table.c
34 *
45 * Copyright (C) 2002 - 2003 Dominik Brodowski
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License version 2 as
8
- * published by the Free Software Foundation.
9
- *
106 */
117
128 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
139
1410 #include <linux/cpufreq.h>
1511 #include <linux/module.h>
12
+#include <trace/hooks/cpufreq.h>
1613
1714 /*********************************************************************
1815 * FREQUENCY TABLE HELPERS *
....@@ -55,8 +52,15 @@
5552 max_freq = freq;
5653 }
5754
55
+ trace_android_vh_freq_table_limits(policy, min_freq, max_freq);
5856 policy->min = policy->cpuinfo.min_freq = min_freq;
59
- policy->max = policy->cpuinfo.max_freq = max_freq;
57
+ policy->max = max_freq;
58
+ /*
59
+ * If the driver has set its own cpuinfo.max_freq above max_freq, leave
60
+ * it as is.
61
+ */
62
+ if (policy->cpuinfo.max_freq < max_freq)
63
+ policy->max = policy->cpuinfo.max_freq = max_freq;
6064
6165 if (policy->min == ~0)
6266 return -EINVAL;
....@@ -64,7 +68,7 @@
6468 return 0;
6569 }
6670
67
-int cpufreq_frequency_table_verify(struct cpufreq_policy *policy,
71
+int cpufreq_frequency_table_verify(struct cpufreq_policy_data *policy,
6872 struct cpufreq_frequency_table *table)
6973 {
7074 struct cpufreq_frequency_table *pos;
....@@ -104,7 +108,7 @@
104108 * Generic routine to verify policy & frequency table, requires driver to set
105109 * policy->freq_table prior to it.
106110 */
107
-int cpufreq_generic_frequency_table_verify(struct cpufreq_policy *policy)
111
+int cpufreq_generic_frequency_table_verify(struct cpufreq_policy_data *policy)
108112 {
109113 if (!policy->freq_table)
110114 return -ENODEV;
....@@ -225,7 +229,7 @@
225229 }
226230 EXPORT_SYMBOL_GPL(cpufreq_frequency_table_get_index);
227231
228
-/**
232
+/*
229233 * show_available_freqs - show available frequencies for the specified CPU
230234 */
231235 static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf,
....@@ -264,7 +268,7 @@
264268 struct freq_attr cpufreq_freq_attr_##_name##_freqs = \
265269 __ATTR_RO(_name##_frequencies)
266270
267
-/**
271
+/*
268272 * show_scaling_available_frequencies - show available normal frequencies for
269273 * the specified CPU
270274 */
....@@ -276,7 +280,7 @@
276280 cpufreq_attr_available_freq(scaling_available);
277281 EXPORT_SYMBOL_GPL(cpufreq_freq_attr_scaling_available_freqs);
278282
279
-/**
283
+/*
280284 * show_available_boost_freqs - show available boost frequencies for
281285 * the specified CPU
282286 */
....@@ -290,9 +294,6 @@
290294
291295 struct freq_attr *cpufreq_generic_attr[] = {
292296 &cpufreq_freq_attr_scaling_available_freqs,
293
-#ifdef CONFIG_CPU_FREQ_BOOST_SW
294
- &cpufreq_freq_attr_scaling_boost_freqs,
295
-#endif
296297 NULL,
297298 };
298299 EXPORT_SYMBOL_GPL(cpufreq_generic_attr);