[PATCH] PM / devfreq: passive: Update frequency when start governor
From: Chanwoo Choi
Date: Tue Nov 03 2020 - 01:53:12 EST
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@xxxxxxxxxxx>
---
drivers/devfreq/governor_passive.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/devfreq/governor_passive.c b/drivers/devfreq/governor_passive.c
index 63332e4a65ae..375aa636027c 100644
--- a/drivers/devfreq/governor_passive.c
+++ b/drivers/devfreq/governor_passive.c
@@ -141,6 +141,21 @@ 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.
+ */
+ ret = devfreq_update_target(devfreq, parent->previous_freq);
+ if (ret < 0)
+ dev_warn(&devfreq->dev,
+ "failed to update devfreq using passive governor\n");
+
nb->notifier_call = devfreq_passive_notifier_call;
ret = devfreq_register_notifier(parent, nb,
DEVFREQ_TRANSITION_NOTIFIER);
--
2.17.1