1# Copyright (c) 2025 Analog Devices, Inc.
2#
3# SPDX-License-Identifier: Apache-2.0
4
5config HAS_CPU_FREQ
6	bool
7	help
8	  Enabled by the SoC if it has a DTS property indicating support for
9	  CPU frequency scaling.
10
11menuconfig CPU_FREQ
12	bool "CPU Frequency Scaling Subsystem"
13	select EXPERIMENTAL
14	help
15	  CPU Frequency scaling subsystem
16
17if CPU_FREQ
18
19module = CPU_FREQ
20module-str = CPU Frequency Scaling
21source "subsys/logging/Kconfig.template.log_config"
22
23config CPU_FREQ_INTERVAL_MS
24	int "CPU Freq evaluation interval"
25	default 1000
26	help
27	  Controls the interval (in milliseconds) at which the CPU Frequency
28	  subsystem runs and evaluates the current policy.
29
30config CPU_FREQ_PER_CPU_SCALING
31	bool "Per-CPU frequency scaling"
32	default n
33	depends on SMP
34	help
35	  Enable per-CPU frequency scaling support. If disabled, setting the
36	  P-state will apply to the whole system instead of just the current CPU.
37	  This should be done at the SoC level.
38
39choice CPU_FREQ_POLICY
40	prompt "CPU Frequency Scaling Policy"
41	default CPU_FREQ_POLICY_NONE
42	help
43	  The policy algorithm to use when using the CPU freq subsystem.
44
45config CPU_FREQ_POLICY_NONE
46	bool "No selected policy"
47	help
48	  Kconfig placeholder if no policy is chosen. This Kconfig will produce a build error
49
50config CPU_FREQ_POLICY_ON_DEMAND
51	bool "On-demand Policy"
52	select CPU_LOAD_METRIC
53
54endchoice # CPU_FREQ_POLICY
55
56choice CPU_FREQ_PSTATE_SET
57	prompt "Select method of setting CPU P-state"
58	default CPU_FREQ_PSTATE_SET_SOC if HAS_CPU_FREQ
59	default CPU_FREQ_PSTATE_SET_STUB
60	help
61	  The implementation used to set the CPU P-state.
62
63config CPU_FREQ_PSTATE_SET_STUB
64	bool "Stub P-state setter"
65	help
66	  A stub implementation that does nothing. This is useful for
67	  exercising the CPU frequency subsystem without actually
68	  changing the CPU frequency.
69
70config CPU_FREQ_PSTATE_SET_SOC
71	bool "SoC-specific P-state setter"
72	depends on HAS_CPU_FREQ
73	help
74	  A SoC-specific implementation that sets the CPU P-state using
75	  SoC-specific mechanisms. This requires the SoC to provide
76	  the necessary implementation of cpu_freq_pstate_set().
77
78config CPU_FREQ_PSTATE_SET_CUSTOM
79	bool "Custom P-state setter defined by the project"
80	help
81	  A custom implementation that sets the CPU P-state using
82	  project-specific mechanisms. This requires the project to provide
83	  the necessary implementation of cpu_freq_pstate_set().
84
85endchoice # CPU_FREQ_PSTATE_SET
86
87endif # CPU_FREQ
88