From e9a982e1d9e0bd1ae33cfe11d679475d02656e62 Mon Sep 17 00:00:00 2001 From: Ansuel Smith Date: Sun, 15 Dec 2019 03:01:29 +0100 Subject: [PATCH] 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 [nbg6817/ipq8065] Signed-off-by: Ansuel Smith --- ...e-voltage-tolerance-when-adjusting-t.patch | 33 ++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/target/linux/ipq806x/patches-4.19/0052-PM-OPP-Update-the-voltage-tolerance-when-adjusting-t.patch b/target/linux/ipq806x/patches-4.19/0052-PM-OPP-Update-the-voltage-tolerance-when-adjusting-t.patch index 2882f505d9..f940d8ca62 100644 --- a/target/linux/ipq806x/patches-4.19/0052-PM-OPP-Update-the-voltage-tolerance-when-adjusting-t.patch +++ b/target/linux/ipq806x/patches-4.19/0052-PM-OPP-Update-the-voltage-tolerance-when-adjusting-t.patch @@ -17,22 +17,31 @@ Signed-off-by: Georgi Djakov --- 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); -- 2.30.2