amdgpu_device_set_cg_state(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… amdgpu_device_set_cg_state(9) β€” from the Kernel API Manual, bestie

okay so bestie, we're diving into the kernel API manual today and this one is called amdgpu_device_set_cg_state(9) and it is literally the remote control for your GPU's clockgating ✨ pull up a chair πŸŽ€


✨ NAME ✨

amdgpu_device_set_cg_state β€” set clockgating for amdgpu device πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

int amdgpu_device_set_cg_state (struct amdgpu_device *adev , enum
amd_clockgating_state state );

that's the whole vibe, no cap πŸ’…


🌸 ARGUMENTS 🌸

  • adev β€” an amdgpu_device pointer, aka your little handle on the GPU itself 🫢
  • state β€” the clockgating state, and it's either gate or ungate (yes those are the actual words, that's the whole enum energy) πŸ’€

πŸ”₯ DESCRIPTION πŸ”₯

okay so here's what happens, fr fr: the list of all the hardware IPs that make up the asic gets walked, and the set_clockgating_state callbacks are run for each one. every single IP. no skipping. main character energy for the entire list πŸ‘‘

so like, the late initialization pass? that's where you're enabling clockgating for the hardware IPs. and the fini or suspend pass? that's where you're disabling clockgating for the hardware IPs. same function, opposite directions, iconic πŸŽ€

and it returns 0 on success, or a negative error code on failure β€” so if you see a negative number, that's the function telling you something went wrong 😭

ngl, negative error codes are the blueprint, so always check the return value before you go acting like everything's slay πŸ’…

🧚 SEE ALSO 🧚

the kernel file lives right here, bestie:

./drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

and now the friend group, hold on, this is a long one, take a sip of water πŸ“

like I said. whole friend group. ate πŸ’…


and that's the page, bestie 🫢 it lives in ./drivers/gpu/drm/amd/amdgpu, this is the Kernel API Manual, dated October 2026 β€” go forth and gate those clocks responsibly πŸ‘‘βœ¨

πŸ“¦ where this page comes from