devm_pwm_get(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– devm_pwm_get β€” the resource-managed glow-up of pwm_get() πŸ’–

okay so bestie, welcome to the devm_pwm_get(9) page from the Kernel API Manual (yes that's the manual name, we're being fancy today πŸ‘‘). This is the PWM consumer girlie you call when you want a PWM device and you want it handled for you. Let's get into it ✨


🌸 SYNOPSIS 🌸

struct pwm_device * devm_pwm_get (struct device *dev , const char *con_id );

like, that's the whole vibe. returns a struct pwm_device *, takes two args, slays πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

okay so the two things you gotta hand her:

  • dev β€” the device for the PWM consumer. like, who's asking. it's giving "hi yes I would like a PWM please, it's for me" 🫢
  • con_id β€” the consumer name. the little label so the kernel knows which consumer you are, iykyk πŸ’œ

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea: this function performs like pwm_get β€” same energy, same job β€” but the acquired PWM device will automatically be released on driver detach. no cap. πŸ”₯

basically it's pwm_get but with resource management built in, so you're not out here manually cleaning up like some kind of Victorian orphan. the kernel handles the breakup for you when the driver detaches. main character behavior, honestly πŸ’€βœ¨


⭐ RETURN ⭐

you get one of two things:

  • a pointer to the requested PWM device πŸ’– (slay)
  • an ERR_PTR-encoded error code on failure 😭 (not slay, pls vibe check your args)

that's it that's the return. no in-between, no "maybe", periodt.


🌈 SEE ALSO 🌈

the whole crew, in the kernel file ./drivers/pwm/core.c:

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_capture(9), pwm_request_from_chip(9), of_pwm_get(9), acpi_pwm_get(9), pwm_get(9), pwm_put(9), devm_fwnode_pwm_get(9), __pwmchip_add(9), pwmchip_remove(9), pwm_add_table(9), pwm_remove_table(9)

like a whole friend group honestly, go say hi πŸ§šβ€β™€οΈ


reminder bestie: this page lives under ./drivers/pwm, and it's dated October 2026, and the whole thing is literally titled devm_pwm_get(9). don't lose the receipts πŸ’…

okay that's the page!! go forth and get your PWM devices, resource-managed and immaculate. mwah πŸ’‹πŸŽ€πŸ“

πŸ“¦ where this page comes from