devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pi-Cheng Chen <pi-cheng.chen@linaro.org>
To: Viresh Kumar <viresh.kumar@linaro.org>,
	Matthias Brugger <matthias.bgg@gmail.com>
Cc: Michael Turquette <mturquette@baylibre.com>,
	Daniel Kurtz <djkurtz@chromium.org>,
	linux-mediatek@lists.infradead.org,
	linaro-kernel@lists.linaro.org,
	linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: [PATCH v2 2/3] cpufreq: mt8173: migrate to use operating-points-v2 bindings
Date: Sun, 27 Dec 2015 14:21:57 +0800	[thread overview]
Message-ID: <1451197318-12418-3-git-send-email-pi-cheng.chen@linaro.org> (raw)
In-Reply-To: <1451197318-12418-1-git-send-email-pi-cheng.chen@linaro.org>

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>
---
 drivers/cpufreq/mt8173-cpufreq.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/cpufreq/mt8173-cpufreq.c b/drivers/cpufreq/mt8173-cpufreq.c
index fd601b9..1efba34 100644
--- a/drivers/cpufreq/mt8173-cpufreq.c
+++ b/drivers/cpufreq/mt8173-cpufreq.c
@@ -390,7 +390,15 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu)
 	/* Both presence and absence of sram regulator are valid cases. */
 	sram_reg = regulator_get_exclusive(cpu_dev, "sram");
 
-	ret = dev_pm_opp_of_add_table(cpu_dev);
+	/* Get OPP-sharing information from "operating-points-v2" bindings */
+	ret = dev_pm_opp_of_get_sharing_cpus(cpu_dev, &info->cpus);
+	if (ret) {
+		pr_err("failed to get OPP-sharing information for cpu%d\n",
+		       cpu);
+		goto out_free_resources;
+	}
+
+	ret = dev_pm_opp_of_cpumask_add_table(&info->cpus);
 	if (ret) {
 		pr_warn("no OPP table for cpu%d\n", cpu);
 		goto out_free_resources;
@@ -421,13 +429,10 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu)
 	 */
 	info->need_voltage_tracking = !IS_ERR(sram_reg);
 
-	/* CPUs in the same cluster share a clock and power domain. */
-	cpumask_copy(&info->cpus, &cpu_topology[cpu].core_sibling);
-
 	return 0;
 
 out_free_opp_table:
-	dev_pm_opp_of_remove_table(cpu_dev);
+	dev_pm_opp_of_cpumask_remove_table(&info->cpus);
 
 out_free_resources:
 	if (!IS_ERR(proc_reg))
@@ -453,7 +458,7 @@ static void mtk_cpu_dvfs_info_release(struct mtk_cpu_dvfs_info *info)
 	if (!IS_ERR(info->inter_clk))
 		clk_put(info->inter_clk);
 
-	dev_pm_opp_of_remove_table(info->cpu_dev);
+	dev_pm_opp_of_cpumask_remove_table(&info->cpus);
 }
 
 static int mtk_cpufreq_init(struct cpufreq_policy *policy)
-- 
1.9.1


  parent reply	other threads:[~2015-12-27  6:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-27  6:21 [PATCH v2 0/3] ARM64: dts: cpufreq: mt8173: Migrate mt8173-cpufreq to use OPPv2 bindings Pi-Cheng Chen
2015-12-27  6:21 ` [PATCH v2 1/3] PM/OPP: Don't skip cpu_dev->id when setting up cpumask Pi-Cheng Chen
2015-12-28  3:11   ` Viresh Kumar
2015-12-28 13:06     ` [PATCH v2] PM/OPP: Set cpu_dev->id in cpumask first Pi-Cheng Chen
2015-12-29  3:50       ` Viresh Kumar
2016-01-03  1:01         ` Rafael J. Wysocki
2015-12-27  6:21 ` Pi-Cheng Chen [this message]
2015-12-28  3:12   ` [PATCH v2 2/3] cpufreq: mt8173: migrate to use operating-points-v2 bindings Viresh Kumar
2015-12-27  6:21 ` [PATCH v2 3/3] ARM64: dts: mt8173: Add CPU OPP, clock and regulator supply properties Pi-Cheng Chen
2015-12-28  3:13   ` Viresh Kumar
2016-01-05 10:21     ` Arnd Bergmann
2016-01-05 10:24       ` Viresh Kumar
2016-02-02 11:06         ` Matthias Brugger
2016-02-02 14:09           ` Matthias Brugger
     [not found]             ` <56B0B894.9040706-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-02-03  1:46               ` Pi-Cheng Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1451197318-12418-3-git-send-email-pi-cheng.chen@linaro.org \
    --to=pi-cheng.chen@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=djkurtz@chromium.org \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mturquette@baylibre.com \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).