PWMBUS(9)
π PWMBUS π
okay bestie, welcome to pwmbus β that's the PWMBUS methods page from the Kernel Developer's Manual, and yes she's a whole vibe π
β¨ NAME β¨
pwmbus, PWMBUS_CHANNEL_CONFIG, PWMBUS_CHANNEL_COUNT, PWMBUS_CHANNEL_ENABLE, PWMBUS_CHANNEL_GET_CONFIG, PWMBUS_CHANNEL_GET_FLAGS, PWMBUS_CHANNEL_IS_ENABLED, PWMBUS_CHANNEL_SET_FLAGS, PWMBUS_GET_BUS β PWMBUS methods π¦
π SYNOPSIS π
device pwm
#include <pwmbus_if.h>
int
PWMBUS_CHANNEL_CONFIG(device_t bus, int channel, uint64_t period,
uint64_t duty);
int
PWMBUS_CHANNEL_COUNT(device_t bus, int channel, int *nchannel);
int
PWMBUS_CHANNEL_ENABLE(device_t bus, int channel, bool enable);
int
PWMBUS_CHANNEL_GET_CONFIG(device_t bus, int channel, uint64_t *period,
uint64_t *duty);
int
PWMBUS_CHANNEL_GET_FLAGS(device_t bus, int channel, uint32_t *flags);
int
PWMBUS_CHANNEL_IS_ENABLED(device_t bus, int channel, bool *enabled);
int
PWMBUS_CHANNEL_SET_FLAGS(device_t bus, int channel, uint32_t flags);
πΈ DESCRIPTION πΈ
so basically, the PWMBUS (Pulse-Width Modulation) interface is how a device driver registers itself onto a global bus so that other devices in the kernel can use it in a generic way. she's the social butterfly of the kernel, networking era π β¨
for all pwmbus methods, the period argument is the duration in nanoseconds of one complete on-off cycle, and the duty argument is the duration in nanoseconds of the on portion of that cycle. on-off. periodt π
some PWM hardware is organized as a single controller with multiple channels, and the channel numbers count up from zero. when multiple channels are present, they sometimes share a common clock or other resources π and in those cases, changing the period or duty cycle of any one channel may affect other channels within the hardware that share the same resources. so pls, consult the documentation for the underlying PWM hardware device driver for the deets on channels that share resources. don't just yolo it, bestie π
π₯ INTERFACE π₯
PWMBUS_CHANNEL_CONFIG(device_t bus, int channel, uint64_t period, uint64_t duty)β configure theperiodandduty(in nanoseconds) in the PWM controller on the bus for the specifiedchannel. returns0on success, orEINVALif the values aren't supported by the controller, orEBUSYif the PWMBUS controller is in use and does not support changing the value on the fly. πPWMBUS_CHANNEL_COUNT(device_t bus, int *nchannel)β get the number of channels supported by the controller. count 'em up bestie π’PWMBUS_CHANNEL_ENABLE(device_t bus, int channel, bool enable)β enable the PWM channel. go girl, turn on β¨PWMBUS_CHANNEL_GET_CONFIG(device_t bus, int channel, uint64_t *period, uint64_t *duty)β get the current configuration of theperiodanddutyfor the specifiedchannel. receipts, we love to see them π§ΎPWMBUS_CHANNEL_GET_FLAGS(device_t bus, int channel, uint32_t *flags)β get the currentflagsfor the channel. and if the driver or controller does not support this, a default method returns a flags value of zero. no drama, just zeros π«ΆPWMBUS_CHANNEL_IS_ENABLED(device_t bus, int channel, bool *enable)β test whether the PWM channel is enabled. are u up? vibe check πPWMBUS_CHANNEL_SET_FLAGS(device_t bus, int channel, uint32_t flags)β set theflagsof the channel (such as inverted polarity π). if the driver or controller does not support this, a do-nothing default method is used. she simply does not engage π
π HISTORY π
the pwmbus interface first appear in FreeBSD 13.0 π
the pwmbus interface and manual page was written by Emmanuel Vadot <manu@FreeBSD.org> π
okay that's the whole page bestie, no notes, she ate π
Debian Β· June 21, 2019 Β· PWMBUS(9) β that's the source, the version and the date, mwah, byeeee ππ¦β¨
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2018 Emmanuel Vadot <manu@freebsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms