From owner-svn-src-head@freebsd.org Mon Jan 22 07:43:56 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03683ED4117; Mon, 22 Jan 2018 07:43:56 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B5A506FF91; Mon, 22 Jan 2018 07:43:55 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E729C17593; Mon, 22 Jan 2018 07:43:54 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0M7hs5w008173; Mon, 22 Jan 2018 07:43:54 GMT (envelope-from phk@FreeBSD.org) Received: (from phk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M7hspG008170; Mon, 22 Jan 2018 07:43:54 GMT (envelope-from phk@FreeBSD.org) Message-Id: <201801220743.w0M7hspG008170@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phk set sender to phk@FreeBSD.org using -f From: Poul-Henning Kamp Date: Mon, 22 Jan 2018 07:43:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328259 - in head: share/man/man4 sys/arm/broadcom/bcm2835 X-SVN-Group: head X-SVN-Commit-Author: phk X-SVN-Commit-Paths: in head: share/man/man4 sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 328259 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jan 2018 07:43:56 -0000 Author: phk Date: Mon Jan 22 07:43:54 2018 New Revision: 328259 URL: https://svnweb.freebsd.org/changeset/base/328259 Log: Add skeleton manual page for bcm283x_pwm (Feel free to improve this) Added: head/share/man/man4/bcm283x_pwm.4 (contents, props changed) Modified: head/share/man/man4/Makefile head/sys/arm/broadcom/bcm2835/bcm2835_clkman.c Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Mon Jan 22 07:15:24 2018 (r328258) +++ head/share/man/man4/Makefile Mon Jan 22 07:43:54 2018 (r328259) @@ -78,6 +78,7 @@ MAN= aac.4 \ axe.4 \ axge.4 \ bce.4 \ + ${_bcm283x_pwm.4} \ bcma.4 \ bfe.4 \ bge.4 \ @@ -881,6 +882,10 @@ _vmm.4= vmm.4 .if ${MACHINE_CPUARCH} == "mips" _nvram2env.4= nvram2env.4 +.endif + +.if ${MACHINE_ARCH:Marmv[67]*} != "" || ${MACHINE_CPUARCH} == "aarch64" +_bcm283x_pwm.4= bcm283x_pwm.4 .endif .if exists(${.CURDIR}/man4.${MACHINE_CPUARCH}) Added: head/share/man/man4/bcm283x_pwm.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/bcm283x_pwm.4 Mon Jan 22 07:43:54 2018 (r328259) @@ -0,0 +1,97 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright (c) 2017 Poul-Henning Kamp +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd January 22, 2017 +.Dt BCM283X_PWM 4 +.Os +.Sh NAME +.Nm bcm283x_pwm +.Nd bcm283x_pwm - driver for Raspberry Pi 2/3 PWM +.Sh SYNOPSIS +.Cd "kldload bcm283x_clkman" +.Cd "kldload bcm283x_pwm" +.Sh DESCRIPTION +The +.Nm +driver provides access to the PWM engine on GPIO12 of Rpi 2 and 3 hardware. +.Pp +The PWM hardware is controlled via the +.Xr sysctl 8 +interface: +.Bd -literal +dev.pwm.0.mode: 1 +dev.pwm.0.freq: 125000000 +dev.pwm.0.ratio: 2500 +dev.pwm.0.period: 10000 +dev.pwm.0.pwm_freq: 12500 +.Ed +.Bl -tag -width ".Va dev.pwm.0.mode" +.It Va dev.pwm.0.mode +Three modes exist, 0=off, 1=PWM, 2=N/M. +The N/M mode is a first order delta-sigma mode, which makes a quite +handy DAC output with a trivial RC lowpass filter. +.Pp +.It Va dev.pwm.0.freq +The input frequency to the PWM hardware in Hz. +Minmum frequency is 123 kHz, maximum frequency is 125 MHz. +.It Va dev.pwm.0.period +The period length in cycles. +In PWM mode, the output frequency will be +( +.Va dev.pwm.0.freq +/ +.Va dev.pwm.0.period . +) +In N/M mode this is the 'M' +.It Va dev.pwm.0.ratio +The "on" period in cycles. +In PWM mode, to get a 25% dutycycle, set this to 25% of +.Va dev.pwm.0.period . +In N/M mode this is the 'N' +.It Va dev.pwm.0.pwm_freq +The calculated PWM output frequency in PWM mode. +.El +.Pp +.Sh NOTES +Currently the +.Nm +driver ignores the 'status="disabled"' flag in the DTB, assuming that +if you load the driver, you want it to work. +.Sh SEE ALSO +.Xr sysctl 8 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 12.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver and this manual page were written by +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org . Modified: head/sys/arm/broadcom/bcm2835/bcm2835_clkman.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_clkman.c Mon Jan 22 07:15:24 2018 (r328258) +++ head/sys/arm/broadcom/bcm2835/bcm2835_clkman.c Mon Jan 22 07:43:54 2018 (r328259) @@ -150,13 +150,13 @@ bcm2835_clkman_set_frequency(device_t dev, uint32_t un u = 500000000/hz; if (u < 4) { device_printf(sc->sc_dev, - "Frequency too high for unit 0x%x (max: 125MHz)", + "Frequency too high for unit 0x%x (max: 125 MHz)", unit); return (0); } if (u > 0xfff) { device_printf(sc->sc_dev, - "Frequency too low for unit 0x%x (min: 123Hz)", + "Frequency too low for unit 0x%x (min: 123 kHz)", unit); return (0); }