[PATCH] cpufreq: Add CPU frequency policy change notification support

From: Tony W Wang-oc

Date: Tue Jan 20 2026 - 04:26:29 EST


Implemented CPUFREQ_CHANGE_POLICY notification in cpufreq subsystem.
This enhancement allows kernel modules to be notified when a CPU frequency
policy is modified, facilitating more integrated system management.
The notification is dispatched after a successful governor switch during
policy updates.

Signed-off-by: Tony W Wang-oc <TonyWWang-oc@xxxxxxxxxxx>
---
drivers/cpufreq/cpufreq.c | 2 ++
include/linux/cpufreq.h | 1 +
2 files changed, 3 insertions(+)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index a7a69f4d7675..b35fed93bca4 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2707,6 +2707,8 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
ret = cpufreq_start_governor(policy);
if (!ret) {
pr_debug("governor change\n");
+ blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
+ CPUFREQ_CHANGE_POLICY, policy);
return 0;
}
cpufreq_exit_governor(policy);
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index cc894fc38971..b1cc9138e801 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -528,6 +528,7 @@ static inline void cpufreq_resume(void) {}
/* Policy Notifiers */
#define CPUFREQ_CREATE_POLICY (0)
#define CPUFREQ_REMOVE_POLICY (1)
+#define CPUFREQ_CHANGE_POLICY (2)

#ifdef CONFIG_CPU_FREQ
int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list);
--
2.25.1