cpufreq_power2state(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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 β€” a thermal_cooling_device pointer. 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 🌈

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