19312900fSEmmanuel Vadot.\" Copyright (c) 2018 Emmanuel Vadot <manu@freebsd.org> 29312900fSEmmanuel Vadot.\" 39312900fSEmmanuel Vadot.\" Redistribution and use in source and binary forms, with or without 49312900fSEmmanuel Vadot.\" modification, are permitted provided that the following conditions 59312900fSEmmanuel Vadot.\" are met: 69312900fSEmmanuel Vadot.\" 1. Redistributions of source code must retain the above copyright 79312900fSEmmanuel Vadot.\" notice, this list of conditions and the following disclaimer. 89312900fSEmmanuel Vadot.\" 2. Redistributions in binary form must reproduce the above copyright 99312900fSEmmanuel Vadot.\" notice, this list of conditions and the following disclaimer in the 109312900fSEmmanuel Vadot.\" documentation and/or other materials provided with the distribution. 119312900fSEmmanuel Vadot.\" 129312900fSEmmanuel Vadot.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR 139312900fSEmmanuel Vadot.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 149312900fSEmmanuel Vadot.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 159312900fSEmmanuel Vadot.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, 169312900fSEmmanuel Vadot.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 179312900fSEmmanuel Vadot.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 189312900fSEmmanuel Vadot.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 199312900fSEmmanuel Vadot.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 209312900fSEmmanuel Vadot.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 219312900fSEmmanuel Vadot.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 229312900fSEmmanuel Vadot.\" 239312900fSEmmanuel Vadot.\" $FreeBSD$ 249312900fSEmmanuel Vadot.\" 25*7202a380SIan Lepore.Dd June 21, 2019 269312900fSEmmanuel Vadot.Dt PWMBUS 9 279312900fSEmmanuel Vadot.Os 289312900fSEmmanuel Vadot.Sh NAME 299312900fSEmmanuel Vadot.Nm pwmbus , 309312900fSEmmanuel Vadot.Nm PWMBUS_GET_BUS , 319312900fSEmmanuel Vadot.Nm PWMBUS_CHANNEL_CONFIG , 329312900fSEmmanuel Vadot.Nm PWMBUS_CHANNEL_GET_CONFIG , 339312900fSEmmanuel Vadot.Nm PWMBUS_CHANNEL_SET_FLAGS , 349312900fSEmmanuel Vadot.Nm PWMBUS_CHANNEL_GET_FLAGS , 359312900fSEmmanuel Vadot.Nm PWMBUS_CHANNEL_ENABLE , 369312900fSEmmanuel Vadot.Nm PWMBUS_CHANNEL_IS_ENABLED , 379312900fSEmmanuel Vadot.Nm PWMBUS_CHANNEL_MAX 389312900fSEmmanuel Vadot.Nd PWMBUS methods 399312900fSEmmanuel Vadot.Sh SYNOPSIS 409312900fSEmmanuel Vadot.Cd "device pwm" 419312900fSEmmanuel Vadot.In "pwmbus_if.h" 429312900fSEmmanuel Vadot.Ft int 439312900fSEmmanuel Vadot.Fn PWMBUS_CHANNEL_CONFIG "device_t bus" "int channel" "uint64_t period" "uint64_t duty" 449312900fSEmmanuel Vadot.Ft int 459312900fSEmmanuel Vadot.Fn PWMBUS_CHANNEL_GET_CONFIG "device_t bus" "int channel" "uint64_t *period" "uint64_t *duty" 469312900fSEmmanuel Vadot.Ft int 479312900fSEmmanuel Vadot.Fn PWMBUS_CHANNEL_SET_FLAGS "device_t bus" "int channel" "uint32_t flags" 489312900fSEmmanuel Vadot.Ft int 499312900fSEmmanuel Vadot.Fn PWMBUS_CHANNEL_GET_FLAGS "device_t bus" "int channel" "uint32_t *flags" 509312900fSEmmanuel Vadot.Ft int 519312900fSEmmanuel Vadot.Fn PWMBUS_CHANNEL_ENABLE "device_t bus" "int channel" "bool enable" 529312900fSEmmanuel Vadot.Ft int 539312900fSEmmanuel Vadot.Fn PWMBUS_CHANNEL_IS_ENABLED "device_t bus" "int channel" "bool *enabled" 549312900fSEmmanuel Vadot.Ft int 55*7202a380SIan Lepore.Fn PWMBUS_CHANNEL_COUNT "device_t bus" "int channel" "int *nchannel" 569312900fSEmmanuel Vadot.Sh DESCRIPTION 579312900fSEmmanuel VadotThe PWMBUS (Pulse-Width Modulation) interface allows the device driver to register to a global 58*7202a380SIan Leporebus so other devices in the kernel can use them in a generic way. 599312900fSEmmanuel Vadot.Sh INTERFACE 609312900fSEmmanuel Vadot.Bl -tag -width indent 619312900fSEmmanuel Vadot.It Fn PWMBUS_CHANNEL_CONFIG "device_t bus" "int channel" "uint64_t period" "uint64_t duty" 629312900fSEmmanuel VadotConfigure the period and duty (in nanoseconds) in the PWM controller on the bus for the specified channel. 639312900fSEmmanuel VadotReturns 0 on success or 649312900fSEmmanuel Vadot.Er EINVAL 65*7202a380SIan Leporeif the values are not supported by the controller or 669312900fSEmmanuel Vadot.Er EBUSY 67*7202a380SIan Leporeif the PWMBUS controller is in use and doesn't support changing the value on the fly. 689312900fSEmmanuel Vadot.It Fn PWMBUS_CHANNEL_GET_CONFIG "device_t bus" "int channel" "uint64_t *period" "uint64_t *duty" 699312900fSEmmanuel VadotGet the current configuration of the period and duty for the specified channel. 709312900fSEmmanuel Vadot.It Fn PWMBUS_CHANNEL_SET_FLAGS "device_t bus" "int channel" "uint32_t flags" 71*7202a380SIan LeporeSet the flags of the channel (such as inverted polarity), if the driver or controller 72*7202a380SIan Leporedoesn't support this a do-nothing default method is used. 739312900fSEmmanuel Vadot.It Fn PWMBUS_CHANNEL_GET_FLAGS "device_t bus" "int channel" "uint32_t *flags" 74*7202a380SIan LeporeGet the current flags for the channel. 75*7202a380SIan LeporeIf the driver or controller 76*7202a380SIan Leporedoesn't support this, a default method returns a flags value of zero. 779312900fSEmmanuel Vadot.It Fn PWMBUS_CHANNEL_ENABLE "device_t bus" "int channel" "bool enable" 789312900fSEmmanuel VadotEnable the PWM channel. 799312900fSEmmanuel Vadot.It Fn PWMBUS_CHANNEL_ISENABLED "device_t bus" "int channel" "bool *enable" 809312900fSEmmanuel VadotTest if the PWM channel is enabled. 81*7202a380SIan Lepore.It PWMBUS_CHANNEL_COUNT "device_t bus" "int channel" "int *nchannel" 82*7202a380SIan LeporeGet the number of channels supported by the controller. 83*7202a380SIan LeporeChannel numbers count up from zero. 849312900fSEmmanuel Vadot.El 859312900fSEmmanuel Vadot.Sh HISTORY 869312900fSEmmanuel VadotThe 879312900fSEmmanuel Vadot.Nm pwmbus 889312900fSEmmanuel Vadotinterface first appear in 899312900fSEmmanuel Vadot.Fx 13.0 . 909312900fSEmmanuel VadotThe 919312900fSEmmanuel Vadot.Nm pwmbus 929312900fSEmmanuel Vadotinterface and manual page was written by 939312900fSEmmanuel Vadot.An Emmanuel Vadot Aq Mt manu@FreeBSD.org . 94