Skip to content

Commit d863f05

Browse files
committed
Merge tag 'pm-6.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management fixes from Rafael Wysocki: "These fix assorted issues in the ARM cpufreq drivers and in the AMD P-state driver. Specifics: - Fix cpufreq policy reference counting in amd-pstate to prevent it from crashing on removal (Perry Yuan) - Fix double initialization and set suspend-freq for Apple's cpufreq driver (Arnd Bergmann, Hector Martin) - Fix reading of "reg" property, update cpufreq-dt's blocklist and update DT documentation for Qualcomm's cpufreq driver (Konrad Dybcio, Krzysztof Kozlowski) - Replace 0 with NULL in the Armada cpufreq driver (Miles Chen) - Fix potential overflows in the CPPC cpufreq driver (Pierre Gondois) - Update blocklist for the Tegra234 Soc cpufreq driver (Sumit Gupta)" * tag 'pm-6.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: cpufreq: amd-pstate: fix kernel hang issue while amd-pstate unregistering cpufreq: armada-37xx: stop using 0 as NULL pointer cpufreq: apple-soc: Switch to the lowest frequency on suspend dt-bindings: cpufreq: cpufreq-qcom-hw: document interrupts cpufreq: Add SM6375 to cpufreq-dt-platdev blocklist cpufreq: Add Tegra234 to cpufreq-dt-platdev blocklist cpufreq: qcom-hw: Fix reading "reg" with address/size-cells != 2 cpufreq: CPPC: Add u64 casts to avoid overflowing cpufreq: apple: remove duplicate intializer
2 parents cdbbca2 + 4f3085f commit d863f05

File tree

7 files changed

+43
-9
lines changed

7 files changed

+43
-9
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,17 @@ properties:
5454
- const: xo
5555
- const: alternate
5656

57+
interrupts:
58+
minItems: 1
59+
maxItems: 3
60+
61+
interrupt-names:
62+
minItems: 1
63+
items:
64+
- const: dcvsh-irq-0
65+
- const: dcvsh-irq-1
66+
- const: dcvsh-irq-2
67+
5768
'#freq-domain-cells':
5869
const: 1
5970

drivers/cpufreq/amd-pstate.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ static void amd_pstate_adjust_perf(unsigned int cpu,
307307
max_perf = min_perf;
308308

309309
amd_pstate_update(cpudata, min_perf, des_perf, max_perf, true);
310+
cpufreq_cpu_put(policy);
310311
}
311312

312313
static int amd_get_min_freq(struct amd_cpudata *cpudata)

drivers/cpufreq/apple-soc-cpufreq.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ static int apple_soc_cpufreq_init(struct cpufreq_policy *policy)
280280
policy->cpuinfo.transition_latency = transition_latency;
281281
policy->dvfs_possible_from_any_cpu = true;
282282
policy->fast_switch_possible = true;
283+
policy->suspend_freq = freq_table[0].frequency;
283284

284285
if (policy_has_boost_freq(policy)) {
285286
ret = cpufreq_enable_boost_support();
@@ -321,14 +322,14 @@ static struct cpufreq_driver apple_soc_cpufreq_driver = {
321322
.flags = CPUFREQ_HAVE_GOVERNOR_PER_POLICY |
322323
CPUFREQ_NEED_INITIAL_FREQ_CHECK | CPUFREQ_IS_COOLING_DEV,
323324
.verify = cpufreq_generic_frequency_table_verify,
324-
.attr = cpufreq_generic_attr,
325325
.get = apple_soc_cpufreq_get_rate,
326326
.init = apple_soc_cpufreq_init,
327327
.exit = apple_soc_cpufreq_exit,
328328
.target_index = apple_soc_cpufreq_set_target,
329329
.fast_switch = apple_soc_cpufreq_fast_switch,
330330
.register_em = cpufreq_register_em_with_opp,
331331
.attr = apple_soc_cpufreq_hw_attr,
332+
.suspend = cpufreq_generic_suspend,
332333
};
333334

334335
static int __init apple_soc_cpufreq_module_init(void)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ static int __init armada37xx_cpufreq_driver_init(void)
445445
return -ENODEV;
446446
}
447447

