Skip to content

Commit c51f0d3

Browse files
committed
Merge back earlier cpufreq material for 6.18
2 parents 4ea5af0 + 9a1aa64 commit c51f0d3

33 files changed

+426
-324
lines changed

Documentation/devicetree/bindings/cpufreq/cpufreq-dt.txt

Lines changed: 0 additions & 61 deletions
This file was deleted.

Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ properties:
2222
items:
2323
- enum:
2424
- qcom,qcm2290-cpufreq-hw
25+
- qcom,qcs615-cpufreq-hw
2526
- qcom,sc7180-cpufreq-hw
2627
- qcom,sc8180x-cpufreq-hw
2728
- qcom,sdm670-cpufreq-hw
@@ -132,6 +133,7 @@ allOf:
132133
compatible:
133134
contains:
134135
enum:
136+
- qcom,qcs615-cpufreq-hw
135137
- qcom,qdu1000-cpufreq-epss
136138
- qcom,sa8255p-cpufreq-epss
137139
- qcom,sa8775p-cpufreq-epss
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/cpufreq/mediatek,mt8196-cpufreq-hw.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: MediaTek Hybrid CPUFreq for MT8196/MT6991 series SoCs
8+
9+
maintainers:
10+
- Nicolas Frattaroli <[email protected]>
11+
12+
description:
13+
MT8196 uses CPUFreq management hardware that supports dynamic voltage
14+
frequency scaling (dvfs), and can support several performance domains.
15+
16+
properties:
17+
compatible:
18+
const: mediatek,mt8196-cpufreq-hw
19+
20+
reg:
21+
items:
22+
- description: FDVFS control register region
23+
- description: OPP tables and control for performance domain 0
24+
- description: OPP tables and control for performance domain 1
25+
- description: OPP tables and control for performance domain 2
26+
27+
"#performance-domain-cells":
28+
const: 1
29+
30+
required:
31+
- compatible
32+
- reg
33+
- "#performance-domain-cells"
34+
35+
additionalProperties: false
36+
37+
examples:
38+
- |
39+
cpus {
40+
#address-cells = <1>;
41+
#size-cells = <0>;
42+
43+
cpu0: cpu@0 {
44+
device_type = "cpu";
45+
compatible = "arm,cortex-a720";
46+
enable-method = "psci";
47+
performance-domains = <&performance 0>;
48+
reg = <0x000>;
49+
};
50+
51+
/* ... */
52+
53+
cpu6: cpu@600 {
54+
device_type = "cpu";
55+
compatible = "arm,cortex-x4";
56+
enable-method = "psci";
57+
performance-domains = <&performance 1>;
58+
reg = <0x600>;
59+
};
60+
61+
cpu7: cpu@700 {
62+
device_type = "cpu";
63+
compatible = "arm,cortex-x925";
64+
enable-method = "psci";
65+
performance-domains = <&performance 2>;
66+
reg = <0x700>;
67+
};
68+
};
69+
70+
/* ... */
71+
72+
soc {
73+
#address-cells = <2>;
74+
#size-cells = <2>;
75+
76+
performance: performance-controller@c2c2034 {
77+
compatible = "mediatek,mt8196-cpufreq-hw";
78+
reg = <0 0xc220400 0 0x20>, <0 0xc2c0f20 0 0x120>,
79+
<0 0xc2c1040 0 0x120>, <0 0xc2c1160 0 0x120>;
80+
#performance-domain-cells = <1>;
81+
};
82+
};

MAINTAINERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6349,6 +6349,12 @@ F: kernel/sched/cpufreq*.c
63496349
F: rust/kernel/cpufreq.rs
63506350
F: tools/testing/selftests/cpufreq/
63516351

6352+
CPU FREQUENCY DRIVERS - VIRTUAL MACHINE CPUFREQ
6353+
M: Saravana Kannan <[email protected]>
6354+
6355+
S: Maintained
6356+
F: drivers/cpufreq/virtual-cpufreq.c
6357+
63526358
CPU HOTPLUG
63536359
M: Thomas Gleixner <[email protected]>
63546360
M: Peter Zijlstra <[email protected]>

arch/arm64/boot/dts/ti/k3-am62p5.dtsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135

136136
opp-1000000000 {
137137
opp-hz = /bits/ 64 <1000000000>;
138-
opp-supported-hw = <0x01 0x0006>;
138+
opp-supported-hw = <0x01 0x0007>;
139139
clock-latency-ns = <6000000>;
140140
};
141141

drivers/cpufreq/acpi-cpufreq.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,6 @@ static u32 drv_read(struct acpi_cpufreq_data *data, const struct cpumask *mask)
318318
return cmd.val;
319319
}
320320

321-
/* Called via smp_call_function_many(), on the target CPUs */
322321
static void do_drv_write(void *_cmd)
323322
{
324323
struct drv_cmd *cmd = _cmd;
@@ -335,14 +334,8 @@ static void drv_write(struct acpi_cpufreq_data *data,
335334
.val = val,
336335
.func.write = data->cpu_freq_write,
337336
};
338-
int this_cpu;
339337

340-
this_cpu = get_cpu();
341-
if (cpumask_test_cpu(this_cpu, mask))
342-
do_drv_write(&cmd);
343-
344-
smp_call_function_many(mask, do_drv_write, &cmd, 1);
345-
put_cpu();
338+
on_each_cpu_mask(mask, do_drv_write, &cmd, true);
346339
}
347340

