Skip to content

Commit 813ce98

Browse files
committed
Merge tag 'cpufreq-arm-updates-6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm
Pull ARM cpufreq updates for 6.5 from Viresh Kumar: "- Add support to build cpufreq-dt-platdev as module (Zhipeng Wang). - Don't allocate Sparc's cpufreq_driver dynamically (Viresh Kumar). - Add support for TI's AM62A7 platform (Vibhore Vardhan). - Add support for Armada's ap807 platform (Russell King (Oracle)). - Add support for StarFive JH7110 SoC (Mason Huo). - Fix voltage selection for Mediatek Socs (Daniel Golle). - Fix error handling in Tegra's cpufreq driver (Christophe JAILLET). - Document Qualcomm's IPQ8074 in DT bindings (Robert Marko). - Don't warn for disabling a non-existing frequency for imx6q cpufreq driver (Christoph Niedermaier). - Use dev_err_probe() in Qualcomm's cpufreq driver (Andrew Halaney)."
2 parents 40e8e98 + 5ee6425 commit 813ce98

11 files changed

Lines changed: 82 additions & 110 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ select:
2828
- qcom,apq8064
2929
- qcom,apq8096
3030
- qcom,ipq8064
31+
- qcom,ipq8074
3132
- qcom,msm8939
3233
- qcom,msm8960
3334
- qcom,msm8974

drivers/cpufreq/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ config CPUFREQ_DT
218218
If in doubt, say N.
219219

220220
config CPUFREQ_DT_PLATDEV
221-
bool
221+
tristate "Generic DT based cpufreq platdev driver"
222222
help
223223
This adds a generic DT based cpufreq platdev driver for frequency
224224
management. This creates a 'cpufreq-dt' platform device, on the

drivers/cpufreq/armada-8k-cpufreq.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@
2121
#include <linux/pm_opp.h>
2222
#include <linux/slab.h>
2323