448-
clk = clk_get(cpu_dev, 0);
448+
clk = clk_get(cpu_dev, NULL);
449449
if (IS_ERR(clk)) {
450450
dev_err(cpu_dev, "Cannot get clock for CPU0\n");
451451
return PTR_ERR(clk);

drivers/cpufreq/cppc_cpufreq.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,8 @@ static unsigned int get_perf_level_count(struct cpufreq_policy *policy)
487487
cpu_data = policy->driver_data;
488488
perf_caps = &cpu_data->perf_caps;
489489
max_cap = arch_scale_cpu_capacity(cpu);
490-
min_cap = div_u64(max_cap * perf_caps->lowest_perf, perf_caps->highest_perf);
490+
min_cap = div_u64((u64)max_cap * perf_caps->lowest_perf,
491+
perf_caps->highest_perf);
491492
if ((min_cap == 0) || (max_cap < min_cap))
492493
return 0;
493494
return 1 + max_cap / CPPC_EM_CAP_STEP - min_cap / CPPC_EM_CAP_STEP;
@@ -519,10 +520,10 @@ static int cppc_get_cpu_power(struct device *cpu_dev,
519520
cpu_data = policy->driver_data;
520521
perf_caps = &cpu_data->perf_caps;
521522
max_cap = arch_scale_cpu_capacity(cpu_dev->id);
522-
min_cap = div_u64(max_cap * perf_caps->lowest_perf,
523-
perf_caps->highest_perf);
524-
525-
perf_step = CPPC_EM_CAP_STEP * perf_caps->highest_perf / max_cap;
523+
min_cap = div_u64((u64)max_cap * perf_caps->lowest_perf,
524+
perf_caps->highest_perf);
525+
perf_step = div_u64((u64)CPPC_EM_CAP_STEP * perf_caps->highest_perf,
526+
max_cap);
526527
min_step = min_cap / CPPC_EM_CAP_STEP;
527528
max_step = max_cap / CPPC_EM_CAP_STEP;
528529

drivers/cpufreq/cpufreq-dt-platdev.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ static const struct of_device_id blocklist[] __initconst = {
137137
{ .compatible = "nvidia,tegra30", },
138138
{ .compatible = "nvidia,tegra124", },
139139
{ .compatible = "nvidia,tegra210", },
140+
{ .compatible = "nvidia,tegra234", },
140141

141142
{ .compatible = "qcom,apq8096", },
142143
{ .compatible = "qcom,msm8996", },
@@ -150,6 +151,7 @@ static const struct of_device_id blocklist[] __initconst = {
150151
{ .compatible = "qcom,sdm845", },
151152
{ .compatible = "qcom,sm6115", },
152153
{ .compatible = "qcom,sm6350", },
154+
{ .compatible = "qcom,sm6375", },
153155
{ .compatible = "qcom,sm8150", },
154156
{ .compatible = "qcom,sm8250", },
155157
{ .compatible = "qcom,sm8350", },

drivers/cpufreq/qcom-cpufreq-hw.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,9 +649,10 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev)
649649
{
650650
struct clk_hw_onecell_data *clk_data;
651651
struct device *dev = &pdev->dev;
652+
struct device_node *soc_node;
652653
struct device *cpu_dev;
653654
struct clk *clk;
654-
int ret, i, num_domains;
655+
int ret, i, num_domains, reg_sz;
655656

656657
clk = clk_get(dev, "xo");
657658
if (IS_ERR(clk))
@@ -679,7 +680,21 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev)
679680
return ret;
680681

681682
/* Allocate qcom_cpufreq_data based on the available frequency domains in DT */
682-
num_domains = of_property_count_elems_of_size(dev->of_node, "reg", sizeof(u32) * 4);
683+
soc_node = of_get_parent(dev->of_node);
684+
if (!soc_node)
685+
return -EINVAL;
686+
687+
ret = of_property_read_u32(soc_node, "#address-cells", &reg_sz);
688+
if (ret)
689+
goto of_exit;
690+
691+
ret = of_property_read_u32(soc_node, "#size-cells", &i);
692+
if (ret)
693+
goto of_exit;
694+
695+
reg_sz += i;
696+
697+
num_domains = of_property_count_elems_of_size(dev->of_node, "reg", sizeof(u32) * reg_sz);
683698
if (num_domains <= 0)
684699
return num_domains;
685700

@@ -743,6 +758,9 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev)
743758
else
744759
dev_dbg(dev, "QCOM CPUFreq HW driver initialized\n");
745760

761+
of_exit:
762+
of_node_put(soc_node);
763+
746764
return ret;
747765
}
748766

0 commit comments

Comments
 (0)