Commit 8e3d0867 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

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
parents 71bb5c82 c4c0efb0
...@@ -156,7 +156,7 @@ static struct cpufreq_driver bmips_cpufreq_driver = { ...@@ -156,7 +156,7 @@ static struct cpufreq_driver bmips_cpufreq_driver = {
.name = BMIPS_CPUFREQ_PREFIX, .name = BMIPS_CPUFREQ_PREFIX,
}; };
static int __init bmips_cpufreq_probe(void) static int __init bmips_cpufreq_driver_init(void)
{ {
struct cpufreq_compat *cc; struct cpufreq_compat *cc;
struct device_node *np; struct device_node *np;
...@@ -176,7 +176,13 @@ static int __init bmips_cpufreq_probe(void) ...@@ -176,7 +176,13 @@ static int __init bmips_cpufreq_probe(void)
return cpufreq_register_driver(&bmips_cpufreq_driver); return cpufreq_register_driver(&bmips_cpufreq_driver);
} }
device_initcall(bmips_cpufreq_probe); module_init(bmips_cpufreq_driver_init);
static void __exit bmips_cpufreq_driver_exit(void)
{
cpufreq_unregister_driver(&bmips_cpufreq_driver);
}
module_exit(bmips_cpufreq_driver_exit);
MODULE_AUTHOR("Markus Mayer <mmayer@broadcom.com>"); MODULE_AUTHOR("Markus Mayer <mmayer@broadcom.com>");
MODULE_DESCRIPTION("CPUfreq driver for Broadcom BMIPS SoCs"); MODULE_DESCRIPTION("CPUfreq driver for Broadcom BMIPS SoCs");
......
...@@ -146,6 +146,7 @@ static const struct of_device_id blocklist[] __initconst = { ...@@ -146,6 +146,7 @@ static const struct of_device_id blocklist[] __initconst = {
{ .compatible = "qcom,sc8180x", }, { .compatible = "qcom,sc8180x", },
{ .compatible = "qcom,sc8280xp", }, { .compatible = "qcom,sc8280xp", },
{ .compatible = "qcom,sdm845", }, { .compatible = "qcom,sdm845", },
{ .compatible = "qcom,sm6115", },
{ .compatible = "qcom,sm6350", }, { .compatible = "qcom,sm6350", },
{ .compatible = "qcom,sm8150", }, { .compatible = "qcom,sm8150", },
{ .compatible = "qcom,sm8250", }, { .compatible = "qcom,sm8250", },
......
...@@ -55,7 +55,7 @@ static struct notifier_block hb_cpufreq_clk_nb = { ...@@ -55,7 +55,7 @@ static struct notifier_block hb_cpufreq_clk_nb = {
.notifier_call = hb_cpufreq_clk_notify, .notifier_call = hb_cpufreq_clk_notify,
}; };
static int hb_cpufreq_driver_init(void) static int __init hb_cpufreq_driver_init(void)
{ {
struct platform_device_info devinfo = { .name = "cpufreq-dt", }; struct platform_device_info devinfo = { .name = "cpufreq-dt", };
struct device *cpu_dev; struct device *cpu_dev;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/pm_opp.h> #include <linux/pm_opp.h>
#include <linux/pm_qos.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/units.h> #include <linux/units.h>
...@@ -56,6 +57,8 @@ struct qcom_cpufreq_data { ...@@ -56,6 +57,8 @@ struct qcom_cpufreq_data {
struct cpufreq_policy *policy; struct cpufreq_policy *policy;
bool per_core_dcvs; bool per_core_dcvs;
struct freq_qos_request throttle_freq_req;
}; };
static unsigned long cpu_hw_rate, xo_rate; static unsigned long cpu_hw_rate, xo_rate;
...@@ -316,14 +319,16 @@ static void qcom_lmh_dcvs_notify(struct qcom_cpufreq_data *data) ...@@ -316,14 +319,16 @@ static void qcom_lmh_dcvs_notify(struct qcom_cpufreq_data *data)
if (IS_ERR(opp)) { if (IS_ERR(opp)) {
dev_warn(dev, "Can't find the OPP for throttling: %pe!\n", opp); dev_warn(dev, "Can't find the OPP for throttling: %pe!\n", opp);
} else { } else {
throttled_freq = freq_hz / HZ_PER_KHZ;
/* Update thermal pressure (the boost frequencies are accepted) */
arch_update_thermal_pressure(policy->related_cpus, throttled_freq);
dev_pm_opp_put(opp); dev_pm_opp_put(opp);
} }
throttled_freq = freq_hz / HZ_PER_KHZ;
freq_qos_update_request(&data->throttle_freq_req, throttled_freq);
/* Update thermal pressure (the boost frequencies are accepted) */
arch_update_thermal_pressure(policy->related_cpus, throttled_freq);
/* /*
* In the unlikely case policy is unregistered do not enable * In the unlikely case policy is unregistered do not enable
* polling or h/w interrupt * polling or h/w interrupt
...@@ -413,6 +418,14 @@ static int qcom_cpufreq_hw_lmh_init(struct cpufreq_policy *policy, int index) ...@@ -413,6 +418,14 @@ static int qcom_cpufreq_hw_lmh_init(struct cpufreq_policy *policy, int index)
if (data->throttle_irq < 0) if (data->throttle_irq < 0)
return data->throttle_irq; return data->throttle_irq;
ret = freq_qos_add_request(&policy->constraints,
&data->throttle_freq_req, FREQ_QOS_MAX,
FREQ_QOS_MAX_DEFAULT_VALUE);
if (ret < 0) {
dev_err(&pdev->dev, "Failed to add freq constraint (%d)\n", ret);
return ret;
}
data->cancel_throttle = false; data->cancel_throttle = false;
data->policy = policy; data->policy = policy;
...@@ -479,6 +492,7 @@ static void qcom_cpufreq_hw_lmh_exit(struct qcom_cpufreq_data *data) ...@@ -479,6 +492,7 @@ static void qcom_cpufreq_hw_lmh_exit(struct qcom_cpufreq_data *data)
if (data->throttle_irq <= 0) if (data->throttle_irq <= 0)
return; return;
freq_qos_remove_request(&data->throttle_freq_req);
free_irq(data->throttle_irq, data); free_irq(data->throttle_irq, data);
} }
......
...@@ -252,7 +252,7 @@ static int sti_cpufreq_fetch_syscon_registers(void) ...@@ -252,7 +252,7 @@ static int sti_cpufreq_fetch_syscon_registers(void)
return 0; return 0;
} }
static int sti_cpufreq_init(void) static int __init sti_cpufreq_init(void)
{ {
int ret; int ret;
......
...@@ -38,14 +38,6 @@ ...@@ -38,14 +38,6 @@
/* cpufreq transisition latency */ /* cpufreq transisition latency */
#define TEGRA_CPUFREQ_TRANSITION_LATENCY (300 * 1000) /* unit in nanoseconds */ #define TEGRA_CPUFREQ_TRANSITION_LATENCY (300 * 1000) /* unit in nanoseconds */
enum cluster {
CLUSTER0,
CLUSTER1,
CLUSTER2,
CLUSTER3,
MAX_CLUSTERS,
};
struct tegra_cpu_ctr { struct tegra_cpu_ctr {
u32 cpu; u32 cpu;
u32 coreclk_cnt, last_coreclk_cnt; u32 coreclk_cnt, last_coreclk_cnt;
...@@ -67,12 +59,12 @@ struct tegra_cpufreq_ops { ...@@ -67,12 +59,12 @@ struct tegra_cpufreq_ops {
struct tegra_cpufreq_soc { struct tegra_cpufreq_soc {
struct tegra_cpufreq_ops *ops; struct tegra_cpufreq_ops *ops;
int maxcpus_per_cluster; int maxcpus_per_cluster;
unsigned int num_clusters;
phys_addr_t actmon_cntr_base; phys_addr_t actmon_cntr_base;
}; };
struct tegra194_cpufreq_data { struct tegra194_cpufreq_data {
void __iomem *regs; void __iomem *regs;
size_t num_clusters;
struct cpufreq_frequency_table **tables; struct cpufreq_frequency_table **tables;
const struct tegra_cpufreq_soc *soc; const struct tegra_cpufreq_soc *soc;
}; };
...@@ -166,6 +158,14 @@ static const struct tegra_cpufreq_soc tegra234_cpufreq_soc = { ...@@ -166,6 +158,14 @@ static const struct tegra_cpufreq_soc tegra234_cpufreq_soc = {
.ops = &tegra234_cpufreq_ops, .ops = &tegra234_cpufreq_ops,
.actmon_cntr_base = 0x9000, .actmon_cntr_base = 0x9000,
.maxcpus_per_cluster = 4, .maxcpus_per_cluster = 4,
.num_clusters = 3,
};
static const struct tegra_cpufreq_soc tegra239_cpufreq_soc = {
.ops = &tegra234_cpufreq_ops,
.actmon_cntr_base = 0x4000,
.maxcpus_per_cluster = 8,
.num_clusters = 1,
}; };
static void tegra194_get_cpu_cluster_id(u32 cpu, u32 *cpuid, u32 *clusterid) 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) ...@@ -314,11 +314,7 @@ static void tegra194_get_cpu_ndiv_sysreg(void *ndiv)
static int tegra194_get_cpu_ndiv(u32 cpu, u32 cpuid, u32 clusterid, u64 *ndiv) static int tegra194_get_cpu_ndiv(u32 cpu, u32 cpuid, u32 clusterid, u64 *ndiv)
{ {
int ret; return smp_call_function_single(cpu, tegra194_get_cpu_ndiv_sysreg, &ndiv, true);
ret = smp_call_function_single(cpu, tegra194_get_cpu_ndiv_sysreg, &ndiv, true);
return ret;
} }
static void tegra194_set_cpu_ndiv_sysreg(void *data) static void tegra194_set_cpu_ndiv_sysreg(void *data)
...@@ -382,7 +378,7 @@ static int tegra194_cpufreq_init(struct cpufreq_policy *policy) ...@@ -382,7 +378,7 @@ static int tegra194_cpufreq_init(struct cpufreq_policy *policy)
data->soc->ops->get_cpu_cluster_id(policy->cpu, NULL, &clusterid); data->soc->ops->get_cpu_cluster_id(policy->cpu, NULL, &clusterid);
if (clusterid >= data->num_clusters || !data->tables[clusterid]) if (clusterid >= data->soc->num_clusters || !data->tables[clusterid])
return -EINVAL; return -EINVAL;
start_cpu = rounddown(policy->cpu, maxcpus_per_cluster); start_cpu = rounddown(policy->cpu, maxcpus_per_cluster);
...@@ -433,6 +429,7 @@ static struct tegra_cpufreq_ops tegra194_cpufreq_ops = { ...@@ -433,6 +429,7 @@ static struct tegra_cpufreq_ops tegra194_cpufreq_ops = {
static const struct tegra_cpufreq_soc tegra194_cpufreq_soc = { static const struct tegra_cpufreq_soc tegra194_cpufreq_soc = {
.ops = &tegra194_cpufreq_ops, .ops = &tegra194_cpufreq_ops,
.maxcpus_per_cluster = 2, .maxcpus_per_cluster = 2,
.num_clusters = 4,
}; };
static void tegra194_cpufreq_free_resources(void) static void tegra194_cpufreq_free_resources(void)
...@@ -525,15 +522,14 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev) ...@@ -525,15 +522,14 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev)
soc = of_device_get_match_data(&pdev->dev); soc = of_device_get_match_data(&pdev->dev);
if (soc->ops && soc->maxcpus_per_cluster) { if (soc->ops && soc->maxcpus_per_cluster && soc->num_clusters) {
data->soc = soc; data->soc = soc;
} else { } else {
dev_err(&pdev->dev, "soc data missing\n"); dev_err(&pdev->dev, "soc data missing\n");
return -EINVAL; return -EINVAL;
} }
data->num_clusters = MAX_CLUSTERS; data->tables = devm_kcalloc(&pdev->dev, data->soc->num_clusters,
data->tables = devm_kcalloc(&pdev->dev, data->num_clusters,
sizeof(*data->tables), GFP_KERNEL); sizeof(*data->tables), GFP_KERNEL);
if (!data->tables) if (!data->tables)
return -ENOMEM; return -ENOMEM;
...@@ -558,7 +554,7 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev) ...@@ -558,7 +554,7 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev)
goto put_bpmp; goto put_bpmp;
} }
for (i = 0; i < data->num_clusters; i++) { for (i = 0; i < data->soc->num_clusters; i++) {
data->tables[i] = init_freq_table(pdev, bpmp, i); data->tables[i] = init_freq_table(pdev, bpmp, i);
if (IS_ERR(data->tables[i])) { if (IS_ERR(data->tables[i])) {
err = PTR_ERR(data->tables[i]); err = PTR_ERR(data->tables[i]);
...@@ -590,6 +586,7 @@ static int tegra194_cpufreq_remove(struct platform_device *pdev) ...@@ -590,6 +586,7 @@ static int tegra194_cpufreq_remove(struct platform_device *pdev)
static const struct of_device_id tegra194_cpufreq_of_match[] = { static const struct of_device_id tegra194_cpufreq_of_match[] = {
{ .compatible = "nvidia,tegra194-ccplex", .data = &tegra194_cpufreq_soc }, { .compatible = "nvidia,tegra194-ccplex", .data = &tegra194_cpufreq_soc },
{ .compatible = "nvidia,tegra234-ccplex-cluster", .data = &tegra234_cpufreq_soc }, { .compatible = "nvidia,tegra234-ccplex-cluster", .data = &tegra234_cpufreq_soc },
{ .compatible = "nvidia,tegra239-ccplex-cluster", .data = &tegra239_cpufreq_soc },
{ /* sentinel */ } { /* sentinel */ }
}; };
......
...@@ -398,7 +398,7 @@ static int ti_cpufreq_probe(struct platform_device *pdev) ...@@ -398,7 +398,7 @@ static int ti_cpufreq_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int ti_cpufreq_init(void) static int __init ti_cpufreq_init(void)
{ {
const struct of_device_id *match; const struct of_device_id *match;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment