mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 19:07:52 +00:00
Merge branch 'cpufreq/arm/linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm into pm-cpufreq
Pull cpufreq driver fixes for v5.1 from Viresh Kumar: "This pull request contains minor fixes for ap806 and kryo cpufreq drivers (Julia Lawall and Viresh Kumar)." * 'cpufreq/arm/linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm: cpufreq: kryo: Release OPP tables on module removal cpufreq: ap806: add missing of_node_put after of_device_is_available
This commit is contained in:
commit
185a23b6e7
2 changed files with 21 additions and 3 deletions
|
@ -128,8 +128,10 @@ static int __init armada_8k_cpufreq_init(void)
|
||||||
struct cpumask cpus;
|
struct cpumask cpus;
|
||||||
|
|
||||||
node = of_find_compatible_node(NULL, NULL, "marvell,ap806-cpu-clock");
|
node = of_find_compatible_node(NULL, NULL, "marvell,ap806-cpu-clock");
|
||||||
if (!node || !of_device_is_available(node))
|
if (!node || !of_device_is_available(node)) {
|
||||||
|
of_node_put(node);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
nb_cpus = num_possible_cpus();
|
nb_cpus = num_possible_cpus();
|
||||||
freq_tables = kcalloc(nb_cpus, sizeof(*freq_tables), GFP_KERNEL);
|
freq_tables = kcalloc(nb_cpus, sizeof(*freq_tables), GFP_KERNEL);
|
||||||
|
|
|
@ -75,7 +75,7 @@ static enum _msm8996_version qcom_cpufreq_kryo_get_msm_id(void)
|
||||||
|
|
||||||
static int qcom_cpufreq_kryo_probe(struct platform_device *pdev)
|
static int qcom_cpufreq_kryo_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct opp_table *opp_tables[NR_CPUS] = {0};
|
struct opp_table **opp_tables;
|
||||||
enum _msm8996_version msm8996_version;
|
enum _msm8996_version msm8996_version;
|
||||||
struct nvmem_cell *speedbin_nvmem;
|
struct nvmem_cell *speedbin_nvmem;
|
||||||
struct device_node *np;
|
struct device_node *np;
|
||||||
|
@ -133,6 +133,10 @@ static int qcom_cpufreq_kryo_probe(struct platform_device *pdev)
|
||||||
}
|
}
|
||||||
kfree(speedbin);
|
kfree(speedbin);
|
||||||
|
|
||||||
|
opp_tables = kcalloc(num_possible_cpus(), sizeof(*opp_tables), GFP_KERNEL);
|
||||||
|
if (!opp_tables)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
for_each_possible_cpu(cpu) {
|
for_each_possible_cpu(cpu) {
|
||||||
cpu_dev = get_cpu_device(cpu);
|
cpu_dev = get_cpu_device(cpu);
|
||||||
if (NULL == cpu_dev) {
|
if (NULL == cpu_dev) {
|
||||||
|
@ -151,8 +155,10 @@ static int qcom_cpufreq_kryo_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
cpufreq_dt_pdev = platform_device_register_simple("cpufreq-dt", -1,
|
cpufreq_dt_pdev = platform_device_register_simple("cpufreq-dt", -1,
|
||||||
NULL, 0);
|
NULL, 0);
|
||||||
if (!IS_ERR(cpufreq_dt_pdev))
|
if (!IS_ERR(cpufreq_dt_pdev)) {
|
||||||
|
platform_set_drvdata(pdev, opp_tables);
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
ret = PTR_ERR(cpufreq_dt_pdev);
|
ret = PTR_ERR(cpufreq_dt_pdev);
|
||||||
dev_err(cpu_dev, "Failed to register platform device\n");
|
dev_err(cpu_dev, "Failed to register platform device\n");
|
||||||
|
@ -163,13 +169,23 @@ static int qcom_cpufreq_kryo_probe(struct platform_device *pdev)
|
||||||
break;
|
break;
|
||||||
dev_pm_opp_put_supported_hw(opp_tables[cpu]);
|
dev_pm_opp_put_supported_hw(opp_tables[cpu]);
|
||||||
}
|
}
|
||||||
|
kfree(opp_tables);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int qcom_cpufreq_kryo_remove(struct platform_device *pdev)
|
static int qcom_cpufreq_kryo_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
|
struct opp_table **opp_tables = platform_get_drvdata(pdev);
|
||||||
|
unsigned int cpu;
|
||||||
|
|
||||||
platform_device_unregister(cpufreq_dt_pdev);
|
platform_device_unregister(cpufreq_dt_pdev);
|
||||||
|
|
||||||
|
for_each_possible_cpu(cpu)
|
||||||
|
dev_pm_opp_put_supported_hw(opp_tables[cpu]);
|
||||||
|
|
||||||
|
kfree(opp_tables);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue