Skip to content

Commit eabf9e6

Browse files
committed
Merge branch 'pm-cpufreq'
* pm-cpufreq: Revert "cpufreq: intel_pstate: Process HWP Guaranteed change notification" cpufreq: mediatek-hw: Add support for CPUFREQ HW cpufreq: Add of_perf_domain_get_sharing_cpumask dt-bindings: cpufreq: add bindings for MediaTek cpufreq HW cpufreq: Remove ready() callback cpufreq: sh: Remove sh_cpufreq_cpu_ready() cpufreq: acpi: Remove acpi_cpufreq_cpu_ready() cpufreq: qcom-hw: Set dvfs_possible_from_any_cpu cpufreq driver flag cpufreq: blocklist more Qualcomm platforms in cpufreq-dt-platdev cpufreq: qcom-cpufreq-hw: Add dcvs interrupt support cpufreq: scmi: Use .register_em() to register with energy model cpufreq: vexpress: Use .register_em() to register with energy model cpufreq: scpi: Use .register_em() to register with energy model cpufreq: qcom-cpufreq-hw: Use .register_em() to register with energy model cpufreq: omap: Use .register_em() to register with energy model cpufreq: mediatek: Use .register_em() to register with energy model cpufreq: imx6q: Use .register_em() to register with energy model cpufreq: dt: Use .register_em() to register with energy model cpufreq: Add callback to register with energy model cpufreq: vexpress: Set CPUFREQ_IS_COOLING_DEV flag
2 parents 5cbba60 + 27de8d5 commit eabf9e6

21 files changed

+684
-128
lines changed

Documentation/cpu-freq/cpu-drivers.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@ And optionally
7575
.resume - A pointer to a per-policy resume function which is called
7676
with interrupts disabled and _before_ the governor is started again.
7777

78-
.ready - A pointer to a per-policy ready function which is called after
79-
the policy is fully initialized.
80-
8178
.attr - A pointer to a NULL-terminated list of "struct freq_attr" which
8279
allow to export values to sysfs.
8380

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/cpufreq/cpufreq-mediatek-hw.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: MediaTek's CPUFREQ Bindings
8+
9+
maintainers:
10+
- Hector Yuan <[email protected]>
11+
12+
description:
13+
CPUFREQ HW is a hardware engine used by MediaTek SoCs to
14+
manage frequency in hardware. It is capable of controlling
15+
frequency for multiple clusters.
16+
17+
properties:
18+
compatible:
19+
const: mediatek,cpufreq-hw
20+
21+
reg:
22+
minItems: 1
23+
maxItems: 2
24+
description:
25+
Addresses and sizes for the memory of the HW bases in
26+
each frequency domain. Each entry corresponds to
27+
a register bank for each frequency domain present.
28+
29+
"#performance-domain-cells":
30+
description:
31+
Number of cells in a performance domain specifier.
32+
Set const to 1 here for nodes providing multiple
33+
performance domains.
34+
const: 1
35+
36+
required:
37+
- compatible
38+
- reg
39+
- "#performance-domain-cells"
40+
41+
additionalProperties: false
42+
43+
examples:
44+
- |
45+
cpus {
46+
#address-cells = <1>;
47+
#size-cells = <0>;
48+
49+
cpu0: cpu@0 {
50+
device_type = "cpu";
51+
compatible = "arm,cortex-a55";
52+
enable-method = "psci";
53+
performance-domains = <&performance 0>;
54+
reg = <0x000>;
55+
};
56+
};
57+
58+
/* ... */
59+
60+
soc {
61+
#address-cells = <2>;
62+
#size-cells = <2>;
63+
64+
performance: performance-controller@11bc00 {
65+
compatible = "mediatek,cpufreq-hw";
66+
reg = <0 0x0011bc10 0 0x120>, <0 0x0011bd30 0 0x120>;
67+
68+
#performance-domain-cells = <1>;
69+
};
70+
};

Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ CPUfreq核心层注册一个cpufreq_driver结构体。
8080
.resume - 一个指向per-policy恢复函数的指针,该函数在关中断且在调节器再一次开始前被
8181
调用。
8282

