Skip to content

Commit 8e3d086

Browse files
committed
Merge tag 'cpufreq-arm-updates-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm
Pull cpufreq/arm updates for 6.1-rc1 from Viresh Kumar: "- Add SM6115 to cpufreq-dt blocklist (Adam Skladowski). - Add support for Tegra239 and minor cleanups (Sumit Gupta, ye xingchen, and Yang Yingliang). - Add freq qos for qcom cpufreq driver and minor cleanups (Xuewen Yan, and Viresh Kumar). - Minor cleanups around functions called at module_init() (Xiu Jianfeng). - Use module_init and add module_exit for bmips driver (Zhang Jianhua)." * tag 'cpufreq-arm-updates-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm: cpufreq: qcom-cpufreq-hw: Add cpufreq qos for LMh cpufreq: Add __init annotation to module init funcs cpufreq: tegra194: change tegra239_cpufreq_soc to static cpufreq: tegra194: Add support for Tegra239 cpufreq: qcom-cpufreq-hw: Fix uninitialized throttled_freq warning cpufreq: tegra194: Remove the unneeded result variable cpufreq: bmips-cpufreq: Use module_init and add module_exit cpufreq: Add SM6115 to cpufreq-dt-platdev blocklist
2 parents 71bb5c8 + c4c0efb commit 8e3d086

File tree

7 files changed

+47
-29
lines changed

7 files changed

+47
-29
lines changed

drivers/cpufreq/bmips-cpufreq.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static struct cpufreq_driver bmips_cpufreq_driver = {
156156
.name = BMIPS_CPUFREQ_PREFIX,
157157
};
158158

159-
static int __init bmips_cpufreq_probe(void)
159+
static int __init bmips_cpufreq_driver_init(void)
160160
{
161161
struct cpufreq_compat *cc;
162162
struct device_node *np;
@@ -176,7 +176,13 @@ static int __init bmips_cpufreq_probe(void)
176176

177177
return cpufreq_register_driver(&bmips_cpufreq_driver);
178178
}
179-
device_initcall(bmips_cpufreq_probe);
179+
module_init(bmips_cpufreq_driver_init);
180+
181+
static void __exit bmips_cpufreq_driver_exit(void)
182+
{
183+
cpufreq_unregister_driver(&bmips_cpufreq_driver);
184+
}
185+
module_exit(bmips_cpufreq_driver_exit);
180186

181187
MODULE_AUTHOR("Markus Mayer <[email protected]>");
182188
MODULE_DESCRIPTION("CPUfreq driver for Broadcom BMIPS SoCs");

