pwm_capture(9)
π pwm_capture(9) β a Kernel API Manual moment π
okay so bestie, welcome to pwm_capture(9), aka the kernel API manual page that's literally about capturing a PWM signal and reporting back what it found π like, it goes and looks at the signal for you and comes back with the tea.
β¨ NAME β¨
pwm_capture β capture and report a PWM signal π
πΈ SYNOPSIS πΈ
int pwm_capture (struct pwm_device *pwm , struct pwm_capture *result ,
unsigned long timeout );
that's the whole vibe, no cap π«Ά
π¦ ARGUMENTS π¦
pwmβ the PWM device, the main character of this whole operation πresultβ the structure you fill with the capture result, like a little tupperware container for signal data πtimeoutβ how long to wait, in milliseconds, before giving up on the capture π like a situationship with a deadline
β RETURN β
0 on success, or a negative error code on failure π so basically: zero = slay, negative = not slay.
π SEE ALSO π
Kernel file ./drivers/pwm/core.c β that's where the magic lives, iykyk β¨
and then the whole friend group, fr fr:
pwm_round_waveform_might_sleep(9)pwm_get_waveform_might_sleep(9)pwm_set_waveform_might_sleep(9)pwm_apply_might_sleep(9)pwm_apply_atomic(9)pwm_get_state_hw(9)pwm_adjust_config(9)pwm_request_from_chip(9)of_pwm_get(9)acpi_pwm_get(9)pwm_get(9)pwm_put(9)devm_pwm_get(9)devm_fwnode_pwm_get(9)__pwmchip_add(9)pwmchip_remove(9)pwm_add_table(9)pwm_remove_table(9)
go read them all, they ate π₯
lowkey reminder: the capture can time out on you, and when it does you get that negative error code β no signal, no problem, just handle it bestie π
and that's the page!! π it lives under ./drivers/pwm, dated October 2026, and yes it's still called pwm_capture(9) β periodt. bye bestie, go capture some waveforms π§ββοΈβ¨
π¦ 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