__pwmchip_add(9)
π __pwmchip_add β like, the Kernel API Manual page, bestie π
okay so this is a kernel API manual page (man section 9, for the people taking notes π) and it's all about __pwmchip_add β the lowkey-but-iconic function that registers a brand new PWM chip. yes, the double-underscore one. she's the β¨realβ¨ one, and we're about to talk about why you probably shouldn't call her directly. π
β¨ NAME β¨
__pwmchip_add β register a new PWM chip πΈ
like. that's it. that's her whole job. and she ate. π
π SYNOPSIS π
int __pwmchip_add (struct pwm_chip *chip , struct module *owner );
that's the whole call signature, no cap β an int coming back at ya, two arguments going in. π«Ά
π§ ARGUMENTS π§
chipβ the PWM chip you wanna add. this is the main character of the whole operation, the thing being registered. π₯ownerβ a reference to the module that's providing the chip. ngl this one has rules (see below, bestie, I'm not gonna let you fumble this π).
π DESCRIPTION π
so here's the vibe: __pwmchip_add registers a new PWM chip. that's the whole thing. iconic, straightforward, we love a function with a clear purpose.
but listen β owner is supposed to be THIS_MODULE, and the page is extremely clear that you should use the pwmchip_add wrapper to do this right. like, the wrapper exists specifically so you don't have to think about it. use the wrapper. let the wrapper handle it. the wrapper is your bestie here. π«Ά
fr fr, this is the kind of detail that bites you later if you skip it β the manpage straight up tells you to go throughpwmchip_add, so go throughpwmchip_add. π
β RETURN β
0on success π (slay, the chip is registered)- a negative error code on failure π (something went wrong, check the code)
π SEE ALSO π
the whole friend group showed up for this one, and I'm listing every single one because they all deserve their moment:
- Kernel file
./drivers/pwm/core.cβ the source, iykyk π 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_pwm_get(9)devm_fwnode_pwm_get(9)pwmchip_remove(9)β the breakup counterpart πpwm_add_table(9)pwm_remove_table(9)
and that's the page, bestie!! π¦ oh and before I forget β this one's filed under ./drivers/pwm and dated October 2026, so jot that down, and yes the page title is literally __pwmchip_add(9) again at the bottom. full circle. 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