xref: /freebsd/share/man/man9/pwmbus.9 (revision 9312900f6d81c194bac287c3eb2f06b3b5a33c96)
1*9312900fSEmmanuel Vadot.\" Copyright (c) 2018 Emmanuel Vadot <manu@freebsd.org>
2*9312900fSEmmanuel Vadot.\"
3*9312900fSEmmanuel Vadot.\" Redistribution and use in source and binary forms, with or without
4*9312900fSEmmanuel Vadot.\" modification, are permitted provided that the following conditions
5*9312900fSEmmanuel Vadot.\" are met:
6*9312900fSEmmanuel Vadot.\" 1. Redistributions of source code must retain the above copyright
7*9312900fSEmmanuel Vadot.\"    notice, this list of conditions and the following disclaimer.
8*9312900fSEmmanuel Vadot.\" 2. Redistributions in binary form must reproduce the above copyright
9*9312900fSEmmanuel Vadot.\"    notice, this list of conditions and the following disclaimer in the
10*9312900fSEmmanuel Vadot.\"    documentation and/or other materials provided with the distribution.
11*9312900fSEmmanuel Vadot.\"
12*9312900fSEmmanuel Vadot.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
13*9312900fSEmmanuel Vadot.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
14*9312900fSEmmanuel Vadot.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
15*9312900fSEmmanuel Vadot.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
16*9312900fSEmmanuel Vadot.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17*9312900fSEmmanuel Vadot.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
18*9312900fSEmmanuel Vadot.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
19*9312900fSEmmanuel Vadot.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20*9312900fSEmmanuel Vadot.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21*9312900fSEmmanuel Vadot.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22*9312900fSEmmanuel Vadot.\"
23*9312900fSEmmanuel Vadot.\" $FreeBSD$
24*9312900fSEmmanuel Vadot.\"
25*9312900fSEmmanuel Vadot.Dd November 12, 2018
26*9312900fSEmmanuel Vadot.Dt PWMBUS 9
27*9312900fSEmmanuel Vadot.Os
28*9312900fSEmmanuel Vadot.Sh NAME
29*9312900fSEmmanuel Vadot.Nm pwmbus ,
30*9312900fSEmmanuel Vadot.Nm pwmbus_attach_bus ,
31*9312900fSEmmanuel Vadot.Nm PWMBUS_GET_BUS ,
32*9312900fSEmmanuel Vadot.Nm PWMBUS_CHANNEL_CONFIG ,
33*9312900fSEmmanuel Vadot.Nm PWMBUS_CHANNEL_GET_CONFIG ,
34*9312900fSEmmanuel Vadot.Nm PWMBUS_CHANNEL_SET_FLAGS ,
35*9312900fSEmmanuel Vadot.Nm PWMBUS_CHANNEL_GET_FLAGS ,
36*9312900fSEmmanuel Vadot.Nm PWMBUS_CHANNEL_ENABLE ,
37*9312900fSEmmanuel Vadot.Nm PWMBUS_CHANNEL_IS_ENABLED ,
38*9312900fSEmmanuel Vadot.Nm PWMBUS_CHANNEL_MAX
39*9312900fSEmmanuel Vadot.Nd PWMBUS methods
40*9312900fSEmmanuel Vadot.Sh SYNOPSIS
41*9312900fSEmmanuel Vadot.Cd "device pwm"
42*9312900fSEmmanuel Vadot.In "pwmbus_if.h"
43*9312900fSEmmanuel Vadot.Ft device_t
44*9312900fSEmmanuel Vadot.Fn pwmbus_attach_bus "device_t dev"
45*9312900fSEmmanuel Vadot.Ft int
46*9312900fSEmmanuel Vadot.Fn PWMBUS_CHANNEL_CONFIG "device_t bus" "int channel" "uint64_t period" "uint64_t duty"
47*9312900fSEmmanuel Vadot.Ft int
48*9312900fSEmmanuel Vadot.Fn PWMBUS_CHANNEL_GET_CONFIG "device_t bus" "int channel" "uint64_t *period" "uint64_t *duty"
49*9312900fSEmmanuel Vadot.Ft int
50*9312900fSEmmanuel Vadot.Fn PWMBUS_CHANNEL_SET_FLAGS "device_t bus" "int channel" "uint32_t flags"
51*9312900fSEmmanuel Vadot.Ft int
52*9312900fSEmmanuel Vadot.Fn PWMBUS_CHANNEL_GET_FLAGS "device_t bus" "int channel" "uint32_t *flags"
53*9312900fSEmmanuel Vadot.Ft int
54*9312900fSEmmanuel Vadot.Fn PWMBUS_CHANNEL_ENABLE "device_t bus" "int channel" "bool enable"
55*9312900fSEmmanuel Vadot.Ft int
56*9312900fSEmmanuel Vadot.Fn PWMBUS_CHANNEL_IS_ENABLED "device_t bus" "int channel" "bool *enabled"
57*9312900fSEmmanuel Vadot.Ft int
58*9312900fSEmmanuel Vadot.Fn PWMBUS_CHANNEL_MAX "device_t bus" "int channel" "int *nchannel"
59*9312900fSEmmanuel Vadot.Sh DESCRIPTION
60*9312900fSEmmanuel VadotThe PWMBUS (Pulse-Width Modulation) interface allows the device driver to register to a global
61*9312900fSEmmanuel Vadotbus so other devices in the kernel can use them in a generic way
62*9312900fSEmmanuel Vadot.Sh INTERFACE
63*9312900fSEmmanuel Vadot.Bl -tag -width indent
64*9312900fSEmmanuel Vadot.It Fn pwmbus_attach_bus "device_t dev"
65*9312900fSEmmanuel VadotAttach the
66*9312900fSEmmanuel Vadot.Nm pwmbus
67*9312900fSEmmanuel Vadotto the device driver
68*9312900fSEmmanuel Vadot.It Fn PWMBUS_CHANNEL_CONFIG "device_t bus" "int channel" "uint64_t period" "uint64_t duty"
69*9312900fSEmmanuel VadotConfigure the period and duty (in nanoseconds) in the PWM controller on the bus for the specified channel.
70*9312900fSEmmanuel VadotReturns 0 on success or
71*9312900fSEmmanuel Vadot.Er EINVAL
72*9312900fSEmmanuel Vadotis the values are not supported by the controller or
73*9312900fSEmmanuel Vadot.Er EBUSY
74*9312900fSEmmanuel Vadotis the PWMBUS controller is in use and doesn't support changing the value on the fly.
75*9312900fSEmmanuel Vadot.It Fn PWMBUS_CHANNEL_GET_CONFIG "device_t bus" "int channel" "uint64_t *period" "uint64_t *duty"
76*9312900fSEmmanuel VadotGet the current configuration of the period and duty for the specified channel.
77*9312900fSEmmanuel Vadot.It Fn PWMBUS_CHANNEL_SET_FLAGS "device_t bus" "int channel" "uint32_t flags"
78*9312900fSEmmanuel VadotSet the flags of the channel (like inverted polarity), if the driver or controller
79*9312900fSEmmanuel Vadotdoesn't support this a default method is used.
80*9312900fSEmmanuel Vadot.It Fn PWMBUS_CHANNEL_GET_FLAGS "device_t bus" "int channel" "uint32_t *flags"
81*9312900fSEmmanuel VadotGet the current flags for the channel, if the driver or controller
82*9312900fSEmmanuel Vadotdoesn't support this, a default method is used.
83*9312900fSEmmanuel Vadot.It Fn PWMBUS_CHANNEL_ENABLE "device_t bus" "int channel" "bool enable"
84*9312900fSEmmanuel VadotEnable the PWM channel.
85*9312900fSEmmanuel Vadot.It Fn PWMBUS_CHANNEL_ISENABLED "device_t bus" "int channel" "bool *enable"
86*9312900fSEmmanuel VadotTest if the PWM channel is enabled.
87*9312900fSEmmanuel Vadot.It PWMBUS_CHANNEL_MAX "device_t bus" "int channel" "int *nchannel"
88*9312900fSEmmanuel VadotGet the maximum number of channel supported by the controller.
89*9312900fSEmmanuel Vadot.El
90*9312900fSEmmanuel Vadot.Sh HISTORY
91*9312900fSEmmanuel VadotThe
92*9312900fSEmmanuel Vadot.Nm pwmbus
93*9312900fSEmmanuel Vadotinterface first appear in
94*9312900fSEmmanuel Vadot.Fx 13.0 .
95*9312900fSEmmanuel VadotThe
96*9312900fSEmmanuel Vadot.Nm pwmbus
97*9312900fSEmmanuel Vadotinterface and manual page was written by
98*9312900fSEmmanuel Vadot.An Emmanuel Vadot Aq Mt manu@FreeBSD.org .
99