PWM(8)
β¨ PWM(8) β the pwm girlies' field guide β¨
okay so real talk: pwm(8) is a System Manager's Manual page and it's genuinely iconic β it's your whole entire guide to poking at PWM (Pulse Width Modulation) hardware from the command line. no cap, this is the good stuff π
π NAME π
pwm β configure PWM (Pulse Width Modulation) hardware. that's it. that's the vibe. literally the entire point of this little guy π¦
πΈ SYNOPSIS πΈ
pwm [-f device] -C
pwm [-f device] [-D | -E] [-I] [-p period] [-d duty]
two whole forms bestie, pick your fighter π«Ά
π DESCRIPTION π
So pwm is the utility you use to configure pwm hardware β¨ and the way it talks to said hardware is through a pwmc(4) device β that's the middleman, the connection, the bridge π₯
okay listen, here's a thing that's lowkey important: some PWM hardware supports multiple output channels within a single controller block. but each pwmc(4) instance controls a single PWM channel. one instance = one channel. no sharing, no drama π
and these pwmc(4) devices are named like this:
/dev/pwm/pwmcX.Y
where X is the controller unit number and Y is the channel number within that unit. so like, X = which controller, Y = which channel on it. super cute, super logical π
The options are as follows:
-f deviceβ the device you wanna operate on π« If you don't specify one,/dev/pwm/pwmc0.0is used (the default, the fallback, the main character). And if you give it an unqualified name,/dev/pwmgets automatically prepended for you β so you don't have to type the whole path, she's got you π«Ά-Cβ show the configuration of the PWM channel. like a vibe check, but for your PWM β¨-Dβ disable the PWM channel π΄ turn it off, she's resting now-d dutyβ configure the duty cycle of the PWM channel. the value can be in nanoseconds or percentage. and for the record: duty is the portion of the period during which the signal is asserted. iykyk π-Eβ enable the PWM channel π₯ wake up bestie, we're going live-p periodβ configure the period (in nanoseconds) of the PWM channel β±οΈ-Iβ Invert PWM signal polarity π flip it, reverse it, make it opposite
π§ EXAMPLES π§
these are the actual real examples, copy them exactly, don't freestyle, i'm begging π
- Show the configuration of the PWM channel:
pwm -f /dev/pwm/pwmc0.1 -C
- Configure a
50000ns period and a25000ns duty cycle and enable the channel:
pwm -f pwmc1.1 -E -p 50000 -d 25000
- Configure a
50%duty cycle on the device and channel which were configured inpwmc(4)to have the labelbacklight:
pwm -f backlight -d 50%
like?? the label thing?? obsessed. no full paths needed, just vibe with the label π
π SEE ALSO π
pwm(9), pwmbus(9) β go read these next, they're the supporting cast and they ate π
β HISTORY β
The pwm utility appeared in FreeBSD 13.0. a classic, a legend, an era π
π AUTHORS π
The pwm utility and this manual page were written by Emmanuel Vadot <manu@FreeBSD.org> β ty for your service king π«Ά
aaaand that's the whole page bestie, you're officially pwm-pilled π
okay so the very last bits, the sign-off tea: this one comes from Debian, dated June 17, 2019, and it's the PWM(8) page of the System Manager's Manual. mwah, go configure something πβ¨π¦
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2018 Emmanuel Vadot <manu@freebsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms