This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 3839a11f2b89180e65c2c81c60a48a35558892c0
Author: guanyi3 <[email protected]>
AuthorDate: Sat Aug 8 11:37:55 2026 +0800

    drivers/devfreq: add ondemand governor build support
    
    Add Kconfig, Make.defs, and CMakeLists.txt entries for the ondemand 
governor so it can be enabled via CONFIG_DEVFREQ_GOV_ONDEMAND.
    
    Signed-off-by: guanyi3 <[email protected]>
---
 drivers/devfreq/CMakeLists.txt |  4 ++++
 drivers/devfreq/Kconfig        | 23 +++++++++++++++++++++++
 drivers/devfreq/Make.defs      |  6 ++++++
 3 files changed, 33 insertions(+)

diff --git a/drivers/devfreq/CMakeLists.txt b/drivers/devfreq/CMakeLists.txt
index 9fb34381e49..8ae171fb02c 100644
--- a/drivers/devfreq/CMakeLists.txt
+++ b/drivers/devfreq/CMakeLists.txt
@@ -25,5 +25,9 @@ if(CONFIG_DEVFREQ)
     list(APPEND SRCS devfreq_procfs.c)
   endif()
 
+  if(CONFIG_DEVFREQ_GOV_ONDEMAND)
+    list(APPEND SRCS devfreq_ondemand.c)
+  endif()
+
   target_sources(drivers PRIVATE ${SRCS})
 endif()
diff --git a/drivers/devfreq/Kconfig b/drivers/devfreq/Kconfig
index 509d6238d2d..b503100adf7 100644
--- a/drivers/devfreq/Kconfig
+++ b/drivers/devfreq/Kconfig
@@ -27,4 +27,27 @@ config DEVFREQ_PROCFS_QOS
        ---help---
                devfreq procfs show qos requests and their callers
 
+config DEVFREQ_GOV_ONDEMAND
+       bool "devfreq_gov_ondemand"
+       default n
+       depends on !SCHED_CPULOAD_NONE
+       ---help---
+               devfreq_ondemand governor
+
+if DEVFREQ_GOV_ONDEMAND
+
+config DEVFREQ_SAMPLE_RATE
+       int "the default sample rate (us) to get the cpuload"
+       default 1000000
+       ---help---
+               Ondemand sample rate
+
+config DEVFREQ_LOAD_THRESHOLD
+       int "the default cpu load threshold up to max cpu freq"
+       default 80
+       ---help---
+               Ondemand cpu load threshold
+
+endif
+
 endif
diff --git a/drivers/devfreq/Make.defs b/drivers/devfreq/Make.defs
index 59baad2d023..dc63153b77c 100644
--- a/drivers/devfreq/Make.defs
+++ b/drivers/devfreq/Make.defs
@@ -30,6 +30,12 @@ CSRCS += devfreq_procfs.c
 
 endif
 
+ifeq ($(CONFIG_DEVFREQ_GOV_ONDEMAND),y)
+
+CSRCS += devfreq_ondemand.c
+
+endif
+
 DEPPATH += --dep-path devfreq
 VPATH += devfreq
 

Reply via email to