Skip to content

Commit 507f811

Browse files
committed
Merge tag 'pm-5.20-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull more power management updates from Rafael Wysocki: "These are ARM cpufreq updates and operating performance points (OPP) updates plus one cpuidle update adding a new trace point. Specifics: - Fix return error code in mtk_cpu_dvfs_info_init (Yang Yingliang). - Minor cleanups and support for new boards for Qcom cpufreq drivers (Bryan O'Donoghue, Konrad Dybcio, Pierre Gondois, and Yicong Yang). - Fix sparse warnings for Tegra cpufreq driver (Viresh Kumar). - Make dev_pm_opp_set_regulators() accept NULL terminated list (Viresh Kumar). - Add dev_pm_opp_set_config() and friends and migrate other users and helpers to using them (Viresh Kumar). - Add support for multiple clocks for a device (Viresh Kumar and Krzysztof Kozlowski). - Configure resources before adding OPP table for Venus (Stanimir Varbanov). - Keep reference count up for opp->np and opp_table->np while they are still in use (Liang He). - Minor OPP cleanups (Viresh Kumar and Yang Li). - Add a trace event for cpuidle to track missed (too deep or too shallow) wakeups (Kajetan Puchalski)" * tag 'pm-5.20-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (55 commits) cpuidle: Add cpu_idle_miss trace event venus: pm_helpers: Fix warning in OPP during probe OPP: Don't drop opp->np reference while it is still in use OPP: Don't drop opp_table->np reference while it is still in use cpufreq: tegra194: Staticize struct tegra_cpufreq_soc instances dt-bindings: cpufreq: cpufreq-qcom-hw: Add SM6375 compatible dt-bindings: opp: Add msm8939 to the compatible list dt-bindings: opp: Add missing compat devices dt-bindings: opp: opp-v2-kryo-cpu: Fix example binding checks cpufreq: Change order of online() CB and policy->cpus modification cpufreq: qcom-hw: Remove deprecated irq_set_affinity_hint() call cpufreq: qcom-hw: Disable LMH irq when disabling policy cpufreq: qcom-hw: Reset cancel_throttle when policy is re-enabled cpufreq: qcom-cpufreq-hw: use HZ_PER_KHZ macro in units.h cpufreq: mediatek: fix error return code in mtk_cpu_dvfs_info_init() OPP: Remove dev{m}_pm_opp_of_add_table_noclk() PM / devfreq: tegra30: Register config_clks helper OPP: Allow config_clks helper for single clk case OPP: Provide a simple implementation to configure multiple clocks OPP: Assert clk_count == 1 for single clk helpers ...
2 parents 033c88d + c3f834d commit 507f811

33 files changed

+1421
-1285
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ properties:
2525
- description: v2 of CPUFREQ HW (EPSS)
2626
items:
2727
- enum:
28+
- qcom,sm6375-cpufreq-epss
2829
- qcom,sm8250-cpufreq-epss
2930
- const: qcom,cpufreq-epss
3031

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ select:
2222
compatible:
2323
contains:
2424
enum:
25+
- qcom,apq8064
26+
- qcom,apq8096
27+
- qcom,ipq8064
28+
- qcom,msm8939
29+
- qcom,msm8960
30+
- qcom,msm8974
31+
- qcom,msm8996
2532
- qcom,qcs404
2633
required:
2734
- compatible

Documentation/devicetree/bindings/opp/opp-v2-base.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ patternProperties:
5050
property to uniquely identify the OPP nodes exists. Devices like power
5151
domains must have another (implementation dependent) property.
5252

53+
Entries for multiple clocks shall be provided in the same field, as
54+
array of frequencies. The OPP binding doesn't provide any provisions
55+
to relate the values to their clocks or the order in which the clocks
56+
need to be configured and that is left for the implementation
57+
specific binding.
58+
minItems: 1
59+
maxItems: 16
60+
items:
61+
maxItems: 1
62+
5363
opp-microvolt:
5464
description: |
5565
Voltage for the OPP