83-
.ready - 一个指向per-policy准备函数的指针,该函数在策略完全初始化之后被调用。
84-
8583
.attr - 一个指向NULL结尾的"struct freq_attr"列表的指针,该函数允许导出值到
8684
sysfs。
8785

drivers/base/arch_topology.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ void topology_set_freq_scale(const struct cpumask *cpus, unsigned long cur_freq,
149149
}
150150

151151
DEFINE_PER_CPU(unsigned long, cpu_scale) = SCHED_CAPACITY_SCALE;
152+
EXPORT_PER_CPU_SYMBOL_GPL(cpu_scale);
152153

153154
void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity)
154155
{
@@ -165,6 +166,7 @@ void topology_set_thermal_pressure(const struct cpumask *cpus,
165166
for_each_cpu(cpu, cpus)
166167
WRITE_ONCE(per_cpu(thermal_pressure, cpu), th_pressure);
167168
}
169+
EXPORT_SYMBOL_GPL(topology_set_thermal_pressure);
168170

169171
static ssize_t cpu_capacity_show(struct device *dev,
170172
struct device_attribute *attr,

drivers/cpufreq/Kconfig.arm

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,18 @@ config ARM_MEDIATEK_CPUFREQ
133133
help
134134
This adds the CPUFreq driver support for MediaTek SoCs.
135135

136+
config ARM_MEDIATEK_CPUFREQ_HW
137+
tristate "MediaTek CPUFreq HW driver"
138+
depends on ARCH_MEDIATEK || COMPILE_TEST
139+
default m
140+
help
141+
Support for the CPUFreq HW driver.
142+
Some MediaTek chipsets have a HW engine to offload the steps
143+
necessary for changing the frequency of the CPUs. Firmware loaded
144+
in this engine exposes a programming interface to the OS.
145+
The driver implements the cpufreq interface for this HW engine.
146+
Say Y if you want to support CPUFreq HW.
147+
136148
config ARM_OMAP2PLUS_CPUFREQ
137149
bool "TI OMAP2+"
138150
depends on ARCH_OMAP2PLUS

drivers/cpufreq/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ obj-$(CONFIG_ARM_IMX6Q_CPUFREQ) += imx6q-cpufreq.o
5656
obj-$(CONFIG_ARM_IMX_CPUFREQ_DT) += imx-cpufreq-dt.o
5757
obj-$(CONFIG_ARM_KIRKWOOD_CPUFREQ) += kirkwood-cpufreq.o
5858
obj-$(CONFIG_ARM_MEDIATEK_CPUFREQ) += mediatek-cpufreq.o
59+
obj-$(CONFIG_ARM_MEDIATEK_CPUFREQ_HW) += mediatek-cpufreq-hw.o
5960
obj-$(CONFIG_MACH_MVEBU_V7) += mvebu-cpufreq.o
6061
obj-$(CONFIG_ARM_OMAP2PLUS_CPUFREQ) += omap-cpufreq.o
6162
obj-$(CONFIG_ARM_PXA2xx_CPUFREQ) += pxa2xx-cpufreq.o

drivers/cpufreq/acpi-cpufreq.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,9 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
889889
policy->fast_switch_possible = !acpi_pstate_strict &&
890890
!(policy_is_shared(policy) && policy->shared_type != CPUFREQ_SHARED_TYPE_ANY);
891891

892+
if (perf->states[0].core_frequency * 1000 != freq_table[0].frequency)
893+
pr_warn(FW_WARN "P-state 0 is not max freq\n");
894+
892895
return result;
893896

894897
err_unreg:
@@ -918,16 +921,6 @@ static int acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy)
918921
return 0;
919922
}
920923