drivers/cpufreq/cpufreq-dt-platdev.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ static const struct of_device_id blocklist[] __initconst = {
146146
{ .compatible = "qcom,sc8180x", },
147147
{ .compatible = "qcom,sc8280xp", },
148148
{ .compatible = "qcom,sdm845", },
149+
{ .compatible = "qcom,sm6115", },
149150
{ .compatible = "qcom,sm6350", },
150151
{ .compatible = "qcom,sm8150", },
151152
{ .compatible = "qcom,sm8250", },

drivers/cpufreq/highbank-cpufreq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static struct notifier_block hb_cpufreq_clk_nb = {
5555
.notifier_call = hb_cpufreq_clk_notify,
5656
};
5757

58-
static int hb_cpufreq_driver_init(void)
58+
static int __init hb_cpufreq_driver_init(void)
5959
{
6060
struct platform_device_info devinfo = { .name = "cpufreq-dt", };
6161
struct device *cpu_dev;

drivers/cpufreq/qcom-cpufreq-hw.c

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/of_address.h>
1414
#include <linux/of_platform.h>
1515
#include <linux/pm_opp.h>
16+
#include <linux/pm_qos.h>
1617
#include <linux/slab.h>
1718
#include <linux/spinlock.h>
1819
#include <linux/units.h>
@@ -56,6 +57,8 @@ struct qcom_cpufreq_data {
5657
struct cpufreq_policy *policy;
5758

5859
bool per_core_dcvs;
60+
61+
struct freq_qos_request throttle_freq_req;
5962
};
6063

6164
static unsigned long cpu_hw_rate, xo_rate;
@@ -316,14 +319,16 @@ static void qcom_lmh_dcvs_notify(struct qcom_cpufreq_data *data)
316319
if (IS_ERR(opp)) {
317320
dev_warn(dev, "Can't find the OPP for throttling: %pe!\n", opp);
318321
} else {
319-
throttled_freq = freq_hz / HZ_PER_KHZ;
320-
321-
/* Update thermal pressure (the boost frequencies are accepted) */
322-
arch_update_thermal_pressure(policy->related_cpus, throttled_freq);
323-
324322
dev_pm_opp_put(opp);
325323
}
326324

325+
throttled_freq = freq_hz / HZ_PER_KHZ;
326+
327+
freq_qos_update_request(&data->throttle_freq_req, throttled_freq);
328+
329+
/* Update thermal pressure (the boost frequencies are accepted) */
330+
arch_update_thermal_pressure(policy->related_cpus, throttled_freq);
331+
327332
/*
328333
* In the unlikely case policy is unregistered do not enable
329334
* polling or h/w interrupt
@@ -413,6 +418,14 @@ static int qcom_cpufreq_hw_lmh_init(struct cpufreq_policy *policy, int index)
413418
if (data->throttle_irq < 0)
414419
return data->throttle_irq;
415420

421+
ret = freq_qos_add_request(&policy->constraints,
422+
&data->throttle_freq_req, FREQ_QOS_MAX,
423+
FREQ_QOS_MAX_DEFAULT_VALUE);
424+
if (ret < 0) {
425+
dev_err(&pdev->dev, "Failed to add freq constraint (%d)\n", ret);
426+
return ret;
427+
}
428+
416429
data->cancel_throttle = false;
417430
data->policy = policy;
418431

@@ -479,6 +492,7 @@ static void qcom_cpufreq_hw_lmh_exit(struct qcom_cpufreq_data *data)
479492
if (data->throttle_irq <= 0)
480493
return;
481494

495+
freq_qos_remove_request(&data->throttle_freq_req);
482496
free_irq(data->throttle_irq, data);
483497
}
484498

drivers/cpufreq/sti-cpufreq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ static int sti_cpufreq_fetch_syscon_registers(void)
252252
return 0;
253253
}
254254

255-
static int sti_cpufreq_init(void)
255+
static int __init sti_cpufreq_init(void)
256256
{
257257
int ret;
258258

drivers/cpufreq/tegra194-cpufreq.c

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,6 @@
3838
/* cpufreq transisition latency */
3939
#define TEGRA_CPUFREQ_TRANSITION_LATENCY (300 * 1000) /* unit in nanoseconds */
4040

41-
enum cluster {
42-
CLUSTER0,
43-
CLUSTER1,
44-
CLUSTER2,
45-
CLUSTER3,
46-
MAX_CLUSTERS,
47-
};
48-
4941
struct tegra_cpu_ctr {
5042
u32 cpu;
5143
u32 coreclk_cnt, last_coreclk_cnt;
@@ -67,12 +59,12 @@ struct tegra_cpufreq_ops {
6759
struct tegra_cpufreq_soc {
6860
struct tegra_cpufreq_ops *ops;
6961
int maxcpus_per_cluster;
62+
unsigned int num_clusters;
7063
phys_addr_t actmon_cntr_base;
7164
};
7265

7366
struct tegra194_cpufreq_data {
7467
void __iomem *regs;
75-
size_t num_clusters;
7668
struct cpufreq_frequency_table **tables;
7769
const struct tegra_cpufreq_soc *soc;
7870
};
@@ -166,6 +158,14 @@ static const struct tegra_cpufreq_soc tegra234_cpufreq_soc = {
166158
.ops = &tegra234_cpufreq_ops,
167159
.actmon_cntr_base = 0x9000,
168160
.maxcpus_per_cluster = 4,
161+
.num_clusters = 3,
162+
};
163+
164+
static const struct tegra_cpufreq_soc tegra239_cpufreq_soc = {
165+
.ops = &tegra234_cpufreq_ops,
166+
.actmon_cntr_base = 0x4000,
167+
.maxcpus_per_cluster = 8,
168+
.num_clusters = 1,
169169
};
170170

171171
static void tegra194_get_cpu_cluster_id(u32 cpu, u32 *cpuid, u32 *clusterid)
@@ -314,11 +314,7 @@ static void tegra194_get_cpu_ndiv_sysreg(void *ndiv)
314314

315315
static int tegra194_get_cpu_ndiv(u32 cpu, u32 cpuid, u32 clusterid, u64 *ndiv)
316316
{
317-
int ret;
318-
319-
ret = smp_call_function_single(cpu, tegra194_get_cpu_ndiv_sysreg, &ndiv, true);
320-
321-
return ret;
317+
return smp_call_function_single(cpu, tegra194_get_cpu_ndiv_sysreg, &ndiv, true);
322318
}
323319

324320
static void tegra194_set_cpu_ndiv_sysreg(void *data)
@@ -382,7 +378,7 @@ static int tegra194_cpufreq_init(struct cpufreq_policy *policy)
382378

383379
data->soc->ops->get_cpu_cluster_id(policy->cpu, NULL, &clusterid);
384380

385-
if (clusterid >= data->num_clusters || !data->tables[clusterid])
381+
if (clusterid >= data->soc->num_clusters || !data->tables[clusterid])
386382
return -EINVAL;
387383

388384
start_cpu = rounddown(policy->cpu, maxcpus_per_cluster);
@@ -433,6 +429,7 @@ static struct tegra_cpufreq_ops tegra194_cpufreq_ops = {
433429
static const struct tegra_cpufreq_soc tegra194_cpufreq_soc = {
434430
.ops = &tegra194_cpufreq_ops,
435431
.maxcpus_per_cluster = 2,
432+
.num_clusters = 4,
436433
};
437434

438435
static void tegra194_cpufreq_free_resources(void)
@@ -525,15 +522,14 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev)
525522

526523
soc = of_device_get_match_data(&pdev->dev);
527524

528-
if (soc->ops && soc->maxcpus_per_cluster) {
525+
if (soc->ops && soc->maxcpus_per_cluster && soc->num_clusters) {
529526
data->soc = soc;
530527
} else {
531528
dev_err(&pdev->dev, "soc data missing\n");
532529
return -EINVAL;
533530
}
534531

535-
data->num_clusters = MAX_CLUSTERS;
536-
data->tables = devm_kcalloc(&pdev->dev, data->num_clusters,
532+
data->tables = devm_kcalloc(&pdev->dev, data->soc->num_clusters,
537533
sizeof(*data->tables), GFP_KERNEL);
538534
if (!data->tables)
539535
return -ENOMEM;
@@ -558,7 +554,7 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev)
558554
goto put_bpmp;
559555
}
560556

561-
for (i = 0; i < data->num_clusters; i++) {
557+
for (i = 0; i < data->soc->num_clusters; i++) {
562558
data->tables[i] = init_freq_table(pdev, bpmp, i);
563559
if (IS_ERR(data->tables[i])) {
564560
err = PTR_ERR(data->tables[i]);
@@ -590,6 +586,7 @@ static int tegra194_cpufreq_remove(struct platform_device *pdev)
590586
static const struct of_device_id tegra194_cpufreq_of_match[] = {
591587
{ .compatible = "nvidia,tegra194-ccplex", .data = &tegra194_cpufreq_soc },
592588
{ .compatible = "nvidia,tegra234-ccplex-cluster", .data = &tegra234_cpufreq_soc },
589+
{ .compatible = "nvidia,tegra239-ccplex-cluster", .data = &tegra239_cpufreq_soc },
593590
{ /* sentinel */ }
594591
};
595592

drivers/cpufreq/ti-cpufreq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ static int ti_cpufreq_probe(struct platform_device *pdev)
398398
return ret;
399399
}
400400

401-
static int ti_cpufreq_init(void)
401+
static int __init ti_cpufreq_init(void)
402402
{
403403
const struct of_device_id *match;
404404

0 commit comments

Comments
 (0)