PWMBUS(9) | Kernel Developer's Manual | PWMBUS(9) |
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
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);
The PWMBUS (Pulse-Width Modulation) interface allows a device driver to register to a global bus so other devices in the kernel can use them in a generic way.
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.
Some PWM hardware is organized as a single controller with multiple channels. Channel numbers count up from zero. When multiple channels are present, they sometimes share a common clock or other resources. In such cases, changing the period or duty cycle of any one channel may affect other channels within the hardware which share the same resources. Consult the documentation for the underlying PWM hardware device driver for details on channels that share resources.
PWMBUS_CHANNEL_CONFIG
(device_t
bus, int channel, uint64_t
period, uint64_t duty)EINVAL
if the values are not 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)PWMBUS_CHANNEL_ENABLE
(device_t
bus, int channel, bool
enable)PWMBUS_CHANNEL_GET_CONFIG
(device_t
bus, int channel, uint64_t
*period, uint64_t *duty)PWMBUS_CHANNEL_GET_FLAGS
(device_t
bus, int channel, uint32_t
*flags)PWMBUS_CHANNEL_IS_ENABLED
(device_t
bus, int channel, bool
*enable)PWMBUS_CHANNEL_SET_FLAGS
(device_t
bus, int channel, uint32_t
flags)The pwmbus
interface first appear in
FreeBSD 13.0. The pwmbus
interface and manual page was written by Emmanuel
Vadot
<manu@FreeBSD.org>.
June 21, 2019 | Debian |