[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220507150145.531864-6-cw00.choi@samsung.com>
Date: Sun, 8 May 2022 00:01:45 +0900
From: Chanwoo Choi <cwchoi00@...il.com>
To: linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: cw00.choi@...sung.com, myungjoo.ham@...sung.com,
kyungmin.park@...sung.com, johnson.wang@...iatek.com,
mka@...omium.org, jia-wei.chang@...iatek.com,
andrew-sh.cheng@...iatek.com, hsinyi@...omium.org,
sibis@...eaurora.org, saravanak@...gle.com
Subject: [PATCH v2 5/5] PM / devfreq: passive: Update frequency when start governor
If the parent device changes the their frequency before registering
the passive device, the passive device cannot receive the notification
from parent device and then the passive device cannot be able to
set the proper frequency according to the frequency of parent device.
So, when start the passive governor, update the frequency
according to the frequency of parent device.
Signed-off-by: Chanwoo Choi <cw00.choi@...sung.com>
---
drivers/devfreq/governor_passive.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/devfreq/governor_passive.c b/drivers/devfreq/governor_passive.c
index b34dbe750c0a..74d26c193fdb 100644
--- a/drivers/devfreq/governor_passive.c
+++ b/drivers/devfreq/governor_passive.c
@@ -412,6 +412,23 @@ static int devfreq_passive_event_handler(struct devfreq *devfreq,
if (!p_data->this)
p_data->this = devfreq;
+ /*
+ * If the parent device changes the their frequency before
+ * registering the passive device, the passive device cannot
+ * receive the notification from parent device and then the
+ * passive device cannot be able to set the proper frequency
+ * according to the frequency of parent device.
+ *
+ * When start the passive governor, update the frequency
+ * according to the frequency of parent device.
+ */
+ mutex_lock(&devfreq->lock);
+ ret = devfreq_update_target(devfreq, parent->previous_freq);
+ if (ret < 0)
+ dev_warn(&devfreq->dev,
+ "failed to update devfreq using passive governor\n");
+ mutex_unlock(&devfreq->lock);
+
if (p_data->parent_type == DEVFREQ_PARENT_DEV)
ret = devfreq_passive_register_notifier(devfreq);
else if (p_data->parent_type == CPUFREQ_PARENT_DEV)
--
2.25.1
Powered by blists - more mailing lists