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 the period and duty (in nanoseconds) in the PWM controller on the bus for the specified channel. returns 0 on success, or EINVAL if the values aren't supported by the controller, or EBUSY if 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 the period and duty for the specified channel. receipts, we love to see them 🧾
  • PWMBUS_CHANNEL_GET_FLAGS(device_t bus, int channel, uint32_t *flags) β€” get the current flags for 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 the flags of 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