Documentation/devicetree/bindings/opp/opp-v2-kryo-cpu.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ examples:
9898
capacity-dmips-mhz = <1024>;
9999
clocks = <&kryocc 0>;
100100
operating-points-v2 = <&cluster0_opp>;
101+
power-domains = <&cpr>;
102+
power-domain-names = "cpr";
101103
#cooling-cells = <2>;
102104
next-level-cache = <&L2_0>;
103105
L2_0: l2-cache {
@@ -115,6 +117,8 @@ examples:
115117
capacity-dmips-mhz = <1024>;
116118
clocks = <&kryocc 0>;
117119
operating-points-v2 = <&cluster0_opp>;
120+
power-domains = <&cpr>;
121+
power-domain-names = "cpr";
118122
#cooling-cells = <2>;
119123
next-level-cache = <&L2_0>;
120124
};
@@ -128,6 +132,8 @@ examples:
128132
capacity-dmips-mhz = <1024>;
129133
clocks = <&kryocc 1>;
130134
operating-points-v2 = <&cluster1_opp>;
135+
power-domains = <&cpr>;
136+
power-domain-names = "cpr";
131137
#cooling-cells = <2>;
132138
next-level-cache = <&L2_1>;
133139
L2_1: l2-cache {
@@ -145,6 +151,8 @@ examples:
145151
capacity-dmips-mhz = <1024>;
146152
clocks = <&kryocc 1>;
147153
operating-points-v2 = <&cluster1_opp>;
154+
power-domains = <&cpr>;
155+
power-domain-names = "cpr";
148156
#cooling-cells = <2>;
149157
next-level-cache = <&L2_1>;
150158
};
@@ -182,18 +190,21 @@ examples:
182190
opp-microvolt = <905000 905000 1140000>;
183191
opp-supported-hw = <0x7>;
184192
clock-latency-ns = <200000>;
193+
required-opps = <&cpr_opp1>;
185194
};
186195
opp-1401600000 {
187196
opp-hz = /bits/ 64 <1401600000>;
188197
opp-microvolt = <1140000 905000 1140000>;
189198
opp-supported-hw = <0x5>;
190199
clock-latency-ns = <200000>;
200+
required-opps = <&cpr_opp2>;
191201
};
192202
opp-1593600000 {
193203
opp-hz = /bits/ 64 <1593600000>;
194204
opp-microvolt = <1140000 905000 1140000>;
195205
opp-supported-hw = <0x1>;
196206
clock-latency-ns = <200000>;
207+
required-opps = <&cpr_opp3>;
197208
};
198209
};
199210
@@ -207,24 +218,28 @@ examples:
207218
opp-microvolt = <905000 905000 1140000>;
208219
opp-supported-hw = <0x7>;
209220
clock-latency-ns = <200000>;
221+
required-opps = <&cpr_opp1>;
210222
};
211223
opp-1804800000 {
212224
opp-hz = /bits/ 64 <1804800000>;
213225
opp-microvolt = <1140000 905000 1140000>;
214226
opp-supported-hw = <0x6>;
215227
clock-latency-ns = <200000>;
228+
required-opps = <&cpr_opp4>;
216229
};
217230
opp-1900800000 {
218231
opp-hz = /bits/ 64 <1900800000>;
219232
opp-microvolt = <1140000 905000 1140000>;
220233
opp-supported-hw = <0x4>;
221234
clock-latency-ns = <200000>;
235+
required-opps = <&cpr_opp5>;
222236
};
223237
opp-2150400000 {
224238
opp-hz = /bits/ 64 <2150400000>;
225239
opp-microvolt = <1140000 905000 1140000>;
226240
opp-supported-hw = <0x1>;
227241
clock-latency-ns = <200000>;
242+
required-opps = <&cpr_opp6>;
228243
};
229244
};
230245

drivers/cpufreq/cpufreq-dt.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ struct private_data {
2929

3030
cpumask_var_t cpus;
3131
struct device *cpu_dev;
32-
struct opp_table *opp_table;
3332
struct cpufreq_frequency_table *freq_table;
3433
bool have_static_opps;
34+
int opp_token;
3535
};
3636

3737
static LIST_HEAD(priv_list);
@@ -193,7 +193,7 @@ static int dt_cpufreq_early_init(struct device *dev, int cpu)
193193
struct private_data *priv;
194194
struct device *cpu_dev;
195195
bool fallback = false;
196-
const char *reg_name;
196+
const char *reg_name[] = { NULL, NULL };
197197
int ret;
198198

