xref: /freebsd/usr.sbin/pwm/pwm.8 (revision 2e3f49888ec8851bafb22011533217487764fdb0)
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.Dd June 17, 2019
24.Dt PWM 8
25.Os
26.Sh NAME
27.Nm pwm
28.Nd configure PWM (Pulse Width Modulation) hardware
29.Sh SYNOPSIS
30.Nm
31.Op Fl f Ar device
32.Fl C
33.Nm
34.Op Fl f Ar device
35.Op Fl D | Fl E
36.Op Fl I
37.Op Fl p Ar period
38.Op Fl d Ar duty
39.Sh DESCRIPTION
40The
41.Nm
42utility can be used to configure pwm hardware.
43.Nm
44uses a
45.Xr pwmc 4
46device to communicate with the hardware.
47Some PWM hardware supports multiple output channels within a single
48controller block; each
49.Xr pwmc 4
50instance controls a single PWM channel.
51.Pp
52.Xr pwmc 4
53devices are named
54.Pa /dev/pwm/pwmcX.Y ,
55where
56.Va X
57is the controller unit number and
58.Va Y
59is the channel number within that unit.
60.Pp
61The options are as follows:
62.Bl -tag -width "-f device"
63.It Fl f Ar device
64Device to operate on.
65If not specified,
66.Pa /dev/pwm/pwmc0.0
67is used.
68If an unqualified name is provided,
69.Pa /dev/pwm
70is automatically prepended.
71.It Fl C
72Show the configuration of the PWM channel.
73.It Fl D
74Disable the PWM channel.
75.It Fl d Ar duty
76Configure the duty cycle (in nanoseconds or percentage) of the PWM channel.
77Duty is the portion of the
78.Ar period
79during which the signal is asserted.
80.It Fl E
81Enable the PWM channel.
82.It Fl p Ar period
83Configure the period (in nanoseconds) of the PWM channel.
84.It Fl I
85Invert PWM signal polarity
86.El
87.Sh EXAMPLES
88.Bl -bullet
89.It
90Show the configuration of the PWM channel:
91.Bd -literal
92pwm -f /dev/pwm/pwmc0.1 -C
93.Ed
94.It
95Configure a 50000 ns period and a 25000 ns duty cycle
96and enable the channel:
97.Bd -literal
98pwm -f pwmc1.1 -E -p 50000 -d 25000
99.Ed
100.It
101Configure a 50% duty cycle on the device and channel which
102were configured in
103.Xr pwmc 4
104to have the label
105.Pa backlight :
106.Bd -literal
107pwm -f backlight -d 50%
108.Ed
109.El
110.Sh SEE ALSO
111.Xr pwm 9 ,
112.Xr pwmbus 9
113.Sh HISTORY
114The
115.Nm
116utility appeared in
117.Fx 13.0 .
118.Sh AUTHORS
119.An -nosplit
120The
121.Nm
122utility and this manual page were written by
123.An Emmanuel Vadot Aq Mt manu@FreeBSD.org .
124