]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man9/pwmbus.9
accept_filter(9): Fix a mandoc related error
[FreeBSD/FreeBSD.git] / share / man / man9 / pwmbus.9
1 .\" Copyright (c) 2018 Emmanuel Vadot <manu@freebsd.org>
2 .\"
3 .\" Redistribution and use in source and binary forms, with or without
4 .\" modification, are permitted provided that the following conditions
5 .\" are met:
6 .\" 1. Redistributions of source code must retain the above copyright
7 .\"    notice, this list of conditions and the following disclaimer.
8 .\" 2. Redistributions in binary form must reproduce the above copyright
9 .\"    notice, this list of conditions and the following disclaimer in the
10 .\"    documentation and/or other materials provided with the distribution.
11 .\"
12 .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
13 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
14 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
15 .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
16 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
18 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
19 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 .\"
23 .\" $FreeBSD$
24 .\"
25 .Dd June 21, 2019
26 .Dt PWMBUS 9
27 .Os
28 .Sh NAME
29 .Nm pwmbus ,
30 .Nm PWMBUS_CHANNEL_CONFIG ,
31 .Nm PWMBUS_CHANNEL_COUNT ,
32 .Nm PWMBUS_CHANNEL_ENABLE ,
33 .Nm PWMBUS_CHANNEL_GET_CONFIG ,
34 .Nm PWMBUS_CHANNEL_GET_FLAGS ,
35 .Nm PWMBUS_CHANNEL_IS_ENABLED ,
36 .Nm PWMBUS_CHANNEL_SET_FLAGS ,
37 .Nm PWMBUS_GET_BUS
38 .Nd PWMBUS methods
39 .Sh SYNOPSIS
40 .Cd "device pwm"
41 .In "pwmbus_if.h"
42 .Ft int
43 .Fn PWMBUS_CHANNEL_CONFIG "device_t bus" "int channel" "uint64_t period" "uint64_t duty"
44 .Ft int
45 .Fn PWMBUS_CHANNEL_COUNT "device_t bus" "int channel" "int *nchannel"
46 .Ft int
47 .Fn PWMBUS_CHANNEL_ENABLE "device_t bus" "int channel" "bool enable"
48 .Ft int
49 .Fn PWMBUS_CHANNEL_GET_CONFIG "device_t bus" "int channel" "uint64_t *period" "uint64_t *duty"
50 .Ft int
51 .Fn PWMBUS_CHANNEL_GET_FLAGS "device_t bus" "int channel" "uint32_t *flags"
52 .Ft int
53 .Fn PWMBUS_CHANNEL_IS_ENABLED "device_t bus" "int channel" "bool *enabled"
54 .Ft int
55 .Fn PWMBUS_CHANNEL_SET_FLAGS "device_t bus" "int channel" "uint32_t flags"
56 .Sh DESCRIPTION
57 The PWMBUS (Pulse-Width Modulation) interface allows a device driver to
58 register to a global bus so other devices in the kernel can use them in a
59 generic way.
60 .Pp
61 For all
62 .Nm
63 methods, the
64 .Va period
65 argument is the duration in nanoseconds of one complete on-off cycle, and the
66 .Va duty
67 argument is the duration in nanoseconds of the on portion of that cycle.
68 .Pp
69 Some PWM hardware is organized as a single controller with multiple channels.
70 Channel numbers count up from zero.
71 When multiple channels are present, they sometimes share a common clock or
72 other resources.
73 In such cases, changing the period or duty cycle of any one channel may affect
74 other channels within the hardware which share the same resources.
75 Consult the documentation for the underlying PWM hardware device driver for
76 details on channels that share resources.
77 .Sh INTERFACE
78 .Bl -tag -width indent
79 .It Fn PWMBUS_CHANNEL_CONFIG "device_t bus" "int channel" "uint64_t period" "uint64_t duty"
80 Configure the period and duty (in nanoseconds) in the PWM controller on the bus
81 for the specified channel.
82 Returns 0 on success or
83 .Er EINVAL
84 if the values are not supported by the controller or
85 .Er EBUSY
86 if the PWMBUS controller is in use and does not support changing the value on
87 the fly.
88 .It Fn PWMBUS_CHANNEL_COUNT "device_t bus" "int *nchannel"
89 Get the number of channels supported by the controller.
90 .It Fn PWMBUS_CHANNEL_ENABLE "device_t bus" "int channel" "bool enable"
91 Enable the PWM channel.
92 .It Fn PWMBUS_CHANNEL_GET_CONFIG "device_t bus" "int channel" "uint64_t *period" "uint64_t *duty"
93 Get the current configuration of the period and duty for the specified channel.
94 .It Fn PWMBUS_CHANNEL_GET_FLAGS "device_t bus" "int channel" "uint32_t *flags"
95 Get the current flags for the channel.
96 If the driver or controller
97 does not support this, a default method returns a flags value of zero.
98 .It Fn PWMBUS_CHANNEL_IS_ENABLED "device_t bus" "int channel" "bool *enable"
99 Test whether the PWM channel is enabled.
100 .It Fn PWMBUS_CHANNEL_SET_FLAGS "device_t bus" "int channel" "uint32_t flags"
101 Set the flags of the channel (such as inverted polarity).
102 If the driver or controller does not support this a do-nothing default method
103 is used.
104 .El
105 .Sh HISTORY
106 The
107 .Nm pwmbus
108 interface first appear in
109 .Fx 13.0 .
110 The
111 .Nm pwmbus
112 interface and manual page was written by
113 .An Emmanuel Vadot Aq Mt manu@FreeBSD.org .