| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * linux/drivers/cpufreq/freq_table.c |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * 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 | | - * |
|---|
| 10 | 6 | */ |
|---|
| 11 | 7 | |
|---|
| 12 | 8 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
|---|
| 13 | 9 | |
|---|
| 14 | 10 | #include <linux/cpufreq.h> |
|---|
| 15 | 11 | #include <linux/module.h> |
|---|
| 12 | +#include <trace/hooks/cpufreq.h> |
|---|
| 16 | 13 | |
|---|
| 17 | 14 | /********************************************************************* |
|---|
| 18 | 15 | * FREQUENCY TABLE HELPERS * |
|---|
| .. | .. |
|---|
| 55 | 52 | max_freq = freq; |
|---|
| 56 | 53 | } |
|---|
| 57 | 54 | |
|---|
| 55 | + trace_android_vh_freq_table_limits(policy, min_freq, max_freq); |
|---|
| 58 | 56 | 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; |
|---|
| 60 | 64 | |
|---|
| 61 | 65 | if (policy->min == ~0) |
|---|
| 62 | 66 | return -EINVAL; |
|---|
| .. | .. |
|---|
| 64 | 68 | return 0; |
|---|
| 65 | 69 | } |
|---|
| 66 | 70 | |
|---|
| 67 | | -int cpufreq_frequency_table_verify(struct cpufreq_policy *policy, |
|---|
| 71 | +int cpufreq_frequency_table_verify(struct cpufreq_policy_data *policy, |
|---|
| 68 | 72 | struct cpufreq_frequency_table *table) |
|---|
| 69 | 73 | { |
|---|
| 70 | 74 | struct cpufreq_frequency_table *pos; |
|---|
| .. | .. |
|---|
| 104 | 108 | * Generic routine to verify policy & frequency table, requires driver to set |
|---|
| 105 | 109 | * policy->freq_table prior to it. |
|---|
| 106 | 110 | */ |
|---|
| 107 | | -int cpufreq_generic_frequency_table_verify(struct cpufreq_policy *policy) |
|---|
| 111 | +int cpufreq_generic_frequency_table_verify(struct cpufreq_policy_data *policy) |
|---|
| 108 | 112 | { |
|---|
| 109 | 113 | if (!policy->freq_table) |
|---|
| 110 | 114 | return -ENODEV; |
|---|
| .. | .. |
|---|
| 225 | 229 | } |
|---|
| 226 | 230 | EXPORT_SYMBOL_GPL(cpufreq_frequency_table_get_index); |
|---|
| 227 | 231 | |
|---|
| 228 | | -/** |
|---|
| 232 | +/* |
|---|
| 229 | 233 | * show_available_freqs - show available frequencies for the specified CPU |
|---|
| 230 | 234 | */ |
|---|
| 231 | 235 | static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf, |
|---|
| .. | .. |
|---|
| 264 | 268 | struct freq_attr cpufreq_freq_attr_##_name##_freqs = \ |
|---|
| 265 | 269 | __ATTR_RO(_name##_frequencies) |
|---|
| 266 | 270 | |
|---|
| 267 | | -/** |
|---|
| 271 | +/* |
|---|
| 268 | 272 | * show_scaling_available_frequencies - show available normal frequencies for |
|---|
| 269 | 273 | * the specified CPU |
|---|
| 270 | 274 | */ |
|---|
| .. | .. |
|---|
| 276 | 280 | cpufreq_attr_available_freq(scaling_available); |
|---|
| 277 | 281 | EXPORT_SYMBOL_GPL(cpufreq_freq_attr_scaling_available_freqs); |
|---|
| 278 | 282 | |
|---|
| 279 | | -/** |
|---|
| 283 | +/* |
|---|
| 280 | 284 | * show_available_boost_freqs - show available boost frequencies for |
|---|
| 281 | 285 | * the specified CPU |
|---|
| 282 | 286 | */ |
|---|
| .. | .. |
|---|
| 290 | 294 | |
|---|
| 291 | 295 | struct freq_attr *cpufreq_generic_attr[] = { |
|---|
| 292 | 296 | &cpufreq_freq_attr_scaling_available_freqs, |
|---|
| 293 | | -#ifdef CONFIG_CPU_FREQ_BOOST_SW |
|---|
| 294 | | - &cpufreq_freq_attr_scaling_boost_freqs, |
|---|
| 295 | | -#endif |
|---|
| 296 | 297 | NULL, |
|---|
| 297 | 298 | }; |
|---|
| 298 | 299 | EXPORT_SYMBOL_GPL(cpufreq_generic_attr); |
|---|