cpufreq_power2state(9)
β¨ cpufreq_power2state β¨
okay so this is a kernel API page, from the Kernel API Manual, and bestieβ¦ it's literally the glow-up translator that turns power into a cooling device state. that's the whole vibe. π
πΈ NAME πΈ
cpufreq_power2state β convert power to a cooling device state
like, power goes in, state comes out. she's a converter. an icon. π
π¦ SYNOPSIS π¦
int cpufreq_power2state (struct thermal_cooling_device *cdev , u32 power
, unsigned long *state );
π ARGUMENTS π
cdevβ athermal_cooling_devicepointer. yes. that one. the pointer to the cooling device, no cap.powerβ the power, in milliwatts, that you want converted. units matter bestie, don't come at me with watts. π«Άstateβ a pointer where the resulting state gets stored. she's an output param, she doesn't come with a value, you gotta give her a home first.
π₯ DESCRIPTION π₯
so what she does is: she calculates a cooling device state for the cpus described by cdev that would let them consume at most power mW, and then she stores that in state. slay. π
but here's the tea β β this calculation depends on external factors, like the CPUs' load. so if you call this function with the exact same power as input, you can literally get different cooling device states back depending on those external factors. it's giving "she's not inconsistent, she's contextual." π main character energy honestly.
β RETURN β
0 on success. and that's it β this function doesn't fail. zero drama, zero error paths, she just vibes and returns 0. periodt. π
π SEE ALSO π
- Kernel file
./drivers/thermal/cpufreq_cooling.c struct time_in_idle(9)struct cpufreq_cooling_device(9)get_level(9)get_load(9)get_dynamic_power(9)cpufreq_get_requested_power(9)cpufreq_state2power(9)cpufreq_get_max_state(9)cpufreq_get_cur_state(9)cpufreq_set_cur_state(9)__cpufreq_cooling_register(9)cpufreq_cooling_register(9)of_cpufreq_cooling_register(9)cpufreq_cooling_unregister(9)
ngl that's a whole friend group of functions and this one is definitely in the group chat π«Ά go read them too, iykyk.
and that's the page!! this one lives in ./drivers/thermal and it's dated October 2026 β so yeah, she's from the future and still serving. πβ¨ bye bestie, go cool some cpus π§ββοΈπ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms