@@ -20,6 +20,113 @@ transition to the selected state.
2020 C-state. This state gets enabled by default in the CPUIdle driver without
2121 requiring any additional DT configuration.
2222
23+ .. rubric :: Standby Mode
24+
25+ On |__PART_FAMILY_DEVICE_NAMES__ | platforms, "Standby" mode is implemented through the Linux CPUIdle
26+ framework. Standby is the default low-power state that the system enters automatically when idle,
27+ using the WFI (Wait For Interrupt) C-state. This power-saving mechanism activates whenever the
28+ system is "just sitting idle" without requiring any special configuration or activation from
29+ the user.
30+
31+ When your device appears inactive, it is actually cycling in and out of this standby state
32+ many times per second, seamlessly managing power while remaining responsive.
33+
34+ .. rubric :: Standby Implementation Architecture
35+
36+ For |__PART_FAMILY_DEVICE_NAMES__ |, the Standby implementation involves a multi-layer architecture:
37+
38+ 1. **Linux CPUIdle Framework **:
39+ - Determines when to place CPUs into idle states based on system activity
40+ - Uses governors (like the menu governor) to predict how long CPUs will be idle
41+ - Invokes platform-specific drivers to transition to appropriate C-states
42+
43+ 2. **ARM Generic CPUIdle Driver **:
44+ - Implements the Linux CPUIdle driver interface for ARM platforms
45+ - Communicates with TF-A through PSCI SMC (Secure Monitor Call) interface
46+
47+ 3. **PSCI Interface in Linux **:
48+ - Provides a standardized method for the kernel to request power management operations
49+ - Translates Linux-side requests into PSCI calls to TF-A
50+
51+ 4. **TF-A PSCI Implementation **:
52+ - Runs in secure world (EL3)
53+ - Implements the PSCI specification
54+ - Provides platform-specific handlers via the ``plat_psci_ops `` structure
55+
56+ When your system goes idle, the following sequence occurs:
57+
58+ - Linux idle loop detects no runnable tasks
59+ - CPUIdle governor selects the appropriate C-state (WFI for these platforms)
60+ - CPUIdle driver communicates with TF-A via the PSCI interface
61+ - TF-A's PSCI implementation validates the requested power state through ``validate_power_state() ``
62+ - TF-A executes the ``cpu_standby() `` handler from ``plat_psci_ops ``
63+ - The actual WFI instruction is executed within the TF-A's standby handler
64+ - On interrupt: CPU automatically exits WFI state
65+ - Control returns to Linux
66+
67+ This automated process happens continuously during system operation, seamlessly
68+ transitioning between active and idle states to save power whenever possible.
69+
70+ .. rubric :: Standby vs. Deep Sleep: Understanding the Difference
71+
72+ It's important to distinguish between the lightweight "standby" provided by CPUIdle and deeper sleep states:
73+
74+ * **CPUIdle Standby (WFI) **:
75+ - Processor-level power saving only
76+ - Very fast entry and exit (microseconds)
77+ - Occurs automatically hundreds of times per second
78+ - No user intervention required
79+ - All peripherals remain operational
80+ - Perfect for normal "idle" periods
81+
82+ * **Deep Sleep Modes **:
83+ - System-wide power saving
84+ - Slower entry and exit (milliseconds to seconds)
85+ - Requires explicit software requests
86+ - May require peripheral reconfiguration
87+ - Suitable for extended inactive periods
88+
89+ .. rubric :: Source Location
90+
91+ **Linux Side **:
92+
93+ - :file: `drivers/cpuidle/cpuidle-arm.c ` - ARM CPU idle driver
94+ - :file: `drivers/cpuidle/dt_idle_states.c ` - Device tree parsing for idle states
95+ - :file: `drivers/cpuidle/cpuidle.c ` - Core CPUIdle framework
96+ - :file: `kernel/sched/idle.c ` - Kernel idle loop implementation
97+ - :file: `drivers/firmware/psci.c ` - PSCI interface to TF-A
98+
99+ **TF-A Side ** (not part of Linux kernel):
100+
101+ - :file: `plat/ti/k3/common/k3_psci.c ` - PSCI implementation for K3 platforms
102+
103+ .. rubric :: Driver Usage
104+
105+ CPUIdle works automatically once enabled in the kernel, with no user intervention required.
106+ The CPUIdle framework statistics can be accessed through the sysfs interface:
107+
108+ .. code-block :: console
109+
110+ # ls -l /sys/devices/system/cpu/cpu0/cpuidle/
111+ drwxr-xr-x 2 root root 0 Jan 1 00:01 state0
112+
113+ # ls -l /sys/devices/system/cpu/cpu0/cpuidle/state0/
114+ -r--r--r-- 1 root root 4096 Jan 1 00:02 desc
115+ -r--r--r-- 1 root root 4096 Jan 1 00:02 latency
116+ -r--r--r-- 1 root root 4096 Jan 1 00:02 name
117+ -r--r--r-- 1 root root 4096 Jan 1 00:02 power
118+ -r--r--r-- 1 root root 4096 Jan 1 00:02 time
119+ -r--r--r-- 1 root root 4096 Jan 1 00:02 usage
120+
121+ To view the current C-state statistics:
122+
123+ .. code-block :: console
124+
125+ # cat /sys/devices/system/cpu/cpu0/cpuidle/state0/name
126+ WFI
127+ # cat /sys/devices/system/cpu/cpu0/cpuidle/state0/usage
128+ 6245738
129+
23130 .. ifconfig :: CONFIG_part_family in ('AM335X_family', 'AM437X_family')
24131
25132 .. rubric :: Driver Features
@@ -77,7 +184,6 @@ transition to the selected state.
77184 -*- Menu governor (for tickless system)
78185 ARM CPU Idle Drivers ----
79186
80-
81187 .. rubric :: DT Configuration
82188
83189 .. code-block :: dts
0 commit comments