logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

pwmbus, PWMBUS_CHANNEL_CONFIG, PWMBUS_CHANNEL_COUNT, PWMBUS_CHANNEL_ENABLE, PWMBUS_CHANNEL_GET_CONFIG,

Description

       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.

History

       The  pwmbus  interface first appear in FreeBSD 13.0.  The pwmbus interface and manual page was written by
       Emmanuel Vadot <manu@FreeBSD.org>.

Debian                                            June 21, 2019                                        PWMBUS(9)

Interface

PWMBUS_CHANNEL_CONFIG(device_tbus, intchannel, uint64_tperiod, uint64_tduty)
               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 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_tbus, int*nchannel)
               Get the number of channels supported by the controller.

       PWMBUS_CHANNEL_ENABLE(device_tbus, intchannel, boolenable)
               Enable the PWM channel.

       PWMBUS_CHANNEL_GET_CONFIG(device_tbus, intchannel, uint64_t*period, uint64_t*duty)
               Get the current configuration of the period and duty for the specified channel.

       PWMBUS_CHANNEL_GET_FLAGS(device_tbus, intchannel, uint32_t*flags)
               Get  the  current  flags  for  the channel.  If the driver or controller does not support this, a
               default method returns a flags value of zero.

       PWMBUS_CHANNEL_IS_ENABLED(device_tbus, intchannel, bool*enable)
               Test whether the PWM channel is enabled.

       PWMBUS_CHANNEL_SET_FLAGS(device_tbus, intchannel, uint32_tflags)
               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.

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

devicepwm#include<pwmbus_if.h>intPWMBUS_CHANNEL_CONFIG(device_tbus, intchannel, uint64_tperiod, uint64_tduty);

       intPWMBUS_CHANNEL_COUNT(device_tbus, intchannel, int*nchannel);

       intPWMBUS_CHANNEL_ENABLE(device_tbus, intchannel, boolenable);

       intPWMBUS_CHANNEL_GET_CONFIG(device_tbus, intchannel, uint64_t*period, uint64_t*duty);

       intPWMBUS_CHANNEL_GET_FLAGS(device_tbus, intchannel, uint32_t*flags);

       intPWMBUS_CHANNEL_IS_ENABLED(device_tbus, intchannel, bool*enabled);

       intPWMBUS_CHANNEL_SET_FLAGS(device_tbus, intchannel, uint32_tflags);

See Also