aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgi Djakov <georgi.djakov@linaro.org>2016-08-25 18:43:35 +0300
committerGeorgi Djakov <georgi.djakov@linaro.org>2016-10-20 13:04:33 +0300
commit399e2e50a4798489aa10525c5bfb7330bc37a755 (patch)
tree7bc9fdb23425a877775dc72abcec088ee2cead54
parent01ca2bf9bb95025417df3904741aca62f1008936 (diff)
PM / OPP: Update the voltage tolerance when adjusting the OPPtracking-qcomlt-cpufreq-8016-8064
When the voltage is adjusted, the voltage tolerance is not updated. This can lead to situations where the voltage min value is greater than the voltage max value. The final result is triggering a BUG() in the regulator core. Fix this by updating the voltage tolerance values too. Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
-rw-r--r--drivers/base/power/opp/core.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c
index 74e5e5e5fa133..48ac92a1af44e 100644
--- a/drivers/base/power/opp/core.c
+++ b/drivers/base/power/opp/core.c
@@ -1566,6 +1566,7 @@ int dev_pm_opp_adjust_voltage(struct device *dev, unsigned long freq,
struct opp_table *opp_table;
struct dev_pm_opp *new_opp, *tmp_opp, *opp = ERR_PTR(-ENODEV);
int r = 0;
+ unsigned long tol;
/* keep the node allocated */
new_opp = kmalloc(sizeof(*new_opp), GFP_KERNEL);
@@ -1602,6 +1603,10 @@ int dev_pm_opp_adjust_voltage(struct device *dev, unsigned long freq,
/* plug in new node */
new_opp->u_volt = u_volt;
+ tol = u_volt * opp_table->voltage_tolerance_v1 / 100;
+ new_opp->u_volt = u_volt;
+ new_opp->u_volt_min = u_volt - tol;
+ new_opp->u_volt_max = u_volt + tol;
list_replace_rcu(&opp->node, &new_opp->node);
mutex_unlock(&opp_table_lock);