348341
static u32 get_cur_val(const struct cpumask *mask, struct acpi_cpufreq_data *data)

drivers/cpufreq/airoha-cpufreq.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ static struct platform_driver airoha_cpufreq_driver = {
107107
};
108108

109109
static const struct of_device_id airoha_cpufreq_match_list[] __initconst = {
110+
{ .compatible = "airoha,an7583" },
110111
{ .compatible = "airoha,en7581" },
111112
{},
112113
};

drivers/cpufreq/armada-37xx-cpufreq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,15 +265,15 @@ static void __init armada37xx_cpufreq_avs_configure(struct regmap *base,
265265
*/
266266

267267
target_vm = avs_map[l0_vdd_min] - 100;
268-
target_vm = target_vm > MIN_VOLT_MV ? target_vm : MIN_VOLT_MV;
268+
target_vm = max(target_vm, MIN_VOLT_MV);
269269
dvfs->avs[1] = armada_37xx_avs_val_match(target_vm);
270270

271271
/*
272272
* L2 & L3 voltage is equal to L0 voltage - 150mv and it must
273273
* be larger than 1000mv
274274
*/
275275
target_vm = avs_map[l0_vdd_min] - 150;
276-
target_vm = target_vm > MIN_VOLT_MV ? target_vm : MIN_VOLT_MV;
276+
target_vm = max(target_vm, MIN_VOLT_MV);
277277
dvfs->avs[2] = dvfs->avs[3] = armada_37xx_avs_val_match(target_vm);
278278

279279
/*

drivers/cpufreq/brcmstb-avs-cpufreq.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,16 +480,14 @@ static bool brcm_avs_is_firmware_loaded(struct private_data *priv)
480480

481481
static unsigned int brcm_avs_cpufreq_get(unsigned int cpu)
482482
{
483-
struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
483+
struct cpufreq_policy *policy __free(put_cpufreq_policy) = cpufreq_cpu_get(cpu);
484484
struct private_data *priv;
485485

486486
if (!policy)
487487
return 0;
488488

489489
priv = policy->driver_data;
490490

491-
cpufreq_cpu_put(policy);
492-
493491
return brcm_avs_get_frequency(priv->base);
494492
}
495493

drivers/cpufreq/cppc_cpufreq.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ struct cppc_freq_invariance {
5050
static DEFINE_PER_CPU(struct cppc_freq_invariance, cppc_freq_inv);
5151
static struct kthread_worker *kworker_fie;
5252

53-
static int cppc_perf_from_fbctrs(struct cppc_cpudata *cpu_data,
54-
struct cppc_perf_fb_ctrs *fb_ctrs_t0,
53+
static int cppc_perf_from_fbctrs(struct cppc_perf_fb_ctrs *fb_ctrs_t0,
5554
struct cppc_perf_fb_ctrs *fb_ctrs_t1);
5655

5756
/**
@@ -87,8 +86,7 @@ static void cppc_scale_freq_workfn(struct kthread_work *work)
8786
return;
8887
}
8988

90-
perf = cppc_perf_from_fbctrs(cpu_data, &cppc_fi->prev_perf_fb_ctrs,
91-
&fb_ctrs);
89+
perf = cppc_perf_from_fbctrs(&cppc_fi->prev_perf_fb_ctrs, &fb_ctrs);
9290
if (!perf)
9391
return;
9492

@@ -684,8 +682,7 @@ static inline u64 get_delta(u64 t1, u64 t0)
684682
return (u32)t1 - (u32)t0;
685683
}
686684

687-
static int cppc_perf_from_fbctrs(struct cppc_cpudata *cpu_data,
688-
struct cppc_perf_fb_ctrs *fb_ctrs_t0,
685+
static int cppc_perf_from_fbctrs(struct cppc_perf_fb_ctrs *fb_ctrs_t0,
689686
struct cppc_perf_fb_ctrs *fb_ctrs_t1)
690687
{
691688
u64 delta_reference, delta_delivered;
@@ -725,8 +722,8 @@ static int cppc_get_perf_ctrs_sample(int cpu,
725722

726723
static unsigned int cppc_cpufreq_get_rate(unsigned int cpu)
727724
{
725+
struct cpufreq_policy *policy __free(put_cpufreq_policy) = cpufreq_cpu_get(cpu);
728726
struct cppc_perf_fb_ctrs fb_ctrs_t0 = {0}, fb_ctrs_t1 = {0};
729-
struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
730727
struct cppc_cpudata *cpu_data;
731728
u64 delivered_perf;
732729
int ret;
@@ -736,8 +733,6 @@ static unsigned int cppc_cpufreq_get_rate(unsigned int cpu)
736733

737734
cpu_data = policy->driver_data;
738735

739-
cpufreq_cpu_put(policy);
740-
741736
ret = cppc_get_perf_ctrs_sample(cpu, &fb_ctrs_t0, &fb_ctrs_t1);
742737
if (ret) {
743738
if (ret == -EFAULT)
@@ -747,8 +742,7 @@ static unsigned int cppc_cpufreq_get_rate(unsigned int cpu)
747742
return 0;
748743
}
749744

750-
delivered_perf = cppc_perf_from_fbctrs(cpu_data, &fb_ctrs_t0,
751-
&fb_ctrs_t1);
745+
delivered_perf = cppc_perf_from_fbctrs(&fb_ctrs_t0, &fb_ctrs_t1);
752746
if (!delivered_perf)
753747
goto out_invalid_counters;
754748

0 commit comments

Comments
 (0)