STRUCT PWM_DEVICE(9)
π struct pwm_device(9) π
okay bestie, welcome to the Kernel API Manual β¨ β this one's about struct pwm_device, and it's literally the glow-up era of PWM channel objects. it's giving "one struct to rule your PWM channel." π
πΈ NAME πΈ
struct pwm_device β the PWM channel object. that's it, that's the whole vibe. π
β¨ SYNOPSIS β¨
okay so here's the whole glow-up, copy-pasted exactly because we do not mess with the source of truth:
struct pwm_device {
const char *label;
unsigned long flags;
unsigned int hwpwm;
struct pwm_chip *chip;
struct pwm_args args;
struct pwm_state state;
struct pwm_state last;
};
it's cute, it's compact, it's six-ish fields of pure main-character energy π¦
π«Ά Members π«Ά
let's do a lil member-by-member vibe check, iykyk:
labelβ the name of the PWM device. its government name, basically. πflagsβ the flags associated with the PWM device. lil stickers on its locker. πhwpwmβ the per-chip relative index of the PWM device. so like, its seat number within its chip. not global, bestie, relative. πͺchipβ the PWM chip providing this PWM device. its parent, its home base, its ride-or-die. πargsβ the PWM arguments. the receipts. π§Ύstateβ the last applied state. what actually got shipped. πlastβ the last implemented state (forPWM_DEBUG). the "what really happened" copy, kept around specifically for debugging. π
lowkey important:lastis tagged forPWM_DEBUGβ so it's the debug-time reference copy of the last implemented state, no cap. don't act surprised when you see it hanging around in debug builds. π
π SEE ALSO π
now go be nosy, bestie β the whole friend group is tagged below π«Ά
- Kernel file
./include/linux/pwm.h enum pwm_polarity(9)struct pwm_args(9)struct pwm_waveform(9)pwm_get_state(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)
and that's the page, bestie! π
sign-off szn π β this lore came straight out of ./include/linux and it's dated October 2026, so go forth and PWM responsibly, icon. periodt. β¨π
π¦
π¦ 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