xref: /freebsd/share/man/man4/man4.arm/bcm283x_pwm.4 (revision d6eb98610fa65663bf0df4574b7cb2c5c4ffda71)
1.\"
2.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3.\"
4.\" Copyright (c) 2017 Poul-Henning Kamp <phk@FreeBSD.org>
5.\" All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26.\"
27.\" $FreeBSD$
28.\"
29.Dd September 10, 2018
30.Dt BCM283X_PWM 4
31.Os
32.Sh NAME
33.Nm bcm283x_pwm
34.Nd bcm283x_pwm - driver for Raspberry Pi 2/3 PWM
35.Sh SYNOPSIS
36.Cd "kldload bcm283x_clkman"
37.Cd "kldload bcm283x_pwm"
38.Sh DESCRIPTION
39The
40.Nm
41driver provides access to the PWM engine on GPIO12 of Raspberry Pi 2 and 3 hardware.
42.Pp
43The PWM hardware is controlled via the
44.Xr sysctl 8
45interface:
46.Bd -literal
47dev.pwm.0.mode: 1
48dev.pwm.0.mode2: 1
49dev.pwm.0.freq: 125000000
50dev.pwm.0.ratio: 2500
51dev.pwm.0.ratio2: 2500
52dev.pwm.0.period: 10000
53dev.pwm.0.period2: 10000
54dev.pwm.0.pwm_freq: 12500
55dev.pwm.0.pwm_freq2: 12500
56.Ed
57.Bl -tag -width ".Va dev.pwm"
58.It Va dev.pwm.0.mode , dev.pwm.0.mode2
59PWM Mode for channels 1 and 2.
60Three modes exist, 0=off, 1=PWM, 2=N/M.
61The N/M mode is a first order delta-sigma mode, which makes a quite
62handy DAC output with a trivial RC lowpass filter.
63.Pp
64.It Va dev.pwm.0.freq
65The input frequency to the PWM hardware in Hz.
66Applies to both channels 1 and 2.
67Minimum frequency is 123 kHz, maximum frequency is 125 MHz.
68.It Va dev.pwm.0.period , dev.pwm.0.period2
69The period length in cycles.
70In PWM mode, the output frequencies will be
71(
72.Va dev.pwm.0.freq
73/
74.Va dev.pwm.period
75) and (
76.Va dev.pwm.0.freq2
77/
78.Va dev.pwm.0.period2
79).
80In N/M mode this is the 'M'.
81.It Va dev.pwm.0.ratio , dev.pwm.0.ratio2
82The "on" period in cycles for PWM channels 1 and 2.
83In PWM mode, to get a 25% dutycycle, set this to 25% of
84.Va dev.pwm.0.period
85or
86.Va dev.pwm.0.period2 ,
87as appropriate.
88In N/M mode this is the 'N'.
89.It Va dev.pwm.0.pwm_freq , dev.pwm.0.pwm_freq2
90The calculated PWM output frequencies in PWM mode, for channels 1 and 2.
91.El
92.Pp
93.Sh NOTES
94Currently the
95.Nm
96driver ignores the 'status="disabled"' flag in the DTB, assuming that
97if you load the driver, you want it to work.
98.Sh SEE ALSO
99.Xr sysctl 8
100.Sh HISTORY
101The
102.Nm
103driver first appeared in
104.Fx 12.0 .
105.Sh AUTHORS
106.An -nosplit
107The
108.Nm
109driver and this manual page were written by
110.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org .
111