@@ -18,6 +18,7 @@
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/dma-mapping.h>
+#include <linux/pm_domain.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/mfd/syscon.h>
@@ -152,6 +153,8 @@ struct q6v5 {
void *mpss_region;
size_t mpss_size;
+ bool has_perf_state;
+
struct qcom_rproc_subdev smd_subdev;
};
@@ -603,11 +606,12 @@ static int q6v5_start(struct rproc *rproc)
struct q6v5 *qproc = (struct q6v5 *)rproc->priv;
int ret;
- ret = q6v5_regulator_enable(qproc, qproc->proxy_regs,
- qproc->proxy_reg_count);
- if (ret) {
- dev_err(qproc->dev, "failed to enable proxy supplies\n");
- return ret;
+ if (qproc->has_perf_state) {
+ ret = dev_pm_genpd_update_performance_state(qproc->dev, INT_MAX);
+ if (ret) {
+ dev_err(qproc->dev, "Failed to set performance state.\n");
+ return ret;
+ }
}
ret = q6v5_clk_enable(qproc->dev, qproc->proxy_clks,
@@ -671,8 +675,8 @@ static int q6v5_start(struct rproc *rproc)
q6v5_clk_disable(qproc->dev, qproc->proxy_clks,
qproc->proxy_clk_count);
- q6v5_regulator_disable(qproc, qproc->proxy_regs,
- qproc->proxy_reg_count);
+ if (qproc->has_perf_state)
+ dev_pm_genpd_update_performance_state(qproc->dev, 0);
return 0;
@@ -1043,6 +1047,8 @@ static int q6v5_probe(struct platform_device *pdev)
if (ret)
goto free_rproc;
+ qproc->has_perf_state = pm_genpd_has_performance_state(&qproc->dev);
+
return 0;
free_rproc:
@@ -145,6 +145,7 @@ enum msm8996_devices {
UFS,
PCIE,
USB3,
+ Q6V5_PIL,
};
static struct rpmpd_freq_map msm8996_rpmpd_freq_map[] = {
@@ -171,6 +172,10 @@ static struct rpmpd_freq_map msm8996_rpmpd_freq_map[] = {
.freq[LOW] = 120000000,
.freq[NOMINAL] = 150000000,
},
+ [Q6V5_PIL] = {
+ .pd = &msm8996_vddcx,
+ .freq[HIGH] = INT_MAX,
+ },
};
static const struct of_device_id rpmpd_performance_table[] = {
From: Rajendra Nayak <rnayak@codeaurora.org> THIS IS TEST CODE, SHOULDN'T BE MERGED. This patch just demonstrates the usage of pm_genpd_update_performance_state() api in cases where users need to set performance state of a powerdomain without having to do it via the OPP framework. q6v5 remoteproc driver needs to proxy vote for performance states of multiple powerdomains (but we currently only demonstate how it can be done for one powerdomain, as there is no way to associate multiple powerdomains to a device at this time) while it loads the firmware, and then releases the vote, once the firmware is up and can vote for itself. This is not a functional patch since rpmpd driver only supports msm8996 and there is no msm8996 support in the q6v5 remoteproc driver at this point in mainline. This patch is not tested as well. NOT-signed-off-by: Rajendra Nayak <rnayak@codeaurora.org> NOT-signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> --- drivers/remoteproc/qcom_q6v5_pil.c | 20 +++++++++++++------- drivers/soc/qcom/rpmpd.c | 5 +++++ 2 files changed, 18 insertions(+), 7 deletions(-) -- 2.13.0.71.gd7076ec9c9cb