pwm_get_state(9)
π pwm_get_state(9) β like, the Kernel API Manual, bestie β¨
okay so real talk: this is pwm_get_state(9) from the Kernel API Manual, and it's genuinely one of the chillest little functions in the whole PWM universe. no cap. it just... tells you what the state is. that's it. that's the vibe. π
β¨ NAME β¨
pwm_get_state β retrieve the current PWM state π¦
like, it gets the state. the current one. the PWM one. iykyk π
πΈ SYNOPSIS πΈ
void pwm_get_state (const struct pwm_device *pwm , struct pwm_state
*state );
not me writing this out exactly as-is because every character matters, periodt π
π«Ά ARGUMENTS π«Ά
pwmβ the PWM device, bestie. this is the one you're asking about πstateβ the state you're gonna fill with the current PWM state. it's giving "empty cup, please pour the truth into it" π
π₯ DESCRIPTION π₯
okay so here's the tea β β the PWM state that gets returned represents the state that was applied by a previous call to pwm_apply_might_sleep. that's the whole point. that's the lore.
and lowkey, drivers may have to slightly tweak that state before programming it to hardware. like, a little glow-up before it hits the metal. just a smidge. don't @ me π
now, the important bit β if pwm_apply_might_sleep was never called, then this returns either:
- the current hardware state (if supported), or
- the default settings π
so either way you're getting something, it's just a question of which something. main character energy from a function that literally always has an answer β¨
π SEE ALSO π
Kernel file ./include/linux/pwm.h β and honestly the whole extended friend group:
enum pwm_polarity(9)struct pwm_args(9)struct pwm_waveform(9)struct pwm_device(9)pwm_init_state(9)pwm_get_relative_duty_cycle(9)pwm_set_relative_duty_cycle(9)struct pwm_capture(9)struct pwm_ops(9)struct pwm_chip(9)pwmchip_supports_waveform(9)pwm_config(9)pwm_enable(9)pwm_disable(9)pwm_might_sleep(9)
all of them. every single one. i would never do my girls dirty by leaving one out π π
ngl this whole page lives rent-free in ./include/linux, and it's dated October 2026 πΈ so yeah, go off, future-era manpage. mwah π
that's the whole thing bestie β go fill that state and slay π§ββοΈβ
π¦ 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