Skip to content

Commit a889331

Browse files
Pi-Cheng Chenrafaeljw
authored andcommitted
cpufreq: mt8173: migrate to use operating-points-v2 bindings
Modify mt8173-cpufreq driver to get OPP-sharing information and set up OPP table provided by operating-points-v2 bindings. Signed-off-by: Pi-Cheng Chen <pi-cheng.chen@linaro.org> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent c6f4811 commit a889331

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

drivers/cpufreq/mt8173-cpufreq.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,15 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu)
390390
/* Both presence and absence of sram regulator are valid cases. */
391391
sram_reg = regulator_get_exclusive(cpu_dev, "sram");
392392

393-
ret = dev_pm_opp_of_add_table(cpu_dev);
393+
/* Get OPP-sharing information from "operating-points-v2" bindings */
394+
ret = dev_pm_opp_of_get_sharing_cpus(cpu_dev, &info->cpus);
395+
if (ret) {
396+
pr_err("failed to get OPP-sharing information for cpu%d\n",
397+
cpu);
398+
goto out_free_resources;
399+
}
400+
401+
ret = dev_pm_opp_of_cpumask_add_table(&info->cpus);
394402
if (ret) {
395403
pr_warn("no OPP table for cpu%d\n", cpu);
396404
goto out_free_resources;
@@ -421,13 +429,10 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu)
421429
*/
422430
info->need_voltage_tracking = !IS_ERR(sram_reg);
423431

424-
/* CPUs in the same cluster share a clock and power domain. */
425-
cpumask_copy(&info->cpus, &cpu_topology[cpu].core_sibling);
426-
427432
return 0;
428433

429434
out_free_opp_table:
430-
dev_pm_opp_of_remove_table(cpu_dev);
435+
dev_pm_opp_of_cpumask_remove_table(&info->cpus);
431436

432437
out_free_resources:
433438
if (!IS_ERR(proc_reg))
@@ -453,7 +458,7 @@ static void mtk_cpu_dvfs_info_release(struct mtk_cpu_dvfs_info *info)
453458
if (!IS_ERR(info->inter_clk))
454459
clk_put(info->inter_clk);
455460

456-
dev_pm_opp_of_remove_table(info->cpu_dev);
461+
dev_pm_opp_of_cpumask_remove_table(&info->cpus);
457462
}
458463

459464
static int mtk_cpufreq_init(struct cpufreq_policy *policy)

0 commit comments

Comments
 (0)