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

From: Viresh Kumar
Date: Wed Oct 11 2017 - 03:25:52 EST


From: Rajendra Nayak <rnayak@xxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxx>
Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
---
drivers/soc/qcom/rpmpd.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)

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;
--
2.7.4