199199
/* Check if this CPU is already covered by some other policy */
@@ -218,12 +218,11 @@ static int dt_cpufreq_early_init(struct device *dev, int cpu)
218218
* OPP layer will be taking care of regulators now, but it needs to know
219219
* the name of the regulator first.
220220
*/
221-
reg_name = find_supply_name(cpu_dev);
222-
if (reg_name) {
223-
priv->opp_table = dev_pm_opp_set_regulators(cpu_dev, &reg_name,
224-
1);
225-
if (IS_ERR(priv->opp_table)) {
226-
ret = PTR_ERR(priv->opp_table);
221+
reg_name[0] = find_supply_name(cpu_dev);
222+
if (reg_name[0]) {
223+
priv->opp_token = dev_pm_opp_set_regulators(cpu_dev, reg_name);
224+
if (priv->opp_token < 0) {
225+
ret = priv->opp_token;
227226
if (ret != -EPROBE_DEFER)
228227
dev_err(cpu_dev, "failed to set regulators: %d\n",
229228
ret);
@@ -295,7 +294,7 @@ static int dt_cpufreq_early_init(struct device *dev, int cpu)
295294
out:
296295
if (priv->have_static_opps)
297296
dev_pm_opp_of_cpumask_remove_table(priv->cpus);
298-
dev_pm_opp_put_regulators(priv->opp_table);
297+
dev_pm_opp_put_regulators(priv->opp_token);
299298
free_cpumask:
300299
free_cpumask_var(priv->cpus);
301300
return ret;
@@ -309,7 +308,7 @@ static void dt_cpufreq_release(void)
309308
dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &priv->freq_table);
310309
if (priv->have_static_opps)
311310
dev_pm_opp_of_cpumask_remove_table(priv->cpus);
312-
dev_pm_opp_put_regulators(priv->opp_table);
311+
dev_pm_opp_put_regulators(priv->opp_token);
313312
free_cpumask_var(priv->cpus);
314313
list_del(&priv->node);
315314
}

drivers/cpufreq/cpufreq.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,15 +1348,15 @@ static int cpufreq_online(unsigned int cpu)
13481348
}
13491349

13501350
if (!new_policy && cpufreq_driver->online) {
1351+
/* Recover policy->cpus using related_cpus */
1352+
cpumask_copy(policy->cpus, policy->related_cpus);
1353+
13511354
ret = cpufreq_driver->online(policy);
13521355
if (ret) {
13531356
pr_debug("%s: %d: initialization failed\n", __func__,
13541357
__LINE__);
13551358
goto out_exit_policy;
13561359
}
1357-
1358-
/* Recover policy->cpus using related_cpus */
1359-
cpumask_copy(policy->cpus, policy->related_cpus);
13601360
} else {
13611361
cpumask_copy(policy->cpus, cpumask_of(cpu));
13621362

drivers/cpufreq/imx-cpufreq-dt.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131

3232
/* cpufreq-dt device registered by imx-cpufreq-dt */
3333
static struct platform_device *cpufreq_dt_pdev;
34-
static struct opp_table *cpufreq_opp_table;
3534
static struct device *cpu_dev;
35+
static int cpufreq_opp_token;
3636

3737
enum IMX7ULP_CPUFREQ_CLKS {
3838
ARM,
@@ -153,17 +153,17 @@ static int imx_cpufreq_dt_probe(struct platform_device *pdev)
153153
dev_info(&pdev->dev, "cpu speed grade %d mkt segment %d supported-hw %#x %#x\n",
154154
speed_grade, mkt_segment, supported_hw[0], supported_hw[1]);
155155

156-
cpufreq_opp_table = dev_pm_opp_set_supported_hw(cpu_dev, supported_hw, 2);
157-
if (IS_ERR(cpufreq_opp_table)) {
158-
ret = PTR_ERR(cpufreq_opp_table);
156+
cpufreq_opp_token = dev_pm_opp_set_supported_hw(cpu_dev, supported_hw, 2);
157+
if (cpufreq_opp_token < 0) {
158+
ret = cpufreq_opp_token;
159159
dev_err(&pdev->dev, "Failed to set supported opp: %d\n", ret);
160160
return ret;
161161
}
162162

163163
cpufreq_dt_pdev = platform_device_register_data(
164164
&pdev->dev, "cpufreq-dt", -1, NULL, 0);
165165
if (IS_ERR(cpufreq_dt_pdev)) {
166-
dev_pm_opp_put_supported_hw(cpufreq_opp_table);
166+
dev_pm_opp_put_supported_hw(cpufreq_opp_token);
167167
ret = PTR_ERR(cpufreq_dt_pdev);
168168
dev_err(&pdev->dev, "Failed to register cpufreq-dt: %d\n", ret);
169169
return ret;
@@ -176,7 +176,7 @@ static int imx_cpufreq_dt_remove(struct platform_device *pdev)
176176
{
177177
platform_device_unregister(cpufreq_dt_pdev);
178178
if (!of_machine_is_compatible("fsl,imx7ulp"))
179-
dev_pm_opp_put_supported_hw(cpufreq_opp_table);
179+
dev_pm_opp_put_supported_hw(cpufreq_opp_token);
180180
else
181181
clk_bulk_put(ARRAY_SIZE(imx7ulp_clks), imx7ulp_clks);
182182

drivers/cpufreq/mediatek-cpufreq.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,7 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu)
478478
if (info->soc_data->ccifreq_supported) {
479479
info->vproc_on_boot = regulator_get_voltage(info->proc_reg);
480480
if (info->vproc_on_boot < 0) {
481+
ret = info->vproc_on_boot;
481482
dev_err(info->cpu_dev,
482483
"invalid Vproc value: %d\n", info->vproc_on_boot);
483484
goto out_disable_inter_clock;

drivers/cpufreq/qcom-cpufreq-hw.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/pm_opp.h>
1616
#include <linux/slab.h>
1717
#include <linux/spinlock.h>
18+
#include <linux/units.h>
1819

1920
#define LUT_MAX_ENTRIES 40U
2021
#define LUT_SRC GENMASK(31, 30)
@@ -26,8 +27,6 @@
2627

2728
#define GT_IRQ_STATUS BIT(2)
2829

29-
#define HZ_PER_KHZ 1000
30-
3130
struct qcom_cpufreq_soc_data {
3231
u32 reg_enable;
3332
u32 reg_domain_state;
@@ -428,7 +427,7 @@ static int qcom_cpufreq_hw_lmh_init(struct cpufreq_policy *policy, int index)
428427
return 0;
429428
}
430429

431-
ret = irq_set_affinity_hint(data->throttle_irq, policy->cpus);
430+
ret = irq_set_affinity_and_hint(data->throttle_irq, policy->cpus);
432431
if (ret)
433432
dev_err(&pdev->dev, "Failed to set CPU affinity of %s[%d]\n",
434433
data->irq_name, data->throttle_irq);
@@ -445,7 +444,11 @@ static int qcom_cpufreq_hw_cpu_online(struct cpufreq_policy *policy)
445444
if (data->throttle_irq <= 0)
446445
return 0;
447446

448-
ret = irq_set_affinity_hint(data->throttle_irq, policy->cpus);
447+
mutex_lock(&data->throttle_lock);
448+
data->cancel_throttle = false;
449+
mutex_unlock(&data->throttle_lock);
450+
451+
ret = irq_set_affinity_and_hint(data->throttle_irq, policy->cpus);
449452
if (ret)
450453
dev_err(&pdev->dev, "Failed to set CPU affinity of %s[%d]\n",
451454
data->irq_name, data->throttle_irq);
@@ -465,7 +468,8 @@ static int qcom_cpufreq_hw_cpu_offline(struct cpufreq_policy *policy)
465468
mutex_unlock(&data->throttle_lock);
466469

467470
cancel_delayed_work_sync(&data->throttle_work);
468-
irq_set_affinity_hint(data->throttle_irq, NULL);
471+
irq_set_affinity_and_hint(data->throttle_irq, NULL);
472+
disable_irq_nosync(data->throttle_irq);
469473

470474
return 0;
471475
}

0 commit comments

Comments
 (0)