1284db32cSIan Lepore.\" 2*4d846d26SWarner Losh.\" SPDX-License-Identifier: BSD-2-Clause 3284db32cSIan Lepore.\" 4284db32cSIan Lepore.\" Copyright (c) 2017 Poul-Henning Kamp <phk@FreeBSD.org> 5284db32cSIan Lepore.\" All rights reserved. 6284db32cSIan Lepore.\" 7284db32cSIan Lepore.\" Redistribution and use in source and binary forms, with or without 8284db32cSIan Lepore.\" modification, are permitted provided that the following conditions 9284db32cSIan Lepore.\" are met: 10284db32cSIan Lepore.\" 1. Redistributions of source code must retain the above copyright 11284db32cSIan Lepore.\" notice, this list of conditions and the following disclaimer. 12284db32cSIan Lepore.\" 2. Redistributions in binary form must reproduce the above copyright 13284db32cSIan Lepore.\" notice, this list of conditions and the following disclaimer in the 14284db32cSIan Lepore.\" documentation and/or other materials provided with the distribution. 15284db32cSIan Lepore.\" 16284db32cSIan Lepore.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17284db32cSIan Lepore.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18284db32cSIan Lepore.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19284db32cSIan Lepore.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20284db32cSIan Lepore.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21284db32cSIan Lepore.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22284db32cSIan Lepore.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23284db32cSIan Lepore.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24284db32cSIan Lepore.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25284db32cSIan Lepore.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26284db32cSIan Lepore.\" 2787acc146SOleksandr Tymoshenko.Dd September 10, 2018 28284db32cSIan Lepore.Dt BCM283X_PWM 4 29284db32cSIan Lepore.Os 30284db32cSIan Lepore.Sh NAME 31284db32cSIan Lepore.Nm bcm283x_pwm 32284db32cSIan Lepore.Nd bcm283x_pwm - driver for Raspberry Pi 2/3 PWM 33284db32cSIan Lepore.Sh SYNOPSIS 34284db32cSIan Lepore.Cd "kldload bcm283x_clkman" 35284db32cSIan Lepore.Cd "kldload bcm283x_pwm" 36284db32cSIan Lepore.Sh DESCRIPTION 37284db32cSIan LeporeThe 38284db32cSIan Lepore.Nm 3987acc146SOleksandr Tymoshenkodriver provides access to the PWM engine on GPIO12 of Raspberry Pi 2 and 3 hardware. 40284db32cSIan Lepore.Pp 41284db32cSIan LeporeThe PWM hardware is controlled via the 42284db32cSIan Lepore.Xr sysctl 8 43284db32cSIan Leporeinterface: 44284db32cSIan Lepore.Bd -literal 45284db32cSIan Leporedev.pwm.0.mode: 1 4687acc146SOleksandr Tymoshenkodev.pwm.0.mode2: 1 47284db32cSIan Leporedev.pwm.0.freq: 125000000 48284db32cSIan Leporedev.pwm.0.ratio: 2500 4987acc146SOleksandr Tymoshenkodev.pwm.0.ratio2: 2500 50284db32cSIan Leporedev.pwm.0.period: 10000 5187acc146SOleksandr Tymoshenkodev.pwm.0.period2: 10000 52284db32cSIan Leporedev.pwm.0.pwm_freq: 12500 5387acc146SOleksandr Tymoshenkodev.pwm.0.pwm_freq2: 12500 54284db32cSIan Lepore.Ed 5587acc146SOleksandr Tymoshenko.Bl -tag -width ".Va dev.pwm" 5687acc146SOleksandr Tymoshenko.It Va dev.pwm.0.mode , dev.pwm.0.mode2 5787acc146SOleksandr TymoshenkoPWM Mode for channels 1 and 2. 58284db32cSIan LeporeThree modes exist, 0=off, 1=PWM, 2=N/M. 59284db32cSIan LeporeThe N/M mode is a first order delta-sigma mode, which makes a quite 60284db32cSIan Leporehandy DAC output with a trivial RC lowpass filter. 61284db32cSIan Lepore.Pp 62284db32cSIan Lepore.It Va dev.pwm.0.freq 63284db32cSIan LeporeThe input frequency to the PWM hardware in Hz. 6487acc146SOleksandr TymoshenkoApplies to both channels 1 and 2. 6587acc146SOleksandr TymoshenkoMinimum frequency is 123 kHz, maximum frequency is 125 MHz. 6687acc146SOleksandr Tymoshenko.It Va dev.pwm.0.period , dev.pwm.0.period2 67284db32cSIan LeporeThe period length in cycles. 6887acc146SOleksandr TymoshenkoIn PWM mode, the output frequencies will be 69284db32cSIan Lepore( 70284db32cSIan Lepore.Va dev.pwm.0.freq 71284db32cSIan Lepore/ 7287acc146SOleksandr Tymoshenko.Va dev.pwm.period 7387acc146SOleksandr Tymoshenko) and ( 7487acc146SOleksandr Tymoshenko.Va dev.pwm.0.freq2 7587acc146SOleksandr Tymoshenko/ 7687acc146SOleksandr Tymoshenko.Va dev.pwm.0.period2 7787acc146SOleksandr Tymoshenko). 7887acc146SOleksandr TymoshenkoIn N/M mode this is the 'M'. 7987acc146SOleksandr Tymoshenko.It Va dev.pwm.0.ratio , dev.pwm.0.ratio2 8087acc146SOleksandr TymoshenkoThe "on" period in cycles for PWM channels 1 and 2. 81284db32cSIan LeporeIn PWM mode, to get a 25% dutycycle, set this to 25% of 8287acc146SOleksandr Tymoshenko.Va dev.pwm.0.period 8387acc146SOleksandr Tymoshenkoor 8487acc146SOleksandr Tymoshenko.Va dev.pwm.0.period2 , 8587acc146SOleksandr Tymoshenkoas appropriate. 8687acc146SOleksandr TymoshenkoIn N/M mode this is the 'N'. 8787acc146SOleksandr Tymoshenko.It Va dev.pwm.0.pwm_freq , dev.pwm.0.pwm_freq2 8887acc146SOleksandr TymoshenkoThe calculated PWM output frequencies in PWM mode, for channels 1 and 2. 89284db32cSIan Lepore.El 90284db32cSIan Lepore.Pp 91284db32cSIan Lepore.Sh NOTES 92284db32cSIan LeporeCurrently the 93284db32cSIan Lepore.Nm 94284db32cSIan Leporedriver ignores the 'status="disabled"' flag in the DTB, assuming that 95284db32cSIan Leporeif you load the driver, you want it to work. 96284db32cSIan Lepore.Sh SEE ALSO 97284db32cSIan Lepore.Xr sysctl 8 98284db32cSIan Lepore.Sh HISTORY 99284db32cSIan LeporeThe 100284db32cSIan Lepore.Nm 101284db32cSIan Leporedriver first appeared in 102284db32cSIan Lepore.Fx 12.0 . 103284db32cSIan Lepore.Sh AUTHORS 104284db32cSIan Lepore.An -nosplit 105284db32cSIan LeporeThe 106284db32cSIan Lepore.Nm 107284db32cSIan Leporedriver and this manual page were written by 108284db32cSIan Lepore.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org . 109