24+
static const struct of_device_id __maybe_unused armada_8k_cpufreq_of_match[] = {
25+
{ .compatible = "marvell,ap806-cpu-clock" },
26+
{ .compatible = "marvell,ap807-cpu-clock" },
27+
{ },
28+
};
29+
MODULE_DEVICE_TABLE(of, armada_8k_cpufreq_of_match);
30+
2431
/*
2532
* Setup the opps list with the divider for the max frequency, that
2633
* will be filled at runtime.
@@ -127,7 +134,8 @@ static int __init armada_8k_cpufreq_init(void)
127134
struct device_node *node;
128135
struct cpumask cpus;
129136

130-
node = of_find_compatible_node(NULL, NULL, "marvell,ap806-cpu-clock");
137+
node = of_find_matching_node_and_match(NULL, armada_8k_cpufreq_of_match,
138+
NULL);
131139
if (!node || !of_device_is_available(node)) {
132140
of_node_put(node);
133141
return -ENODEV;
@@ -204,12 +212,6 @@ static void __exit armada_8k_cpufreq_exit(void)
204212
}
205213
module_exit(armada_8k_cpufreq_exit);
206214

207-
static const struct of_device_id __maybe_unused armada_8k_cpufreq_of_match[] = {
208-
{ .compatible = "marvell,ap806-cpu-clock" },
209-
{ },
210-
};
211-
MODULE_DEVICE_TABLE(of, armada_8k_cpufreq_of_match);
212-
213215
MODULE_AUTHOR("Gregory Clement <gregory.clement@bootlin.com>");
214216
MODULE_DESCRIPTION("Armada 8K cpufreq driver");
215217
MODULE_LICENSE("GPL");

drivers/cpufreq/cpufreq-dt-platdev.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
#include <linux/err.h>
8+
#include <linux/module.h>
89
#include <linux/of.h>
910
#include <linux/platform_device.h>
1011

@@ -85,6 +86,8 @@ static const struct of_device_id allowlist[] __initconst = {
8586
{ .compatible = "st-ericsson,u9500", },
8687
{ .compatible = "st-ericsson,u9540", },
8788

89+
{ .compatible = "starfive,jh7110", },
90+
8891
{ .compatible = "ti,omap2", },
8992
{ .compatible = "ti,omap4", },
9093
{ .compatible = "ti,omap5", },
@@ -165,6 +168,7 @@ static const struct of_device_id blocklist[] __initconst = {
165168
{ .compatible = "ti,dra7", },
166169
{ .compatible = "ti,omap3", },
167170
{ .compatible = "ti,am625", },
171+
{ .compatible = "ti,am62a7", },
168172

169173
{ .compatible = "qcom,ipq8064", },
170174
{ .compatible = "qcom,apq8064", },
@@ -214,3 +218,4 @@ static int __init cpufreq_dt_platdev_init(void)
214218
sizeof(struct cpufreq_dt_platform_data)));
215219
}
216220
core_initcall(cpufreq_dt_platdev_init);
221+
MODULE_LICENSE("GPL");

drivers/cpufreq/imx6q-cpufreq.c

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,14 @@ static struct cpufreq_driver imx6q_cpufreq_driver = {
209209
.suspend = cpufreq_generic_suspend,
210210
};
211211

212+
static void imx6x_disable_freq_in_opp(struct device *dev, unsigned long freq)
213+
{
214+
int ret = dev_pm_opp_disable(dev, freq);
215+
216+
if (ret < 0 && ret != -ENODEV)
217+
dev_warn(dev, "failed to disable %ldMHz OPP\n", freq / 1000000);
218+
}
219+
212220
#define OCOTP_CFG3 0x440
213221
#define OCOTP_CFG3_SPEED_SHIFT 16
214222
#define OCOTP_CFG3_SPEED_1P2GHZ 0x3
@@ -254,17 +262,15 @@ static int imx6q_opp_check_speed_grading(struct device *dev)
254262
val &= 0x3;
255263

256264
if (val < OCOTP_CFG3_SPEED_996MHZ)
257-
if (dev_pm_opp_disable(dev, 996000000))
258-
dev_warn(dev, "failed to disable 996MHz OPP\n");
265+
imx6x_disable_freq_in_opp(dev, 996000000);
259266

260267
if (of_machine_is_compatible("fsl,imx6q") ||
261268
of_machine_is_compatible("fsl,imx6qp")) {
262269
if (val != OCOTP_CFG3_SPEED_852MHZ)
263-
if (dev_pm_opp_disable(dev, 852000000))
264-
dev_warn(dev, "failed to disable 852MHz OPP\n");
270+
imx6x_disable_freq_in_opp(dev, 852000000);
271+
265272
if (val != OCOTP_CFG3_SPEED_1P2GHZ)
266-
if (dev_pm_opp_disable(dev, 1200000000))
267-
dev_warn(dev, "failed to disable 1.2GHz OPP\n");
273+
imx6x_disable_freq_in_opp(dev, 1200000000);
268274
}
269275

270276
return 0;
@@ -316,20 +322,16 @@ static int imx6ul_opp_check_speed_grading(struct device *dev)
316322
val >>= OCOTP_CFG3_SPEED_SHIFT;
317323
val &= 0x3;
318324

319-
if (of_machine_is_compatible("fsl,imx6ul")) {
325+
if (of_machine_is_compatible("fsl,imx6ul"))
320326
if (val != OCOTP_CFG3_6UL_SPEED_696MHZ)
321-
if (dev_pm_opp_disable(dev, 696000000))
322-
dev_warn(dev, "failed to disable 696MHz OPP\n");
323-
}
327+
imx6x_disable_freq_in_opp(dev, 696000000);
324328

325329
if (of_machine_is_compatible("fsl,imx6ull")) {
326330
if (val != OCOTP_CFG3_6ULL_SPEED_792MHZ)
327-
if (dev_pm_opp_disable(dev, 792000000))
328-
dev_warn(dev, "failed to disable 792MHz OPP\n");
331+
imx6x_disable_freq_in_opp(dev, 792000000);
329332

330333
if (val != OCOTP_CFG3_6ULL_SPEED_900MHZ)
331-
if (dev_pm_opp_disable(dev, 900000000))
332-
dev_warn(dev, "failed to disable 900MHz OPP\n");
334+
imx6x_disable_freq_in_opp(dev, 900000000);
333335
}
334336

335337
return ret;

drivers/cpufreq/mediatek-cpufreq.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -696,9 +696,16 @@ static const struct mtk_cpufreq_platform_data mt2701_platform_data = {
696696
static const struct mtk_cpufreq_platform_data mt7622_platform_data = {
697697
.min_volt_shift = 100000,
698698
.max_volt_shift = 200000,
699-
.proc_max_volt = 1360000,
699+
.proc_max_volt = 1350000,
700700
.sram_min_volt = 0,
701-
.sram_max_volt = 1360000,
701+
.sram_max_volt = 1350000,
702+
.ccifreq_supported = false,
703+
};
704+
705+
static const struct mtk_cpufreq_platform_data mt7623_platform_data = {
706+
.min_volt_shift = 100000,
707+
.max_volt_shift = 200000,
708+
.proc_max_volt = 1300000,
702709
.ccifreq_supported = false,
703710
};
704711

@@ -734,7 +741,7 @@ static const struct of_device_id mtk_cpufreq_machines[] __initconst = {
734741
{ .compatible = "mediatek,mt2701", .data = &mt2701_platform_data },
735742
{ .compatible = "mediatek,mt2712", .data = &mt2701_platform_data },
736743
{ .compatible = "mediatek,mt7622", .data = &mt7622_platform_data },
737-
{ .compatible = "mediatek,mt7623", .data = &mt7622_platform_data },
744+
{ .compatible = "mediatek,mt7623", .data = &mt7623_platform_data },
738745
{ .compatible = "mediatek,mt8167", .data = &mt8516_platform_data },
739746
{ .compatible = "mediatek,mt817x", .data = &mt2701_platform_data },
740747
{ .compatible = "mediatek,mt8173", .data = &mt2701_platform_data },

drivers/cpufreq/qcom-cpufreq-hw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev)
661661

662662
ret = dev_pm_opp_of_find_icc_paths(cpu_dev, NULL);
663663
if (ret)
664-
return ret;
664+
return dev_err_probe(dev, ret, "Failed to find icc paths\n");
665665

666666
for (num_domains = 0; num_domains < MAX_FREQ_DOMAINS; num_domains++)
667667
if (!platform_get_resource(pdev, IORESOURCE_MEM, num_domains))

drivers/cpufreq/sparc-us2e-cpufreq.c

Lines changed: 17 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
#include <asm/asi.h>
2121
#include <asm/timer.h>
2222

23-
static struct cpufreq_driver *cpufreq_us2e_driver;
24-
2523
struct us2e_freq_percpu_info {
2624
struct cpufreq_frequency_table table[6];
2725
};
@@ -300,12 +298,19 @@ static int __init us2e_freq_cpu_init(struct cpufreq_policy *policy)
300298

301299
static int us2e_freq_cpu_exit(struct cpufreq_policy *policy)
302300
{
303-
if (cpufreq_us2e_driver)
304-
us2e_freq_target(policy, 0);
305-
301+
us2e_freq_target(policy, 0);
306302
return 0;
307303
}
308304

305+
static struct cpufreq_driver cpufreq_us2e_driver = {
306+
.name = "UltraSPARC-IIe",
307+
.init = us2e_freq_cpu_init,
308+
.verify = cpufreq_generic_frequency_table_verify,
309+
.target_index = us2e_freq_target,
310+
.get = us2e_freq_get,
311+
.exit = us2e_freq_cpu_exit,
312+
};
313+
309314
static int __init us2e_freq_init(void)
310315
{
311316
unsigned long manuf, impl, ver;
@@ -319,39 +324,15 @@ static int __init us2e_freq_init(void)
319324
impl = ((ver >> 32) & 0xffff);
320325

321326
if (manuf == 0x17 && impl == 0x13) {
322-
struct cpufreq_driver *driver;
323-
324-
ret = -ENOMEM;
325-
driver = kzalloc(sizeof(*driver), GFP_KERNEL);
326-
if (!driver)
327-
goto err_out;
328-
329-
us2e_freq_table = kzalloc((NR_CPUS * sizeof(*us2e_freq_table)),
330-
GFP_KERNEL);
327+
us2e_freq_table = kzalloc(NR_CPUS * sizeof(*us2e_freq_table),
328+
GFP_KERNEL);
331329
if (!us2e_freq_table)
332-
goto err_out;
333-
334-
driver->init = us2e_freq_cpu_init;
335-
driver->verify = cpufreq_generic_frequency_table_verify;
336-
driver->target_index = us2e_freq_target;
337-
driver->get = us2e_freq_get;
338-
driver->exit = us2e_freq_cpu_exit;
339-
strcpy(driver->name, "UltraSPARC-IIe");
330+
return -ENOMEM;
340331

341-
cpufreq_us2e_driver = driver;
342-
ret = cpufreq_register_driver(driver);
332+
ret = cpufreq_register_driver(&cpufreq_us2e_driver);
343333
if (ret)
344-
goto err_out;
334+
kfree(us2e_freq_table);
345335

346-
return 0;
347-
348-
err_out:
349-
if (driver) {
350-
kfree(driver);
351-
cpufreq_us2e_driver = NULL;
352-
}
353-
kfree(us2e_freq_table);
354-
us2e_freq_table = NULL;
355336
return ret;
356337
}
357338

@@ -360,13 +341,8 @@ static int __init us2e_freq_init(void)
360341

361342
static void __exit us2e_freq_exit(void)
362343
{
363-
if (cpufreq_us2e_driver) {
364-
cpufreq_unregister_driver(cpufreq_us2e_driver);
365-
kfree(cpufreq_us2e_driver);
366-
cpufreq_us2e_driver = NULL;
367-
kfree(us2e_freq_table);
368-
us2e_freq_table = NULL;
369-
}
344+
cpufreq_unregister_driver(&cpufreq_us2e_driver);
345+
kfree(us2e_freq_table);
370346
}
371347

372348
MODULE_AUTHOR("David S. Miller <davem@redhat.com>");

drivers/cpufreq/sparc-us3-cpufreq.c

Lines changed: 17 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
#include <asm/head.h>
2020
#include <asm/timer.h>
2121

22-
static struct cpufreq_driver *cpufreq_us3_driver;
23-
2422
struct us3_freq_percpu_info {
2523
struct cpufreq_frequency_table table[4];
2624
};
@@ -144,12 +142,19 @@ static int __init us3_freq_cpu_init(struct cpufreq_policy *policy)
144142

145143
static int us3_freq_cpu_exit(struct cpufreq_policy *policy)
146144
{
147-
if (cpufreq_us3_driver)
148-
us3_freq_target(policy, 0);
149-
145+
us3_freq_target(policy, 0);
150146
return 0;
151147
}
152148

149+
static struct cpufreq_driver cpufreq_us3_driver = {
150+
.name = "UltraSPARC-III",
151+
.init = us3_freq_cpu_init,
152+
.verify = cpufreq_generic_frequency_table_verify,
153+
.target_index = us3_freq_target,
154+
.get = us3_freq_get,
155+
.exit = us3_freq_cpu_exit,
156+
};
157+
153158
static int __init us3_freq_init(void)
154159
{
155160
unsigned long manuf, impl, ver;
@@ -167,39 +172,15 @@ static int __init us3_freq_init(void)
167172
impl == CHEETAH_PLUS_IMPL ||
168173
impl == JAGUAR_IMPL ||
169174
impl == PANTHER_IMPL)) {
170-
struct cpufreq_driver *driver;
171-
172-
ret = -ENOMEM;
173-
driver = kzalloc(sizeof(*driver), GFP_KERNEL);
174-
if (!driver)
175-
goto err_out;
176-
177-
us3_freq_table = kzalloc((NR_CPUS * sizeof(*us3_freq_table)),
178-
GFP_KERNEL);
175+
us3_freq_table = kzalloc(NR_CPUS * sizeof(*us3_freq_table),
176+
GFP_KERNEL);
179177
if (!us3_freq_table)
180-
goto err_out;
181-
182-
driver->init = us3_freq_cpu_init;
183-
driver->verify = cpufreq_generic_frequency_table_verify;
184-
driver->target_index = us3_freq_target;
185-
driver->get = us3_freq_get;
186-
driver->exit = us3_freq_cpu_exit;
187-
strcpy(driver->name, "UltraSPARC-III");
178+
return -ENOMEM;
188179

189-
cpufreq_us3_driver = driver;
190-
ret = cpufreq_register_driver(driver);
180+
ret = cpufreq_register_driver(&cpufreq_us3_driver);
191181
if (ret)
192-
goto err_out;
182+
kfree(us3_freq_table);
193183

194-
return 0;
195-
196-
err_out:
197-
if (driver) {
198-
kfree(driver);
199-
cpufreq_us3_driver = NULL;
200-
}
201-
kfree(us3_freq_table);
202-
us3_freq_table = NULL;
203184
return ret;
204185
}
205186

@@ -208,13 +189,8 @@ static int __init us3_freq_init(void)
208189

209190
static void __exit us3_freq_exit(void)
210191
{
211-
if (cpufreq_us3_driver) {
212-
cpufreq_unregister_driver(cpufreq_us3_driver);
213-
kfree(cpufreq_us3_driver);
214-
cpufreq_us3_driver = NULL;
215-
kfree(us3_freq_table);
216-
us3_freq_table = NULL;
217-
}
192+
cpufreq_unregister_driver(&cpufreq_us3_driver);
193+
kfree(us3_freq_table);
218194
}
219195

220196
MODULE_AUTHOR("David S. Miller <davem@redhat.com>");

drivers/cpufreq/tegra194-cpufreq.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,8 +686,10 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev)
686686

687687
/* Check for optional OPPv2 and interconnect paths on CPU0 to enable ICC scaling */
688688
cpu_dev = get_cpu_device(0);
689-
if (!cpu_dev)
690-
return -EPROBE_DEFER;
689+
if (!cpu_dev) {
690+
err = -EPROBE_DEFER;
691+
goto err_free_res;
692+
}
691693

692694
if (dev_pm_opp_of_get_opp_desc_node(cpu_dev)) {
693695
err = dev_pm_opp_of_find_icc_paths(cpu_dev, NULL);

0 commit comments

Comments
 (0)