921-
static void acpi_cpufreq_cpu_ready(struct cpufreq_policy *policy)
922-
{
923-
struct acpi_processor_performance *perf = per_cpu_ptr(acpi_perf_data,
924-
policy->cpu);
925-
unsigned int freq = policy->freq_table[0].frequency;
926-
927-
if (perf->states[0].core_frequency * 1000 != freq)
928-
pr_warn(FW_WARN "P-state 0 is not max freq\n");
929-
}
930-
931924
static int acpi_cpufreq_resume(struct cpufreq_policy *policy)
932925
{
933926
struct acpi_cpufreq_data *data = policy->driver_data;
@@ -955,7 +948,6 @@ static struct cpufreq_driver acpi_cpufreq_driver = {
955948
.bios_limit = acpi_processor_get_bios_limit,
956949
.init = acpi_cpufreq_cpu_init,
957950
.exit = acpi_cpufreq_cpu_exit,
958-
.ready = acpi_cpufreq_cpu_ready,
959951
.resume = acpi_cpufreq_resume,
960952
.name = "acpi-cpufreq",
961953
.attr = acpi_cpufreq_attr,

drivers/cpufreq/cpufreq-dt-platdev.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,15 @@ static const struct of_device_id blocklist[] __initconst = {
137137
{ .compatible = "qcom,apq8096", },
138138
{ .compatible = "qcom,msm8996", },
139139
{ .compatible = "qcom,qcs404", },
140+
{ .compatible = "qcom,sa8155p" },
140141
{ .compatible = "qcom,sc7180", },
141142
{ .compatible = "qcom,sc7280", },
142143
{ .compatible = "qcom,sc8180x", },
143144
{ .compatible = "qcom,sdm845", },
145+
{ .compatible = "qcom,sm6350", },
144146
{ .compatible = "qcom,sm8150", },
147+
{ .compatible = "qcom,sm8250", },
148+
{ .compatible = "qcom,sm8350", },
145149

146150
{ .compatible = "st,stih407", },
147151
{ .compatible = "st,stih410", },

drivers/cpufreq/cpufreq-dt.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,6 @@ static int cpufreq_init(struct cpufreq_policy *policy)
143143
cpufreq_dt_attr[1] = &cpufreq_freq_attr_scaling_boost_freqs;
144144
}
145145

146-
dev_pm_opp_of_register_em(cpu_dev, policy->cpus);
147-
148146
return 0;
149147

150148
out_clk_put:
@@ -184,6 +182,7 @@ static struct cpufreq_driver dt_cpufreq_driver = {
184182
.exit = cpufreq_exit,
185183
.online = cpufreq_online,
186184
.offline = cpufreq_offline,
185+
.register_em = cpufreq_register_em_with_opp,
187186
.name = "cpufreq-dt",
188187
.attr = cpufreq_dt_attr,
189188
.suspend = cpufreq_generic_suspend,

drivers/cpufreq/cpufreq.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,6 +1491,19 @@ static int cpufreq_online(unsigned int cpu)
14911491
write_lock_irqsave(&cpufreq_driver_lock, flags);
14921492
list_add(&policy->policy_list, &cpufreq_policy_list);
14931493
write_unlock_irqrestore(&cpufreq_driver_lock, flags);
1494+
1495+
/*
1496+
* Register with the energy model before
1497+
* sched_cpufreq_governor_change() is called, which will result
1498+
* in rebuilding of the sched domains, which should only be done
1499+
* once the energy model is properly initialized for the policy
1500+
* first.
1501+
*
1502+
* Also, this should be called before the policy is registered
1503+
* with cooling framework.
1504+
*/
1505+
if (cpufreq_driver->register_em)
1506+
cpufreq_driver->register_em(policy);
14941507
}
14951508

14961509
ret = cpufreq_init_policy(policy);
@@ -1504,10 +1517,6 @@ static int cpufreq_online(unsigned int cpu)
15041517

15051518
kobject_uevent(&policy->kobj, KOBJ_ADD);
15061519

1507-
/* Callback for handling stuff after policy is ready */
1508-
if (cpufreq_driver->ready)
1509-
cpufreq_driver->ready(policy);
1510-
15111520
if (cpufreq_thermal_control_enabled(cpufreq_driver))
15121521
policy->cdev = of_cpufreq_cooling_register(policy);
15131522

0 commit comments

Comments
 (0)