[V11,5/7] soc: qcom: rpmpd: Add support for set performance state

Message ID 5122d00c2f3c0ba076fd7879a4cc397183ccfab2.1507703370.git.viresh.kumar@linaro.org
State New
Headers show
Series
  • PM / Domains: Performance state support
Related show

Commit Message

Viresh Kumar Oct. 11, 2017, 7:24 a.m.
From: Rajendra Nayak <rnayak@codeaurora.org>


NOT FOR MERGE.

With genpd now expecting power domain drivers supporting performance
state to support set performance state callbacks, add support for it in
the rpmpd driver.

Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

---
 drivers/soc/qcom/rpmpd.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

-- 
2.7.4

Patch

diff --git a/drivers/soc/qcom/rpmpd.c b/drivers/soc/qcom/rpmpd.c
index 0958d7693c4f..34d2eb4e75bf 100644
--- a/drivers/soc/qcom/rpmpd.c
+++ b/drivers/soc/qcom/rpmpd.c
@@ -230,6 +230,28 @@  static int rpmpd_power_off(struct generic_pm_domain *domain)
 	return ret;
 }
 
+static int rpmpd_set_performance(struct generic_pm_domain *domain,
+				 unsigned int state)
+{
+	int ret = 0;
+	struct rpmpd *pd = domain_to_rpmpd(domain);
+
+	mutex_lock(&rpmpd_lock);
+
+	pd->corner = state;
+
+	if (!pd->enabled && (pd->key != KEY_FLOOR_CORNER))
+		goto out;
+
+	ret = rpmpd_aggregate_corner(pd);
+
+out:
+	mutex_unlock(&rpmpd_lock);
+
+	return ret;
+}
+
+
 static int rpmpd_probe(struct platform_device *pdev)
 {
 	int i;
@@ -267,6 +289,7 @@  static int rpmpd_probe(struct platform_device *pdev)
 		rpmpds[i]->rpm = rpm;
 		rpmpds[i]->pd.power_off = rpmpd_power_off;
 		rpmpds[i]->pd.power_on = rpmpd_power_on;
+		rpmpds[i]->pd.genpd_set_performance_state = rpmpd_set_performance;
 		pm_genpd_init(&rpmpds[i]->pd, NULL, true);
 
 		data->domains[i] = &rpmpds[i]->pd;