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 January 22, 2017 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 Rpi 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.freq: 125000000 49dev.pwm.0.ratio: 2500 50dev.pwm.0.period: 10000 51dev.pwm.0.pwm_freq: 12500 52.Ed 53.Bl -tag -width ".Va dev.pwm.0.mode" 54.It Va dev.pwm.0.mode 55Three modes exist, 0=off, 1=PWM, 2=N/M. 56The N/M mode is a first order delta-sigma mode, which makes a quite 57handy DAC output with a trivial RC lowpass filter. 58.Pp 59.It Va dev.pwm.0.freq 60The input frequency to the PWM hardware in Hz. 61Minmum frequency is 123 kHz, maximum frequency is 125 MHz. 62.It Va dev.pwm.0.period 63The period length in cycles. 64In PWM mode, the output frequency will be 65( 66.Va dev.pwm.0.freq 67/ 68.Va dev.pwm.0.period . 69) 70In N/M mode this is the 'M' 71.It Va dev.pwm.0.ratio 72The "on" period in cycles. 73In PWM mode, to get a 25% dutycycle, set this to 25% of 74.Va dev.pwm.0.period . 75In N/M mode this is the 'N' 76.It Va dev.pwm.0.pwm_freq 77The calculated PWM output frequency in PWM mode. 78.El 79.Pp 80.Sh NOTES 81Currently the 82.Nm 83driver ignores the 'status="disabled"' flag in the DTB, assuming that 84if you load the driver, you want it to work. 85.Sh SEE ALSO 86.Xr sysctl 8 87.Sh HISTORY 88The 89.Nm 90driver first appeared in 91.Fx 12.0 . 92.Sh AUTHORS 93.An -nosplit 94The 95.Nm 96driver and this manual page were written by 97.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org . 98