STRUCT PWM_DEVICE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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 (for PWM_DEBUG). the "what really happened" copy, kept around specifically for debugging. πŸ”
lowkey important: last is tagged for PWM_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 🫢


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