ipq806x: opp/core: update patch updating voltage tolerance on voltage adjust

Rework 0052-PM-OPP-Update-the-voltage-tolerance-when-adjusting-t
to reflect changes upstream.

- Skip unnecessary allocation of buffer to set u_volt
- Change opp u_volt directly

Tested-by: Stefan Lippers-Hollmann <s.l-h@gmx.de> [nbg6817/ipq8065]
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
master
Ansuel Smith 4 years ago committed by Petr Štetiar
parent 456ab9a912
commit e9a982e1d9

@ -17,22 +17,31 @@ Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -1669,6 +1669,7 @@ int dev_pm_opp_adjust_voltage(struct dev
@@ -1663,6 +1663,7 @@
struct opp_table *opp_table;
struct dev_pm_opp *new_opp, *tmp_opp, *opp = ERR_PTR(-ENODEV);
struct dev_pm_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);
@@ -1705,6 +1706,10 @@ int dev_pm_opp_adjust_voltage(struct dev
/* Find the opp_table */
opp_table = _find_opp_table(dev);
@@ -1692,8 +1693,17 @@
goto adjust_unlock;
/* plug in new node */
new_opp->supplies[0].u_volt = u_volt;
opp->supplies->u_volt = u_volt;
- opp->supplies->u_volt_min = u_volt_min;
- opp->supplies->u_volt_max = u_volt_max;
+
+ tol = u_volt * opp_table->voltage_tolerance_v1 / 100;
+ new_opp->supplies[0].u_volt = u_volt;
+ new_opp->supplies[0].u_volt_min = u_volt - tol;
+ new_opp->supplies[0].u_volt_max = u_volt + tol;
+ if ( u_volt_min == u_volt )
+ opp->supplies->u_volt_min = u_volt - tol;
+ else
+ opp->supplies->u_volt_min = u_volt_min;
+
+ if ( u_volt_max == u_volt )
+ opp->supplies->u_volt_max = u_volt + tol;
+ else
+ opp->supplies->u_volt_max = u_volt_max;
list_replace(&opp->node, &new_opp->node);
mutex_unlock(&opp_table_lock);
dev_pm_opp_get(opp);
mutex_unlock(&opp_table->lock);

Loading…
Cancel
Save